From ba79fcb747e83c3bdb60b4c62099b588b0403f6d Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 1 Sep 2024 15:10:03 +0200 Subject: [PATCH 1/9] Move to OpenAPI generator. --- .fernignore | 26 - .gitignore | 7 +- .openapi-generator-ignore | 22 + .openapi-generator/FILES | 251 + .openapi-generator/VERSION | 1 + build.gradle | 186 +- build.sbt | 27 + generate.ps1 | 2 + gradle/wrapper/gradle-wrapper.jar | Bin 63721 -> 43453 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 176 +- gradlew.bat | 184 +- openapi-config.yml | 24 + openapi.json | 19052 ++++++++++++++++ settings.gradle | 2 +- src/main/AndroidManifest.xml | 3 + .../java/com/squidex/api/AccessToken.java | 28 +- .../com/squidex/api/AccessTokenResponse.java | 32 + .../java/com/squidex/api/AuthInterceptor.java | 53 +- .../com/squidex/api/SquidexApiClient.java | 196 - .../squidex/api/SquidexApiClientBuilder.java | 38 - .../java/com/squidex/api/SquidexClient.java | 275 +- .../com/squidex/api/SquidexClientBuilder.java | 97 +- src/main/java/com/squidex/api/TokenStore.java | 3 +- .../com/squidex/api/core/ApiCallback.java | 62 + .../java/com/squidex/api/core/ApiClient.java | 1586 ++ .../java/com/squidex/api/core/ApiError.java | 28 - .../com/squidex/api/core/ApiException.java | 167 + .../com/squidex/api/core/ApiResponse.java | 76 + .../com/squidex/api/core/ClientOptions.java | 111 - .../com/squidex/api/core/Configuration.java | 41 + .../api/core/DateTimeDeserializer.java | 55 - .../com/squidex/api/core/Environment.java | 22 - .../api/core/GzipRequestInterceptor.java | 85 + src/main/java/com/squidex/api/core/JSON.java | 1093 + .../com/squidex/api/core/ObjectMappers.java | 36 - src/main/java/com/squidex/api/core/Pair.java | 57 + .../squidex/api/core/ProgressRequestBody.java | 73 + .../api/core/ProgressResponseBody.java | 70 + .../com/squidex/api/core/RequestOptions.java | 40 - .../squidex/api/core/RetryInterceptor.java | 78 - .../squidex/api/core/ServerConfiguration.java | 72 + .../com/squidex/api/core/ServerVariable.java | 37 + .../java/com/squidex/api/core/StringUtil.java | 83 + .../java/com/squidex/api/core/Suppliers.java | 23 - .../com/squidex/api/core/api/AppsApi.java | 5819 +++++ .../com/squidex/api/core/api/AssetsApi.java | 4155 ++++ .../com/squidex/api/core/api/BackupsApi.java | 1257 + .../com/squidex/api/core/api/ContentsApi.java | 6061 +++++ .../squidex/api/core/api/DiagnosticsApi.java | 375 + .../api/core/api/EventConsumersApi.java | 728 + .../com/squidex/api/core/api/HistoryApi.java | 423 + .../com/squidex/api/core/api/JobsApi.java | 573 + .../squidex/api/core/api/LanguagesApi.java | 226 + .../com/squidex/api/core/api/NewsApi.java | 241 + .../com/squidex/api/core/api/PingApi.java | 513 + .../com/squidex/api/core/api/PlansApi.java | 738 + .../com/squidex/api/core/api/RulesApi.java | 3180 +++ .../com/squidex/api/core/api/SchemasApi.java | 5577 +++++ .../com/squidex/api/core/api/SearchApi.java | 246 + .../squidex/api/core/api/StatisticsApi.java | 1252 + .../com/squidex/api/core/api/TeamsApi.java | 1914 ++ .../squidex/api/core/api/TemplatesApi.java | 389 + .../squidex/api/core/api/TranslationsApi.java | 241 + .../api/core/api/UserManagementApi.java | 1286 ++ .../com/squidex/api/core/api/UsersApi.java | 875 + .../com/squidex/api/core/auth/ApiKeyAuth.java | 80 + .../squidex/api/core/auth/Authentication.java | 36 + .../squidex/api/core/auth/HttpBasicAuth.java | 55 + .../squidex/api/core/auth/HttpBearerAuth.java | 75 + .../api/resources/apps/AppsClient.java | 1320 -- .../apps/requests/AddLanguageDto.java | 93 - .../resources/apps/requests/AddRoleDto.java | 93 - .../apps/requests/AddWorkflowDto.java | 93 - .../apps/requests/AppsUploadImageRequest.java | 21 - .../resources/apps/requests/CreateAppDto.java | 130 - .../apps/requests/CreateClientDto.java | 93 - .../apps/requests/TransferToTeamDto.java | 83 - .../resources/apps/requests/UpdateAppDto.java | 108 - .../apps/requests/UpdateAppSettingsDto.java | 181 - .../apps/requests/UpdateAssetScriptsDto.java | 246 - .../apps/requests/UpdateClientDto.java | 192 - .../apps/requests/UpdateLanguageDto.java | 137 - .../apps/requests/UpdateRoleDto.java | 117 - .../apps/requests/UpdateWorkflowDto.java | 224 - .../api/resources/assets/AssetsClient.java | 967 - .../assets/requests/AnnotateAssetDto.java | 194 - .../requests/AssetsDeleteAssetRequest.java | 108 - .../AssetsGetAssetContentBySlugRequest.java | 482 - .../AssetsGetAssetContentRequest.java | 481 - .../AssetsGetAssetFoldersRequest.java | 109 - .../requests/AssetsGetAssetsPostRequest.java | 159 - .../requests/AssetsGetAssetsRequest.java | 309 - .../requests/AssetsPostAssetRequest.java | 133 - .../AssetsPostUpsertAssetRequest.java | 108 - .../AssetsPutAssetContentRequest.java | 21 - .../assets/requests/BulkUpdateAssetsDto.java | 167 - .../assets/requests/CreateAssetFolderDto.java | 130 - .../assets/requests/MoveAssetDto.java | 83 - .../assets/requests/MoveAssetFolderDto.java | 83 - .../assets/requests/RenameAssetFolderDto.java | 93 - .../assets/requests/RenameTagDto.java | 93 - .../api/resources/backups/BackupsClient.java | 258 - .../BackupsGetBackupContentV2Request.java | 108 - .../backups/requests/RestoreRequestDto.java | 130 - .../resources/comments/CommentsClient.java | 223 - .../requests/CommentsGetCommentsRequest.java | 83 - .../resources/contents/ContentsClient.java | 1539 -- .../requests/AllContentsByPostDto.java | 433 - .../contents/requests/ChangeStatusDto.java | 245 - .../ContentsBulkUpdateAllContentsRequest.java | 125 - .../requests/ContentsCreateDraftRequest.java | 108 - .../ContentsDeleteContentRequest.java | 108 - .../ContentsDeleteContentStatusRequest.java | 109 - .../ContentsDeleteVersionRequest.java | 108 - .../ContentsGetAllContentsRequest.java | 406 - .../requests/ContentsGetContentRequest.java | 192 - .../ContentsGetContentVersionRequest.java | 108 - .../ContentsGetContentsPostRequest.java | 314 - .../requests/ContentsGetContentsRequest.java | 434 - .../ContentsGetGraphQlBatchRequest.java | 165 - .../requests/ContentsGetGraphQlRequest.java | 165 - .../ContentsGetReferencesRequest.java | 247 - .../ContentsGetReferencingRequest.java | 247 - .../requests/ContentsPatchContentRequest.java | 139 - .../requests/ContentsPostContentRequest.java | 224 - .../ContentsPostGraphQlBatchRequest.java | 123 - .../requests/ContentsPostGraphQlRequest.java | 123 - .../ContentsPostUpsertContentRequest.java | 224 - .../requests/ContentsPutContentRequest.java | 139 - .../contents/requests/ImportContentsDto.java | 174 - .../diagnostics/DiagnosticsClient.java | 78 - .../eventconsumers/EventConsumersClient.java | 146 - .../api/resources/history/HistoryClient.java | 104 - .../requests/HistoryGetAppHistoryRequest.java | 83 - .../HistoryGetTeamHistoryRequest.java | 83 - .../resources/languages/LanguagesClient.java | 61 - .../api/resources/news/NewsClient.java | 59 - .../news/requests/NewsGetNewsRequest.java | 83 - .../notifications/NotificationsClient.java | 103 - .../NotificationsGetNotificationsRequest.java | 84 - .../api/resources/ping/PingClient.java | 123 - .../api/resources/plans/PlansClient.java | 165 - .../api/resources/rules/RulesClient.java | 674 - .../rules/requests/RulesGetEventsRequest.java | 133 - .../requests/RulesPutRuleRunRequest.java | 83 - .../rules/requests/UpdateRuleDto.java | 167 - .../api/resources/schemas/SchemasClient.java | 1278 -- .../schemas/requests/ChangeCategoryDto.java | 83 - .../requests/ConfigureFieldRulesDto.java | 85 - .../requests/ConfigureUiFieldsDto.java | 109 - .../schemas/requests/CreateSchemaDto.java | 544 - .../requests/SynchronizeSchemaDto.java | 392 - .../schemas/requests/UpdateSchemaDto.java | 255 - .../api/resources/search/SearchClient.java | 65 - .../SearchGetSearchResultsRequest.java | 83 - .../statistics/StatisticsClient.java | 257 - .../api/resources/teams/TeamsClient.java | 312 - .../teams/requests/CreateTeamDto.java | 93 - .../teams/requests/UpdateTeamDto.java | 93 - .../resources/templates/TemplatesClient.java | 83 - .../translations/TranslationsClient.java | 106 - .../translations/requests/AskDto.java | 93 - .../translations/requests/TranslateDto.java | 161 - .../usermanagement/UserManagementClient.java | 264 - .../requests/CreateUserDto.java | 205 - .../requests/UpdateUserDto.java | 212 - .../UserManagementGetUsersRequest.java | 133 - .../api/resources/users/UsersClient.java | 206 - .../users/requests/UpdateProfileDto.java | 84 - .../users/requests/UsersGetUsersRequest.java | 83 - .../api/types/AbstractOpenApiSchema.java | 146 + .../com/squidex/api/types/ActionTypeEnum.java | 78 +- .../com/squidex/api/types/AddFieldDto.java | 357 +- .../com/squidex/api/types/AddLanguageDto.java | 209 + .../com/squidex/api/types/AddRoleDto.java | 209 + .../com/squidex/api/types/AddWorkflowDto.java | 209 + .../api/types/AlgoliaRuleActionDto.java | 510 +- .../api/types/AllContentsByPostDto.java | 372 + .../squidex/api/types/AnnotateAssetDto.java | 332 + .../java/com/squidex/api/types/AppDto.java | 1161 +- .../com/squidex/api/types/AppLanguageDto.java | 611 +- .../squidex/api/types/AppLanguagesDto.java | 314 +- .../com/squidex/api/types/AppSettingsDto.java | 647 +- .../types/ArrayCalculatedDefaultValue.java | 76 +- .../api/types/ArrayFieldPropertiesDto.java | 395 +- .../api/types/AssetChangedRuleTriggerDto.java | 252 +- .../java/com/squidex/api/types/AssetDto.java | 1845 +- .../com/squidex/api/types/AssetFolderDto.java | 523 +- .../squidex/api/types/AssetFolderScope.java | 78 +- .../squidex/api/types/AssetFoldersDto.java | 531 +- .../java/com/squidex/api/types/AssetMeta.java | 272 +- .../squidex/api/types/AssetPreviewMode.java | 78 +- .../squidex/api/types/AssetScriptsDto.java | 816 +- .../java/com/squidex/api/types/AssetType.java | 80 +- .../java/com/squidex/api/types/AssetsDto.java | 439 +- .../api/types/AssetsFieldPropertiesDto.java | 1363 +- .../api/types/AssignContributorDto.java | 355 +- .../com/squidex/api/types/AuthSchemeDto.java | 355 + .../api/types/AuthSchemeResponseDto.java | 245 + .../squidex/api/types/AuthSchemeValueDto.java | 203 + .../api/types/AzureQueueRuleActionDto.java | 352 +- .../com/squidex/api/types/BackupJobDto.java | 654 +- .../com/squidex/api/types/BackupJobsDto.java | 314 +- .../squidex/api/types/BooleanFieldEditor.java | 76 +- .../api/types/BooleanFieldPropertiesDto.java | 397 +- .../com/squidex/api/types/BulkResultDto.java | 474 +- .../api/types/BulkUpdateAssetType.java | 78 +- .../api/types/BulkUpdateAssetsDto.java | 304 + .../api/types/BulkUpdateAssetsJobDto.java | 762 +- .../api/types/BulkUpdateContentType.java | 92 +- .../api/types/BulkUpdateContentsDto.java | 623 +- .../api/types/BulkUpdateContentsJobDto.java | 827 +- .../squidex/api/types/CallsUsageDtoDto.java | 762 +- .../api/types/CallsUsagePerDateDto.java | 431 +- .../squidex/api/types/ChangeCategoryDto.java | 213 + .../com/squidex/api/types/ChangePlanDto.java | 272 +- .../squidex/api/types/ChangeStatusDto.java | 268 + .../java/com/squidex/api/types/ClientDto.java | 728 +- .../com/squidex/api/types/ClientsDto.java | 314 +- .../com/squidex/api/types/CommentDto.java | 222 - .../api/types/CommentRuleActionDto.java | 341 +- .../api/types/CommentRuleTriggerDto.java | 252 +- .../com/squidex/api/types/CommentsDto.java | 208 - .../types/ComponentFieldPropertiesDto.java | 269 +- .../types/ComponentsFieldPropertiesDto.java | 495 +- .../api/types/ConfigureFieldRulesDto.java | 235 + .../api/types/ConfigureUIFieldsDto.java | 259 + .../types/ContentChangedRuleTriggerDto.java | 372 +- .../com/squidex/api/types/ContentDto.java | 1531 +- .../com/squidex/api/types/ContentsDto.java | 532 +- .../com/squidex/api/types/ContributorDto.java | 549 +- .../squidex/api/types/ContributorsDto.java | 510 +- .../api/types/ContributorsMetadata.java | 272 +- .../com/squidex/api/types/CreateAppDto.java | 247 + .../api/types/CreateAssetFolderDto.java | 235 + .../squidex/api/types/CreateClientDto.java | 209 + .../api/types/CreateContentRuleActionDto.java | 433 +- .../com/squidex/api/types/CreateRuleDto.java | 328 +- .../squidex/api/types/CreateSchemaDto.java | 579 + .../com/squidex/api/types/CreateTeamDto.java | 209 + .../com/squidex/api/types/CreateUserDto.java | 303 + .../squidex/api/types/CurrentStorageDto.java | 320 +- .../types/DateTimeCalculatedDefaultValue.java | 76 +- .../api/types/DateTimeFieldEditor.java | 76 +- .../api/types/DateTimeFieldPropertiesDto.java | 598 +- .../api/types/DeepDetectRuleActionDto.java | 122 - .../api/types/DiscourseRuleActionDto.java | 630 +- .../java/com/squidex/api/types/EditorDto.java | 328 +- .../api/types/ElasticSearchRuleActionDto.java | 580 +- .../squidex/api/types/EmailRuleActionDto.java | 682 +- .../java/com/squidex/api/types/ErrorDto.java | 600 +- .../squidex/api/types/EventConsumerDto.java | 661 +- .../squidex/api/types/EventConsumersDto.java | 314 +- .../api/types/FastlyRuleActionDto.java | 324 +- .../com/squidex/api/types/FeatureDto.java | 328 +- .../com/squidex/api/types/FeaturesDto.java | 357 +- .../java/com/squidex/api/types/FieldDto.java | 800 +- .../squidex/api/types/FieldPropertiesDto.java | 1201 +- .../squidex/api/types/FieldRuleAction.java | 78 +- .../com/squidex/api/types/FieldRuleDto.java | 355 +- .../api/types/GeolocationFieldEditor.java | 76 + .../types/GeolocationFieldPropertiesDto.java | 263 +- .../squidex/api/types/HistoryEventDto.java | 555 +- .../java/com/squidex/api/types/IResource.java | 10 - .../squidex/api/types/IUpsertSchemaDto.java | 28 - .../com/squidex/api/types/ImageFormat.java | 92 +- .../squidex/api/types/ImportContentsDto.java | 297 + .../java/com/squidex/api/types/JobDto.java | 486 + .../squidex/api/types/JobLogMessageDto.java | 234 + .../java/com/squidex/api/types/JobStatus.java | 82 +- .../java/com/squidex/api/types/JobsDto.java | 262 + .../api/types/JsonFieldPropertiesDto.java | 262 +- .../com/squidex/api/types/LanguageDto.java | 344 +- .../com/squidex/api/types/LogDownloadDto.java | 246 +- .../api/types/ManualRuleTriggerDto.java | 186 +- .../api/types/MediumRuleActionDto.java | 636 +- .../com/squidex/api/types/MoveAssetDto.java | 201 + .../squidex/api/types/MoveAssetFolderDto.java | 201 + .../com/squidex/api/types/NestedFieldDto.java | 642 +- .../api/types/NotificationRuleActionDto.java | 455 +- .../squidex/api/types/NumberFieldEditor.java | 80 +- .../api/types/NumberFieldPropertiesDto.java | 653 +- .../api/types/OpenSearchRuleActionDto.java | 580 +- .../com/squidex/api/types/PatternDto.java | 355 +- .../com/squidex/api/types/PlanChangedDto.java | 246 +- .../java/com/squidex/api/types/PlanDto.java | 903 +- .../java/com/squidex/api/types/PlansDto.java | 632 +- .../squidex/api/types/PlansLockedReason.java | 80 +- .../api/types/PrerenderRuleActionDto.java | 324 +- .../java/com/squidex/api/types/QueryDto.java | 381 +- .../com/squidex/api/types/QueryJsonDto.java | 599 +- .../api/types/ReferencesFieldEditor.java | 84 +- .../types/ReferencesFieldPropertiesDto.java | 770 +- .../com/squidex/api/types/ReferralInfo.java | 321 +- .../api/types/RenameAssetFolderDto.java | 209 + .../com/squidex/api/types/RenameTagDto.java | 209 + .../squidex/api/types/ReorderFieldsDto.java | 274 +- .../com/squidex/api/types/ResizeMode.java | 90 +- .../java/com/squidex/api/types/Resource.java | 270 +- .../com/squidex/api/types/ResourceLink.java | 355 +- .../com/squidex/api/types/ResourcesDto.java | 270 +- .../com/squidex/api/types/RestoreJobDto.java | 541 +- .../squidex/api/types/RestoreRequestDto.java | 248 + .../api/types/RichTextFieldPropertiesDto.java | 431 + .../java/com/squidex/api/types/RoleDto.java | 695 +- .../java/com/squidex/api/types/RolesDto.java | 314 +- .../com/squidex/api/types/RuleActionDto.java | 1348 +- .../java/com/squidex/api/types/RuleDto.java | 1111 +- .../com/squidex/api/types/RuleElementDto.java | 693 +- .../api/types/RuleElementPropertyDto.java | 653 +- .../com/squidex/api/types/RuleEventDto.java | 853 +- .../com/squidex/api/types/RuleEventsDto.java | 439 +- .../squidex/api/types/RuleFieldEditor.java | 96 +- .../com/squidex/api/types/RuleJobResult.java | 82 +- .../com/squidex/api/types/RuleResult.java | 80 +- .../com/squidex/api/types/RuleTriggerDto.java | 584 +- .../java/com/squidex/api/types/RulesDto.java | 368 +- .../com/squidex/api/types/ScheduleJobDto.java | 500 +- .../types/SchemaChangedRuleTriggerDto.java | 252 +- .../squidex/api/types/SchemaCondition.java | 331 +- .../java/com/squidex/api/types/SchemaDto.java | 1575 +- .../api/types/SchemaPropertiesDto.java | 728 +- .../squidex/api/types/SchemaScriptsDto.java | 534 +- .../com/squidex/api/types/SchemaType.java | 78 +- .../com/squidex/api/types/SchemasDto.java | 314 +- .../api/types/ScriptRuleActionDto.java | 273 +- .../squidex/api/types/SearchResultDto.java | 487 +- .../squidex/api/types/SearchResultType.java | 86 +- .../api/types/SignalRRuleActionDto.java | 584 +- .../api/types/SimulatedRuleEventDto.java | 788 +- .../api/types/SimulatedRuleEventsDto.java | 439 +- .../com/squidex/api/types/SkipReason.java | 104 +- .../squidex/api/types/SlackRuleActionDto.java | 325 +- .../java/com/squidex/api/types/SortNode.java | 330 +- .../java/com/squidex/api/types/SortOrder.java | 76 +- .../com/squidex/api/types/StatusInfoDto.java | 328 +- .../api/types/StorageUsagePerDateDto.java | 374 +- .../squidex/api/types/StringContentType.java | 78 +- .../squidex/api/types/StringFieldEditor.java | 100 +- .../api/types/StringFieldPropertiesDto.java | 1278 +- .../api/types/SynchronizeSchemaDto.java | 535 + .../squidex/api/types/TagsFieldEditor.java | 78 +- .../api/types/TagsFieldPropertiesDto.java | 608 +- .../java/com/squidex/api/types/TeamDto.java | 657 +- .../squidex/api/types/TemplateDetailsDto.java | 353 +- .../com/squidex/api/types/TemplateDto.java | 523 +- .../com/squidex/api/types/TemplatesDto.java | 314 +- .../squidex/api/types/TransferToTeamDto.java | 213 + .../com/squidex/api/types/TranslateDto.java | 262 + .../com/squidex/api/types/TranslationDto.java | 354 +- .../squidex/api/types/TranslationStatus.java | 86 +- .../squidex/api/types/TweetRuleActionDto.java | 339 +- .../api/types/TypesenseRuleActionDto.java | 511 +- .../com/squidex/api/types/UIFieldEditor.java | 76 + .../api/types/UiFieldPropertiesDto.java | 263 +- .../com/squidex/api/types/UpdateAppDto.java | 239 + .../api/types/UpdateAppSettingsDto.java | 316 + .../api/types/UpdateAssetScriptsDto.java | 369 + .../squidex/api/types/UpdateClientDto.java | 308 + .../com/squidex/api/types/UpdateFieldDto.java | 272 +- .../squidex/api/types/UpdateLanguageDto.java | 270 + .../squidex/api/types/UpdateProfileDto.java | 220 + .../com/squidex/api/types/UpdateRoleDto.java | 255 + .../com/squidex/api/types/UpdateRuleDto.java | 292 + .../squidex/api/types/UpdateSchemaDto.java | 377 + .../squidex/api/types/UpdateSettingDto.java | 262 +- .../com/squidex/api/types/UpdateTeamDto.java | 209 + .../com/squidex/api/types/UpdateUserDto.java | 314 + .../squidex/api/types/UpdateWorkflowDto.java | 319 + .../squidex/api/types/UpsertCommentDto.java | 130 - .../squidex/api/types/UpsertSchemaDto.java | 772 +- .../api/types/UpsertSchemaFieldDto.java | 671 +- .../api/types/UpsertSchemaNestedFieldDto.java | 513 +- .../api/types/UsageRuleTriggerDto.java | 343 +- .../java/com/squidex/api/types/UserDto.java | 613 +- .../com/squidex/api/types/UserProperty.java | 314 +- .../java/com/squidex/api/types/UsersDto.java | 439 +- .../com/squidex/api/types/WebhookMethod.java | 82 +- .../api/types/WebhookRuleActionDto.java | 581 +- .../com/squidex/api/types/WorkflowDto.java | 642 +- .../squidex/api/types/WorkflowStepDto.java | 547 +- .../api/types/WorkflowTransitionDto.java | 327 +- .../com/squidex/api/types/WorkflowsDto.java | 371 +- .../java/com/squidex/api/AssetsTests.java | 39 +- .../java/com/squidex/api/ClientProvider.java | 9 +- .../java/com/squidex/api/ContentsTests.java | 86 +- .../java/com/squidex/api/SchemasTests.java | 49 +- src/test/java/com/squidex/api/TestSetup.java | 27 +- .../com/squidex/api/UserManagementTests.java | 16 +- src/test/java/com/squidex/api/Utils.java | 4 +- templates/JSON.mustache | 552 + templates/api.mustache | 598 + templates/pojo.mustache | 595 + 394 files changed, 116538 insertions(+), 52996 deletions(-) delete mode 100644 .fernignore create mode 100644 .openapi-generator-ignore create mode 100644 .openapi-generator/FILES create mode 100644 .openapi-generator/VERSION create mode 100644 build.sbt create mode 100644 generate.ps1 create mode 100644 openapi-config.yml create mode 100644 openapi.json create mode 100644 src/main/AndroidManifest.xml create mode 100644 src/main/java/com/squidex/api/AccessTokenResponse.java delete mode 100644 src/main/java/com/squidex/api/SquidexApiClient.java delete mode 100644 src/main/java/com/squidex/api/SquidexApiClientBuilder.java create mode 100644 src/main/java/com/squidex/api/core/ApiCallback.java create mode 100644 src/main/java/com/squidex/api/core/ApiClient.java delete mode 100644 src/main/java/com/squidex/api/core/ApiError.java create mode 100644 src/main/java/com/squidex/api/core/ApiException.java create mode 100644 src/main/java/com/squidex/api/core/ApiResponse.java delete mode 100644 src/main/java/com/squidex/api/core/ClientOptions.java create mode 100644 src/main/java/com/squidex/api/core/Configuration.java delete mode 100644 src/main/java/com/squidex/api/core/DateTimeDeserializer.java delete mode 100644 src/main/java/com/squidex/api/core/Environment.java create mode 100644 src/main/java/com/squidex/api/core/GzipRequestInterceptor.java create mode 100644 src/main/java/com/squidex/api/core/JSON.java delete mode 100644 src/main/java/com/squidex/api/core/ObjectMappers.java create mode 100644 src/main/java/com/squidex/api/core/Pair.java create mode 100644 src/main/java/com/squidex/api/core/ProgressRequestBody.java create mode 100644 src/main/java/com/squidex/api/core/ProgressResponseBody.java delete mode 100644 src/main/java/com/squidex/api/core/RequestOptions.java delete mode 100644 src/main/java/com/squidex/api/core/RetryInterceptor.java create mode 100644 src/main/java/com/squidex/api/core/ServerConfiguration.java create mode 100644 src/main/java/com/squidex/api/core/ServerVariable.java create mode 100644 src/main/java/com/squidex/api/core/StringUtil.java delete mode 100644 src/main/java/com/squidex/api/core/Suppliers.java create mode 100644 src/main/java/com/squidex/api/core/api/AppsApi.java create mode 100644 src/main/java/com/squidex/api/core/api/AssetsApi.java create mode 100644 src/main/java/com/squidex/api/core/api/BackupsApi.java create mode 100644 src/main/java/com/squidex/api/core/api/ContentsApi.java create mode 100644 src/main/java/com/squidex/api/core/api/DiagnosticsApi.java create mode 100644 src/main/java/com/squidex/api/core/api/EventConsumersApi.java create mode 100644 src/main/java/com/squidex/api/core/api/HistoryApi.java create mode 100644 src/main/java/com/squidex/api/core/api/JobsApi.java create mode 100644 src/main/java/com/squidex/api/core/api/LanguagesApi.java create mode 100644 src/main/java/com/squidex/api/core/api/NewsApi.java create mode 100644 src/main/java/com/squidex/api/core/api/PingApi.java create mode 100644 src/main/java/com/squidex/api/core/api/PlansApi.java create mode 100644 src/main/java/com/squidex/api/core/api/RulesApi.java create mode 100644 src/main/java/com/squidex/api/core/api/SchemasApi.java create mode 100644 src/main/java/com/squidex/api/core/api/SearchApi.java create mode 100644 src/main/java/com/squidex/api/core/api/StatisticsApi.java create mode 100644 src/main/java/com/squidex/api/core/api/TeamsApi.java create mode 100644 src/main/java/com/squidex/api/core/api/TemplatesApi.java create mode 100644 src/main/java/com/squidex/api/core/api/TranslationsApi.java create mode 100644 src/main/java/com/squidex/api/core/api/UserManagementApi.java create mode 100644 src/main/java/com/squidex/api/core/api/UsersApi.java create mode 100644 src/main/java/com/squidex/api/core/auth/ApiKeyAuth.java create mode 100644 src/main/java/com/squidex/api/core/auth/Authentication.java create mode 100644 src/main/java/com/squidex/api/core/auth/HttpBasicAuth.java create mode 100644 src/main/java/com/squidex/api/core/auth/HttpBearerAuth.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/AppsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/AddLanguageDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/AddRoleDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/AddWorkflowDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/AppsUploadImageRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/CreateAppDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/CreateClientDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/TransferToTeamDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateAppDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateAppSettingsDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateAssetScriptsDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateClientDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateLanguageDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateRoleDto.java delete mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateWorkflowDto.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/AssetsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AnnotateAssetDto.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsDeleteAssetRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentBySlugRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetFoldersRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsPostRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsPostAssetRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsPostUpsertAssetRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsPutAssetContentRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/BulkUpdateAssetsDto.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/CreateAssetFolderDto.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/MoveAssetDto.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/MoveAssetFolderDto.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/RenameAssetFolderDto.java delete mode 100644 src/main/java/com/squidex/api/resources/assets/requests/RenameTagDto.java delete mode 100644 src/main/java/com/squidex/api/resources/backups/BackupsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/backups/requests/BackupsGetBackupContentV2Request.java delete mode 100644 src/main/java/com/squidex/api/resources/backups/requests/RestoreRequestDto.java delete mode 100644 src/main/java/com/squidex/api/resources/comments/CommentsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/comments/requests/CommentsGetCommentsRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/ContentsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/AllContentsByPostDto.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ChangeStatusDto.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsBulkUpdateAllContentsRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsCreateDraftRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentStatusRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteVersionRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetAllContentsRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentVersionRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsPostRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetGraphQlBatchRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetGraphQlRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencesRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencingRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsPatchContentRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsPostContentRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsPostGraphQlBatchRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsPostGraphQlRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsPostUpsertContentRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsPutContentRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ImportContentsDto.java delete mode 100644 src/main/java/com/squidex/api/resources/diagnostics/DiagnosticsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java delete mode 100644 src/main/java/com/squidex/api/resources/history/HistoryClient.java delete mode 100644 src/main/java/com/squidex/api/resources/history/requests/HistoryGetAppHistoryRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/history/requests/HistoryGetTeamHistoryRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/languages/LanguagesClient.java delete mode 100644 src/main/java/com/squidex/api/resources/news/NewsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/news/requests/NewsGetNewsRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/notifications/NotificationsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/notifications/requests/NotificationsGetNotificationsRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/ping/PingClient.java delete mode 100644 src/main/java/com/squidex/api/resources/plans/PlansClient.java delete mode 100644 src/main/java/com/squidex/api/resources/rules/RulesClient.java delete mode 100644 src/main/java/com/squidex/api/resources/rules/requests/RulesGetEventsRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/rules/requests/RulesPutRuleRunRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/rules/requests/UpdateRuleDto.java delete mode 100644 src/main/java/com/squidex/api/resources/schemas/SchemasClient.java delete mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/ChangeCategoryDto.java delete mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/ConfigureFieldRulesDto.java delete mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/ConfigureUiFieldsDto.java delete mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/CreateSchemaDto.java delete mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/SynchronizeSchemaDto.java delete mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/UpdateSchemaDto.java delete mode 100644 src/main/java/com/squidex/api/resources/search/SearchClient.java delete mode 100644 src/main/java/com/squidex/api/resources/search/requests/SearchGetSearchResultsRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/statistics/StatisticsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/teams/TeamsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/teams/requests/CreateTeamDto.java delete mode 100644 src/main/java/com/squidex/api/resources/teams/requests/UpdateTeamDto.java delete mode 100644 src/main/java/com/squidex/api/resources/templates/TemplatesClient.java delete mode 100644 src/main/java/com/squidex/api/resources/translations/TranslationsClient.java delete mode 100644 src/main/java/com/squidex/api/resources/translations/requests/AskDto.java delete mode 100644 src/main/java/com/squidex/api/resources/translations/requests/TranslateDto.java delete mode 100644 src/main/java/com/squidex/api/resources/usermanagement/UserManagementClient.java delete mode 100644 src/main/java/com/squidex/api/resources/usermanagement/requests/CreateUserDto.java delete mode 100644 src/main/java/com/squidex/api/resources/usermanagement/requests/UpdateUserDto.java delete mode 100644 src/main/java/com/squidex/api/resources/usermanagement/requests/UserManagementGetUsersRequest.java delete mode 100644 src/main/java/com/squidex/api/resources/users/UsersClient.java delete mode 100644 src/main/java/com/squidex/api/resources/users/requests/UpdateProfileDto.java delete mode 100644 src/main/java/com/squidex/api/resources/users/requests/UsersGetUsersRequest.java create mode 100644 src/main/java/com/squidex/api/types/AbstractOpenApiSchema.java create mode 100644 src/main/java/com/squidex/api/types/AddLanguageDto.java create mode 100644 src/main/java/com/squidex/api/types/AddRoleDto.java create mode 100644 src/main/java/com/squidex/api/types/AddWorkflowDto.java create mode 100644 src/main/java/com/squidex/api/types/AllContentsByPostDto.java create mode 100644 src/main/java/com/squidex/api/types/AnnotateAssetDto.java create mode 100644 src/main/java/com/squidex/api/types/AuthSchemeDto.java create mode 100644 src/main/java/com/squidex/api/types/AuthSchemeResponseDto.java create mode 100644 src/main/java/com/squidex/api/types/AuthSchemeValueDto.java create mode 100644 src/main/java/com/squidex/api/types/BulkUpdateAssetsDto.java create mode 100644 src/main/java/com/squidex/api/types/ChangeCategoryDto.java create mode 100644 src/main/java/com/squidex/api/types/ChangeStatusDto.java delete mode 100644 src/main/java/com/squidex/api/types/CommentDto.java delete mode 100644 src/main/java/com/squidex/api/types/CommentsDto.java create mode 100644 src/main/java/com/squidex/api/types/ConfigureFieldRulesDto.java create mode 100644 src/main/java/com/squidex/api/types/ConfigureUIFieldsDto.java create mode 100644 src/main/java/com/squidex/api/types/CreateAppDto.java create mode 100644 src/main/java/com/squidex/api/types/CreateAssetFolderDto.java create mode 100644 src/main/java/com/squidex/api/types/CreateClientDto.java create mode 100644 src/main/java/com/squidex/api/types/CreateSchemaDto.java create mode 100644 src/main/java/com/squidex/api/types/CreateTeamDto.java create mode 100644 src/main/java/com/squidex/api/types/CreateUserDto.java delete mode 100644 src/main/java/com/squidex/api/types/DeepDetectRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/GeolocationFieldEditor.java delete mode 100644 src/main/java/com/squidex/api/types/IResource.java delete mode 100644 src/main/java/com/squidex/api/types/IUpsertSchemaDto.java create mode 100644 src/main/java/com/squidex/api/types/ImportContentsDto.java create mode 100644 src/main/java/com/squidex/api/types/JobDto.java create mode 100644 src/main/java/com/squidex/api/types/JobLogMessageDto.java create mode 100644 src/main/java/com/squidex/api/types/JobsDto.java create mode 100644 src/main/java/com/squidex/api/types/MoveAssetDto.java create mode 100644 src/main/java/com/squidex/api/types/MoveAssetFolderDto.java create mode 100644 src/main/java/com/squidex/api/types/RenameAssetFolderDto.java create mode 100644 src/main/java/com/squidex/api/types/RenameTagDto.java create mode 100644 src/main/java/com/squidex/api/types/RestoreRequestDto.java create mode 100644 src/main/java/com/squidex/api/types/RichTextFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/SynchronizeSchemaDto.java create mode 100644 src/main/java/com/squidex/api/types/TransferToTeamDto.java create mode 100644 src/main/java/com/squidex/api/types/TranslateDto.java create mode 100644 src/main/java/com/squidex/api/types/UIFieldEditor.java create mode 100644 src/main/java/com/squidex/api/types/UpdateAppDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateAppSettingsDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateAssetScriptsDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateClientDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateLanguageDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateProfileDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateRoleDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateRuleDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateSchemaDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateTeamDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateUserDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateWorkflowDto.java delete mode 100644 src/main/java/com/squidex/api/types/UpsertCommentDto.java create mode 100644 templates/JSON.mustache create mode 100644 templates/api.mustache create mode 100644 templates/pojo.mustache diff --git a/.fernignore b/.fernignore deleted file mode 100644 index d19619c..0000000 --- a/.fernignore +++ /dev/null @@ -1,26 +0,0 @@ -README.md - -# Wrappers -src/main/java/com/squidex/api/core/ClientOptions.java - -# Client files -src/main/java/com/squidex/api/AccessToken.java -src/main/java/com/squidex/api/AuthInterceptor.java -src/main/java/com/squidex/api/InMemoryTokenStore.java -src/main/java/com/squidex/api/SquidexClient.java -src/main/java/com/squidex/api/SquidexClientBuilder.java -src/main/java/com/squidex/api/TokenStore.java - -# Workflows -.github/workflows/check-updates.yml -.github/workflows/ci.yml -.github/workflows/test.yml - -# Tests -src/test/ - -# Sample App -sample-app - -# Docker Compose -tests diff --git a/.gitignore b/.gitignore index d4199ab..4ddab18 100644 --- a/.gitignore +++ b/.gitignore @@ -21,4 +21,9 @@ generated_testSrc/ generated/ bin -build \ No newline at end of file +build + +local.properties + +# OpenAPI Generator creates a copy for whatver reason +/api \ No newline at end of file diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..c251ce9 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,22 @@ +# Use this file to prevent files from being overwritten by the generator. +/local/docs/*.* +/local/test/*.* + +# Whatever this is for +git_push.sh + +# We use github actions +.github/**/*.* +.gitignore +.travis.yml + +/api/ + +pom.xml + +openapi.yml +gradle.properties +gradlew +gradlew.bat + +README.md \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES new file mode 100644 index 0000000..3644d0b --- /dev/null +++ b/.openapi-generator/FILES @@ -0,0 +1,251 @@ +build.gradle +build.sbt +gradle/wrapper/gradle-wrapper.jar +gradle/wrapper/gradle-wrapper.properties +settings.gradle +src/main/AndroidManifest.xml +src/main/java/com/squidex/api/core/ApiCallback.java +src/main/java/com/squidex/api/core/ApiClient.java +src/main/java/com/squidex/api/core/ApiException.java +src/main/java/com/squidex/api/core/ApiResponse.java +src/main/java/com/squidex/api/core/Configuration.java +src/main/java/com/squidex/api/core/GzipRequestInterceptor.java +src/main/java/com/squidex/api/core/JSON.java +src/main/java/com/squidex/api/core/Pair.java +src/main/java/com/squidex/api/core/ProgressRequestBody.java +src/main/java/com/squidex/api/core/ProgressResponseBody.java +src/main/java/com/squidex/api/core/ServerConfiguration.java +src/main/java/com/squidex/api/core/ServerVariable.java +src/main/java/com/squidex/api/core/StringUtil.java +src/main/java/com/squidex/api/core/api/AppsApi.java +src/main/java/com/squidex/api/core/api/AssetsApi.java +src/main/java/com/squidex/api/core/api/BackupsApi.java +src/main/java/com/squidex/api/core/api/ContentsApi.java +src/main/java/com/squidex/api/core/api/DiagnosticsApi.java +src/main/java/com/squidex/api/core/api/EventConsumersApi.java +src/main/java/com/squidex/api/core/api/HistoryApi.java +src/main/java/com/squidex/api/core/api/JobsApi.java +src/main/java/com/squidex/api/core/api/LanguagesApi.java +src/main/java/com/squidex/api/core/api/NewsApi.java +src/main/java/com/squidex/api/core/api/PingApi.java +src/main/java/com/squidex/api/core/api/PlansApi.java +src/main/java/com/squidex/api/core/api/RulesApi.java +src/main/java/com/squidex/api/core/api/SchemasApi.java +src/main/java/com/squidex/api/core/api/SearchApi.java +src/main/java/com/squidex/api/core/api/StatisticsApi.java +src/main/java/com/squidex/api/core/api/TeamsApi.java +src/main/java/com/squidex/api/core/api/TemplatesApi.java +src/main/java/com/squidex/api/core/api/TranslationsApi.java +src/main/java/com/squidex/api/core/api/UserManagementApi.java +src/main/java/com/squidex/api/core/api/UsersApi.java +src/main/java/com/squidex/api/core/auth/ApiKeyAuth.java +src/main/java/com/squidex/api/core/auth/Authentication.java +src/main/java/com/squidex/api/core/auth/HttpBasicAuth.java +src/main/java/com/squidex/api/core/auth/HttpBearerAuth.java +src/main/java/com/squidex/api/types/AbstractOpenApiSchema.java +src/main/java/com/squidex/api/types/ActionTypeEnum.java +src/main/java/com/squidex/api/types/AddFieldDto.java +src/main/java/com/squidex/api/types/AddLanguageDto.java +src/main/java/com/squidex/api/types/AddRoleDto.java +src/main/java/com/squidex/api/types/AddWorkflowDto.java +src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java +src/main/java/com/squidex/api/types/AllContentsByPostDto.java +src/main/java/com/squidex/api/types/AnnotateAssetDto.java +src/main/java/com/squidex/api/types/AppDto.java +src/main/java/com/squidex/api/types/AppLanguageDto.java +src/main/java/com/squidex/api/types/AppLanguagesDto.java +src/main/java/com/squidex/api/types/AppSettingsDto.java +src/main/java/com/squidex/api/types/ArrayCalculatedDefaultValue.java +src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java +src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java +src/main/java/com/squidex/api/types/AssetDto.java +src/main/java/com/squidex/api/types/AssetFolderDto.java +src/main/java/com/squidex/api/types/AssetFolderScope.java +src/main/java/com/squidex/api/types/AssetFoldersDto.java +src/main/java/com/squidex/api/types/AssetMeta.java +src/main/java/com/squidex/api/types/AssetPreviewMode.java +src/main/java/com/squidex/api/types/AssetScriptsDto.java +src/main/java/com/squidex/api/types/AssetType.java +src/main/java/com/squidex/api/types/AssetsDto.java +src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java +src/main/java/com/squidex/api/types/AssignContributorDto.java +src/main/java/com/squidex/api/types/AuthSchemeDto.java +src/main/java/com/squidex/api/types/AuthSchemeResponseDto.java +src/main/java/com/squidex/api/types/AuthSchemeValueDto.java +src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java +src/main/java/com/squidex/api/types/BackupJobDto.java +src/main/java/com/squidex/api/types/BackupJobsDto.java +src/main/java/com/squidex/api/types/BooleanFieldEditor.java +src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java +src/main/java/com/squidex/api/types/BulkResultDto.java +src/main/java/com/squidex/api/types/BulkUpdateAssetType.java +src/main/java/com/squidex/api/types/BulkUpdateAssetsDto.java +src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java +src/main/java/com/squidex/api/types/BulkUpdateContentType.java +src/main/java/com/squidex/api/types/BulkUpdateContentsDto.java +src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java +src/main/java/com/squidex/api/types/CallsUsageDtoDto.java +src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java +src/main/java/com/squidex/api/types/ChangeCategoryDto.java +src/main/java/com/squidex/api/types/ChangePlanDto.java +src/main/java/com/squidex/api/types/ChangeStatusDto.java +src/main/java/com/squidex/api/types/ClientDto.java +src/main/java/com/squidex/api/types/ClientsDto.java +src/main/java/com/squidex/api/types/CommentRuleActionDto.java +src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java +src/main/java/com/squidex/api/types/ComponentFieldPropertiesDto.java +src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java +src/main/java/com/squidex/api/types/ConfigureFieldRulesDto.java +src/main/java/com/squidex/api/types/ConfigureUIFieldsDto.java +src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java +src/main/java/com/squidex/api/types/ContentDto.java +src/main/java/com/squidex/api/types/ContentsDto.java +src/main/java/com/squidex/api/types/ContributorDto.java +src/main/java/com/squidex/api/types/ContributorsDto.java +src/main/java/com/squidex/api/types/ContributorsMetadata.java +src/main/java/com/squidex/api/types/CreateAppDto.java +src/main/java/com/squidex/api/types/CreateAssetFolderDto.java +src/main/java/com/squidex/api/types/CreateClientDto.java +src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java +src/main/java/com/squidex/api/types/CreateRuleDto.java +src/main/java/com/squidex/api/types/CreateSchemaDto.java +src/main/java/com/squidex/api/types/CreateTeamDto.java +src/main/java/com/squidex/api/types/CreateUserDto.java +src/main/java/com/squidex/api/types/CurrentStorageDto.java +src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java +src/main/java/com/squidex/api/types/DateTimeFieldEditor.java +src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java +src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java +src/main/java/com/squidex/api/types/EditorDto.java +src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java +src/main/java/com/squidex/api/types/EmailRuleActionDto.java +src/main/java/com/squidex/api/types/ErrorDto.java +src/main/java/com/squidex/api/types/EventConsumerDto.java +src/main/java/com/squidex/api/types/EventConsumersDto.java +src/main/java/com/squidex/api/types/FastlyRuleActionDto.java +src/main/java/com/squidex/api/types/FeatureDto.java +src/main/java/com/squidex/api/types/FeaturesDto.java +src/main/java/com/squidex/api/types/FieldDto.java +src/main/java/com/squidex/api/types/FieldPropertiesDto.java +src/main/java/com/squidex/api/types/FieldRuleAction.java +src/main/java/com/squidex/api/types/FieldRuleDto.java +src/main/java/com/squidex/api/types/GeolocationFieldEditor.java +src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java +src/main/java/com/squidex/api/types/HistoryEventDto.java +src/main/java/com/squidex/api/types/ImageFormat.java +src/main/java/com/squidex/api/types/ImportContentsDto.java +src/main/java/com/squidex/api/types/JobDto.java +src/main/java/com/squidex/api/types/JobLogMessageDto.java +src/main/java/com/squidex/api/types/JobStatus.java +src/main/java/com/squidex/api/types/JobsDto.java +src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java +src/main/java/com/squidex/api/types/LanguageDto.java +src/main/java/com/squidex/api/types/LogDownloadDto.java +src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java +src/main/java/com/squidex/api/types/MediumRuleActionDto.java +src/main/java/com/squidex/api/types/MoveAssetDto.java +src/main/java/com/squidex/api/types/MoveAssetFolderDto.java +src/main/java/com/squidex/api/types/NestedFieldDto.java +src/main/java/com/squidex/api/types/NotificationRuleActionDto.java +src/main/java/com/squidex/api/types/NumberFieldEditor.java +src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java +src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java +src/main/java/com/squidex/api/types/PatternDto.java +src/main/java/com/squidex/api/types/PlanChangedDto.java +src/main/java/com/squidex/api/types/PlanDto.java +src/main/java/com/squidex/api/types/PlansDto.java +src/main/java/com/squidex/api/types/PlansLockedReason.java +src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java +src/main/java/com/squidex/api/types/QueryDto.java +src/main/java/com/squidex/api/types/QueryJsonDto.java +src/main/java/com/squidex/api/types/ReferencesFieldEditor.java +src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java +src/main/java/com/squidex/api/types/ReferralInfo.java +src/main/java/com/squidex/api/types/RenameAssetFolderDto.java +src/main/java/com/squidex/api/types/RenameTagDto.java +src/main/java/com/squidex/api/types/ReorderFieldsDto.java +src/main/java/com/squidex/api/types/ResizeMode.java +src/main/java/com/squidex/api/types/Resource.java +src/main/java/com/squidex/api/types/ResourceLink.java +src/main/java/com/squidex/api/types/ResourcesDto.java +src/main/java/com/squidex/api/types/RestoreJobDto.java +src/main/java/com/squidex/api/types/RestoreRequestDto.java +src/main/java/com/squidex/api/types/RichTextFieldPropertiesDto.java +src/main/java/com/squidex/api/types/RoleDto.java +src/main/java/com/squidex/api/types/RolesDto.java +src/main/java/com/squidex/api/types/RuleActionDto.java +src/main/java/com/squidex/api/types/RuleDto.java +src/main/java/com/squidex/api/types/RuleElementDto.java +src/main/java/com/squidex/api/types/RuleElementPropertyDto.java +src/main/java/com/squidex/api/types/RuleEventDto.java +src/main/java/com/squidex/api/types/RuleEventsDto.java +src/main/java/com/squidex/api/types/RuleFieldEditor.java +src/main/java/com/squidex/api/types/RuleJobResult.java +src/main/java/com/squidex/api/types/RuleResult.java +src/main/java/com/squidex/api/types/RuleTriggerDto.java +src/main/java/com/squidex/api/types/RulesDto.java +src/main/java/com/squidex/api/types/ScheduleJobDto.java +src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java +src/main/java/com/squidex/api/types/SchemaCondition.java +src/main/java/com/squidex/api/types/SchemaDto.java +src/main/java/com/squidex/api/types/SchemaPropertiesDto.java +src/main/java/com/squidex/api/types/SchemaScriptsDto.java +src/main/java/com/squidex/api/types/SchemaType.java +src/main/java/com/squidex/api/types/SchemasDto.java +src/main/java/com/squidex/api/types/ScriptRuleActionDto.java +src/main/java/com/squidex/api/types/SearchResultDto.java +src/main/java/com/squidex/api/types/SearchResultType.java +src/main/java/com/squidex/api/types/SignalRRuleActionDto.java +src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java +src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java +src/main/java/com/squidex/api/types/SkipReason.java +src/main/java/com/squidex/api/types/SlackRuleActionDto.java +src/main/java/com/squidex/api/types/SortNode.java +src/main/java/com/squidex/api/types/SortOrder.java +src/main/java/com/squidex/api/types/StatusInfoDto.java +src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java +src/main/java/com/squidex/api/types/StringContentType.java +src/main/java/com/squidex/api/types/StringFieldEditor.java +src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java +src/main/java/com/squidex/api/types/SynchronizeSchemaDto.java +src/main/java/com/squidex/api/types/TagsFieldEditor.java +src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java +src/main/java/com/squidex/api/types/TeamDto.java +src/main/java/com/squidex/api/types/TemplateDetailsDto.java +src/main/java/com/squidex/api/types/TemplateDto.java +src/main/java/com/squidex/api/types/TemplatesDto.java +src/main/java/com/squidex/api/types/TransferToTeamDto.java +src/main/java/com/squidex/api/types/TranslateDto.java +src/main/java/com/squidex/api/types/TranslationDto.java +src/main/java/com/squidex/api/types/TranslationStatus.java +src/main/java/com/squidex/api/types/TweetRuleActionDto.java +src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java +src/main/java/com/squidex/api/types/UIFieldEditor.java +src/main/java/com/squidex/api/types/UIFieldPropertiesDto.java +src/main/java/com/squidex/api/types/UpdateAppDto.java +src/main/java/com/squidex/api/types/UpdateAppSettingsDto.java +src/main/java/com/squidex/api/types/UpdateAssetScriptsDto.java +src/main/java/com/squidex/api/types/UpdateClientDto.java +src/main/java/com/squidex/api/types/UpdateFieldDto.java +src/main/java/com/squidex/api/types/UpdateLanguageDto.java +src/main/java/com/squidex/api/types/UpdateProfileDto.java +src/main/java/com/squidex/api/types/UpdateRoleDto.java +src/main/java/com/squidex/api/types/UpdateRuleDto.java +src/main/java/com/squidex/api/types/UpdateSchemaDto.java +src/main/java/com/squidex/api/types/UpdateSettingDto.java +src/main/java/com/squidex/api/types/UpdateTeamDto.java +src/main/java/com/squidex/api/types/UpdateUserDto.java +src/main/java/com/squidex/api/types/UpdateWorkflowDto.java +src/main/java/com/squidex/api/types/UpsertSchemaDto.java +src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java +src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java +src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java +src/main/java/com/squidex/api/types/UserDto.java +src/main/java/com/squidex/api/types/UserProperty.java +src/main/java/com/squidex/api/types/UsersDto.java +src/main/java/com/squidex/api/types/WebhookMethod.java +src/main/java/com/squidex/api/types/WebhookRuleActionDto.java +src/main/java/com/squidex/api/types/WorkflowDto.java +src/main/java/com/squidex/api/types/WorkflowStepDto.java +src/main/java/com/squidex/api/types/WorkflowTransitionDto.java +src/main/java/com/squidex/api/types/WorkflowsDto.java diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..17f2442 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.9.0-SNAPSHOT diff --git a/build.gradle b/build.gradle index 9332d37..02181b6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,59 +1,167 @@ -plugins { - id 'java-library' - id 'maven-publish' - id 'com.diffplug.spotless' version '6.11.0' +apply plugin: 'idea' +apply plugin: 'eclipse' +apply plugin: 'java' +apply plugin: 'com.diffplug.spotless' + +group = 'com.squidex.api' +version = '1.0.0.0' + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' + } } repositories { mavenCentral() - maven { - url 'https://s01.oss.sonatype.org/content/repositories/releases/' +} +sourceSets { + main.java.srcDirs = ['src/main/java'] +} + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDirectory + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task) + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar } + +} else { + + apply plugin: 'java' + apply plugin: 'maven-publish' + + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + publishing { + publications { + maven(MavenPublication) { + artifactId = 'openapi-java-client' + from components.java + } + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + jakarta_annotation_version = "1.3.5" } dependencies { - api 'com.squareup.okhttp3:okhttp:4.9.3' - api 'com.fasterxml.jackson.core:jackson-databind:2.13.0' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.12.3' - api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.12.3' - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' - testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' + implementation 'io.swagger:swagger-annotations:1.6.8' + implementation "com.google.code.findbugs:jsr305:3.0.2" + implementation 'com.squareup.okhttp3:okhttp:4.12.0' + implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' + implementation 'com.google.code.gson:gson:2.9.1' + implementation 'io.gsonfire:gson-fire:1.9.0' + implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6' + implementation 'org.openapitools:jackson-databind-nullable:0.2.6' + implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' + testImplementation 'org.mockito:mockito-core:3.12.4' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' } +javadoc { + options.tags = [ "http.response.details:a:Http Response Details" ] +} + +// Use spotless plugin to automatically format code, remove unused import, etc +// To apply changes directly to the file, run `gradlew spotlessApply` +// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle spotless { - java { - palantirJavaFormat() + // comment out below to run spotless as part of the `check` task + enforceCheck false + + format 'misc', { + // define the files (e.g. '*.gradle', '*.md') to apply `misc` to + target '.gitignore' + + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithSpaces() // Takes an integer argument if you don't like 4 + endWithNewline() } -} + java { + // don't need to set target, it is inferred from java -java { - withSourcesJar() - withJavadocJar() + // apply a specific flavor of google-java-format + googleJavaFormat('1.8').aosp().reflowLongStrings() + + removeUnusedImports() + importOrder() + } } test { + // Enable JUnit 5 (Gradle 4.6+). useJUnitPlatform() + + // Always run tests, even when nothing changed. + dependsOn 'cleanTest' + + // Show test results. testLogging { - showStandardStreams = true - } -} -publishing { - publications { - maven(MavenPublication) { - groupId = 'io.squidex' - artifactId = 'squidex' - version = '1.0.0' - from components.java - } + events "passed", "skipped", "failed" } - repositories { - maven { - url "$System.env.MAVEN_PUBLISH_REGISTRY_URL" - credentials { - username "$System.env.MAVEN_USERNAME" - password "$System.env.MAVEN_PASSWORD" - } - } - } -} +} diff --git a/build.sbt b/build.sbt new file mode 100644 index 0000000..1e76c3b --- /dev/null +++ b/build.sbt @@ -0,0 +1,27 @@ +lazy val root = (project in file(".")). + settings( + organization := "com.squidex.api", + name := "openapi-java-client", + version := "1.0.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.6.5", + "com.squareup.okhttp3" % "okhttp" % "4.12.0", + "com.squareup.okhttp3" % "logging-interceptor" % "4.12.0", + "com.google.code.gson" % "gson" % "2.9.1", + "org.apache.commons" % "commons-lang3" % "3.12.0", + "jakarta.ws.rs" % "jakarta.ws.rs-api" % "2.1.6", + "org.openapitools" % "jackson-databind-nullable" % "0.2.6", + "io.gsonfire" % "gson-fire" % "1.9.0" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", + "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", + "org.junit.jupiter" % "junit-jupiter-api" % "5.10.3" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test", + "org.mockito" % "mockito-core" % "3.12.4" % "test" + ) + ) diff --git a/generate.ps1 b/generate.ps1 new file mode 100644 index 0000000..18bba68 --- /dev/null +++ b/generate.ps1 @@ -0,0 +1,2 @@ +# docker run --rm -v ${PWD}:/local squidex/openapi-generator-cli config-help -g php +docker run --rm -v ${PWD}:/local squidex/openapi-generator-cli generate -i /local/openapi.json -g java --template-dir /local/templates -o /local -c /local/openapi-config.yml \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7f93135c49b765f8051ef9d0a6055ff8e46073d8..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%nnW$ZR+`W ze|#J8f4A@M|F5BpfUJb5h>|j$jOe}0oE!`Zf6fM>CR?!y@zU(cL8NsKk`a z6tx5mAkdjD;J=LcJ;;Aw8p!v#ouk>mUDZF@ zK>yvw%+bKu+T{Nk@LZ;zkYy0HBKw06_IWcMHo*0HKpTsEFZhn5qCHH9j z)|XpN&{`!0a>Vl+PmdQc)Yg4A(AG-z!+@Q#eHr&g<9D?7E)_aEB?s_rx>UE9TUq|? z;(ggJt>9l?C|zoO@5)tu?EV0x_7T17q4fF-q3{yZ^ipUbKcRZ4Qftd!xO(#UGhb2y>?*@{xq%`(-`2T^vc=#< zx!+@4pRdk&*1ht2OWk^Z5IAQ0YTAXLkL{(D*$gENaD)7A%^XXrCchN&z2x+*>o2FwPFjWpeaL=!tzv#JOW#( z$B)Nel<+$bkH1KZv3&-}=SiG~w2sbDbAWarg%5>YbC|}*d9hBjBkR(@tyM0T)FO$# zPtRXukGPnOd)~z=?avu+4Co@wF}1T)-uh5jI<1$HLtyDrVak{gw`mcH@Q-@wg{v^c zRzu}hMKFHV<8w}o*yg6p@Sq%=gkd~;`_VGTS?L@yVu`xuGy+dH6YOwcP6ZE`_0rK% zAx5!FjDuss`FQ3eF|mhrWkjux(Pny^k$u_)dyCSEbAsecHsq#8B3n3kDU(zW5yE|( zgc>sFQywFj5}U*qtF9Y(bi*;>B7WJykcAXF86@)z|0-Vm@jt!EPoLA6>r)?@DIobIZ5Sx zsc@OC{b|3%vaMbyeM|O^UxEYlEMHK4r)V-{r)_yz`w1*xV0|lh-LQOP`OP`Pk1aW( z8DSlGN>Ts|n*xj+%If~+E_BxK)~5T#w6Q1WEKt{!Xtbd`J;`2a>8boRo;7u2M&iOop4qcy<)z023=oghSFV zST;?S;ye+dRQe>ygiJ6HCv4;~3DHtJ({fWeE~$H@mKn@Oh6Z(_sO>01JwH5oA4nvK zr5Sr^g+LC zLt(i&ecdmqsIJGNOSUyUpglvhhrY8lGkzO=0USEKNL%8zHshS>Qziu|`eyWP^5xL4 zRP122_dCJl>hZc~?58w~>`P_s18VoU|7(|Eit0-lZRgLTZKNq5{k zE?V=`7=R&ro(X%LTS*f+#H-mGo_j3dm@F_krAYegDLk6UV{`UKE;{YSsn$ z(yz{v1@p|p!0>g04!eRSrSVb>MQYPr8_MA|MpoGzqyd*$@4j|)cD_%^Hrd>SorF>@ zBX+V<@vEB5PRLGR(uP9&U&5=(HVc?6B58NJT_igiAH*q~Wb`dDZpJSKfy5#Aag4IX zj~uv74EQ_Q_1qaXWI!7Vf@ZrdUhZFE;L&P_Xr8l@GMkhc#=plV0+g(ki>+7fO%?Jb zl+bTy7q{w^pTb{>(Xf2q1BVdq?#f=!geqssXp z4pMu*q;iiHmA*IjOj4`4S&|8@gSw*^{|PT}Aw~}ZXU`6=vZB=GGeMm}V6W46|pU&58~P+?LUs%n@J}CSrICkeng6YJ^M? zS(W?K4nOtoBe4tvBXs@@`i?4G$S2W&;$z8VBSM;Mn9 zxcaEiQ9=vS|bIJ>*tf9AH~m&U%2+Dim<)E=}KORp+cZ^!@wI`h1NVBXu{@%hB2Cq(dXx_aQ9x3mr*fwL5!ZryQqi|KFJuzvP zK1)nrKZ7U+B{1ZmJub?4)Ln^J6k!i0t~VO#=q1{?T)%OV?MN}k5M{}vjyZu#M0_*u z8jwZKJ#Df~1jcLXZL7bnCEhB6IzQZ-GcoQJ!16I*39iazoVGugcKA{lhiHg4Ta2fD zk1Utyc5%QzZ$s3;p0N+N8VX{sd!~l*Ta3|t>lhI&G`sr6L~G5Lul`>m z{!^INm?J|&7X=;{XveF!(b*=?9NAp4y&r&N3(GKcW4rS(Ejk|Lzs1PrxPI_owB-`H zg3(Rruh^&)`TKA6+_!n>RdI6pw>Vt1_j&+bKIaMTYLiqhZ#y_=J8`TK{Jd<7l9&sY z^^`hmi7^14s16B6)1O;vJWOF$=$B5ONW;;2&|pUvJlmeUS&F;DbSHCrEb0QBDR|my zIs+pE0Y^`qJTyH-_mP=)Y+u^LHcuZhsM3+P||?+W#V!_6E-8boP#R-*na4!o-Q1 zVthtYhK{mDhF(&7Okzo9dTi03X(AE{8cH$JIg%MEQca`S zy@8{Fjft~~BdzWC(di#X{ny;!yYGK9b@=b|zcKZ{vv4D8i+`ilOPl;PJl{!&5-0!w z^fOl#|}vVg%=n)@_e1BrP)`A zKPgs`O0EO}Y2KWLuo`iGaKu1k#YR6BMySxQf2V++Wo{6EHmK>A~Q5o73yM z-RbxC7Qdh0Cz!nG+7BRZE>~FLI-?&W_rJUl-8FDIaXoNBL)@1hwKa^wOr1($*5h~T zF;%f^%<$p8Y_yu(JEg=c_O!aZ#)Gjh$n(hfJAp$C2he555W5zdrBqjFmo|VY+el;o z=*D_w|GXG|p0**hQ7~9-n|y5k%B}TAF0iarDM!q-jYbR^us(>&y;n^2l0C%@2B}KM zyeRT9)oMt97Agvc4sEKUEy%MpXr2vz*lb zh*L}}iG>-pqDRw7ud{=FvTD?}xjD)w{`KzjNom-$jS^;iw0+7nXSnt1R@G|VqoRhE%12nm+PH?9`(4rM0kfrZzIK9JU=^$YNyLvAIoxl#Q)xxDz!^0@zZ zSCs$nfcxK_vRYM34O<1}QHZ|hp4`ioX3x8(UV(FU$J@o%tw3t4k1QPmlEpZa2IujG&(roX_q*%e`Hq|);0;@k z0z=fZiFckp#JzW0p+2A+D$PC~IsakhJJkG(c;CqAgFfU0Z`u$PzG~-9I1oPHrCw&)@s^Dc~^)#HPW0Ra}J^=|h7Fs*<8|b13ZzG6MP*Q1dkoZ6&A^!}|hbjM{2HpqlSXv_UUg1U4gn z3Q)2VjU^ti1myodv+tjhSZp%D978m~p& z43uZUrraHs80Mq&vcetqfQpQP?m!CFj)44t8Z}k`E798wxg&~aCm+DBoI+nKq}&j^ zlPY3W$)K;KtEajks1`G?-@me7C>{PiiBu+41#yU_c(dITaqE?IQ(DBu+c^Ux!>pCj zLC|HJGU*v+!it1(;3e`6igkH(VA)-S+k(*yqxMgUah3$@C zz`7hEM47xr>j8^g`%*f=6S5n>z%Bt_Fg{Tvmr+MIsCx=0gsu_sF`q2hlkEmisz#Fy zj_0;zUWr;Gz}$BS%Y`meb(=$d%@Crs(OoJ|}m#<7=-A~PQbyN$x%2iXP2@e*nO0b7AwfH8cCUa*Wfu@b)D_>I*%uE4O3 z(lfnB`-Xf*LfC)E}e?%X2kK7DItK6Tf<+M^mX0Ijf_!IP>7c8IZX%8_#0060P{QMuV^B9i<^E`_Qf0pv9(P%_s8D`qvDE9LK9u-jB}J2S`(mCO&XHTS04Z5Ez*vl^T%!^$~EH8M-UdwhegL>3IQ*)(MtuH2Xt1p!fS4o~*rR?WLxlA!sjc2(O znjJn~wQ!Fp9s2e^IWP1C<4%sFF}T4omr}7+4asciyo3DntTgWIzhQpQirM$9{EbQd z3jz9vS@{aOqTQHI|l#aUV@2Q^Wko4T0T04Me4!2nsdrA8QY1%fnAYb~d2GDz@lAtfcHq(P7 zaMBAGo}+NcE-K*@9y;Vt3*(aCaMKXBB*BJcD_Qnxpt75r?GeAQ}*|>pYJE=uZb73 zC>sv)18)q#EGrTG6io*}JLuB_jP3AU1Uiu$D7r|2_zlIGb9 zjhst#ni)Y`$)!fc#reM*$~iaYoz~_Cy7J3ZTiPm)E?%`fbk`3Tu-F#`{i!l5pNEn5 zO-Tw-=TojYhzT{J=?SZj=Z8#|eoF>434b-DXiUsignxXNaR3 zm_}4iWU$gt2Mw5NvZ5(VpF`?X*f2UZDs1TEa1oZCif?Jdgr{>O~7}-$|BZ7I(IKW`{f;@|IZFX*R8&iT= zoWstN8&R;}@2Ka%d3vrLtR|O??ben;k8QbS-WB0VgiCz;<$pBmIZdN!aalyCSEm)crpS9dcD^Y@XT1a3+zpi-`D}e#HV<} z$Y(G&o~PvL-xSVD5D?JqF3?B9rxGWeb=oEGJ3vRp5xfBPlngh1O$yI95EL+T8{GC@ z98i1H9KhZGFl|;`)_=QpM6H?eDPpw~^(aFQWwyXZ8_EEE4#@QeT_URray*mEOGsGc z6|sdXtq!hVZo=d#+9^@lm&L5|q&-GDCyUx#YQiccq;spOBe3V+VKdjJA=IL=Zn%P} zNk=_8u}VhzFf{UYZV0`lUwcD&)9AFx0@Fc6LD9A6Rd1=ga>Mi0)_QxM2ddCVRmZ0d z+J=uXc(?5JLX3=)e)Jm$HS2yF`44IKhwRnm2*669_J=2LlwuF5$1tAo@ROSU@-y+;Foy2IEl2^V1N;fk~YR z?&EP8#t&m0B=?aJeuz~lHjAzRBX>&x=A;gIvb>MD{XEV zV%l-+9N-)i;YH%nKP?>f`=?#`>B(`*t`aiPLoQM(a6(qs4p5KFjDBN?8JGrf3z8>= zi7sD)c)Nm~x{e<^jy4nTx${P~cwz_*a>%0_;ULou3kHCAD7EYkw@l$8TN#LO9jC( z1BeFW`k+bu5e8Ns^a8dPcjEVHM;r6UX+cN=Uy7HU)j-myRU0wHd$A1fNI~`4;I~`zC)3ul#8#^rXVSO*m}Ag>c%_;nj=Nv$rCZ z*~L@C@OZg%Q^m)lc-kcX&a*a5`y&DaRxh6O*dfhLfF+fU5wKs(1v*!TkZidw*)YBP za@r`3+^IHRFeO%!ai%rxy;R;;V^Fr=OJlpBX;(b*3+SIw}7= zIq$*Thr(Zft-RlY)D3e8V;BmD&HOfX+E$H#Y@B3?UL5L~_fA-@*IB-!gItK7PIgG9 zgWuGZK_nuZjHVT_Fv(XxtU%)58;W39vzTI2n&)&4Dmq7&JX6G>XFaAR{7_3QB6zsT z?$L8c*WdN~nZGiscY%5KljQARN;`w$gho=p006z;n(qIQ*Zu<``TMO3n0{ARL@gYh zoRwS*|Niw~cR!?hE{m*y@F`1)vx-JRfqET=dJ5_(076st(=lFfjtKHoYg`k3oNmo_ zNbQEw8&sO5jAYmkD|Zaz_yUb0rC})U!rCHOl}JhbYIDLzLvrZVw0~JO`d*6f;X&?V=#T@ND*cv^I;`sFeq4 z##H5;gpZTb^0Hz@3C*~u0AqqNZ-r%rN3KD~%Gw`0XsIq$(^MEb<~H(2*5G^<2(*aI z%7}WB+TRlMIrEK#s0 z93xn*Ohb=kWFc)BNHG4I(~RPn-R8#0lqyBBz5OM6o5|>x9LK@%HaM}}Y5goCQRt2C z{j*2TtT4ne!Z}vh89mjwiSXG=%DURar~=kGNNaO_+Nkb+tRi~Rkf!7a$*QlavziD( z83s4GmQ^Wf*0Bd04f#0HX@ua_d8 z23~z*53ePD6@xwZ(vdl0DLc=>cPIOPOdca&MyR^jhhKrdQO?_jJh`xV3GKz&2lvP8 zEOwW6L*ufvK;TN{=S&R@pzV^U=QNk^Ec}5H z+2~JvEVA{`uMAr)?Kf|aW>33`)UL@bnfIUQc~L;TsTQ6>r-<^rB8uoNOJ>HWgqMI8 zSW}pZmp_;z_2O5_RD|fGyTxaxk53Hg_3Khc<8AUzV|ZeK{fp|Ne933=1&_^Dbv5^u zB9n=*)k*tjHDRJ@$bp9mrh}qFn*s}npMl5BMDC%Hs0M0g-hW~P*3CNG06G!MOPEQ_ zi}Qs-6M8aMt;sL$vlmVBR^+Ry<64jrm1EI1%#j?c?4b*7>)a{aDw#TfTYKq+SjEFA z(aJ&z_0?0JB83D-i3Vh+o|XV4UP+YJ$9Boid2^M2en@APw&wx7vU~t$r2V`F|7Qfo z>WKgI@eNBZ-+Og<{u2ZiG%>YvH2L3fNpV9J;WLJoBZda)01Rn;o@){01{7E#ke(7U zHK>S#qZ(N=aoae*4X!0A{)nu0R_sKpi1{)u>GVjC+b5Jyl6#AoQ-1_3UDovNSo`T> z?c-@7XX*2GMy?k?{g)7?Sv;SJkmxYPJPs!&QqB12ejq`Lee^-cDveVWL^CTUldb(G zjDGe(O4P=S{4fF=#~oAu>LG>wrU^z_?3yt24FOx>}{^lCGh8?vtvY$^hbZ)9I0E3r3NOlb9I?F-Yc=r$*~l`4N^xzlV~N zl~#oc>U)Yjl0BxV>O*Kr@lKT{Z09OXt2GlvE38nfs+DD7exl|&vT;)>VFXJVZp9Np zDK}aO;R3~ag$X*|hRVY3OPax|PG`@_ESc8E!mHRByJbZQRS38V2F__7MW~sgh!a>98Q2%lUNFO=^xU52|?D=IK#QjwBky-C>zOWlsiiM&1n z;!&1((Xn1$9K}xabq~222gYvx3hnZPg}VMF_GV~5ocE=-v>V=T&RsLBo&`)DOyIj* zLV{h)JU_y*7SdRtDajP_Y+rBkNN*1_TXiKwHH2&p51d(#zv~s#HwbNy?<+(=9WBvo zw2hkk2Dj%kTFhY+$T+W-b7@qD!bkfN#Z2ng@Pd=i3-i?xYfs5Z*1hO?kd7Sp^9`;Y zM2jeGg<-nJD1er@Pc_cSY7wo5dzQX44=%6rn}P_SRbpzsA{6B+!$3B0#;}qwO37G^ zL(V_5JK`XT?OHVk|{_$vQ|oNEpab*BO4F zUTNQ7RUhnRsU`TK#~`)$icsvKh~(pl=3p6m98@k3P#~upd=k*u20SNcb{l^1rUa)>qO997)pYRWMncC8A&&MHlbW?7i^7M`+B$hH~Y|J zd>FYOGQ;j>Zc2e7R{KK7)0>>nn_jYJy&o@sK!4G>-rLKM8Hv)f;hi1D2fAc$+six2 zyVZ@wZ6x|fJ!4KrpCJY=!Mq0;)X)OoS~{Lkh6u8J`eK%u0WtKh6B>GW_)PVc zl}-k`p09qwGtZ@VbYJC!>29V?Dr>>vk?)o(x?!z*9DJ||9qG-&G~#kXxbw{KKYy}J zQKa-dPt~M~E}V?PhW0R26xdA%1T*%ra6SguGu50YHngOTIv)@N|YttEXo#OZfgtP7;H?EeZZxo<}3YlYxtBq znJ!WFR^tmGf0Py}N?kZ(#=VtpC@%xJkDmfcCoBTxq zr_|5gP?u1@vJZbxPZ|G0AW4=tpb84gM2DpJU||(b8kMOV1S3|(yuwZJ&rIiFW(U;5 zUtAW`O6F6Zy+eZ1EDuP~AAHlSY-+A_eI5Gx)%*uro5tljy}kCZU*_d7)oJ>oQSZ3* zneTn`{gnNC&uJd)0aMBzAg021?YJ~b(fmkwZAd696a=0NzBAqBN54KuNDwa*no(^O z6p05bioXUR^uXjpTol*ppHp%1v9e)vkoUAUJyBx3lw0UO39b0?^{}yb!$yca(@DUn zCquRF?t=Zb9`Ed3AI6|L{eX~ijVH`VzSMheKoP7LSSf4g>md>`yi!TkoG5P>Ofp+n z(v~rW+(5L96L{vBb^g51B=(o)?%%xhvT*A5btOpw(TKh^g^4c zw>0%X!_0`{iN%RbVk+A^f{w-4-SSf*fu@FhruNL##F~sF24O~u zyYF<3el2b$$wZ_|uW#@Ak+VAGk#e|kS8nL1g>2B-SNMjMp^8;-FfeofY2fphFHO!{ z*!o4oTb{4e;S<|JEs<1_hPsmAlVNk?_5-Fp5KKU&d#FiNW~Y+pVFk@Cua1I{T+1|+ zHx6rFMor)7L)krbilqsWwy@T+g3DiH5MyVf8Wy}XbEaoFIDr~y;@r&I>FMW{ z?Q+(IgyebZ)-i4jNoXQhq4Muy9Fv+OxU;9_Jmn+<`mEC#%2Q_2bpcgzcinygNI!&^ z=V$)o2&Yz04~+&pPWWn`rrWxJ&}8khR)6B(--!9Q zubo}h+1T)>a@c)H^i``@<^j?|r4*{;tQf78(xn0g39IoZw0(CwY1f<%F>kEaJ zp9u|IeMY5mRdAlw*+gSN^5$Q)ShM<~E=(c8QM+T-Qk)FyKz#Sw0EJ*edYcuOtO#~Cx^(M7w5 z3)rl#L)rF|(Vun2LkFr!rg8Q@=r>9p>(t3Gf_auiJ2Xx9HmxYTa|=MH_SUlYL`mz9 zTTS$`%;D-|Jt}AP1&k7PcnfFNTH0A-*FmxstjBDiZX?}%u%Yq94$fUT&z6od+(Uk> zuqsld#G(b$G8tus=M!N#oPd|PVFX)?M?tCD0tS%2IGTfh}3YA3f&UM)W$_GNV8 zQo+a(ml2Km4o6O%gKTCSDNq+#zCTIQ1*`TIJh~k6Gp;htHBFnne))rlFdGqwC6dx2+La1&Mnko*352k0y z+tQcwndQlX`nc6nb$A9?<-o|r*%aWXV#=6PQic0Ok_D;q>wbv&j7cKc!w4~KF#-{6 z(S%6Za)WpGIWf7jZ3svNG5OLs0>vCL9{V7cgO%zevIVMH{WgP*^D9ws&OqA{yr|m| zKD4*07dGXshJHd#e%x%J+qmS^lS|0Bp?{drv;{@{l9ArPO&?Q5=?OO9=}h$oVe#3b z3Yofj&Cb}WC$PxmRRS)H%&$1-)z7jELS}!u!zQ?A^Y{Tv4QVt*vd@uj-^t2fYRzQj zfxGR>-q|o$3sGn^#VzZ!QQx?h9`njeJry}@x?|k0-GTTA4y3t2E`3DZ!A~D?GiJup z)8%PK2^9OVRlP(24P^4_<|D=H^7}WlWu#LgsdHzB%cPy|f8dD3|A^mh4WXxhLTVu_ z@abE{6Saz|Y{rXYPd4$tfPYo}ef(oQWZ=4Bct-=_9`#Qgp4ma$n$`tOwq#&E18$B; z@Bp)bn3&rEi0>fWWZ@7k5WazfoX`SCO4jQWwVuo+$PmSZn^Hz?O(-tW@*DGxuf)V1 zO_xm&;NVCaHD4dqt(-MlszI3F-p?0!-e$fbiCeuaw66h^TTDLWuaV<@C-`=Xe5WL) zwooG7h>4&*)p3pKMS3O!4>-4jQUN}iAMQ)2*70?hP~)TzzR?-f@?Aqy$$1Iy8VGG$ zMM?8;j!pUX7QQD$gRc_#+=raAS577ga-w?jd`vCiN5lu)dEUkkUPl9!?{$IJNxQys z*E4e$eF&n&+AMRQR2gcaFEjAy*r)G!s(P6D&TfoApMFC_*Ftx0|D0@E-=B7tezU@d zZ{hGiN;YLIoSeRS;9o%dEua4b%4R3;$SugDjP$x;Z!M!@QibuSBb)HY!3zJ7M;^jw zlx6AD50FD&p3JyP*>o+t9YWW8(7P2t!VQQ21pHJOcG_SXQD;(5aX#M6x##5H_Re>6lPyDCjxr*R(+HE%c&QN+b^tbT zXBJk?p)zhJj#I?&Y2n&~XiytG9!1ox;bw5Rbj~)7c(MFBb4>IiRATdhg zmiEFlj@S_hwYYI(ki{}&<;_7(Z0Qkfq>am z&LtL=2qc7rWguk3BtE4zL41@#S;NN*-jWw|7Kx7H7~_%7fPt;TIX}Ubo>;Rmj94V> zNB1=;-9AR7s`Pxn}t_6^3ahlq53e&!Lh85uG zec0vJY_6e`tg7LgfrJ3k!DjR)Bi#L@DHIrZ`sK=<5O0Ip!fxGf*OgGSpP@Hbbe&$9 z;ZI}8lEoC2_7;%L2=w?tb%1oL0V+=Z`7b=P&lNGY;yVBazXRYu;+cQDKvm*7NCxu&i;zub zAJh#11%?w>E2rf2e~C4+rAb-&$^vsdACs7 z@|Ra!OfVM(ke{vyiqh7puf&Yp6cd6{DptUteYfIRWG3pI+5< zBVBI_xkBAc<(pcb$!Y%dTW(b;B;2pOI-(QCsLv@U-D1XJ z(Gk8Q3l7Ws46Aktuj>|s{$6zA&xCPuXL-kB`CgYMs}4IeyG*P51IDwW?8UNQd+$i~ zlxOPtSi5L|gJcF@DwmJA5Ju8HEJ>o{{upwIpb!f{2(vLNBw`7xMbvcw<^{Fj@E~1( z?w`iIMieunS#>nXlmUcSMU+D3rX28f?s7z;X=se6bo8;5vM|O^(D6{A9*ChnGH!RG zP##3>LDC3jZPE4PH32AxrqPk|yIIrq~`aL-=}`okhNu9aT%q z1b)7iJ)CN=V#Ly84N_r7U^SH2FGdE5FpTO2 z630TF$P>GNMu8`rOytb(lB2};`;P4YNwW1<5d3Q~AX#P0aX}R2b2)`rgkp#zTxcGj zAV^cvFbhP|JgWrq_e`~exr~sIR$6p5V?o4Wym3kQ3HA+;Pr$bQ0(PmADVO%MKL!^q z?zAM8j1l4jrq|5X+V!8S*2Wl@=7*pPgciTVK6kS1Ge zMsd_u6DFK$jTnvVtE;qa+8(1sGBu~n&F%dh(&c(Zs4Fc#A=gG^^%^AyH}1^?|8quj zl@Z47h$){PlELJgYZCIHHL= z{U8O>Tw4x3<1{?$8>k-P<}1y9DmAZP_;(3Y*{Sk^H^A=_iSJ@+s5ktgwTXz_2$~W9>VVZsfwCm@s0sQ zeB50_yu@uS+e7QoPvdCwDz{prjo(AFwR%C?z`EL{1`|coJHQTk^nX=tvs1<0arUOJ z!^`*x&&BvTYmemyZ)2p~{%eYX=JVR?DYr(rNgqRMA5E1PR1Iw=prk=L2ldy3r3Vg@27IZx43+ywyzr-X*p*d@tZV+!U#~$-q=8c zgdSuh#r?b4GhEGNai)ayHQpk>5(%j5c@C1K3(W1pb~HeHpaqijJZa-e6vq_8t-^M^ zBJxq|MqZc?pjXPIH}70a5vt!IUh;l}<>VX<-Qcv^u@5(@@M2CHSe_hD$VG-eiV^V( zj7*9T0?di?P$FaD6oo?)<)QT>Npf6Og!GO^GmPV(Km0!=+dE&bk#SNI+C9RGQ|{~O*VC+tXK3!n`5 zHfl6>lwf_aEVV3`0T!aHNZLsj$paS$=LL(?b!Czaa5bbSuZ6#$_@LK<(7yrrl+80| z{tOFd=|ta2Z`^ssozD9BINn45NxUeCQis?-BKmU*Kt=FY-NJ+)8S1ecuFtN-M?&42 zl2$G>u!iNhAk*HoJ^4v^9#ORYp5t^wDj6|lx~5w45#E5wVqI1JQ~9l?nPp1YINf++ zMAdSif~_ETv@Er(EFBI^@L4BULFW>)NI+ejHFP*T}UhWNN`I)RRS8za? z*@`1>9ZB}An%aT5K=_2iQmfE;GcBVHLF!$`I99o5GO`O%O_zLr9AG18>&^HkG(;=V z%}c!OBQ~?MX(9h~tajX{=x)+!cbM7$YzTlmsPOdp2L-?GoW`@{lY9U3f;OUo*BwRB z8A+nv(br0-SH#VxGy#ZrgnGD(=@;HME;yd46EgWJ`EL%oXc&lFpc@Y}^>G(W>h_v_ zlN!`idhX+OjL+~T?19sroAFVGfa5tX-D49w$1g2g_-T|EpHL6}K_aX4$K=LTvwtlF zL*z}j{f+Uoe7{-px3_5iKPA<_7W=>Izkk)!l9ez2w%vi(?Y;i8AxRNLSOGDzNoqoI zP!1uAl}r=_871(G?y`i&)-7{u=%nxk7CZ_Qh#!|ITec zwQn`33GTUM`;D2POWnkqngqJhJRlM>CTONzTG}>^Q0wUunQyn|TAiHzyX2_%ATx%P z%7gW)%4rA9^)M<_%k@`Y?RbC<29sWU&5;@|9thf2#zf8z12$hRcZ!CSb>kUp=4N#y zl3hE#y6>kkA8VY2`W`g5Ip?2qC_BY$>R`iGQLhz2-S>x(RuWv)SPaGdl^)gGw7tjR zH@;jwk!jIaCgSg_*9iF|a);sRUTq30(8I(obh^|}S~}P4U^BIGYqcz;MPpC~Y@k_m zaw4WG1_vz2GdCAX!$_a%GHK**@IrHSkGoN>)e}>yzUTm52on`hYot7cB=oA-h1u|R ztH$11t?54Qg2L+i33FPFKKRm1aOjKST{l1*(nps`>sv%VqeVMWjl5+Gh+9);hIP8? zA@$?}Sc z3qIRpba+y5yf{R6G(u8Z^vkg0Fu&D-7?1s=QZU`Ub{-!Y`I?AGf1VNuc^L3v>)>i# z{DV9W$)>34wnzAXUiV^ZpYKw>UElrN_5Xj6{r_3| z$X5PK`e5$7>~9Dj7gK5ash(dvs`vwfk}&RD`>04;j62zoXESkFBklYaKm5seyiX(P zqQ-;XxlV*yg?Dhlx%xt!b0N3GHp@(p$A;8|%# zZ5m2KL|{on4nr>2_s9Yh=r5ScQ0;aMF)G$-9-Ca6%wA`Pa)i?NGFA|#Yi?{X-4ZO_ z^}%7%vkzvUHa$-^Y#aA+aiR5sa%S|Ebyn`EV<3Pc?ax_f>@sBZF1S;7y$CXd5t5=WGsTKBk8$OfH4v|0?0I=Yp}7c=WBSCg!{0n)XmiU;lfx)**zZaYqmDJelxk$)nZyx5`x$6R|fz(;u zEje5Dtm|a%zK!!tk3{i9$I2b{vXNFy%Bf{50X!x{98+BsDr_u9i>G5%*sqEX|06J0 z^IY{UcEbj6LDwuMh7cH`H@9sVt1l1#8kEQ(LyT@&+K}(ReE`ux8gb0r6L_#bDUo^P z3Ka2lRo52Hdtl_%+pwVs14=q`{d^L58PsU@AMf(hENumaxM{7iAT5sYmWh@hQCO^ zK&}ijo=`VqZ#a3vE?`7QW0ZREL17ZvDfdqKGD?0D4fg{7v%|Yj&_jcKJAB)>=*RS* zto8p6@k%;&^ZF>hvXm&$PCuEp{uqw3VPG$9VMdW5$w-fy2CNNT>E;>ejBgy-m_6`& z97L1p{%srn@O_JQgFpa_#f(_)eb#YS>o>q3(*uB;uZb605(iqM$=NK{nHY=+X2*G) zO3-_Xh%aG}fHWe*==58zBwp%&`mge<8uq8;xIxOd=P%9EK!34^E9sk|(Zq1QSz-JVeP12Fp)-`F|KY$LPwUE?rku zY@OJ)Z9A!ojfzfeyJ9;zv2EM7ZQB)AR5xGa-tMn^bl)FmoIiVyJ@!~@%{}qXXD&Ns zPnfe5U+&ohKefILu_1mPfLGuapX@btta5C#gPB2cjk5m4T}Nfi+Vfka!Yd(L?-c~5 z#ZK4VeQEXNPc4r$K00Fg>g#_W!YZ)cJ?JTS<&68_$#cZT-ME`}tcwqg3#``3M3UPvn+pi}(VNNx6y zFIMVb6OwYU(2`at$gHba*qrMVUl8xk5z-z~fb@Q3Y_+aXuEKH}L+>eW__!IAd@V}L zkw#s%H0v2k5-=vh$^vPCuAi22Luu3uKTf6fPo?*nvj$9(u)4$6tvF-%IM+3pt*cgs z_?wW}J7VAA{_~!?))?s6{M=KPpVhg4fNuU*|3THp@_(q!b*hdl{fjRVFWtu^1dV(f z6iOux9hi&+UK=|%M*~|aqFK{Urfl!TA}UWY#`w(0P!KMe1Si{8|o))Gy6d7;!JQYhgMYmXl?3FfOM2nQGN@~Ap6(G z3+d_5y@=nkpKAhRqf{qQ~k7Z$v&l&@m7Ppt#FSNzKPZM z8LhihcE6i=<(#87E|Wr~HKvVWhkll4iSK$^mUHaxgy8*K$_Zj;zJ`L$naPj+^3zTi z-3NTaaKnD5FPY-~?Tq6QHnmDDRxu0mh0D|zD~Y=vv_qig5r-cIbCpxlju&8Sya)@{ zsmv6XUSi)@(?PvItkiZEeN*)AE~I_?#+Ja-r8$(XiXei2d@Hi7Rx8+rZZb?ZLa{;@*EHeRQ-YDadz~M*YCM4&F-r;E#M+@CSJMJ0oU|PQ^ z=E!HBJDMQ2TN*Y(Ag(ynAL8%^v;=~q?s4plA_hig&5Z0x_^Oab!T)@6kRN$)qEJ6E zNuQjg|G7iwU(N8pI@_6==0CL;lRh1dQF#wePhmu@hADFd3B5KIH#dx(2A zp~K&;Xw}F_N6CU~0)QpQk7s$a+LcTOj1%=WXI(U=Dv!6 z{#<#-)2+gCyyv=Jw?Ab#PVkxPDeH|sAxyG`|Ys}A$PW4TdBv%zDz z^?lwrxWR<%Vzc8Sgt|?FL6ej_*e&rhqJZ3Y>k=X(^dytycR;XDU16}Pc9Vn0>_@H+ zQ;a`GSMEG64=JRAOg%~L)x*w{2re6DVprNp+FcNra4VdNjiaF0M^*>CdPkt(m150rCue?FVdL0nFL$V%5y6N z%eLr5%YN7D06k5ji5*p4v$UMM)G??Q%RB27IvH7vYr_^3>1D-M66#MN8tWGw>WED} z5AhlsanO=STFYFs)Il_0i)l)f<8qn|$DW7ZXhf5xI;m+7M5-%P63XFQrG9>DMqHc} zsgNU9nR`b}E^mL5=@7<1_R~j@q_2U^3h|+`7YH-?C=vme1C3m`Fe0HC>pjt6f_XMh zy~-i-8R46QNYneL4t@)<0VU7({aUO?aH`z4V2+kxgH5pYD5)wCh75JqQY)jIPN=U6 z+qi8cGiOtXG2tXm;_CfpH9ESCz#i5B(42}rBJJF$jh<1sbpj^8&L;gzGHb8M{of+} zzF^8VgML2O9nxBW7AvdEt90vp+#kZxWf@A)o9f9}vKJy9NDBjBW zSt=Hcs=YWCwnfY1UYx*+msp{g!w0HC<_SM!VL1(I2PE?CS}r(eh?{I)mQixmo5^p# zV?2R!R@3GV6hwTCrfHiK#3Orj>I!GS2kYhk1S;aFBD_}u2v;0HYFq}Iz1Z(I4oca4 zxquja8$+8JW_EagDHf$a1OTk5S97umGSDaj)gH=fLs9>_=XvVj^Xj9a#gLdk=&3tl zfmK9MNnIX9v{?%xdw7568 zNrZ|roYs(vC4pHB5RJ8>)^*OuyNC>x7ad)tB_}3SgQ96+-JT^Qi<`xi=)_=$Skwv~ zdqeT9Pa`LYvCAn&rMa2aCDV(TMI#PA5g#RtV|CWpgDYRA^|55LLN^uNh*gOU>Z=a06qJ;$C9z8;n-Pq=qZnc1zUwJ@t)L;&NN+E5m zRkQ(SeM8=l-aoAKGKD>!@?mWTW&~)uF2PYUJ;tB^my`r9n|Ly~0c%diYzqs9W#FTjy?h&X3TnH zXqA{QI82sdjPO->f=^K^f>N`+B`q9&rN0bOXO79S&a9XX8zund(kW7O76f4dcWhIu zER`XSMSFbSL>b;Rp#`CuGJ&p$s~G|76){d?xSA5wVg##_O0DrmyEYppyBr%fyWbbv zp`K84JwRNP$d-pJ!Qk|(RMr?*!wi1if-9G#0p>>1QXKXWFy)eB3ai)l3601q8!9JC zvU#ZWWDNKq9g6fYs?JQ)Q4C_cgTy3FhgKb8s&m)DdmL5zhNK#8wWg!J*7G7Qhe9VU zha?^AQTDpYcuN!B+#1dE*X{<#!M%zfUQbj=zLE{dW0XeQ7-oIsGY6RbkP2re@Q{}r_$iiH0xU%iN*ST`A)-EH6eaZB$GA#v)cLi z*MpA(3bYk$oBDKAzu^kJoSUsDd|856DApz={3u8sbQV@JnRkp2nC|)m;#T=DvIL-O zI4vh;g7824l}*`_p@MT4+d`JZ2%6NQh=N9bmgJ#q!hK@_<`HQq3}Z8Ij>3%~<*= zcv=!oT#5xmeGI92lqm9sGVE%#X$ls;St|F#u!?5Y7syhx6q#MVRa&lBmmn%$C0QzU z);*ldgwwCmzM3uglr}!Z2G+?& zf%Dpo&mD%2ZcNFiN-Z0f;c_Q;A%f@>26f?{d1kxIJD}LxsQkB47SAdwinfMILZdN3 zfj^HmTzS3Ku5BxY>ANutS8WPQ-G>v4^_Qndy==P3pDm+Xc?>rUHl-4+^%Sp5atOja z2oP}ftw-rqnb}+khR3CrRg^ibi6?QYk1*i^;kQGirQ=uB9Sd1NTfT-Rbv;hqnY4neE5H1YUrjS2m+2&@uXiAo- zrKUX|Ohg7(6F(AoP~tj;NZlV#xsfo-5reuQHB$&EIAhyZk;bL;k9ouDmJNBAun;H& zn;Of1z_Qj`x&M;5X;{s~iGzBQTY^kv-k{ksbE*Dl%Qf%N@hQCfY~iUw!=F-*$cpf2 z3wix|aLBV0b;W@z^%7S{>9Z^T^fLOI68_;l@+Qzaxo`nAI8emTV@rRhEKZ z?*z_{oGdI~R*#<2{bkz$G~^Qef}$*4OYTgtL$e9q!FY7EqxJ2`zk6SQc}M(k(_MaV zSLJnTXw&@djco1~a(vhBl^&w=$fa9{Sru>7g8SHahv$&Bl(D@(Zwxo_3r=;VH|uc5 zi1Ny)J!<(KN-EcQ(xlw%PNwK8U>4$9nVOhj(y0l9X^vP1TA>r_7WtSExIOsz`nDOP zs}d>Vxb2Vo2e5x8p(n~Y5ggAyvib>d)6?)|E@{FIz?G3PVGLf7-;BxaP;c?7ddH$z zA+{~k^V=bZuXafOv!RPsE1GrR3J2TH9uB=Z67gok+u`V#}BR86hB1xl}H4v`F+mRfr zYhortD%@IGfh!JB(NUNSDh+qDz?4ztEgCz&bIG-Wg7w-ua4ChgQR_c+z8dT3<1?uX z*G(DKy_LTl*Ea!%v!RhpCXW1WJO6F`bgS-SB;Xw9#! z<*K}=#wVu9$`Yo|e!z-CPYH!nj7s9dEPr-E`DXUBu0n!xX~&|%#G=BeM?X@shQQMf zMvr2!y7p_gD5-!Lnm|a@z8Of^EKboZsTMk%5VsJEm>VsJ4W7Kv{<|#4f-qDE$D-W>gWT%z-!qXnDHhOvLk=?^a1*|0j z{pW{M0{#1VcR5;F!!fIlLVNh_Gj zbnW(_j?0c2q$EHIi@fSMR{OUKBcLr{Y&$hrM8XhPByyZaXy|dd&{hYQRJ9@Fn%h3p7*VQolBIV@Eq`=y%5BU~3RPa^$a?ixp^cCg z+}Q*X+CW9~TL29@OOng(#OAOd!)e$d%sr}^KBJ-?-X&|4HTmtemxmp?cT3uA?md4% zT8yZ0U;6Rg6JHy3fJae{6TMGS?ZUX6+gGTT{Q{)SI85$5FD{g-eR%O0KMpWPY`4@O zx!hen1*8^E(*}{m^V_?}(b5k3hYo=T+$&M32+B`}81~KKZhY;2H{7O-M@vbCzuX0n zW-&HXeyr1%I3$@ns-V1~Lb@wIpkmx|8I~ob1Of7i6BTNysEwI}=!nU%q7(V_^+d*G z7G;07m(CRTJup!`cdYi93r^+LY+`M*>aMuHJm(A8_O8C#A*$!Xvddgpjx5)?_EB*q zgE8o5O>e~9IiSC@WtZpF{4Bj2J5eZ>uUzY%TgWF7wdDE!fSQIAWCP)V{;HsU3ap?4 znRsiiDbtN7i9hapO;(|Ew>Ip2TZSvK9Z^N21%J?OiA_&eP1{(Pu_=%JjKy|HOardq ze?zK^K zA%sjF64*Wufad%H<) z^|t>e*h+Z1#l=5wHexzt9HNDNXgM=-OPWKd^5p!~%SIl>Fo&7BvNpbf8{NXmH)o{r zO=aBJ;meX1^{O%q;kqdw*5k!Y7%t_30 zy{nGRVc&5qt?dBwLs+^Sfp;f`YVMSB#C>z^a9@fpZ!xb|b-JEz1LBX7ci)V@W+kvQ89KWA0T~Lj$aCcfW#nD5bt&Y_< z-q{4ZXDqVg?|0o)j1%l0^_it0WF*LCn-+)c!2y5yS7aZIN$>0LqNnkujV*YVes(v$ zY@_-!Q;!ZyJ}Bg|G-~w@or&u0RO?vlt5*9~yeoPV_UWrO2J54b4#{D(D>jF(R88u2 zo#B^@iF_%S>{iXSol8jpmsZuJ?+;epg>k=$d`?GSegAVp3n$`GVDvK${N*#L_1`44 z{w0fL{2%)0|E+qgZtjX}itZz^KJt4Y;*8uSK}Ft38+3>j|K(PxIXXR-t4VopXo#9# zt|F{LWr-?34y`$nLBVV_*UEgA6AUI65dYIbqpNq9cl&uLJ0~L}<=ESlOm?Y-S@L*d z<7vt}`)TW#f%Rp$Q}6@3=j$7Tze@_uZO@aMn<|si{?S}~maII`VTjs&?}jQ4_cut9$)PEqMukwoXobzaKx^MV z2fQwl+;LSZ$qy%Tys0oo^K=jOw$!YwCv^ei4NBVauL)tN%=wz9M{uf{IB(BxK|lT*pFkmNK_1tV`nb%jH=a0~VNq2RCKY(rG7jz!-D^k)Ec)yS%17pE#o6&eY+ z^qN(hQT$}5F(=4lgNQhlxj?nB4N6ntUY6(?+R#B?W3hY_a*)hnr4PA|vJ<6p`K3Z5Hy z{{8(|ux~NLUW=!?9Qe&WXMTAkQnLXg(g=I@(VG3{HE13OaUT|DljyWXPs2FE@?`iU z4GQlM&Q=T<4&v@Fe<+TuXiZQT3G~vZ&^POfmI1K2h6t4eD}Gk5XFGpbj1n_g*{qmD6Xy z`6Vv|lLZtLmrnv*{Q%xxtcWVj3K4M%$bdBk_a&ar{{GWyu#ljM;dII;*jP;QH z#+^o-A4np{@|Mz+LphTD0`FTyxYq#wY)*&Ls5o{0z9yg2K+K7ZN>j1>N&;r+Z`vI| zDzG1LJZ+sE?m?>x{5LJx^)g&pGEpY=fQ-4}{x=ru;}FL$inHemOg%|R*ZXPodU}Kh zFEd5#+8rGq$Y<_?k-}r5zgQ3jRV=ooHiF|@z_#D4pKVEmn5CGV(9VKCyG|sT9nc=U zEoT67R`C->KY8Wp-fEcjjFm^;Cg(ls|*ABVHq8clBE(;~K^b+S>6uj70g? z&{XQ5U&!Z$SO7zfP+y^8XBbiu*Cv-yJG|l-oe*!s5$@Lh_KpxYL2sx`B|V=dETN>5K+C+CU~a_3cI8{vbu$TNVdGf15*>D zz@f{zIlorkY>TRh7mKuAlN9A0>N>SV`X)+bEHms=mfYTMWt_AJtz_h+JMmrgH?mZt zm=lfdF`t^J*XLg7v+iS)XZROygK=CS@CvUaJo&w2W!Wb@aa?~Drtf`JV^cCMjngVZ zv&xaIBEo8EYWuML+vxCpjjY^s1-ahXJzAV6hTw%ZIy!FjI}aJ+{rE&u#>rs)vzuxz z+$5z=7W?zH2>Eb32dvgHYZtCAf!=OLY-pb4>Ae79rd68E2LkVPj-|jFeyqtBCCwiW zkB@kO_(3wFq)7qwV}bA=zD!*@UhT`geq}ITo%@O(Z5Y80nEX~;0-8kO{oB6|(4fQh z);73T!>3@{ZobPwRv*W?7m0Ml9GmJBCJd&6E?hdj9lV= z4flNfsc(J*DyPv?RCOx!MSvk(M952PJ-G|JeVxWVjN~SNS6n-_Ge3Q;TGE;EQvZg86%wZ`MB zSMQua(i*R8a75!6$QRO^(o7sGoomb+Y{OMy;m~Oa`;P9Yqo>?bJAhqXxLr7_3g_n>f#UVtxG!^F#1+y@os6x(sg z^28bsQ@8rw%Gxk-stAEPRbv^}5sLe=VMbkc@Jjimqjvmd!3E7+QnL>|(^3!R} zD-l1l7*Amu@j+PWLGHXXaFG0Ct2Q=}5YNUxEQHCAU7gA$sSC<5OGylNnQUa>>l%sM zyu}z6i&({U@x^hln**o6r2s-(C-L50tQvz|zHTqW!ir?w&V23tuYEDJVV#5pE|OJu z7^R!A$iM$YCe?8n67l*J-okwfZ+ZTkGvZ)tVPfR;|3gyFjF)8V zyXXN=!*bpyRg9#~Bg1+UDYCt0 ztp4&?t1X0q>uz;ann$OrZs{5*r`(oNvw=$7O#rD|Wuv*wIi)4b zGtq4%BX+kkagv3F9Id6~-c+1&?zny%w5j&nk9SQfo0k4LhdSU_kWGW7axkfpgR`8* z!?UTG*Zi_baA1^0eda8S|@&F z{)Rad0kiLjB|=}XFJhD(S3ssKlveFFmkN{Vl^_nb!o5M!RC=m)V&v2%e?ZoRC@h3> zJ(?pvToFd`*Zc@HFPL#=otWKwtuuQ_dT-Hr{S%pQX<6dqVJ8;f(o)4~VM_kEQkMR+ zs1SCVi~k>M`u1u2xc}>#D!V&6nOOh-E$O&SzYrjJdZpaDv1!R-QGA141WjQe2s0J~ zQ;AXG)F+K#K8_5HVqRoRM%^EduqOnS(j2)|ctA6Q^=|s_WJYU;Z%5bHp08HPL`YF2 zR)Ad1z{zh`=sDs^&V}J z%$Z$!jd7BY5AkT?j`eqMs%!Gm@T8)4w3GYEX~IwgE~`d|@T{WYHkudy(47brgHXx& zBL1yFG6!!!VOSmDxBpefy2{L_u5yTwja&HA!mYA#wg#bc-m%~8aRR|~AvMnind@zs zy>wkShe5&*un^zvSOdlVu%kHsEo>@puMQ`b1}(|)l~E{5)f7gC=E$fP(FC2=F<^|A zxeIm?{EE!3sO!Gr7e{w)Dx(uU#3WrFZ>ibmKSQ1tY?*-Nh1TDHLe+k*;{Rp!Bmd_m zb#^kh`Y*8l|9Cz2e{;RL%_lg{#^Ar+NH|3z*Zye>!alpt{z;4dFAw^^H!6ING*EFc z_yqhr8d!;%nHX9AKhFQZBGrSzfzYCi%C!(Q5*~hX>)0N`vbhZ@N|i;_972WSx*>LH z87?en(;2_`{_JHF`Sv6Wlps;dCcj+8IJ8ca6`DsOQCMb3n# z3)_w%FuJ3>fjeOOtWyq)ag|PmgQbC-s}KRHG~enBcIwqIiGW8R8jFeBNY9|YswRY5 zjGUxdGgUD26wOpwM#8a!Nuqg68*dG@VM~SbOroL_On0N6QdT9?)NeB3@0FCC?Z|E0 z6TPZj(AsPtwCw>*{eDEE}Gby>0q{*lI+g2e&(YQrsY&uGM{O~}(oM@YWmb*F zA0^rr5~UD^qmNljq$F#ARXRZ1igP`MQx4aS6*MS;Ot(1L5jF2NJ;de!NujUYg$dr# z=TEL_zTj2@>ZZN(NYCeVX2==~=aT)R30gETO{G&GM4XN<+!&W&(WcDP%oL8PyIVUC zs5AvMgh6qr-2?^unB@mXK*Dbil^y-GTC+>&N5HkzXtozVf93m~xOUHn8`HpX=$_v2 z61H;Z1qK9o;>->tb8y%#4H)765W4E>TQ1o0PFj)uTOPEvv&}%(_mG0ISmyhnQV33Z$#&yd{ zc{>8V8XK$3u8}04CmAQ#I@XvtmB*s4t8va?-IY4@CN>;)mLb_4!&P3XSw4pA_NzDb zORn!blT-aHk1%Jpi>T~oGLuh{DB)JIGZ9KOsciWs2N7mM1JWM+lna4vkDL?Q)z_Ct z`!mi0jtr+4*L&N7jk&LodVO#6?_qRGVaucqVB8*us6i3BTa^^EI0x%EREQSXV@f!lak6Wf1cNZ8>*artIJ(ADO*=<-an`3zB4d*oO*8D1K!f z*A@P1bZCNtU=p!742MrAj%&5v%Xp_dSX@4YCw%F|%Dk=u|1BOmo)HsVz)nD5USa zR~??e61sO(;PR)iaxK{M%QM_rIua9C^4ppVS$qCT9j2%?*em?`4Z;4@>I(c%M&#cH z>4}*;ej<4cKkbCAjjDsyKS8rIm90O)Jjgyxj5^venBx&7B!xLmzxW3jhj7sR(^3Fz z84EY|p1NauwXUr;FfZjdaAfh%ivyp+^!jBjJuAaKa!yCq=?T_)R!>16?{~p)FQ3LDoMyG%hL#pR!f@P%*;#90rs_y z@9}@r1BmM-SJ#DeuqCQk=J?ixDSwL*wh|G#us;dd{H}3*-Y7Tv5m=bQJMcH+_S`zVtf;!0kt*(zwJ zs+kedTm!A}cMiM!qv(c$o5K%}Yd0|nOd0iLjus&;s0Acvoi-PFrWm?+q9f^FslxGi z6ywB`QpL$rJzWDg(4)C4+!2cLE}UPCTBLa*_=c#*$b2PWrRN46$y~yST3a2$7hEH= zNjux+wna^AzQ=KEa_5#9Ph=G1{S0#hh1L3hQ`@HrVnCx{!fw_a0N5xV(iPdKZ-HOM za)LdgK}1ww*C_>V7hbQnTzjURJL`S%`6nTHcgS+dB6b_;PY1FsrdE8(2K6FN>37!62j_cBlui{jO^$dPkGHV>pXvW0EiOA zqW`YaSUBWg_v^Y5tPJfWLcLpsA8T zG)!x>pKMpt!lv3&KV!-um= zKCir6`bEL_LCFx4Z5bAFXW$g3Cq`?Q%)3q0r852XI*Der*JNuKUZ`C{cCuu8R8nkt z%pnF>R$uY8L+D!V{s^9>IC+bmt<05h**>49R*#vpM*4i0qRB2uPbg8{{s#9yC;Z18 zD7|4m<9qneQ84uX|J&f-g8a|nFKFt34@Bt{CU`v(SYbbn95Q67*)_Esl_;v291s=9 z+#2F2apZU4Tq=x+?V}CjwD(P=U~d<=mfEFuyPB`Ey82V9G#Sk8H_Ob_RnP3s?)S_3 zr%}Pb?;lt_)Nf>@zX~D~TBr;-LS<1I##8z`;0ZCvI_QbXNh8Iv)$LS=*gHr;}dgb=w5$3k2la1keIm|=7<-JD>)U%=Avl0Vj@+&vxn zt-)`vJxJr88D&!}2^{GPXc^nmRf#}nb$4MMkBA21GzB`-Or`-3lq^O^svO7Vs~FdM zv`NvzyG+0T!P8l_&8gH|pzE{N(gv_tgDU7SWeiI-iHC#0Ai%Ixn4&nt{5y3(GQs)i z&uA;~_0shP$0Wh0VooIeyC|lak__#KVJfxa7*mYmZ22@(<^W}FdKjd*U1CqSjNKW% z*z$5$=t^+;Ui=MoDW~A7;)Mj%ibX1_p4gu>RC}Z_pl`U*{_z@+HN?AF{_W z?M_X@o%w8fgFIJ$fIzBeK=v#*`mtY$HC3tqw7q^GCT!P$I%=2N4FY7j9nG8aIm$c9 zeKTxVKN!UJ{#W)zxW|Q^K!3s;(*7Gbn;e@pQBCDS(I|Y0euK#dSQ_W^)sv5pa%<^o zyu}3d?Lx`)3-n5Sy9r#`I{+t6x%I%G(iewGbvor&I^{lhu-!#}*Q3^itvY(^UWXgvthH52zLy&T+B)Pw;5>4D6>74 zO_EBS)>l!zLTVkX@NDqyN2cXTwsUVao7$HcqV2%t$YzdAC&T)dwzExa3*kt9d(}al zA~M}=%2NVNUjZiO7c>04YH)sRelXJYpWSn^aC$|Ji|E13a^-v2MB!Nc*b+=KY7MCm zqIteKfNkONq}uM;PB?vvgQvfKLPMB8u5+Am=d#>g+o&Ysb>dX9EC8q?D$pJH!MTAqa=DS5$cb+;hEvjwVfF{4;M{5U&^_+r zvZdu_rildI!*|*A$TzJ&apQWV@p{!W`=?t(o0{?9y&vM)V)ycGSlI3`;ps(vf2PUq zX745#`cmT*ra7XECC0gKkpu2eyhFEUb?;4@X7weEnLjXj_F~?OzL1U1L0|s6M+kIhmi%`n5vvDALMagi4`wMc=JV{XiO+^ z?s9i7;GgrRW{Mx)d7rj)?(;|b-`iBNPqdwtt%32se@?w4<^KU&585_kZ=`Wy^oLu9 z?DQAh5z%q;UkP48jgMFHTf#mj?#z|=w= z(q6~17Vn}P)J3M?O)x))%a5+>TFW3No~TgP;f}K$#icBh;rSS+R|}l鯊%1Et zwk~hMkhq;MOw^Q5`7oC{CUUyTw9x>^%*FHx^qJw(LB+E0WBX@{Ghw;)6aA-KyYg8p z7XDveQOpEr;B4je@2~usI5BlFadedX^ma{b{ypd|RNYqo#~d*mj&y`^iojR}s%~vF z(H!u`yx68D1Tj(3(m;Q+Ma}s2n#;O~bcB1`lYk%Irx60&-nWIUBr2x&@}@76+*zJ5 ze&4?q8?m%L9c6h=J$WBzbiTf1Z-0Eb5$IZs>lvm$>1n_Mezp*qw_pr8<8$6f)5f<@ zyV#tzMCs51nTv_5ca`x`yfE5YA^*%O_H?;tWYdM_kHPubA%vy47i=9>Bq) zRQ&0UwLQHeswmB1yP)+BiR;S+Vc-5TX84KUA;8VY9}yEj0eESSO`7HQ4lO z4(CyA8y1G7_C;6kd4U3K-aNOK!sHE}KL_-^EDl(vB42P$2Km7$WGqNy=%fqB+ zSLdrlcbEH=T@W8V4(TgoXZ*G1_aq$K^@ek=TVhoKRjw;HyI&coln|uRr5mMOy2GXP zwr*F^Y|!Sjr2YQXX(Fp^*`Wk905K%$bd03R4(igl0&7IIm*#f`A!DCarW9$h$z`kYk9MjjqN&5-DsH@8xh63!fTNPxWsFQhNv z#|3RjnP$Thdb#Ys7M+v|>AHm0BVTw)EH}>x@_f4zca&3tXJhTZ8pO}aN?(dHo)44Z z_5j+YP=jMlFqwvf3lq!57-SAuRV2_gJ*wsR_!Y4Z(trO}0wmB9%f#jNDHPdQGHFR; zZXzS-$`;7DQ5vF~oSgP3bNV$6Z(rwo6W(U07b1n3UHqml>{=6&-4PALATsH@Bh^W? z)ob%oAPaiw{?9HfMzpGb)@Kys^J$CN{uf*HX?)z=g`J(uK1YO^8~s1(ZIbG%Et(|q z$D@_QqltVZu9Py4R0Ld8!U|#`5~^M=b>fnHthzKBRr=i+w@0Vr^l|W;=zFT#PJ?*a zbC}G#It}rQP^Ait^W&aa6B;+0gNvz4cWUMzpv(1gvfw-X4xJ2Sv;mt;zb2Tsn|kSS zo*U9N?I{=-;a-OybL4r;PolCfiaL=y@o9{%`>+&FI#D^uy#>)R@b^1ue&AKKwuI*` zx%+6r48EIX6nF4o;>)zhV_8(IEX})NGU6Vs(yslrx{5fII}o3SMHW7wGtK9oIO4OM&@@ECtXSICLcPXoS|{;=_yj>hh*%hP27yZwOmj4&Lh z*Nd@OMkd!aKReoqNOkp5cW*lC)&C$P?+H3*%8)6HcpBg&IhGP^77XPZpc%WKYLX$T zsSQ$|ntaVVOoRat$6lvZO(G-QM5s#N4j*|N_;8cc2v_k4n6zx9c1L4JL*83F-C1Cn zaJhd;>rHXB%%ZN=3_o3&Qd2YOxrK~&?1=UuN9QhL$~OY-Qyg&})#ez*8NpQW_*a&kD&ANjedxT0Ar z<6r{eaVz3`d~+N~vkMaV8{F?RBVemN(jD@S8qO~L{rUw#=2a$V(7rLE+kGUZ<%pdr z?$DP|Vg#gZ9S}w((O2NbxzQ^zTot=89!0^~hE{|c9q1hVzv0?YC5s42Yx($;hAp*E zyoGuRyphQY{Q2ee0Xx`1&lv(l-SeC$NEyS~8iil3_aNlnqF_G|;zt#F%1;J)jnPT& z@iU0S;wHJ2$f!juqEzPZeZkjcQ+Pa@eERSLKsWf=`{R@yv7AuRh&ALRTAy z8=g&nxsSJCe!QLchJ=}6|LshnXIK)SNd zRkJNiqHwKK{SO;N5m5wdL&qK`v|d?5<4!(FAsDxR>Ky#0#t$8XCMptvNo?|SY?d8b z`*8dVBlXTUanlh6n)!EHf2&PDG8sXNAt6~u-_1EjPI1|<=33T8 zEnA00E!`4Ave0d&VVh0e>)Dc}=FfAFxpsC1u9ATfQ`-Cu;mhc8Z>2;uyXtqpLb7(P zd2F9<3cXS} znMg?{&8_YFTGRQZEPU-XPq55%51}RJpw@LO_|)CFAt62-_!u_Uq$csc+7|3+TV_!h z+2a7Yh^5AA{q^m|=KSJL+w-EWDBc&I_I1vOr^}P8i?cKMhGy$CP0XKrQzCheG$}G# zuglf8*PAFO8%xop7KSwI8||liTaQ9NCAFarr~psQt)g*pC@9bORZ>m`_GA`_K@~&% zijH0z;T$fd;-Liw8%EKZas>BH8nYTqsK7F;>>@YsE=Rqo?_8}UO-S#|6~CAW0Oz1} z3F(1=+#wrBJh4H)9jTQ_$~@#9|Bc1Pd3rAIA_&vOpvvbgDJOM(yNPhJJq2%PCcMaI zrbe~toYzvkZYQ{ea(Wiyu#4WB#RRN%bMe=SOk!CbJZv^m?Flo5p{W8|0i3`hI3Np# zvCZqY%o258CI=SGb+A3yJe~JH^i{uU`#U#fvSC~rWTq+K`E%J@ zasU07&pB6A4w3b?d?q}2=0rA#SA7D`X+zg@&zm^iA*HVi z009#PUH<%lk4z~p^l0S{lCJk1Uxi=F4e_DwlfHA`X`rv(|JqWKAA5nH+u4Da+E_p+ zVmH@lg^n4ixs~*@gm_dgQ&eDmE1mnw5wBz9Yg?QdZwF|an67Xd*x!He)Gc8&2!urh z4_uXzbYz-aX)X1>&iUjGp;P1u8&7TID0bTH-jCL&Xk8b&;;6p2op_=y^m@Nq*0{#o!!A;wNAFG@0%Z9rHo zcJs?Th>Ny6+hI`+1XoU*ED$Yf@9f91m9Y=#N(HJP^Y@ZEYR6I?oM{>&Wq4|v0IB(p zqX#Z<_3X(&{H+{3Tr|sFy}~=bv+l=P;|sBz$wk-n^R`G3p0(p>p=5ahpaD7>r|>pm zv;V`_IR@tvZreIuv2EM7ZQHhO+qUgw#kOs%*ekY^n|=1#x9&c;Ro&I~{rG-#_3ZB1 z?|9}IFdbP}^DneP*T-JaoYHt~r@EfvnPE5EKUwIxjPbsr$% zfWW83pgWST7*B(o=kmo)74$8UU)v0{@4DI+ci&%=#90}!CZz|rnH+Mz=HN~97G3~@ z;v5(9_2%eca(9iu@J@aqaMS6*$TMw!S>H(b z4(*B!|H|8&EuB%mITr~O?vVEf%(Gr)6E=>H~1VR z&1YOXluJSG1!?TnT)_*YmJ*o_Q@om~(GdrhI{$Fsx_zrkupc#y{DK1WOUR>tk>ZE) ziOLoBkhZZ?0Uf}cm>GsA>Rd6V8@JF)J*EQlQ<=JD@m<)hyElXR0`pTku*3MU`HJn| zIf7$)RlK^pW-$87U;431;Ye4Ie+l~_B3*bH1>*yKzn23cH0u(i5pXV! z4K?{3oF7ZavmmtTq((wtml)m6i)8X6ot_mrE-QJCW}Yn!(3~aUHYG=^fA<^~`e3yc z-NWTb{gR;DOUcK#zPbN^D*e=2eR^_!(!RKkiwMW@@yYtEoOp4XjOGgzi`;=8 zi3`Ccw1%L*y(FDj=C7Ro-V?q)-%p?Ob2ZElu`eZ99n14-ZkEV#y5C+{Pq87Gu3&>g zFy~Wk7^6v*)4pF3@F@rE__k3ikx(hzN3@e*^0=KNA6|jC^B5nf(XaoQaZN?Xi}Rn3 z$8&m*KmWvPaUQ(V<#J+S&zO|8P-#!f%7G+n_%sXp9=J%Z4&9OkWXeuZN}ssgQ#Tcj z8p6ErJQJWZ+fXLCco=RN8D{W%+*kko*2-LEb))xcHwNl~Xmir>kmAxW?eW50Osw3# zki8Fl$#fvw*7rqd?%E?}ZX4`c5-R&w!Y0#EBbelVXSng+kUfeUiqofPehl}$ormli zg%r)}?%=?_pHb9`Cq9Z|B`L8b>(!+8HSX?`5+5mm81AFXfnAt1*R3F z%b2RPIacKAddx%JfQ8l{3U|vK@W7KB$CdLqn@wP^?azRks@x8z59#$Q*7q!KilY-P zHUbs(IFYRGG1{~@RF;Lqyho$~7^hNC`NL3kn^Td%A7dRgr_&`2k=t+}D-o9&C!y^? z6MsQ=tc3g0xkK(O%DzR9nbNB(r@L;1zQrs8mzx&4dz}?3KNYozOW5;=w18U6$G4U2 z#2^qRLT*Mo4bV1Oeo1PKQ2WQS2Y-hv&S|C7`xh6=Pj7MNLC5K-zokZ67S)C;(F0Dd zloDK2_o1$Fmza>EMj3X9je7e%Q`$39Dk~GoOj89-6q9|_WJlSl!!+*{R=tGp z8u|MuSwm^t7K^nUe+^0G3dkGZr3@(X+TL5eah)K^Tn zXEtHmR9UIaEYgD5Nhh(s*fcG_lh-mfy5iUF3xxpRZ0q3nZ=1qAtUa?(LnT9I&~uxX z`pV?+=|-Gl(kz?w!zIieXT}o}7@`QO>;u$Z!QB${a08_bW0_o@&9cjJUXzVyNGCm8 zm=W+$H!;_Kzp6WQqxUI;JlPY&`V}9C$8HZ^m?NvI*JT@~BM=()T()Ii#+*$y@lTZBkmMMda>7s#O(1YZR+zTG@&}!EXFG{ zEWPSDI5bFi;NT>Yj*FjH((=oe%t%xYmE~AGaOc4#9K_XsVpl<4SP@E!TgC0qpe1oi zNpxU2b0(lEMcoibQ-G^cxO?ySVW26HoBNa;n0}CWL*{k)oBu1>F18X061$SP{Gu67 z-v-Fa=Fl^u3lnGY^o5v)Bux}bNZ~ z5pL+7F_Esoun8^5>z8NFoIdb$sNS&xT8_|`GTe8zSXQzs4r^g0kZjg(b0bJvz`g<70u9Z3fQILX1Lj@;@+##bP|FAOl)U^9U>0rx zGi)M1(Hce)LAvQO-pW!MN$;#ZMX?VE(22lTlJrk#pB0FJNqVwC+*%${Gt#r_tH9I_ z;+#)#8cWAl?d@R+O+}@1A^hAR1s3UcW{G+>;X4utD2d9X(jF555}!TVN-hByV6t+A zdFR^aE@GNNgSxxixS2p=on4(+*+f<8xrwAObC)D5)4!z7)}mTpb7&ofF3u&9&wPS< zB62WHLGMhmrmOAgmJ+|c>qEWTD#jd~lHNgT0?t-p{T=~#EMcB| z=AoDKOL+qXCfk~F)-Rv**V}}gWFl>liXOl7Uec_8v)(S#av99PX1sQIVZ9eNLkhq$ zt|qu0b?GW_uo}TbU8!jYn8iJeIP)r@;!Ze_7mj{AUV$GEz6bDSDO=D!&C9!M@*S2! zfGyA|EPlXGMjkH6x7OMF?gKL7{GvGfED=Jte^p=91FpCu)#{whAMw`vSLa`K#atdN zThnL+7!ZNmP{rc=Z>%$meH;Qi1=m1E3Lq2D_O1-X5C;!I0L>zur@tPAC9*7Jeh)`;eec}1`nkRP(%iv-`N zZ@ip-g|7l6Hz%j%gcAM}6-nrC8oA$BkOTz^?dakvX?`^=ZkYh%vUE z9+&)K1UTK=ahYiaNn&G5nHUY5niLGus@p5E2@RwZufRvF{@$hW{;{3QhjvEHMvduO z#Wf-@oYU4ht?#uP{N3utVzV49mEc9>*TV_W2TVC`6+oI)zAjy$KJrr=*q##&kobiQ z1vNbya&OVjK`2pdRrM?LuK6BgrLN7H_3m z!qpNKg~87XgCwb#I=Q&0rI*l$wM!qTkXrx1ko5q-f;=R2fImRMwt5Qs{P*p^z@9ex z`2#v(qE&F%MXlHpdO#QEZyZftn4f05ab^f2vjxuFaat2}jke{j?5GrF=WYBR?gS(^ z9SBiNi}anzBDBRc+QqizTTQuJrzm^bNA~A{j%ugXP7McZqJ}65l10({wk++$=e8O{ zxWjG!Qp#5OmI#XRQQM?n6?1ztl6^D40hDJr?4$Wc&O_{*OfMfxe)V0=e{|N?J#fgE>j9jAajze$iN!*yeF%jJU#G1c@@rm zolGW!j?W6Q8pP=lkctNFdfgUMg92wlM4E$aks1??M$~WQfzzzXtS)wKrr2sJeCN4X zY(X^H_c^PzfcO8Bq(Q*p4c_v@F$Y8cHLrH$`pJ2}=#*8%JYdqsqnGqEdBQMpl!Ot04tUGSXTQdsX&GDtjbWD=prcCT9(+ z&UM%lW%Q3yrl1yiYs;LxzIy>2G}EPY6|sBhL&X&RAQrSAV4Tlh2nITR?{6xO9ujGu zr*)^E`>o!c=gT*_@6S&>0POxcXYNQd&HMw6<|#{eSute2C3{&h?Ah|cw56-AP^f8l zT^kvZY$YiH8j)sk7_=;gx)vx-PW`hbSBXJGCTkpt;ap(}G2GY=2bbjABU5)ty%G#x zAi07{Bjhv}>OD#5zh#$0w;-vvC@^}F! z#X$@)zIs1L^E;2xDAwEjaXhTBw2<{&JkF*`;c3<1U@A4MaLPe{M5DGGkL}#{cHL%* zYMG+-Fm0#qzPL#V)TvQVI|?_M>=zVJr9>(6ib*#z8q@mYKXDP`k&A4A};xMK0h=yrMp~JW{L?mE~ph&1Y1a#4%SO)@{ zK2juwynUOC)U*hVlJU17%llUxAJFuKZh3K0gU`aP)pc~bE~mM!i1mi!~LTf>1Wp< zuG+ahp^gH8g8-M$u{HUWh0m^9Rg@cQ{&DAO{PTMudV6c?ka7+AO& z746QylZ&Oj`1aqfu?l&zGtJnpEQOt;OAFq19MXTcI~`ZcoZmyMrIKDFRIDi`FH)w; z8+*8tdevMDv*VtQi|e}CnB_JWs>fhLOH-+Os2Lh!&)Oh2utl{*AwR)QVLS49iTp{6 z;|172Jl!Ml17unF+pd+Ff@jIE-{Oxv)5|pOm@CkHW?{l}b@1>Pe!l}VccX#xp@xgJ zyE<&ep$=*vT=}7vtvif0B?9xw_3Gej7mN*dOHdQPtW5kA5_zGD zpA4tV2*0E^OUimSsV#?Tg#oiQ>%4D@1F5@AHwT8Kgen$bSMHD3sXCkq8^(uo7CWk`mT zuslYq`6Yz;L%wJh$3l1%SZv#QnG3=NZ=BK4yzk#HAPbqXa92;3K5?0kn4TQ`%E%X} z&>Lbt!!QclYKd6+J7Nl@xv!uD%)*bY-;p`y^ZCC<%LEHUi$l5biu!sT3TGGSTPA21 zT8@B&a0lJHVn1I$I3I1I{W9fJAYc+8 zVj8>HvD}&O`TqU2AAb={?eT;0hyL(R{|h23=4fDSZKC32;wWxsVj`P z3J3{M$PwdH!ro*Cn!D&=jnFR>BNGR<<|I8CI@+@658Dy(lhqbhXfPTVecY@L8%`3Q z1Fux2w?2C3th60jI~%OC9BtpNF$QPqcG+Pz96qZJ71_`0o0w_q7|h&O>`6U+^BA&5 zXd5Zp1Xkw~>M%RixTm&OqpNl8Q+ue=92Op_>T~_9UON?ZM2c0aGm=^A4ejrXj3dV9 zhh_bCt-b9`uOX#cFLj!vhZ#lS8Tc47OH>*)y#{O9?AT~KR9LntM|#l#Dlm^8{nZdk zjMl#>ZM%#^nK2TPzLcKxqx24P7R1FPlBy7LSBrRvx>fE$9AJ;7{PQm~^LBX^k#6Zq zw*Z(zJC|`!6_)EFR}8|n8&&Rbj8y028~P~sFXBFRt+tmqH-S3<%N;C&WGH!f3{7cm zy_fCAb9@HqaXa1Y5vFbxWf%#zg6SI$C+Uz5=CTO}e|2fjWkZ;Dx|84Ow~bkI=LW+U zuq;KSv9VMboRvs9)}2PAO|b(JCEC_A0wq{uEj|3x@}*=bOd zwr{TgeCGG>HT<@Zeq8y}vTpwDg#UBvD)BEs@1KP$^3$sh&_joQPn{hjBXmLPJ{tC) z*HS`*2+VtJO{|e$mM^|qv1R*8i(m1`%)}g=SU#T#0KlTM2RSvYUc1fP+va|4;5}Bfz98UvDCpq7}+SMV&;nX zQw~N6qOX{P55{#LQkrZk(e5YGzr|(B;Q;ju;2a`q+S9bsEH@i1{_Y0;hWYn1-79jl z5c&bytD*k)GqrVcHn6t-7kinadiD>B{Tl`ZY@`g|b~pvHh5!gKP4({rp?D0aFd_cN zhHRo4dd5^S6ViN(>(28qZT6E>??aRhc($kP`>@<+lIKS5HdhjVU;>f7<4))E*5|g{ z&d1}D|vpuV^eRj5j|xx9nwaCxXFG?Qbjn~_WSy=N}P0W>MP zG-F%70lX5Xr$a)2i6?i|iMyM|;Jtf*hO?=Jxj12oz&>P=1#h~lf%#fc73M2_(SUM- zf&qnjS80|_Y0lDgl&I?*eMumUklLe_=Td!9G@eR*tcPOgIShJipp3{A10u(4eT~DY zHezEj8V+7m!knn7)W!-5QI3=IvC^as5+TW1@Ern@yX| z7Nn~xVx&fGSr+L%4iohtS3w^{-H1A_5=r&x8}R!YZvp<2T^YFvj8G_vm}5q;^UOJf ztl=X3iL;;^^a#`t{Ae-%5Oq{?M#s6Npj+L(n-*LMI-yMR{)qki!~{5z{&`-iL}lgW zxo+tnvICK=lImjV$Z|O_cYj_PlEYCzu-XBz&XC-JVxUh9;6*z4fuBG+H{voCC;`~GYV|hj%j_&I zDZCj>Q_0RCwFauYoVMiUSB+*Mx`tg)bWmM^SwMA+?lBg12QUF_x2b)b?qb88K-YUd z0dO}3k#QirBV<5%jL$#wlf!60dizu;tsp(7XLdI=eQs?P`tOZYMjVq&jE)qK*6B^$ zBe>VvH5TO>s>izhwJJ$<`a8fakTL!yM^Zfr2hV9`f}}VVUXK39p@G|xYRz{fTI+Yq z20d=)iwjuG9RB$%$^&8#(c0_j0t_C~^|n+c`Apu|x7~;#cS-s=X1|C*YxX3ailhg_|0`g!E&GZJEr?bh#Tpb8siR=JxWKc{#w7g zWznLwi;zLFmM1g8V5-P#RsM@iX>TK$xsWuujcsVR^7TQ@!+vCD<>Bk9tdCo7Mzgq5 zv8d>dK9x8C@Qoh01u@3h0X_`SZluTb@5o;{4{{eF!-4405x8X7hewZWpz z2qEi4UTiXTvsa(0X7kQH{3VMF>W|6;6iTrrYD2fMggFA&-CBEfSqPlQDxqsa>{e2M z(R5PJ7uOooFc|9GU0ELA%m4&4Ja#cQpNw8i8ACAoK6?-px+oBl_yKmenZut#Xumjz zk8p^OV2KY&?5MUwGrBOo?ki`Sxo#?-Q4gw*Sh0k`@ zFTaYK2;}%Zk-68`#5DXU$2#=%YL#S&MTN8bF+!J2VT6x^XBci6O)Q#JfW{YMz) zOBM>t2rSj)n#0a3cjvu}r|k3od6W(SN}V-cL?bi*Iz-8uOcCcsX0L>ZXjLqk zZu2uHq5B|Kt>e+=pPKu=1P@1r9WLgYFq_TNV1p9pu0erHGd!+bBp!qGi+~4A(RsYN@CyXNrC&hxGmW)u5m35OmWwX`I+0yByglO`}HC4nGE^_HUs^&A(uaM zKPj^=qI{&ayOq#z=p&pnx@@k&I1JI>cttJcu@Ihljt?6p^6{|ds`0MoQwp+I{3l6` zB<9S((RpLG^>=Kic`1LnhpW2=Gu!x`m~=y;A`Qk!-w`IN;S8S930#vBVMv2vCKi}u z6<-VPrU0AnE&vzwV(CFC0gnZYcpa-l5T0ZS$P6(?9AM;`Aj~XDvt;Jua=jIgF=Fm? zdp=M$>`phx%+Gu};;-&7T|B1AcC#L4@mW5SV_^1BRbo6;2PWe$r+npRV`yc;T1mo& z+~_?7rA+(Um&o@Tddl zL_hxvWk~a)yY}%j`Y+200D%9$bWHy&;(yj{jpi?Rtz{J66ANw)UyPOm;t6FzY3$hx zcn)Ir79nhFvNa7^a{SHN7XH*|Vlsx`CddPnA&Qvh8aNhEA;mPVv;Ah=k<*u!Zq^7 z<=xs*iQTQOMMcg|(NA_auh@x`3#_LFt=)}%SQppP{E>mu_LgquAWvh<>L7tf9+~rO znwUDS52u)OtY<~!d$;m9+87aO+&`#2ICl@Y>&F{jI=H(K+@3M1$rr=*H^dye#~TyD z!){#Pyfn+|ugUu}G;a~!&&0aqQ59U@UT3|_JuBlYUpT$2+11;}JBJ`{+lQN9T@QFY z5+`t;6(TS0F?OlBTE!@7D`8#URDNqx2t6`GZ{ZgXeS@v%-eJzZOHz18aS|svxII$a zZeFjrJ*$IwX$f-Rzr_G>xbu@euGl)B7pC&S+CmDJBg$BoV~jxSO#>y z33`bupN#LDoW0feZe0%q8un0rYN|eRAnwDHQ6e_)xBTbtoZtTA=Fvk){q}9Os~6mQ zKB80VI_&6iSq`LnK7*kfHZoeX6?WE}8yjuDn=2#JG$+;-TOA1%^=DnXx%w{b=w}tS zQbU3XxtOI8E(!%`64r2`zog;5<0b4i)xBmGP^jiDZ2%HNSxIf3@wKs~uk4%3Mxz;~ zts_S~E4>W+YwI<-*-$U8*^HKDEa8oLbmqGg?3vewnaNg%Mm)W=)lcC_J+1ov^u*N3 zXJ?!BrH-+wGYziJq2Y#vyry6Z>NPgkEk+Ke`^DvNRdb>Q2Nlr#v%O@<5hbflI6EKE z9dWc0-ORk^T}jP!nkJ1imyjdVX@GrjOs%cpgA8-c&FH&$(4od#x6Y&=LiJZPINVyW z0snY$8JW@>tc2}DlrD3StQmA0Twck~@>8dSix9CyQOALcREdxoM$Sw*l!}bXKq9&r zysMWR@%OY24@e`?+#xV2bk{T^C_xSo8v2ZI=lBI*l{RciPwuE>L5@uhz@{!l)rtVlWC>)6(G)1~n=Q|S!{E9~6*fdpa*n z!()-8EpTdj=zr_Lswi;#{TxbtH$8*G=UM`I+icz7sr_SdnHXrv=?iEOF1UL+*6O;% zPw>t^kbW9X@oEXx<97%lBm-9?O_7L!DeD)Me#rwE54t~UBu9VZ zl_I1tBB~>jm@bw0Aljz8! zXBB6ATG6iByKIxs!qr%pz%wgqbg(l{65DP4#v(vqhhL{0b#0C8mq`bnqZ1OwFV z7mlZZJFMACm>h9v^2J9+^_zc1=JjL#qM5ZHaThH&n zXPTsR8(+)cj&>Un{6v*z?@VTLr{TmZ@-fY%*o2G}*G}#!bmqpoo*Ay@U!JI^Q@7gj;Kg-HIrLj4}#ec4~D2~X6vo;ghep-@&yOivYP zC19L0D`jjKy1Yi-SGPAn94(768Tcf$urAf{)1)9W58P`6MA{YG%O?|07!g9(b`8PXG1B1Sh0?HQmeJtP0M$O$hI z{5G`&9XzYhh|y@qsF1GnHN|~^ru~HVf#)lOTSrv=S@DyR$UKQk zjdEPFDz{uHM&UM;=mG!xKvp;xAGHOBo~>_=WFTmh$chpC7c`~7?36h)7$fF~Ii}8q zF|YXxH-Z?d+Q+27Rs3X9S&K3N+)OBxMHn1u(vlrUC6ckBY@@jl+mgr#KQUKo#VeFm zFwNYgv0<%~Wn}KeLeD9e1$S>jhOq&(e*I@L<=I5b(?G(zpqI*WBqf|Zge0&aoDUsC zngMRA_Kt0>La+Erl=Uv_J^p(z=!?XHpenzn$%EA`JIq#yYF?JLDMYiPfM(&Csr#f{ zdd+LJL1by?xz|D8+(fgzRs~(N1k9DSyK@LJygwaYX8dZl0W!I&c^K?7)z{2is;OkE zd$VK-(uH#AUaZrp=1z;O*n=b?QJkxu`Xsw&7yrX0?(CX=I-C#T;yi8a<{E~?vr3W> zQrpPqOW2M+AnZ&p{hqmHZU-;Q(7?- zP8L|Q0RM~sB0w1w53f&Kd*y}ofx@c z5Y6B8qGel+uT1JMot$nT1!Tim6{>oZzJXdyA+4euOLME?5Fd_85Uk%#E*ln%y{u8Q z$|?|R@Hpb~yTVK-Yr_S#%NUy7EBfYGAg>b({J|5b+j-PBpPy$Ns`PaJin4JdRfOaS zE|<HjH%NuJgsd2wOlv>~y=np%=2)$M9LS|>P)zJ+Fei5vYo_N~B0XCn+GM76 z)Xz3tg*FRVFgIl9zpESgdpWAavvVViGlU8|UFY{{gVJskg*I!ZjWyk~OW-Td4(mZ6 zB&SQreAAMqwp}rjy`HsG({l2&q5Y52<@AULVAu~rWI$UbFuZs>Sc*x+XI<+ez%$U)|a^unjpiW0l0 zj1!K0(b6$8LOjzRqQ~K&dfbMIE=TF}XFAi)$+h}5SD3lo z%%Qd>p9se=VtQG{kQ;N`sI)G^u|DN#7{aoEd zkksYP%_X$Rq08);-s6o>CGJ<}v`qs%eYf+J%DQ^2k68C%nvikRsN?$ap--f+vCS`K z#&~)f7!N^;sdUXu54gl3L=LN>FB^tuK=y2e#|hWiWUls__n@L|>xH{%8lIJTd5`w? zSwZbnS;W~DawT4OwSJVdAylbY+u5S+ZH{4hAi2&}Iv~W(UvHg(1GTZRPz`@{SOqzy z(8g&Dz=$PfRV=6FgxN~zo+G8OoPI&d-thcGVR*_^(R8COTM@bq?fDwY{}WhsQS1AK zF6R1t8!RdFmfocpJ6?9Yv~;WYi~XPgs(|>{5})j!AR!voO7y9&cMPo#80A(`za@t>cx<0;qxM@S*m(jYP)dMXr*?q0E`oL;12}VAep179uEr8c<=D zr5?A*C{eJ`z9Ee;E$8)MECqatHkbHH z&Y+ho0B$31MIB-xm&;xyaFCtg<{m~M-QDbY)fQ>Q*Xibb~8ytxZQ?QMf9!%cV zU0_X1@b4d+Pg#R!`OJ~DOrQz3@cpiGy~XSKjZQQ|^4J1puvwKeScrH8o{bscBsowomu z^f12kTvje`yEI3eEXDHJ6L+O{Jv$HVj%IKb|J{IvD*l6IG8WUgDJ*UGz z3!C%>?=dlfSJ>4U88)V+`U-!9r^@AxJBx8R;)J4Fn@`~k>8>v0M9xp90OJElWP&R5 zM#v*vtT}*Gm1^)Bv!s72T3PB0yVIjJW)H7a)ilkAvoaH?)jjb`MP>2z{%Y?}83 zUIwBKn`-MSg)=?R)1Q0z3b>dHE^)D8LFs}6ASG1|daDly_^lOSy&zIIhm*HXm1?VS=_iacG);_I9c zUQH1>i#*?oPIwBMJkzi_*>HoUe}_4o>2(SHWzqQ=;TyhAHS;Enr7!#8;sdlty&(>d zl%5cjri8`2X^Ds`jnw7>A`X|bl=U8n+3LKLy(1dAu8`g@9=5iw$R0qk)w8Vh_Dt^U zIglK}sn^)W7aB(Q>HvrX=rxB z+*L)3DiqpQ_%~|m=44LcD4-bxO3OO*LPjsh%p(k?&jvLp0py57oMH|*IMa(<|{m1(0S|x)?R-mqJ=I;_YUZA>J z62v*eSK;5w!h8J+6Z2~oyGdZ68waWfy09?4fU&m7%u~zi?YPHPgK6LDwphgaYu%0j zurtw)AYOpYKgHBrkX189mlJ`q)w-f|6>IER{5Lk97%P~a-JyCRFjejW@L>n4vt6#hq;!|m;hNE||LK3nw1{bJOy+eBJjK=QqNjI;Q6;Rp5 z&035pZDUZ#%Oa;&_7x0T<7!RW`#YBOj}F380Bq?MjjEhrvlCATPdkCTTl+2efTX$k zH&0zR1n^`C3ef~^sXzJK-)52(T}uTG%OF8yDhT76L~|^+hZ2hiSM*QA9*D5odI1>& z9kV9jC~twA5MwyOx(lsGD_ggYmztXPD`2=_V|ks_FOx!_J8!zM zTzh^cc+=VNZ&(OdN=y4Juw)@8-85lwf_#VMN!Ed(eQiRiLB2^2e`4dp286h@v@`O%_b)Y~A; zv}r6U?zs&@uD_+(_4bwoy7*uozNvp?bXFoB8?l8yG0qsm1JYzIvB_OH4_2G*IIOwT zVl%HX1562vLVcxM_RG*~w_`FbIc!(T=3>r528#%mwwMK}uEhJ()3MEby zQQjzqjWkwfI~;Fuj(Lj=Ug0y`>~C7`w&wzjK(rPw+Hpd~EvQ-ufQOiB4OMpyUKJhw zqEt~jle9d7S~LI~$6Z->J~QJ{Vdn3!c}g9}*KG^Kzr^(7VI5Gk(mHLL{itj_hG?&K4Ws0+T4gLfi3eu$N=`s36geNC?c zm!~}vG6lx9Uf^5M;bWntF<-{p^bruy~f?sk9 zcETAPQZLoJ8JzMMg<-=ju4keY@SY%Wo?u9Gx=j&dfa6LIAB|IrbORLV1-H==Z1zCM zeZcOYpm5>U2fU7V*h;%n`8 zN95QhfD994={1*<2vKLCNF)feKOGk`R#K~G=;rfq}|)s20&MCa65 zUM?xF5!&e0lF%|U!#rD@I{~OsS_?=;s_MQ_b_s=PuWdC)q|UQ&ea)DMRh5>fpQjXe z%9#*x=7{iRCtBKT#H>#v%>77|{4_slZ)XCY{s3j_r{tdpvb#|r|sbS^dU1x70$eJMU!h{Y7Kd{dl}9&vxQl6Jt1a` zHQZrWyY0?!vqf@u-fxU_@+}u(%Wm>0I#KP48tiAPYY!TdW(o|KtVI|EUB9V`CBBNaBLVih7+yMVF|GSoIQD0Jfb{ z!OXq;(>Z?O`1gap(L~bUcp>Lc@Jl-})^=6P%<~~9ywY=$iu8pJ0m*hOPzr~q`23eX zgbs;VOxxENe0UMVeN*>uCn9Gk!4siN-e>x)pIKAbQz!G)TcqIJ0`JBBaX>1-4_XO_-HCS^vr2vjv#7KltDZdyQ{tlWh4$Gm zB>|O1cBDC)yG(sbnc*@w6e%e}r*|IhpXckx&;sQCwGdKH+3oSG-2)Bf#x`@<4ETAr z0My%7RFh6ZLiZ_;X6Mu1YmXx7C$lSZ^}1h;j`EZd6@%JNUe=btBE z%s=Xmo1Ps?8G`}9+6>iaB8bgjUdXT?=trMu|4yLX^m0Dg{m7rpKNJey|EwHI+nN1e zL^>qN%5Fg)dGs4DO~uwIdXImN)QJ*Jhpj7$fq_^`{3fwpztL@WBB}OwQ#Epo-mqMO zsM$UgpFiG&d#)lzEQ{3Q;)&zTw;SzGOah-Dpm{!q7<8*)Ti_;xvV2TYXa}=faXZy? z3y?~GY@kl)>G&EvEijk9y1S`*=zBJSB1iet>0;x1Ai)*`^{pj0JMs)KAM=@UyOGtO z3y0BouW$N&TnwU6!%zS%nIrnANvZF&vB1~P5_d`x-giHuG zPJ;>XkVoghm#kZXRf>qxxEix;2;D1CC~NrbO6NBX!`&_$iXwP~P*c($EVV|669kDO zKoTLZNF4Cskh!Jz5ga9uZ`3o%7Pv`d^;a=cXI|>y;zC3rYPFLQkF*nv(r>SQvD*## z(Vo%^9g`%XwS0t#94zPq;mYGLKu4LU3;txF26?V~A0xZbU4Lmy`)>SoQX^m7fd^*E z+%{R4eN!rIk~K)M&UEzxp9dbY;_I^c} zOc{wlIrN_P(PPqi51k_$>Lt|X6A^|CGYgKAmoI#Li?;Wq%q~q*L7ehZkUrMxW67Jl zhsb~+U?33QS>eqyN{(odAkbopo=Q$Az?L+NZW>j;#~@wCDX?=L5SI|OxI~7!Pli;e zELMFcZtJY3!|=Gr2L4>z8yQ-{To>(f80*#;6`4IAiqUw`=Pg$%C?#1 z_g@hIGerILSU>=P>z{gM|DS91A4cT@PEIB^hSop!uhMo#2G;+tQSpDO_6nOnPWSLU zS;a9m^DFMXR4?*X=}d7l;nXuHk&0|m`NQn%d?8|Ab3A9l9Jh5s120ibWBdB z$5YwsK3;wvp!Kn@)Qae{ef`0#NwlRpQ}k^r>yos_Ne1;xyKLO?4)t_G4eK~wkUS2A&@_;)K0-03XGBzU+5f+uMDxC z(s8!8!RvdC#@`~fx$r)TKdLD6fWEVdEYtV#{ncT-ZMX~eI#UeQ-+H(Z43vVn%Yj9X zLdu9>o%wnWdvzA-#d6Z~vzj-}V3FQ5;axDIZ;i(95IIU=GQ4WuU{tl-{gk!5{l4_d zvvb&uE{%!iFwpymz{wh?bKr1*qzeZb5f6e6m_ozRF&zux2mlK=v_(_s^R6b5lu?_W4W3#<$zeG~Pd)^!4tzhs}-Sx$FJP>)ZGF(hVTH|C3(U zs0PO&*h_ zNA-&qZpTP$$LtIgfiCn07}XDbK#HIXdmv8zdz4TY;ifNIH-0jy(gMSByG2EF~Th#eb_TueZC` zE?3I>UTMpKQ})=C;6p!?G)M6w^u*A57bD?2X`m3X^6;&4%i_m(uGJ3Z5h`nwxM<)H z$I5m?wN>O~8`BGnZ=y^p6;0+%_0K}Dcg|K;+fEi|qoBqvHj(M&aHGqNF48~XqhtU? z^ogwBzRlOfpAJ+Rw7IED8lRbTdBdyEK$gPUpUG}j-M42xDj_&qEAQEtbs>D#dRd7Y z<&TpSZ(quQDHiCFn&0xsrz~4`4tz!CdL8m~HxZM_agu@IrBpyeL1Ft}V$HX_ZqDPm z-f89)pjuEzGdq-PRu`b1m+qBGY{zr_>{6Ss>F|xHZlJj9dt5HD$u`1*WZe)qEIuDSR)%z+|n zatVlhQ?$w#XRS7xUrFE;Y8vMGhQS5*T{ZnY=q1P?w5g$OKJ#M&e??tAmPWHMj3xhS ziGxapy?kn@$~2%ZY;M8Bc@%$pkl%Rvj!?o%agBvpQ-Q61n9kznC4ttrRNQ4%GFR5u zyv%Yo9~yxQJWJSfj z?#HY$y=O~F|2pZs22pu|_&Ajd+D(Mt!nPUG{|1nlvP`=R#kKH zO*s$r_%ss5h1YO7k0bHJ2CXN)Yd6CHn~W!R=SqkWe=&nAZu(Q1G!xgcUilM@YVei@2@a`8he z9@pM`)VB*=e7-MWgLlXlc)t;fF&-AwM{E-EX}pViFn0I0CNw2bNEnN2dj!^4(^zS3 zobUm1uQnpqk_4q{pl*n06=TfK_C>UgurKFjRXsK_LEn};=79`TB12tv6KzwSu*-C8 z;=~ohDLZylHQ|Mpx-?yql>|e=vI1Z!epyUpAcDCp4T|*RV&X`Q$0ogNwy6mFALo^@ z9=&(9txO8V@E!@6^(W0{*~CT>+-MA~vnJULBxCTUW>X5>r7*eXYUT0B6+w@lzw%n> z_VjJ<2qf|(d6jYq2(x$(ZDf!yVkfnbvNmb5c|hhZ^2TV_LBz`9w!e_V*W_(MiA7|= z&EeIIkw*+$Xd!)j8<@_<}A5;~A_>3JT*kX^@}cDoLd>Qj<`Se^wdUa(j0dp+Tl8EptwBm{9OGsdFEq zM`!pjf(Lm(`$e3FLOjqA5LnN5o!}z{ zNf}rJuZh@yUtq&ErjHeGzX4(!luV!jB&;FAP|!R_QHYw#^Z1LwTePAKJ6X&IDNO#; z)#I@Xnnzyij~C@UH~X51JCgQeF0&hTXnuoElz#m{heZRexWc0k4<>0+ClX7%0 zEBqCCld1tD9Zwkr4{?Nor19#E5-YKfB8d?qgR82-Ow2^AuNevly2*tHA|sK!ybYkX zm-sLQH72P&{vEAW6+z~O5d0qd=xW~rua~5a?ymYFSD@8&gV)E5@RNNBAj^C99+Z5Z zR@Pq55mbCQbz+Mn$d_CMW<-+?TU960agEk1J<>d>0K=pF19yN))a~4>m^G&tc*xR+yMD*S=yip-q=H zIlredHpsJV8H(32@Zxc@bX6a21dUV95Th--8pE6C&3F>pk=yv$yd6@Haw;$v4+Fcb zRwn{Qo@0`7aPa2LQOP}j9v>sjOo5Kqvn|`FLizX zB+@-u4Lw|jsvz{p^>n8Vo8H2peIqJJnMN}A)q6%$Tmig7eu^}K2 zrh$X?T|ZMsoh{6pdw1G$_T<`Ds-G=jc;qcGdK4{?dN2-XxjDNbb(7pk|3JUVCU4y; z)?LXR>f+AAu)JEiti_Zy#z5{RgsC}R(@jl%9YZ>zu~hKQ*AxbvhC378-I@{~#%Y`Z zy=a=9YpewPIC+gkEUUwtUL7|RU7=!^Aa}Mk^6uxOgRGA#JXjWLsjFUnix|Mau{hDT z7mn*z1m5g`vP(#tjT0Zy4eAY(br&!RiiXE=ZI!{sE1#^#%x^Z7t1U)b<;%Y}Q9=5v z;wpDCEZ@OE36TWT=|gxigT@VaW9BvHS05;_P(#s z8zI4XFQys}q)<`tkX$WnSarn{3e!s}4(J!=Yf>+Y>cP3f;vr63f2{|S^`_pWc)^5_!R z*(x-fuBxL51@xe!lnDBKi}Br$c$BMZ3%f2Sa6kLabiBS{pq*yj;q|k(86x`PiC{p6 z_bxCW{>Q2BA8~Ggz&0jkrcU+-$ANBsOop*ms>34K9lNYil@}jC;?cYP(m^P}nR6FV zk(M%48Z&%2Rx$A&FhOEirEhY0(dn;-k(qkTU)sFQ`+-ih+s@A8g?r8Pw+}2;35WYf zi}VO`jS`p(tc)$X$a>-#WXoW!phhatC*$}|rk>|wUU71eUJG^$c6_jwX?iSHM@6__ zvV|6%U*$sSXJu9SX?2%M^kK|}a2QJ8AhF{fuXrHZxXsI~O zGKX45!K7p*MCPEQ=gp?eu&#AW*pR{lhQR##P_*{c_DjMGL|3T3-bSJ(o$|M{ytU}> zAV>wq*uE*qFo9KvnA^@juy{x<-u*#2NvkV={Ly}ysKYB-k`K3@K#^S1Bb$8Y#0L0# z`6IkSG&|Z$ODy|VLS+y5pFJx&8tvPmMd8c9FhCyiU8~k6FwkakUd^(_ml8`rnl>JS zZV){9G*)xBqPz^LDqRwyS6w86#D^~xP4($150M)SOZRe9sn=>V#aG0Iy(_^YcPpIz8QYM-#s+n% z@Jd?xQq?Xk6=<3xSY7XYP$$yd&Spu{A#uafiIfy8gRC`o0nk{ezEDjb=q_qRAlR1d zFq^*9Gn)yTG4b}R{!+3hWQ+u3GT~8nwl2S1lpw`s0X_qpxv)g+JIkVKl${sYf_nV~B>Em>M;RlqGb5WVil(89 zs=ld@|#;dq1*vQGz=7--Br-|l) zZ%Xh@v8>B7P?~}?Cg$q9_={59l%m~O&*a6TKsCMAzG&vD>k2WDzJ6!tc!V)+oxF;h zJH;apM=wO?r_+*#;ulohuP=E>^zon}a$NnlcQ{1$SO*i=jnGVcQa^>QOILc)e6;eNTI>os=eaJ{*^DE+~jc zS}TYeOykDmJ=6O%>m`i*>&pO_S;qMySJIyP=}4E&J%#1zju$RpVAkZbEl+p%?ZP^C z*$$2b4t%a(e+%>a>d_f_<JjxI#J1x;=hPd1zFPx=6T$;;X1TD*2(edZ3f46zaAoW>L53vS_J*N8TMB|n+;LD| zC=GkQPpyDY#Am4l49chDv*gojhRj_?63&&8#doW`INATAo(qY#{q}%nf@eTIXmtU< zdB<7YWfyCmBs|c)cK>1)v&M#!yNj#4d$~pVfDWQc_ke1?fw{T1Nce_b`v|Vp5ig(H zJvRD^+ps46^hLX;=e2!2e;w9y1D@!D$c@Jc&%%%IL=+xzw55&2?darw=9g~>P z9>?Kdc$r?6c$m%x2S$sdpPl>GQZ{rC9mPS63*qjCVa?OIBj!fW zm|g?>CVfGXNjOfcyqImXR_(tXS(F{FcoNzKvG5R$IgGaxC@)i(e+$ME}vPVIhd|mx2IIE+f zM?9opQHIVgBWu)^A|RzXw!^??S!x)SZOwZaJkGjc<_}2l^eSBm!eAJG9T>EC6I_sy z?bxzDIAn&K5*mX)$RQzDA?s)-no-XF(g*yl4%+GBf`##bDXJ==AQk*xmnatI;SsLp zP9XTHq5mmS=iWu~9ES>b%Q=1aMa|ya^vj$@qz9S!ih{T8_PD%Sf_QrNKwgrXw9ldm zHRVR98*{C?_XNpJn{abA!oix_mowRMu^2lV-LPi;0+?-F(>^5#OHX-fPED zCu^l7u3E%STI}c4{J2!)9SUlGP_@!d?5W^QJXOI-Ea`hFMKjR7TluLvzC-ozCPn1`Tpy z!vlv@_Z58ILX6>nDjTp-1LlFMx~-%GA`aJvG$?8*Ihn;mH37eK**rmOEwqegf-Ccx zrIX4;{c~RK>XuTXxYo5kMiWMy)!IC{*DHG@E$hx?RwP@+wuad(P1{@%tRkyJRqD)3 zMHHHZ4boqDn>-=DgR5VlhQTpfVy182Gk;A_S8A1-;U1RR>+$62>(MUx@Nox$vTjHq z%QR=j!6Gdyb5wu7y(YUktwMuW5<@jl?m4cv4BODiT5o8qVdC0MBqGr@-YBIwnpZAY znX9(_uQjP}JJ=!~Ve9#5I~rUnN|P_3D$LqZcvBnywYhjlMSFHm`;u9GPla{5QD7(7*6Tb3Svr8;(nuAd81q$*uq6HC_&~je*Ca7hP4sJp0av{M8480wF zxASi7Qv+~@2U%Nu1Ud;s-G4CTVWIPyx!sg&8ZG0Wq zG_}i3C(6_1>q3w!EH7$Kwq8uBp2F2N7}l65mk1p*9v0&+;th=_E-W)E;w}P(j⁢ zv5o9#E7!G0XmdzfsS{efPNi`1b44~SZ4Z8fuX!I}#8g+(wxzQwUT#Xb2(tbY1+EUhGKoT@KEU9Ktl>_0 z%bjDJg;#*gtJZv!-Zs`?^}v5eKmnbjqlvnSzE@_SP|LG_PJ6CYU+6zY6>92%E+ z=j@TZf-iW4(%U{lnYxQA;7Q!b;^brF8n0D>)`q5>|WDDXLrqYU_tKN2>=#@~OE7grMnNh?UOz-O~6 z6%rHy{#h9K0AT+lDC7q4{hw^|q6*Ry;;L%Q@)Ga}$60_q%D)rv(CtS$CQbpq9|y1e zRSrN4;$Jyl{m5bZw`$8TGvb}(LpY{-cQ)fcyJv7l3S52TLXVDsphtv&aPuDk1OzCA z4A^QtC(!11`IsNx_HnSy?>EKpHJWT^wmS~hc^p^zIIh@9f6U@I2 zC=Mve{j2^)mS#U$e{@Q?SO6%LDsXz@SY+=cK_QMmXBIU)j!$ajc-zLx3V60EXJ!qC zi<%2x8Q24YN+&8U@CIlN zrZkcT9yh%LrlGS9`G)KdP(@9Eo-AQz@8GEFWcb7U=a0H^ZVbLmz{+&M7W(nXJ4sN8 zJLR7eeK(K8`2-}j(T7JsO`L!+CvbueT%izanm-^A1Dn{`1Nw`9P?cq;7no+XfC`K(GO9?O^5zNIt4M+M8LM0=7Gz8UA@Z0N+lg+cX)NfazRu z5D)~HA^(u%w^cz+@2@_#S|u>GpB+j4KzQ^&Wcl9f z&hG#bCA(Yk0D&t&aJE^xME^&E-&xGHhXn%}psEIj641H+Nl-}boj;)Zt*t(4wZ5DN z@GXF$bL=&pBq-#vkTkh>7hl%K5|3 z{`Vn9b$iR-SoGENp}bn4;fR3>9sA%X2@1L3aE9yTra;Wb#_`xWwLSLdfu+PAu+o3| zGVnpzPr=ch{uuoHjtw7+_!L_2;knQ!DuDl0R`|%jr+}jFzXtrHIKc323?JO{l&;VF z*L1+}JU7%QJOg|5|Tc|D8fN zJORAg=_vsy{ak|o);@)Yh8Lkcg@$FG3k@ep36BRa^>~UmnRPziS>Z=`Jb2x*Q#`%A zU*i3&Vg?TluO@X0O;r2Jl6LKLUOVhSqg1*qOt^|8*c7 zo(298@+r$k_wQNGHv{|$tW(T8L+4_`FQ{kEW5Jgg{yf7ey4ss_(SNKfz(N9lx&a;< je(UuV8hP?p&}TPdm1I$XmG#(RzlD&B2izSj9sl%y5~4qc diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ac72c34..b82aa23 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 0adc8e1..9d0ce63 100755 --- a/gradlew +++ b/gradlew @@ -69,15 +69,15 @@ 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 # This is normally unused @@ -90,14 +90,14 @@ APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit 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'). @@ -106,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 @@ -117,46 +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 - 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. +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 fi # Increase the maximum file descriptors if we can. if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then - 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=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=SC3045 - 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: @@ -169,55 +169,55 @@ 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 # 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, 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. +# 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" +die "xargs is not available" fi # Use "xargs" to parse quoted args. @@ -240,10 +240,10 @@ fi # 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 6689b85..25da30d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,92 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -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="-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% 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. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -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. - -goto fail - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* - -:end -@rem End local scope for the variables with windows NT shell -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! -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 - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +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="-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% equ 0 goto execute + +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 + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +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 + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +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! +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 + +:omega diff --git a/openapi-config.yml b/openapi-config.yml new file mode 100644 index 0000000..1a7dbb2 --- /dev/null +++ b/openapi-config.yml @@ -0,0 +1,24 @@ +globalProperties: + apiDocs: false + apiTests: false + modelDocs: false + modelTests: false + +additionalProperties: + apiPackage: com.squidex.api.core.api + generateBuilders: true + groupId: com.squidex.api + hideGenerationTimestamp: true + invokerPackage: com.squidex.api.core + modelPackage: com.squidex.api.types + useRuntimeException: true + useSingleRequestParameter: true + +nameMappings: + file2: uploadFile + X-Fields: fields + X-Flatten: flatten + X-Languages: languages + X-NoSlowTotal: noSlowTotal + X-NoTotal: noTotal + X-Unpublished: unpublished \ No newline at end of file diff --git a/openapi.json b/openapi.json new file mode 100644 index 0000000..e13d7ab --- /dev/null +++ b/openapi.json @@ -0,0 +1,19052 @@ +{ + "x-generator": "NSwag v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0))", + "openapi": "3.0.0", + "info": { + "title": "Squidex API", + "version": "1.0.0.0", + "x-logo": { + "url": "https://cloud.squidex.io/images/logo-white.png", + "backgroundStyle": "", + "backgroundColor": "#3f83df" + } + }, + "servers": [ + { + "url": "https://cloud.squidex.io" + } + ], + "paths": { + "/api/user-management": { + "get": { + "tags": [ + "UserManagement" + ], + "summary": "Get users by query.", + "operationId": "UserManagement_GetUsers", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "Optional query to search by email address or username.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 1 + }, + { + "name": "skip", + "in": "query", + "description": "The number of users to skip.", + "schema": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "x-position": 2 + }, + { + "name": "take", + "in": "query", + "description": "The number of users to return.", + "schema": { + "type": "integer", + "format": "int32", + "default": 10 + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Users returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UsersDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getUsers" + }, + "post": { + "tags": [ + "UserManagement" + ], + "summary": "Create a new user.", + "operationId": "UserManagement_PostUser", + "requestBody": { + "x-name": "request", + "description": "The user object that needs to be added.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateUserDto" + } + } + }, + "required": true, + "x-position": 1 + }, + "responses": { + "201": { + "description": "User created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserDto" + } + } + } + }, + "400": { + "description": "User request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postUser" + } + }, + "/api/user-management/{id}": { + "get": { + "tags": [ + "UserManagement" + ], + "summary": "Get a user by ID.", + "operationId": "UserManagement_GetUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the user.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "User returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserDto" + } + } + } + }, + "404": { + "description": "User not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getUser" + }, + "put": { + "tags": [ + "UserManagement" + ], + "summary": "Update a user.", + "operationId": "UserManagement_PutUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the user.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "requestBody": { + "x-name": "request", + "description": "The user object that needs to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateUserDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "User created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserDto" + } + } + } + }, + "400": { + "description": "User request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "User not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putUser" + }, + "delete": { + "tags": [ + "UserManagement" + ], + "summary": "Delete a User.", + "operationId": "UserManagement_DeleteUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the user to delete.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "204": { + "description": "User deleted." + }, + "403": { + "description": "User is the current user.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "User not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteUser" + } + }, + "/api/user-management/{id}/lock": { + "put": { + "tags": [ + "UserManagement" + ], + "summary": "Lock a user.", + "operationId": "UserManagement_LockUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the user to lock.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "User locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserDto" + } + } + } + }, + "403": { + "description": "User is the current user.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "User not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "lockUser" + } + }, + "/api/user-management/{id}/unlock": { + "put": { + "tags": [ + "UserManagement" + ], + "summary": "Unlock a user.", + "operationId": "UserManagement_UnlockUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the user to unlock.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "User unlocked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserDto" + } + } + } + }, + "403": { + "description": "User is the current user.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "User not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "unlockUser" + } + }, + "/api": { + "get": { + "tags": [ + "Users" + ], + "summary": "Get the user resources.", + "operationId": "Users_GetUserResources", + "responses": { + "200": { + "description": "User resources returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResourcesDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "security": [ + { + "squidex-oauth-auth": [] + } + ], + "x-method-name": "getUserResources" + } + }, + "/api/user": { + "post": { + "tags": [ + "Users" + ], + "summary": "Update the user profile.", + "operationId": "Users_PostUser", + "requestBody": { + "x-name": "request", + "description": "The values to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateProfileDto" + } + } + }, + "required": true, + "x-position": 1 + }, + "responses": { + "204": { + "description": "User updated." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postUser" + } + }, + "/api/users": { + "get": { + "tags": [ + "Users" + ], + "summary": "Get users by query.", + "description": "Search the user by query that contains the email address or the part of the email address.", + "operationId": "Users_GetUsers", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "The query to search the user by email address. Case invariant.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Users returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/UserDto" + } + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getUsers" + } + }, + "/api/users/{id}": { + "get": { + "tags": [ + "Users" + ], + "summary": "Get user by id.", + "operationId": "Users_GetUser", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the user (GUID).", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "User found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserDto" + } + } + } + }, + "404": { + "description": "User not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getUser" + } + }, + "/api/users/{id}/picture": { + "get": { + "tags": [ + "Users" + ], + "summary": "Get user picture by id.", + "operationId": "Users_GetUserPicture", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the user (GUID).", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "User found and image or fallback returned.", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "User not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getUserPicture" + } + }, + "/api/apps/$app$/translations": { + "post": { + "tags": [ + "Translations" + ], + "summary": "Translate a text.", + "operationId": "Translations_PostTranslation", + "requestBody": { + "x-name": "request", + "description": "The translation request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TranslateDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "Text translated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TranslationDto" + } + } + } + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postTranslation" + } + }, + "/api/templates": { + "get": { + "tags": [ + "Templates" + ], + "summary": "Get all templates.", + "operationId": "Templates_GetTemplates", + "responses": { + "200": { + "description": "Templates returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TemplatesDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "security": [ + { + "squidex-oauth-auth": [] + } + ], + "x-method-name": "getTemplates" + } + }, + "/api/templates/{name}": { + "get": { + "tags": [ + "Templates" + ], + "summary": "Get template details.", + "operationId": "Templates_GetTemplate", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "description": "The name of the template.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Template returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TemplateDetailsDto" + } + } + } + }, + "404": { + "description": "Template not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getTemplate" + } + }, + "/api/teams/{team}/contributors": { + "get": { + "tags": [ + "Teams" + ], + "summary": "Get team contributors.", + "operationId": "TeamContributors_GetContributors", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Contributors returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContributorsDto" + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getContributors" + }, + "post": { + "tags": [ + "Teams" + ], + "summary": "Assign contributor to team.", + "operationId": "TeamContributors_PostContributor", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "requestBody": { + "x-name": "request", + "description": "Contributor object that needs to be added to the team.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssignContributorDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "201": { + "description": "Contributor assigned to team.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContributorsDto" + } + } + } + }, + "400": { + "description": "Contributor request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postContributor" + } + }, + "/api/teams/{team}/contributors/me": { + "delete": { + "tags": [ + "Teams" + ], + "summary": "Remove yourself.", + "operationId": "TeamContributors_DeleteMyself", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Contributor removed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContributorsDto" + } + } + } + }, + "404": { + "description": "Contributor or team not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteMyself" + } + }, + "/api/teams/{team}/contributors/{id}": { + "delete": { + "tags": [ + "Teams" + ], + "summary": "Remove contributor.", + "operationId": "TeamContributors_DeleteContributor", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the contributor.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Contributor removed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContributorsDto" + } + } + } + }, + "404": { + "description": "Contributor or team not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteContributor" + } + }, + "/api/teams": { + "get": { + "tags": [ + "Teams" + ], + "summary": "Get your teams.", + "description": "You can only retrieve the list of teams when you are authenticated as a user (OpenID implicit flow).\nYou will retrieve all teams, where you are assigned as a contributor.", + "operationId": "Teams_GetTeams", + "responses": { + "200": { + "description": "Teams returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TeamDto" + } + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "security": [ + { + "squidex-oauth-auth": [] + } + ], + "x-method-name": "getTeams" + }, + "post": { + "tags": [ + "Teams" + ], + "summary": "Create a new team.", + "description": "You can only create an team when you are authenticated as a user (OpenID implicit flow).\nYou will be assigned as owner of the new team automatically.", + "operationId": "Teams_PostTeam", + "requestBody": { + "x-name": "request", + "description": "The team object that needs to be added to Squidex.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateTeamDto" + } + } + }, + "required": true, + "x-position": 1 + }, + "responses": { + "201": { + "description": "Team created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TeamDto" + } + } + } + }, + "400": { + "description": "Team request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postTeam" + } + }, + "/api/teams/{team}": { + "get": { + "tags": [ + "Teams" + ], + "summary": "Get an team by ID.", + "operationId": "Teams_GetTeam", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Teams returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TeamDto" + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getTeam" + }, + "put": { + "tags": [ + "Teams" + ], + "summary": "Update the team.", + "operationId": "Teams_PutTeam", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team to update.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "requestBody": { + "x-name": "request", + "description": "The values to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateTeamDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "Team updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TeamDto" + } + } + } + }, + "400": { + "description": "Team request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putTeam" + }, + "delete": { + "tags": [ + "Teams" + ], + "summary": "Delete the team.", + "operationId": "Teams_DeleteTeam", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team to delete.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "204": { + "description": "Team deleted." + }, + "404": { + "description": "Team not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteTeam" + } + }, + "/api/teams/{team}/auth": { + "get": { + "tags": [ + "Teams" + ], + "summary": "Get the team auth settings.", + "operationId": "Teams_GetTeamAuth", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Teams returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthSchemeResponseDto" + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getTeamAuth" + }, + "put": { + "tags": [ + "Teams" + ], + "summary": "Update the team auth.", + "operationId": "Teams_PutTeamAuth", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team to update.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "requestBody": { + "x-name": "request", + "description": "The values to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthSchemeValueDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "Team updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AuthSchemeResponseDto" + } + } + } + }, + "400": { + "description": "Team request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putTeamAuth" + } + }, + "/api/apps/$app$/usages/log": { + "get": { + "tags": [ + "Statistics" + ], + "summary": "Get api calls as log file.", + "operationId": "Usages_GetLog", + "responses": { + "200": { + "description": "Usage tracking results returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LogDownloadDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getLog" + } + }, + "/api/apps/$app$/usages/calls/{fromDate}/{toDate}": { + "get": { + "tags": [ + "Statistics" + ], + "summary": "Get api calls in date range for app.", + "operationId": "Usages_GetUsages", + "parameters": [ + { + "name": "fromDate", + "in": "path", + "required": true, + "description": "The from date.", + "schema": { + "type": "string", + "format": "date" + }, + "x-position": 2 + }, + { + "name": "toDate", + "in": "path", + "required": true, + "description": "The to date.", + "schema": { + "type": "string", + "format": "date" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "API call returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CallsUsageDtoDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getUsages" + } + }, + "/api/teams/{team}/usages/calls/{fromDate}/{toDate}": { + "get": { + "tags": [ + "Statistics" + ], + "summary": "Get api calls in date range for team.", + "operationId": "Usages_GetUsagesForTeam", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The name of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "fromDate", + "in": "path", + "required": true, + "description": "The from date.", + "schema": { + "type": "string", + "format": "date" + }, + "x-position": 2 + }, + { + "name": "toDate", + "in": "path", + "required": true, + "description": "The to date.", + "schema": { + "type": "string", + "format": "date" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "API call returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CallsUsageDtoDto" + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getUsagesForTeam" + } + }, + "/api/apps/$app$/usages/storage/today": { + "get": { + "tags": [ + "Statistics" + ], + "summary": "Get total asset size for app.", + "operationId": "Usages_GetCurrentStorageSize", + "responses": { + "200": { + "description": "Storage usage returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CurrentStorageDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getCurrentStorageSize" + } + }, + "/api/teams/{team}/usages/storage/today": { + "get": { + "tags": [ + "Statistics" + ], + "summary": "Get total asset size for team.", + "operationId": "Usages_GetTeamCurrentStorageSizeForTeam", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Storage usage returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CurrentStorageDto" + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getTeamCurrentStorageSizeForTeam" + } + }, + "/api/apps/$app$/usages/storage/{fromDate}/{toDate}": { + "get": { + "tags": [ + "Statistics" + ], + "summary": "Get asset usage by date for app.", + "operationId": "Usages_GetStorageSizes", + "parameters": [ + { + "name": "fromDate", + "in": "path", + "required": true, + "description": "The from date.", + "schema": { + "type": "string", + "format": "date" + }, + "x-position": 2 + }, + { + "name": "toDate", + "in": "path", + "required": true, + "description": "The to date.", + "schema": { + "type": "string", + "format": "date" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Storage usage returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StorageUsagePerDateDto" + } + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getStorageSizes" + } + }, + "/api/teams/{team}/usages/storage/{fromDate}/{toDate}": { + "get": { + "tags": [ + "Statistics" + ], + "summary": "Get asset usage by date for team.", + "operationId": "Usages_GetStorageSizesForTeam", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "fromDate", + "in": "path", + "required": true, + "description": "The from date.", + "schema": { + "type": "string", + "format": "date" + }, + "x-position": 2 + }, + { + "name": "toDate", + "in": "path", + "required": true, + "description": "The to date.", + "schema": { + "type": "string", + "format": "date" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Storage usage returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/StorageUsagePerDateDto" + } + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getStorageSizesForTeam" + } + }, + "/api/apps/$app$/search": { + "get": { + "tags": [ + "Search" + ], + "summary": "Get search results.", + "operationId": "Search_GetSearchResults", + "parameters": [ + { + "name": "query", + "in": "query", + "description": "The search query.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Search results returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SearchResultDto" + } + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getSearchResults" + } + }, + "/api/apps/$app$/schemas/{schema}/fields": { + "post": { + "tags": [ + "Schemas" + ], + "summary": "Add a schema field.", + "operationId": "SchemaFields_PostField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The field object that needs to be added to the schema.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddFieldDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "201": { + "description": "Schema field created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "409": { + "description": "Schema field name already in use.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested": { + "post": { + "tags": [ + "Schemas" + ], + "summary": "Add a nested field.", + "operationId": "SchemaFields_PostNestedField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "parentId", + "in": "path", + "required": true, + "description": "The parent field id.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + } + ], + "requestBody": { + "x-name": "request", + "description": "The field object that needs to be added to the schema.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddFieldDto" + } + } + }, + "required": true, + "x-position": 4 + }, + "responses": { + "201": { + "description": "Schema field created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "409": { + "description": "Schema field name already in use.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postNestedField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/ui": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Configure UI fields.", + "operationId": "SchemaFields_PutSchemaUIFields", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The request that contains the field names.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConfigureUIFieldsDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Schema UI fields defined.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putSchemaUIFields" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/ordering": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Reorder all fields.", + "operationId": "SchemaFields_PutSchemaFieldOrdering", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The request that contains the field ids.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReorderFieldsDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Schema fields reordered.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putSchemaFieldOrdering" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/ordering": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Reorder all nested fields.", + "operationId": "SchemaFields_PutNestedFieldOrdering", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "parentId", + "in": "path", + "required": true, + "description": "The parent field id.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + } + ], + "requestBody": { + "x-name": "request", + "description": "The request that contains the field ids.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReorderFieldsDto" + } + } + }, + "required": true, + "x-position": 4 + }, + "responses": { + "200": { + "description": "Schema fields reordered.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putNestedFieldOrdering" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{id}": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Update a schema field.", + "operationId": "SchemaFields_PutField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to update.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + } + ], + "requestBody": { + "x-name": "request", + "description": "The field object that needs to be added to the schema.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateFieldDto" + } + } + }, + "required": true, + "x-position": 4 + }, + "responses": { + "200": { + "description": "Schema field updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putField" + }, + "delete": { + "tags": [ + "Schemas" + ], + "summary": "Delete a schema field.", + "operationId": "SchemaFields_DeleteField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to disable.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Schema field deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Update a nested field.", + "operationId": "SchemaFields_PutNestedField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "parentId", + "in": "path", + "required": true, + "description": "The parent field id.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to update.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 4 + } + ], + "requestBody": { + "x-name": "request", + "description": "The field object that needs to be added to the schema.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateFieldDto" + } + } + }, + "required": true, + "x-position": 5 + }, + "responses": { + "200": { + "description": "Schema field updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putNestedField" + }, + "delete": { + "tags": [ + "Schemas" + ], + "summary": "Delete a nested field.", + "operationId": "SchemaFields_DeleteNestedField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "parentId", + "in": "path", + "required": true, + "description": "The parent field id.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to disable.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 4 + } + ], + "responses": { + "200": { + "description": "Schema field deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteNestedField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{id}/lock": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Lock a schema field.", + "description": "A locked field cannot be updated or deleted.", + "operationId": "SchemaFields_LockField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to lock.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Schema field shown.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "lockField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}/lock": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Lock a nested field.", + "description": "A locked field cannot be edited or deleted.", + "operationId": "SchemaFields_LockNestedField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "parentId", + "in": "path", + "required": true, + "description": "The parent field id.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to lock.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 4 + } + ], + "responses": { + "200": { + "description": "Schema field hidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Field, schema, or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "lockNestedField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{id}/hide": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Hide a schema field.", + "description": "A hidden field is not part of the API response, but can still be edited in the portal.", + "operationId": "SchemaFields_HideField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to hide.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Schema field hidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "hideField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}/hide": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Hide a nested field.", + "description": "A hidden field is not part of the API response, but can still be edited in the portal.", + "operationId": "SchemaFields_HideNestedField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "parentId", + "in": "path", + "required": true, + "description": "The parent field id.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to hide.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 4 + } + ], + "responses": { + "200": { + "description": "Schema field hidden.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Field, schema, or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "hideNestedField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{id}/show": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Show a schema field.", + "description": "A hidden field is not part of the API response, but can still be edited in the portal.", + "operationId": "SchemaFields_ShowField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to show.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Schema field shown.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "showField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}/show": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Show a nested field.", + "description": "A hidden field is not part of the API response, but can still be edited in the portal.", + "operationId": "SchemaFields_ShowNestedField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "parentId", + "in": "path", + "required": true, + "description": "The parent field id.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to show.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 4 + } + ], + "responses": { + "200": { + "description": "Schema field shown.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "showNestedField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{id}/enable": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Enable a schema field.", + "description": "A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response.", + "operationId": "SchemaFields_EnableField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to enable.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Schema field enabled.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "enableField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}/enable": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Enable a nested field.", + "description": "A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response.", + "operationId": "SchemaFields_EnableNestedField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "parentId", + "in": "path", + "required": true, + "description": "The parent field id.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to enable.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 4 + } + ], + "responses": { + "200": { + "description": "Schema field enabled.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "enableNestedField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{id}/disable": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Disable a schema field.", + "description": "A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response.", + "operationId": "SchemaFields_DisableField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to disable.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Schema field disabled.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "disableField" + } + }, + "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}/disable": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Disable a nested field.", + "description": "A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response.", + "operationId": "SchemaFields_DisableNestedField", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "parentId", + "in": "path", + "required": true, + "description": "The parent field id.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the field to disable.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 4 + } + ], + "responses": { + "200": { + "description": "Schema field disabled.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema field request not valid or field locked.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema, field or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "disableNestedField" + } + }, + "/api/apps/$app$/schemas": { + "get": { + "tags": [ + "Schemas" + ], + "summary": "Get schemas.", + "operationId": "Schemas_GetSchemas", + "responses": { + "200": { + "description": "Schemas returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemasDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getSchemas" + }, + "post": { + "tags": [ + "Schemas" + ], + "summary": "Create a new schema.", + "operationId": "Schemas_PostSchema", + "requestBody": { + "x-name": "request", + "description": "The schema object that needs to be added to the app.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateSchemaDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "201": { + "description": "Schema created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "409": { + "description": "Schema name already in use.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postSchema" + } + }, + "/api/apps/$app$/schemas/{schema}": { + "get": { + "tags": [ + "Schemas" + ], + "summary": "Get a schema by name.", + "operationId": "Schemas_GetSchema", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema to retrieve.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Schema found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getSchema" + }, + "put": { + "tags": [ + "Schemas" + ], + "summary": "Update a schema.", + "operationId": "Schemas_PutSchema", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The schema object that needs to updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateSchemaDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Schema updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putSchema" + }, + "delete": { + "tags": [ + "Schemas" + ], + "summary": "Delete a schema.", + "operationId": "Schemas_DeleteSchema", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema to delete.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "204": { + "description": "Schema deleted." + }, + "404": { + "description": "Schema or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteSchema" + } + }, + "/api/apps/$app$/schemas/{schema}/sync": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Synchronize a schema.", + "operationId": "Schemas_PutSchemaSync", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The schema object that needs to updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SynchronizeSchemaDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Schema updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putSchemaSync" + } + }, + "/api/apps/$app$/schemas/{schema}/category": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Update a schema category.", + "operationId": "Schemas_PutCategory", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The schema object that needs to updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChangeCategoryDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Schema updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putCategory" + } + }, + "/api/apps/$app$/schemas/{schema}/preview-urls": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Update the preview urls.", + "operationId": "Schemas_PutPreviewUrls", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The preview urls for the schema.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConfigurePreviewUrlsDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Schema updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putPreviewUrls" + } + }, + "/api/apps/$app$/schemas/{schema}/scripts": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Update the scripts.", + "operationId": "Schemas_PutScripts", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The schema scripts object that needs to updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaScriptsDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Schema updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putScripts" + } + }, + "/api/apps/$app$/schemas/{schema}/rules": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Update the rules.", + "operationId": "Schemas_PutRules", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The schema rules object that needs to updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ConfigureFieldRulesDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Schema updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "400": { + "description": "Schema request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putRules" + } + }, + "/api/apps/$app$/schemas/{schema}/publish": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Publish a schema.", + "operationId": "Schemas_PublishSchema", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema to publish.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Schema published.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "publishSchema" + } + }, + "/api/apps/$app$/schemas/{schema}/unpublish": { + "put": { + "tags": [ + "Schemas" + ], + "summary": "Unpublish a schema.", + "operationId": "Schemas_UnpublishSchema", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema to unpublish.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Schema unpublished.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "unpublishSchema" + } + }, + "/api/rules/actions": { + "get": { + "tags": [ + "Rules" + ], + "summary": "Get supported rule actions.", + "operationId": "Rules_GetActions", + "responses": { + "200": { + "description": "Rule actions returned.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/RuleElementDto" + } + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "security": [ + { + "squidex-oauth-auth": [] + } + ], + "x-method-name": "getActions" + } + }, + "/api/apps/$app$/rules": { + "get": { + "tags": [ + "Rules" + ], + "summary": "Get rules.", + "operationId": "Rules_GetRules", + "responses": { + "200": { + "description": "Rules returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RulesDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getRules" + }, + "post": { + "tags": [ + "Rules" + ], + "summary": "Create a new rule.", + "operationId": "Rules_PostRule", + "requestBody": { + "x-name": "request", + "description": "The rule object that needs to be added to the app.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRuleDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "201": { + "description": "Rule created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RuleDto" + } + } + } + }, + "400": { + "description": "Rule request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postRule" + } + }, + "/api/apps/$app$/rules/run": { + "delete": { + "tags": [ + "Rules" + ], + "summary": "Cancel the current run.", + "operationId": "Rules_DeleteRuleRun", + "responses": { + "204": { + "description": "Rule run cancelled." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteRuleRun" + } + }, + "/api/apps/$app$/rules/{id}": { + "put": { + "tags": [ + "Rules" + ], + "summary": "Update a rule.", + "operationId": "Rules_PutRule", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the rule to update.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The rule object that needs to be added to the app.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateRuleDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Rule updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RuleDto" + } + } + } + }, + "400": { + "description": "Rule request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Rule or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putRule" + }, + "delete": { + "tags": [ + "Rules" + ], + "summary": "Delete a rule.", + "operationId": "Rules_DeleteRule", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the rule to delete.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "204": { + "description": "Rule deleted." + }, + "404": { + "description": "Rule or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteRule" + } + }, + "/api/apps/$app$/rules/{id}/enable": { + "put": { + "tags": [ + "Rules" + ], + "summary": "Enable a rule.", + "operationId": "Rules_EnableRule", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the rule to enable.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Rule enabled.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RuleDto" + } + } + } + }, + "404": { + "description": "Rule or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "enableRule" + } + }, + "/api/apps/$app$/rules/{id}/disable": { + "put": { + "tags": [ + "Rules" + ], + "summary": "Disable a rule.", + "operationId": "Rules_DisableRule", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the rule to disable.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Rule disabled.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RuleDto" + } + } + } + }, + "404": { + "description": "Rule or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "disableRule" + } + }, + "/api/apps/$app$/rules/{id}/trigger": { + "put": { + "tags": [ + "Rules" + ], + "summary": "Trigger a rule.", + "operationId": "Rules_TriggerRule", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the rule to disable.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "204": { + "description": "Rule triggered." + }, + "404": { + "description": "Rule or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "triggerRule" + } + }, + "/api/apps/$app$/rules/{id}/run": { + "put": { + "tags": [ + "Rules" + ], + "summary": "Run a rule.", + "operationId": "Rules_PutRuleRun", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the rule to run.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "fromSnapshots", + "in": "query", + "description": "Runs the rule from snapeshots if possible.", + "schema": { + "type": "boolean", + "default": false + }, + "x-position": 3 + } + ], + "responses": { + "204": { + "description": "Rule started." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putRuleRun" + } + }, + "/api/apps/$app$/rules/{id}/events": { + "delete": { + "tags": [ + "Rules" + ], + "summary": "Cancels all rule events.", + "operationId": "Rules_DeleteRuleEvents", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the rule to cancel.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "204": { + "description": "Rule events cancelled." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteRuleEvents" + } + }, + "/api/apps/$app$/rules/simulate": { + "post": { + "tags": [ + "Rules" + ], + "summary": "Simulate a rule.", + "operationId": "Rules_SimulatePOST", + "requestBody": { + "x-name": "request", + "description": "The rule to simulate.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateRuleDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "Rule simulated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SimulatedRuleEventsDto" + } + } + } + }, + "404": { + "description": "Rule or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "simulatePOST" + } + }, + "/api/apps/$app$/rules/{id}/simulate": { + "get": { + "tags": [ + "Rules" + ], + "summary": "Simulate a rule.", + "operationId": "Rules_SimulateGET", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the rule to simulate.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Rule simulated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SimulatedRuleEventsDto" + } + } + } + }, + "404": { + "description": "Rule or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "simulateGET" + } + }, + "/api/apps/$app$/rules/events": { + "get": { + "tags": [ + "Rules" + ], + "summary": "Get rule events.", + "operationId": "Rules_GetEvents", + "parameters": [ + { + "name": "ruleId", + "in": "query", + "description": "The optional rule id to filter to events.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 2 + }, + { + "name": "skip", + "in": "query", + "description": "The number of events to skip.", + "schema": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "x-position": 3 + }, + { + "name": "take", + "in": "query", + "description": "The number of events to take.", + "schema": { + "type": "integer", + "format": "int32", + "default": 20 + }, + "x-position": 4 + } + ], + "responses": { + "200": { + "description": "Rule events returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RuleEventsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getEvents" + }, + "delete": { + "tags": [ + "Rules" + ], + "summary": "Cancels all events.", + "operationId": "Rules_DeleteEvents", + "responses": { + "204": { + "description": "Events cancelled." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteEvents" + } + }, + "/api/apps/$app$/rules/events/{id}": { + "put": { + "tags": [ + "Rules" + ], + "summary": "Retry the event immediately.", + "operationId": "Rules_PutEvent", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The event to enqueue.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "204": { + "description": "Rule enqueued." + }, + "404": { + "description": "App or rule event not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putEvent" + }, + "delete": { + "tags": [ + "Rules" + ], + "summary": "Cancels an event.", + "operationId": "Rules_DeleteEvent", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The event to cancel.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "204": { + "description": "Rule event cancelled." + }, + "404": { + "description": "App or rule event not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteEvent" + } + }, + "/api/rules/eventtypes": { + "get": { + "tags": [ + "Rules" + ], + "summary": "Provide a list of all event types that are used in rules.", + "operationId": "Rules_GetEventTypes", + "responses": { + "200": { + "description": "Rule events returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getEventTypes" + } + }, + "/api/rules/eventtypes/{type}": { + "get": { + "tags": [ + "Rules" + ], + "summary": "Provide the json schema for the event with the specified name.", + "operationId": "Rules_GetEventSchema", + "parameters": [ + { + "name": "type", + "in": "path", + "required": true, + "description": "The type name of the event.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Rule event type found.", + "content": { + "application/json": { + "schema": {} + } + } + }, + "404": { + "description": "Rule event not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getEventSchema" + } + }, + "/api/apps/$app$/plans": { + "get": { + "tags": [ + "Plans" + ], + "summary": "Get app plan information.", + "operationId": "AppPlans_GetPlans", + "responses": { + "200": { + "description": "App plan information returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PlansDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getPlans" + } + }, + "/api/apps/$app$/plan": { + "put": { + "tags": [ + "Plans" + ], + "summary": "Change the app plan.", + "operationId": "AppPlans_PutPlan", + "requestBody": { + "x-name": "request", + "description": "Plan object that needs to be changed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChangePlanDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "Plan changed or redirect url returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PlanChangedDto" + } + } + } + }, + "400": { + "description": "Plan not owned by user.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putPlan" + } + }, + "/api/teams/{team}/plans": { + "get": { + "tags": [ + "Plans" + ], + "summary": "Get team plan information.", + "operationId": "TeamPlans_GetTeamPlans", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The name of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Team plan information returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PlansDto" + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getTeamPlans" + } + }, + "/api/teams/{team}/plan": { + "put": { + "tags": [ + "Plans" + ], + "summary": "Change the team plan.", + "operationId": "TeamPlans_PutTeamPlan", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The name of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "requestBody": { + "x-name": "request", + "description": "Plan object that needs to be changed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChangePlanDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "Plan changed or redirect url returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PlanChangedDto" + } + } + } + }, + "404": { + "description": "Team not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putTeamPlan" + } + }, + "/api/info": { + "get": { + "tags": [ + "Ping" + ], + "summary": "Get API information.", + "operationId": "Ping_GetInfo", + "responses": { + "200": { + "description": "Infos returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExposedValues" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getInfo" + } + }, + "/api/ping": { + "get": { + "tags": [ + "Ping" + ], + "summary": "Get ping status of the API.", + "description": "Can be used to test, if the Squidex API is alive and responding.", + "operationId": "Ping_GetPing", + "responses": { + "204": { + "description": "Service ping successful." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getPing" + } + }, + "/api/ping/$app$": { + "get": { + "tags": [ + "Ping" + ], + "summary": "Get ping status.", + "description": "Can be used to test, if the Squidex API is alive and responding.", + "operationId": "Ping_GetAppPing", + "responses": { + "204": { + "description": "Service ping successful." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getAppPing" + } + }, + "/api/news/features": { + "get": { + "tags": [ + "News" + ], + "summary": "Get features since version.", + "operationId": "News_GetNews", + "parameters": [ + { + "name": "version", + "in": "query", + "description": "The latest received version.", + "schema": { + "type": "integer", + "format": "int32", + "default": 0 + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Latest features returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FeaturesDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getNews" + } + }, + "/api/languages": { + "get": { + "tags": [ + "Languages" + ], + "summary": "Get supported languages.", + "description": "Provide a list of supported language codes, following the ISO2Code standard.", + "operationId": "Languages_GetLanguages", + "responses": { + "200": { + "description": "Supported language codes returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LanguageDto" + } + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "security": [ + { + "squidex-oauth-auth": [] + } + ], + "x-method-name": "getLanguages" + } + }, + "/api/apps/jobs/{id}": { + "get": { + "tags": [ + "Jobs" + ], + "summary": "Get the job content.", + "operationId": "JobsContent_GetJobContent", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the job.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "appId", + "in": "query", + "description": "The ID of the app.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Job found and content returned.", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "Job or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getJobContent" + } + }, + "/api/apps/$app$/jobs": { + "get": { + "tags": [ + "Jobs" + ], + "summary": "Get all jobs.", + "operationId": "Jobs_GetJobs", + "responses": { + "200": { + "description": "Jobs returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/JobsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getJobs" + } + }, + "/api/apps/$app$/jobs/{id}": { + "delete": { + "tags": [ + "Jobs" + ], + "summary": "Delete a job.", + "operationId": "Jobs_DeleteJob", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the jobs to delete.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "204": { + "description": "Job deleted." + }, + "404": { + "description": "Job or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteJob" + } + }, + "/api/apps/$app$/history": { + "get": { + "tags": [ + "History" + ], + "summary": "Get the app history.", + "operationId": "History_GetAppHistory", + "parameters": [ + { + "name": "channel", + "in": "query", + "description": "The name of the channel.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Events returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HistoryEventDto" + } + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getAppHistory" + } + }, + "/api/teams/{team}/history": { + "get": { + "tags": [ + "History" + ], + "summary": "Get the team history.", + "operationId": "History_GetTeamHistory", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "channel", + "in": "query", + "description": "The name of the channel.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Events returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/HistoryEventDto" + } + } + } + } + }, + "404": { + "description": "Team not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getTeamHistory" + } + }, + "/api/event-consumers": { + "get": { + "tags": [ + "EventConsumers" + ], + "summary": "Get event consumers.", + "operationId": "EventConsumers_GetEventConsumers", + "responses": { + "200": { + "description": "Event consumers returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EventConsumersDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "security": [ + { + "squidex-oauth-auth": [ + "squidex.admin.events.read" + ] + } + ], + "x-method-name": "getEventConsumers" + } + }, + "/api/event-consumers/{consumerName}/start": { + "put": { + "tags": [ + "EventConsumers" + ], + "summary": "Start an event consumer.", + "operationId": "EventConsumers_StartEventConsumer", + "parameters": [ + { + "name": "consumerName", + "in": "path", + "required": true, + "description": "The name of the event consumer.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Event consumer started asynchronously.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EventConsumerDto" + } + } + } + }, + "404": { + "description": "Event consumer not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "startEventConsumer" + } + }, + "/api/event-consumers/{consumerName}/stop": { + "put": { + "tags": [ + "EventConsumers" + ], + "summary": "Stop an event consumer.", + "operationId": "EventConsumers_StopEventConsumer", + "parameters": [ + { + "name": "consumerName", + "in": "path", + "required": true, + "description": "The name of the event consumer.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Event consumer stopped asynchronously.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EventConsumerDto" + } + } + } + }, + "404": { + "description": "Event consumer not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "stopEventConsumer" + } + }, + "/api/event-consumers/{consumerName}/reset": { + "put": { + "tags": [ + "EventConsumers" + ], + "summary": "Reset an event consumer.", + "operationId": "EventConsumers_ResetEventConsumer", + "parameters": [ + { + "name": "consumerName", + "in": "path", + "required": true, + "description": "The name of the event consumer.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Event consumer resetted asynchronously.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EventConsumerDto" + } + } + } + }, + "404": { + "description": "Event consumer not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "resetEventConsumer" + } + }, + "/api/diagnostics/dump": { + "get": { + "tags": [ + "Diagnostics" + ], + "summary": "Creates a dump and writes it into storage..", + "operationId": "Diagnostics_GetDump", + "responses": { + "204": { + "description": "Dump created successful." + }, + "501": { + "description": "Not configured.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "security": [ + { + "squidex-oauth-auth": [ + "squidex.admin.*" + ] + } + ], + "x-method-name": "getDump" + } + }, + "/api/diagnostics/gcdump": { + "get": { + "tags": [ + "Diagnostics" + ], + "summary": "Creates a gc dump and writes it into storage.", + "operationId": "Diagnostics_GetGCDump", + "responses": { + "204": { + "description": "Dump created successful." + }, + "501": { + "description": "Not configured.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "security": [ + { + "squidex-oauth-auth": [ + "squidex.admin.*" + ] + } + ], + "x-method-name": "getGCDump" + } + }, + "/api/content/$app$/{schema}": { + "get": { + "tags": [ + "Contents" + ], + "summary": "Queries contents.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_GetContents", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "ids", + "in": "query", + "description": "The optional ids of the content to fetch.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 2 + }, + { + "name": "q", + "in": "query", + "description": "The optional json query.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "$search", + "in": "query", + "description": "Optional number of items to skip.", + "schema": { + "type": "string" + }, + "x-position": 4 + }, + { + "name": "$top", + "in": "query", + "description": "Optional number of items to take.", + "schema": { + "type": "number" + }, + "x-position": 5 + }, + { + "name": "$skip", + "in": "query", + "description": "Optional number of items to skip.", + "schema": { + "type": "number" + }, + "x-position": 6 + }, + { + "name": "$orderby", + "in": "query", + "description": "Optional OData order definition.", + "schema": { + "type": "string" + }, + "x-position": 7 + }, + { + "name": "$filter", + "in": "query", + "description": "Optional OData filter.", + "schema": { + "type": "string" + }, + "x-position": 8 + }, + { + "name": "fields", + "in": "header", + "description": "The list of content fields (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 9, + "x-header-name": "X-Fields" + }, + { + "name": "flatten", + "in": "header", + "description": "Provide the data as flat object.", + "schema": { + "type": "boolean" + }, + "x-position": 10, + "x-header-name": "X-Flatten" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 11, + "x-header-name": "X-Languages" + }, + { + "name": "noSlowTotal", + "in": "header", + "description": "Do not return the total amount, if it would be slow.", + "schema": { + "type": "boolean" + }, + "x-position": 12, + "x-header-name": "X-NoSlowTotal" + }, + { + "name": "noTotal", + "in": "header", + "description": "Do not return the total amount.", + "schema": { + "type": "boolean" + }, + "x-position": 13, + "x-header-name": "X-NoTotal" + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 14, + "x-header-name": "X-Unpublished" + } + ], + "responses": { + "200": { + "description": "Contents returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentsDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getContents" + }, + "post": { + "tags": [ + "Contents" + ], + "summary": "Create a content item.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_PostContent", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "status", + "in": "query", + "description": "The initial status.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "id", + "in": "query", + "description": "The optional custom content id.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 4 + }, + { + "name": "publish", + "in": "query", + "description": "True to automatically publish the content.", + "schema": { + "type": "boolean" + }, + "x-position": 5 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 6, + "x-header-name": "X-Unpublished" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 7, + "x-header-name": "X-Languages" + } + ], + "requestBody": { + "x-name": "Data", + "description": "The full data for the content item.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentData" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "201": { + "description": "Content created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentDto" + } + } + } + }, + "400": { + "description": "Content request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postContent" + } + }, + "/api/content/$app$/{schema}/query": { + "post": { + "tags": [ + "Contents" + ], + "summary": "Queries contents.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_GetContentsPost", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "fields", + "in": "header", + "description": "The list of content fields (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 3, + "x-header-name": "X-Fields" + }, + { + "name": "flatten", + "in": "header", + "description": "Provide the data as flat object.", + "schema": { + "type": "boolean" + }, + "x-position": 4, + "x-header-name": "X-Flatten" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 5, + "x-header-name": "X-Languages" + }, + { + "name": "noSlowTotal", + "in": "header", + "description": "Do not return the total amount, if it would be slow.", + "schema": { + "type": "boolean" + }, + "x-position": 6, + "x-header-name": "X-NoSlowTotal" + }, + { + "name": "noTotal", + "in": "header", + "description": "Do not return the total amount.", + "schema": { + "type": "boolean" + }, + "x-position": 7, + "x-header-name": "X-NoTotal" + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 8, + "x-header-name": "X-Unpublished" + } + ], + "requestBody": { + "x-name": "query", + "description": "The required query object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "Contents returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentsDto" + } + } + } + }, + "404": { + "description": "Schema or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getContentsPost" + } + }, + "/api/content/$app$/{schema}/{id}": { + "get": { + "tags": [ + "Contents" + ], + "summary": "Get a content item.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_GetContent", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content to fetch.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "version", + "in": "query", + "description": "The optional version.", + "schema": { + "type": "integer", + "format": "int64", + "default": -2 + }, + "x-position": 3 + }, + { + "name": "fields", + "in": "header", + "description": "The list of content fields (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 4, + "x-header-name": "X-Fields" + }, + { + "name": "flatten", + "in": "header", + "description": "Provide the data as flat object.", + "schema": { + "type": "boolean" + }, + "x-position": 5, + "x-header-name": "X-Flatten" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 6, + "x-header-name": "X-Languages" + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 7, + "x-header-name": "X-Unpublished" + } + ], + "responses": { + "200": { + "description": "Content returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getContent" + }, + "post": { + "tags": [ + "Contents" + ], + "summary": "Upsert a content item.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_PostUpsertContent", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content item to update.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "status", + "in": "query", + "description": "The initial status.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 4 + }, + { + "name": "patch", + "in": "query", + "description": "Makes the update as patch.", + "schema": { + "type": "boolean" + }, + "x-position": 5 + }, + { + "name": "enrichDefaults", + "in": "query", + "description": "Enrich the content with defaults.", + "schema": { + "type": "boolean" + }, + "x-position": 6 + }, + { + "name": "publish", + "in": "query", + "description": "True to automatically publish the content.", + "schema": { + "type": "boolean" + }, + "x-position": 7 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 8, + "x-header-name": "X-Unpublished" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 9, + "x-header-name": "X-Languages" + } + ], + "requestBody": { + "x-name": "Data", + "description": "The full data for the content item.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentData" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Content created or updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentDto" + } + } + } + }, + "400": { + "description": "Content request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Content references, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postUpsertContent" + }, + "put": { + "tags": [ + "Contents" + ], + "summary": "Update a content item.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_PutContent", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content item to update.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "enrichDefaults", + "in": "query", + "description": "Enrich the content with defaults.", + "schema": { + "type": "boolean" + }, + "x-position": 4 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 5, + "x-header-name": "X-Unpublished" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 6, + "x-header-name": "X-Languages" + } + ], + "requestBody": { + "x-name": "Data", + "description": "The full data for the content item.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentData" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Content updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentDto" + } + } + } + }, + "400": { + "description": "Content request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Content references, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putContent" + }, + "patch": { + "tags": [ + "Contents" + ], + "summary": "Patchs a content item.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_PatchContent", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content item to patch.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 4, + "x-header-name": "X-Unpublished" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 5, + "x-header-name": "X-Languages" + } + ], + "requestBody": { + "x-name": "request", + "description": "The patch for the content item.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentData" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Content patched.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentDto" + } + } + } + }, + "400": { + "description": "Content request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "patchContent" + }, + "delete": { + "tags": [ + "Contents" + ], + "summary": "Delete a content item.", + "description": "You can create an generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_DeleteContent", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content item to delete.", + "schema": { + "type": "string" + }, + "x-position": 3 + }, + { + "name": "checkReferrers", + "in": "query", + "description": "True to check referrers of this content.", + "schema": { + "type": "boolean" + }, + "x-position": 4 + }, + { + "name": "permanent", + "in": "query", + "description": "True to delete the content permanently.", + "schema": { + "type": "boolean" + }, + "x-position": 5 + } + ], + "responses": { + "204": { + "description": "Content deleted." + }, + "400": { + "description": "Content cannot be deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteContent" + } + }, + "/api/content/$app$/{schema}/{id}/validity": { + "get": { + "tags": [ + "Contents" + ], + "summary": "Get a content item validity.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_GetContentValidity", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content to fetch.", + "schema": { + "type": "string" + }, + "x-position": 3 + } + ], + "responses": { + "204": { + "description": "Content is valid." + }, + "400": { + "description": "Content not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getContentValidity" + } + }, + "/api/content/$app$/{schema}/{id}/references": { + "get": { + "tags": [ + "Contents" + ], + "summary": "Get all references of a content.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_GetReferences", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content to fetch.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "q", + "in": "query", + "description": "The optional json query.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "fields", + "in": "header", + "description": "The list of content fields (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 4, + "x-header-name": "X-Fields" + }, + { + "name": "flatten", + "in": "header", + "description": "Provide the data as flat object.", + "schema": { + "type": "boolean" + }, + "x-position": 5, + "x-header-name": "X-Flatten" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 6, + "x-header-name": "X-Languages" + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 7, + "x-header-name": "X-Unpublished" + }, + { + "name": "noSlowTotal", + "in": "header", + "description": "Do not return the total amount, if it would be slow.", + "schema": { + "type": "boolean" + }, + "x-position": 8, + "x-header-name": "X-NoSlowTotal" + }, + { + "name": "noTotal", + "in": "header", + "description": "Do not return the total amount.", + "schema": { + "type": "boolean" + }, + "x-position": 9, + "x-header-name": "X-NoTotal" + } + ], + "responses": { + "200": { + "description": "Contents returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentsDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getReferences" + } + }, + "/api/content/$app$/{schema}/{id}/referencing": { + "get": { + "tags": [ + "Contents" + ], + "summary": "Get a referencing contents of a content item.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_GetReferencing", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content to fetch.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "q", + "in": "query", + "description": "The optional json query.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "fields", + "in": "header", + "description": "The list of content fields (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 4, + "x-header-name": "X-Fields" + }, + { + "name": "flatten", + "in": "header", + "description": "Provide the data as flat object.", + "schema": { + "type": "boolean" + }, + "x-position": 5, + "x-header-name": "X-Flatten" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 6, + "x-header-name": "X-Languages" + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 7, + "x-header-name": "X-Unpublished" + }, + { + "name": "noSlowTotal", + "in": "header", + "description": "Do not return the total amount, if it would be slow.", + "schema": { + "type": "boolean" + }, + "x-position": 8, + "x-header-name": "X-NoSlowTotal" + }, + { + "name": "noTotal", + "in": "header", + "description": "Do not return the total amount.", + "schema": { + "type": "boolean" + }, + "x-position": 9, + "x-header-name": "X-NoTotal" + } + ], + "responses": { + "200": { + "description": "Content returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentsDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getReferencing" + } + }, + "/api/content/$app$/{schema}/{id}/{version}": { + "get": { + "tags": [ + "Contents" + ], + "summary": "Get a content by version.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_GetContentVersion", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content to fetch.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "version", + "in": "path", + "required": true, + "description": "The version fo the content to fetch.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 3 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 4, + "x-header-name": "X-Unpublished" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 5, + "x-header-name": "X-Languages" + } + ], + "responses": { + "200": { + "description": "Content version returned.", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "deprecated": true, + "x-method-name": "getContentVersion" + } + }, + "/api/content/$app$/{schema}/import": { + "post": { + "tags": [ + "Contents" + ], + "summary": "Import content items.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_PostContents", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The import request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImportContentsDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Contents created.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BulkResultDto" + } + } + } + } + }, + "400": { + "description": "Content request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Content references, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "deprecated": true, + "x-method-name": "postContents" + } + }, + "/api/content/$app$/{schema}/bulk": { + "post": { + "tags": [ + "Contents" + ], + "summary": "Bulk update content items.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_BulkUpdateContents", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The bulk update request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkUpdateContentsDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BulkResultDto" + } + } + } + } + }, + "400": { + "description": "Contents request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Contents references, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "bulkUpdateContents" + } + }, + "/api/content/$app$/{schema}/{id}/defaults": { + "put": { + "tags": [ + "Contents" + ], + "summary": "Enrich a content item with defaults.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_PutContentDefaults", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content item to update.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "enrichRequiredFields", + "in": "query", + "description": "True, to also enrich required fields. Default: false.\n ", + "schema": { + "type": "boolean" + }, + "x-position": 3 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 4, + "x-header-name": "X-Unpublished" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 5, + "x-header-name": "X-Languages" + } + ], + "responses": { + "200": { + "description": "Content updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentDto" + } + } + } + }, + "404": { + "description": "Content references, schema or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putContentDefaults" + } + }, + "/api/content/$app$/{schema}/{id}/status": { + "put": { + "tags": [ + "Contents" + ], + "summary": "Change status of a content item.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_PutContentStatus", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content item to change.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 4, + "x-header-name": "X-Unpublished" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 5, + "x-header-name": "X-Languages" + } + ], + "requestBody": { + "x-name": "request", + "description": "The status request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ChangeStatusDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Content status changed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentDto" + } + } + } + }, + "400": { + "description": "Content request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putContentStatus" + }, + "delete": { + "tags": [ + "Contents" + ], + "summary": "Cancel status change of a content item.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_DeleteContentStatus", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content item to cancel.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 3, + "x-header-name": "X-Unpublished" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 4, + "x-header-name": "X-Languages" + } + ], + "responses": { + "200": { + "description": "Content status change cancelled.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentDto" + } + } + } + }, + "400": { + "description": "Content request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteContentStatus" + } + }, + "/api/content/$app$/{schema}/{id}/draft": { + "post": { + "tags": [ + "Contents" + ], + "summary": "Create a new draft version.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_CreateDraft", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content item to create the draft for.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 3, + "x-header-name": "X-Unpublished" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 4, + "x-header-name": "X-Languages" + } + ], + "responses": { + "200": { + "description": "Content draft created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "createDraft" + }, + "delete": { + "tags": [ + "Contents" + ], + "summary": "Delete the draft version.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "Contents_DeleteVersion", + "parameters": [ + { + "name": "schema", + "in": "path", + "required": true, + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the content item to delete the draft from.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 3, + "x-header-name": "X-Unpublished" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 4, + "x-header-name": "X-Languages" + } + ], + "responses": { + "200": { + "description": "Content draft deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentDto" + } + } + } + }, + "404": { + "description": "Content, schema or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteVersion" + } + }, + "/api/content/$app$/graphql": { + "get": { + "tags": [ + "Contents" + ], + "summary": "GraphQL endpoint.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "ContentsShared_GetGraphQL", + "parameters": [ + { + "name": "The query string", + "in": "query", + "description": "The optional version of the asset.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "variables", + "in": "query", + "description": "The optional operation variables.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 2 + }, + { + "name": "operationName", + "in": "query", + "description": "The optional operation name.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 4, + "x-header-name": "X-Unpublished" + } + ], + "responses": { + "200": { + "description": "Contents returned or mutated.", + "content": { + "application/json": { + "schema": {} + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getGraphQL" + }, + "post": { + "tags": [ + "Contents" + ], + "summary": "GraphQL endpoint.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "ContentsShared_PostGraphQL", + "parameters": [ + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 2, + "x-header-name": "X-Unpublished" + } + ], + "requestBody": { + "x-name": "request", + "description": "The graphql request.", + "content": { + "application/json": { + "schema": {} + } + }, + "x-position": 1 + }, + "responses": { + "200": { + "description": "Contents returned or mutated.", + "content": { + "application/json": { + "schema": {} + } + } + }, + "404": { + "description": "App not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postGraphQL" + } + }, + "/api/content/$app$/graphql/batch": { + "get": { + "tags": [ + "Contents" + ], + "summary": "GraphQL batch endpoint.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "ContentsShared_GetGraphQLBatch", + "parameters": [ + { + "name": "The query string", + "in": "query", + "description": "The optional version of the asset.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "variables", + "in": "query", + "description": "The optional operation variables.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 2 + }, + { + "name": "operationName", + "in": "query", + "description": "The optional operation name.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 4, + "x-header-name": "X-Unpublished" + } + ], + "responses": { + "200": { + "description": "Contents returned or mutated.", + "content": { + "application/json": { + "schema": {} + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getGraphQLBatch" + }, + "post": { + "tags": [ + "Contents" + ], + "summary": "GraphQL batch endpoint.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "ContentsShared_PostGraphQLBatch", + "parameters": [ + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 2, + "x-header-name": "X-Unpublished" + } + ], + "requestBody": { + "x-name": "request", + "description": "The graphql request.", + "content": { + "application/json": { + "schema": {} + } + }, + "x-position": 1 + }, + "responses": { + "200": { + "description": "Contents returned or mutated.", + "content": { + "application/json": { + "schema": {} + } + } + }, + "404": { + "description": "App not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postGraphQLBatch" + } + }, + "/api/content/$app$": { + "get": { + "tags": [ + "Contents" + ], + "summary": "Queries contents.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "ContentsShared_GetAllContents", + "parameters": [ + { + "name": "ids", + "in": "query", + "description": "The list of ids to query.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 1 + }, + { + "name": "scheduleFrom", + "in": "query", + "description": "The start of the schedule.", + "schema": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "x-position": 2 + }, + { + "name": "scheduleTo", + "in": "query", + "description": "The end of the schedule.", + "schema": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "referencing", + "in": "query", + "description": "The ID of the referencing content item.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 4 + }, + { + "name": "references", + "in": "query", + "description": "The ID of the reference content item.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 5 + }, + { + "name": "q", + "in": "query", + "description": "The optional json query.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 6 + }, + { + "name": "fields", + "in": "header", + "description": "The list of content fields (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 7, + "x-header-name": "X-Fields" + }, + { + "name": "flatten", + "in": "header", + "description": "Provide the data as flat object.", + "schema": { + "type": "boolean" + }, + "x-position": 8, + "x-header-name": "X-Flatten" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 9, + "x-header-name": "X-Languages" + }, + { + "name": "noSlowTotal", + "in": "header", + "description": "Do not return the total amount, if it would be slow.", + "schema": { + "type": "boolean" + }, + "x-position": 10, + "x-header-name": "X-NoSlowTotal" + }, + { + "name": "noTotal", + "in": "header", + "description": "Do not return the total amount.", + "schema": { + "type": "boolean" + }, + "x-position": 11, + "x-header-name": "X-NoTotal" + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 12, + "x-header-name": "X-Unpublished" + } + ], + "responses": { + "200": { + "description": "Contents returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getAllContents" + }, + "post": { + "tags": [ + "Contents" + ], + "summary": "Queries contents.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "ContentsShared_GetAllContentsPost", + "parameters": [ + { + "name": "fields", + "in": "header", + "description": "The list of content fields (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 2, + "x-header-name": "X-Fields" + }, + { + "name": "flatten", + "in": "header", + "description": "Provide the data as flat object.", + "schema": { + "type": "boolean" + }, + "x-position": 3, + "x-header-name": "X-Flatten" + }, + { + "name": "languages", + "in": "header", + "description": "The list of languages to resolve (comma-separated).", + "schema": { + "type": "string" + }, + "x-position": 4, + "x-header-name": "X-Languages" + }, + { + "name": "noSlowTotal", + "in": "header", + "description": "Do not return the total amount, if it would be slow.", + "schema": { + "type": "boolean" + }, + "x-position": 5, + "x-header-name": "X-NoSlowTotal" + }, + { + "name": "noTotal", + "in": "header", + "description": "Do not return the total amount.", + "schema": { + "type": "boolean" + }, + "x-position": 6, + "x-header-name": "X-NoTotal" + }, + { + "name": "unpublished", + "in": "header", + "description": "Return unpublished content items.", + "schema": { + "type": "boolean" + }, + "x-position": 7, + "x-header-name": "X-Unpublished" + } + ], + "requestBody": { + "x-name": "query", + "description": "The required query object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AllContentsByPostDto" + } + } + }, + "required": true, + "x-position": 1 + }, + "responses": { + "200": { + "description": "Contents returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContentsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getAllContentsPost" + } + }, + "/api/content/$app$/bulk": { + "post": { + "tags": [ + "Contents" + ], + "summary": "Bulk update content items.", + "description": "You can read the generated documentation for your app at /api/content/{appName}/docs.", + "operationId": "ContentsShared_BulkUpdateAllContents", + "parameters": [ + { + "name": "schema", + "in": "query", + "description": "The name of the schema.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The bulk update request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkUpdateContentsDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BulkResultDto" + } + } + } + } + }, + "400": { + "description": "Contents request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Contents references, schema or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "bulkUpdateAllContents" + } + }, + "/api/apps/$app$/backups/{id}": { + "get": { + "tags": [ + "Backups" + ], + "summary": "Get the backup content.", + "operationId": "BackupContent_GetBackupContent", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the backup.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Backup found and content returned.", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "Backup or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "deprecated": true, + "x-method-name": "getBackupContent" + }, + "delete": { + "tags": [ + "Backups" + ], + "summary": "Delete a backup.", + "operationId": "Backups_DeleteBackup", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the backup to delete.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "204": { + "description": "Backup deleted." + }, + "404": { + "description": "Backup or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "deprecated": true, + "x-method-name": "deleteBackup" + } + }, + "/api/apps/backups/{id}": { + "get": { + "tags": [ + "Backups" + ], + "summary": "Get the backup content.", + "operationId": "BackupContent_GetBackupContentV2", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the backup.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "appId", + "in": "query", + "description": "The ID of the app.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "app", + "in": "query", + "description": "The name of the app.", + "schema": { + "type": "string", + "default": "" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Backup found and content returned.", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "Backup or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "deprecated": true, + "x-method-name": "getBackupContentV2" + } + }, + "/api/apps/$app$/backups": { + "get": { + "tags": [ + "Backups" + ], + "summary": "Get all backup jobs.", + "operationId": "Backups_GetBackups", + "responses": { + "200": { + "description": "Backups returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BackupJobsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "deprecated": true, + "x-method-name": "getBackups" + }, + "post": { + "tags": [ + "Backups" + ], + "summary": "Start a new backup.", + "operationId": "Backups_PostBackup", + "responses": { + "204": { + "description": "Backup started." + }, + "400": { + "description": "Backup contingent reached.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postBackup" + } + }, + "/api/apps/restore": { + "get": { + "tags": [ + "Backups" + ], + "summary": "Get current restore status.", + "operationId": "Restore_GetRestoreJob", + "responses": { + "200": { + "description": "Status returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RestoreJobDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "security": [ + { + "squidex-oauth-auth": [ + "squidex.admin.restore" + ] + } + ], + "x-method-name": "getRestoreJob" + }, + "post": { + "tags": [ + "Backups" + ], + "summary": "Restore a backup.", + "operationId": "Restore_PostRestoreJob", + "requestBody": { + "x-name": "request", + "description": "The backup to restore.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RestoreRequestDto" + } + } + }, + "required": true, + "x-position": 1 + }, + "responses": { + "204": { + "description": "Restore operation started." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postRestoreJob" + } + }, + "/api/assets/$app$/{idOrSlug}/": { + "get": { + "tags": [ + "Assets" + ], + "summary": "Get the asset content.", + "operationId": "AssetContent_GetAssetContentBySlug", + "parameters": [ + { + "name": "idOrSlug", + "in": "path", + "required": true, + "description": "The id or slug of the asset.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "version", + "in": "query", + "description": "The optional version of the asset.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + }, + { + "name": "cache", + "in": "query", + "description": "The cache duration in seconds.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 4 + }, + { + "name": "download", + "in": "query", + "description": "Set it to 0 to prevent download.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 5 + }, + { + "name": "width", + "in": "query", + "description": "The target width of the asset, if it is an image.", + "schema": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "x-position": 6 + }, + { + "name": "height", + "in": "query", + "description": "The target height of the asset, if it is an image.", + "schema": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "x-position": 7 + }, + { + "name": "quality", + "in": "query", + "description": "Optional image quality, it is is an jpeg image.", + "schema": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "x-position": 8 + }, + { + "name": "mode", + "in": "query", + "description": "The resize mode when the width and height is defined.", + "schema": { + "nullable": true, + "$ref": "#/components/schemas/ResizeMode" + }, + "x-position": 9 + }, + { + "name": "bg", + "in": "query", + "description": "Optional background color.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 10 + }, + { + "name": "focusX", + "in": "query", + "description": "Override the y focus point.", + "schema": { + "type": "number", + "format": "float", + "nullable": true + }, + "x-position": 11 + }, + { + "name": "focusY", + "in": "query", + "description": "Override the x focus point.", + "schema": { + "type": "number", + "format": "float", + "nullable": true + }, + "x-position": 12 + }, + { + "name": "nofocus", + "in": "query", + "description": "True to ignore the asset focus point if any.", + "schema": { + "type": "boolean" + }, + "x-position": 13 + }, + { + "name": "auto", + "in": "query", + "description": "True to use auto format.", + "schema": { + "type": "boolean" + }, + "x-position": 14 + }, + { + "name": "force", + "in": "query", + "description": "True to force a new resize even if it already stored.", + "schema": { + "type": "boolean" + }, + "x-position": 15 + }, + { + "name": "deleted", + "in": "query", + "description": "Also return deleted content items.", + "schema": { + "type": "boolean" + }, + "x-position": 16 + }, + { + "name": "format", + "in": "query", + "description": "True to force a new resize even if it already stored.", + "schema": { + "nullable": true, + "$ref": "#/components/schemas/ImageFormat" + }, + "x-position": 17 + } + ], + "responses": { + "200": { + "description": "Asset found and content or (resized) image returned.", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "Asset or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getAssetContentBySlug" + } + }, + "/api/assets/{id}": { + "get": { + "tags": [ + "Assets" + ], + "summary": "Get the asset content.", + "operationId": "AssetContent_GetAssetContent", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the asset.", + "schema": { + "type": "string" + }, + "x-position": 1 + }, + { + "name": "version", + "in": "query", + "description": "The optional version of the asset.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 2 + }, + { + "name": "cache", + "in": "query", + "description": "The cache duration in seconds.", + "schema": { + "type": "integer", + "format": "int64" + }, + "x-position": 3 + }, + { + "name": "download", + "in": "query", + "description": "Set it to 0 to prevent download.", + "schema": { + "type": "integer", + "format": "int32" + }, + "x-position": 4 + }, + { + "name": "width", + "in": "query", + "description": "The target width of the asset, if it is an image.", + "schema": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "x-position": 5 + }, + { + "name": "height", + "in": "query", + "description": "The target height of the asset, if it is an image.", + "schema": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "x-position": 6 + }, + { + "name": "quality", + "in": "query", + "description": "Optional image quality, it is is an jpeg image.", + "schema": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "x-position": 7 + }, + { + "name": "mode", + "in": "query", + "description": "The resize mode when the width and height is defined.", + "schema": { + "nullable": true, + "$ref": "#/components/schemas/ResizeMode" + }, + "x-position": 8 + }, + { + "name": "bg", + "in": "query", + "description": "Optional background color.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 9 + }, + { + "name": "focusX", + "in": "query", + "description": "Override the y focus point.", + "schema": { + "type": "number", + "format": "float", + "nullable": true + }, + "x-position": 10 + }, + { + "name": "focusY", + "in": "query", + "description": "Override the x focus point.", + "schema": { + "type": "number", + "format": "float", + "nullable": true + }, + "x-position": 11 + }, + { + "name": "nofocus", + "in": "query", + "description": "True to ignore the asset focus point if any.", + "schema": { + "type": "boolean" + }, + "x-position": 12 + }, + { + "name": "auto", + "in": "query", + "description": "True to use auto format.", + "schema": { + "type": "boolean" + }, + "x-position": 13 + }, + { + "name": "force", + "in": "query", + "description": "True to force a new resize even if it already stored.", + "schema": { + "type": "boolean" + }, + "x-position": 14 + }, + { + "name": "deleted", + "in": "query", + "description": "Also return deleted content items.", + "schema": { + "type": "boolean" + }, + "x-position": 15 + }, + { + "name": "format", + "in": "query", + "description": "True to force a new resize even if it already stored.", + "schema": { + "nullable": true, + "$ref": "#/components/schemas/ImageFormat" + }, + "x-position": 16 + } + ], + "responses": { + "200": { + "description": "Asset found and content or (resized) image returned.", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "Asset or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "deprecated": true, + "x-method-name": "getAssetContent" + } + }, + "/api/apps/$app$/assets/folders": { + "get": { + "tags": [ + "Assets" + ], + "summary": "Get asset folders.", + "description": "Get all asset folders for the app.", + "operationId": "AssetFolders_GetAssetFolders", + "parameters": [ + { + "name": "parentId", + "in": "query", + "description": "The optional parent folder id.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 2 + }, + { + "name": "scope", + "in": "query", + "description": "The scope of the query.", + "schema": { + "default": "PathAndItems", + "$ref": "#/components/schemas/AssetFolderScope" + }, + "x-position": 3 + } + ], + "responses": { + "200": { + "description": "Asset folders returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetFoldersDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getAssetFolders" + }, + "post": { + "tags": [ + "Assets" + ], + "summary": "Create an asset folder.", + "operationId": "AssetFolders_PostAssetFolder", + "requestBody": { + "x-name": "request", + "description": "The asset folder object that needs to be added to the App.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAssetFolderDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "201": { + "description": "Asset folder created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetFolderDto" + } + } + } + }, + "400": { + "description": "Asset folder request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postAssetFolder" + } + }, + "/api/apps/$app$/assets/folders/{id}": { + "put": { + "tags": [ + "Assets" + ], + "summary": "Update an asset folder.", + "operationId": "AssetFolders_PutAssetFolder", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the asset folder.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The asset folder object that needs to updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RenameAssetFolderDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Asset folder updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetFolderDto" + } + } + } + }, + "400": { + "description": "Asset folder request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Asset folder or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putAssetFolder" + }, + "delete": { + "tags": [ + "Assets" + ], + "summary": "Delete an asset folder.", + "operationId": "AssetFolders_DeleteAssetFolder", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the asset folder to delete.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "204": { + "description": "Asset folder deleted." + }, + "404": { + "description": "Asset folder or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteAssetFolder" + } + }, + "/api/apps/$app$/assets/folders/{id}/parent": { + "put": { + "tags": [ + "Assets" + ], + "summary": "Move an asset folder.", + "operationId": "AssetFolders_PutAssetFolderParent", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the asset folder.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The asset folder object that needs to updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MoveAssetFolderDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Asset folder moved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetFolderDto" + } + } + } + }, + "400": { + "description": "Asset folder request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Asset folder or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putAssetFolderParent" + } + }, + "/api/apps/$app$/assets/tags": { + "get": { + "tags": [ + "Assets" + ], + "summary": "Get assets tags.", + "description": "Get all tags for assets.", + "operationId": "Assets_GetTags", + "responses": { + "200": { + "description": "Assets tags returned.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int32" + } + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getTags" + } + }, + "/api/apps/$app$/assets/tags/{name}": { + "put": { + "tags": [ + "Assets" + ], + "summary": "Rename an asset tag.", + "operationId": "Assets_PutTag", + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "description": "The tag to return.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The required request object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RenameTagDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Asset tag renamed and new tags returned.", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "int32" + } + } + } + } + }, + "404": { + "description": "App not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putTag" + } + }, + "/api/apps/$app$/assets": { + "get": { + "tags": [ + "Assets" + ], + "summary": "Get assets.", + "description": "Get all assets for the app.", + "operationId": "Assets_GetAssets", + "parameters": [ + { + "name": "parentId", + "in": "query", + "description": "The optional parent folder id.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 1 + }, + { + "name": "ids", + "in": "query", + "description": "The optional asset ids.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 2 + }, + { + "name": "q", + "in": "query", + "description": "The optional json query.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "$top", + "in": "query", + "description": "Optional number of items to take.", + "schema": { + "type": "number" + }, + "x-position": 4 + }, + { + "name": "$skip", + "in": "query", + "description": "Optional number of items to skip.", + "schema": { + "type": "number" + }, + "x-position": 5 + }, + { + "name": "$orderby", + "in": "query", + "description": "Optional OData order definition.", + "schema": { + "type": "string" + }, + "x-position": 6 + }, + { + "name": "$filter", + "in": "query", + "description": "Optional OData filter.", + "schema": { + "type": "string" + }, + "x-position": 7 + }, + { + "name": "noTotal", + "in": "header", + "description": "Do not return the total amount.", + "schema": { + "type": "boolean" + }, + "x-position": 8, + "x-header-name": "X-NoTotal" + }, + { + "name": "noSlowTotal", + "in": "header", + "description": "Do not return the total amount, if it would be slow.", + "schema": { + "type": "boolean" + }, + "x-position": 9, + "x-header-name": "X-NoSlowTotal" + } + ], + "responses": { + "200": { + "description": "Assets returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getAssets" + }, + "post": { + "tags": [ + "Assets" + ], + "summary": "Upload a new asset.", + "description": "You can only upload one file at a time. The mime type of the file is not calculated by Squidex and is required correctly.", + "operationId": "Assets_PostAsset", + "parameters": [ + { + "name": "ParentId", + "in": "query", + "description": "The optional parent folder id.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "id", + "in": "query", + "description": "The optional custom asset id.", + "schema": { + "type": "string", + "nullable": true + }, + "x-position": 3 + }, + { + "name": "duplicate", + "in": "query", + "description": "True to duplicate the asset, event if the file has been uploaded.", + "schema": { + "type": "boolean" + }, + "x-position": 4 + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "file": { + "type": "string", + "format": "binary" + }, + "url": { + "type": "string" + }, + "name": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "201": { + "description": "Asset created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetDto" + } + } + } + }, + "400": { + "description": "Asset request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "413": { + "description": "Asset exceeds the maximum upload size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postAsset" + } + }, + "/api/apps/$app$/assets/query": { + "post": { + "tags": [ + "Assets" + ], + "summary": "Get assets.", + "description": "Get all assets for the app.", + "operationId": "Assets_GetAssetsPost", + "parameters": [ + { + "name": "noTotal", + "in": "header", + "description": "Do not return the total amount.", + "schema": { + "type": "boolean" + }, + "x-position": 2, + "x-header-name": "X-NoTotal" + }, + { + "name": "noSlowTotal", + "in": "header", + "description": "Do not return the total amount, if it would be slow.", + "schema": { + "type": "boolean" + }, + "x-position": 3, + "x-header-name": "X-NoSlowTotal" + } + ], + "requestBody": { + "x-name": "query", + "description": "The required query object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/QueryDto" + } + } + }, + "required": true, + "x-position": 1 + }, + "responses": { + "200": { + "description": "Assets returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getAssetsPost" + } + }, + "/api/apps/$app$/assets/{id}": { + "get": { + "tags": [ + "Assets" + ], + "summary": "Get an asset by id.", + "operationId": "Assets_GetAsset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the asset to retrieve.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Asset found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetDto" + } + } + } + }, + "404": { + "description": "Asset or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getAsset" + }, + "post": { + "tags": [ + "Assets" + ], + "summary": "Upsert an asset.", + "description": "You can only upload one file at a time. The mime type of the file is not calculated by Squidex and is required correctly.", + "operationId": "Assets_PostUpsertAsset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The optional custom asset id.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "parentId", + "in": "query", + "description": "The optional parent folder id.", + "schema": { + "type": "string" + }, + "x-position": 3 + }, + { + "name": "duplicate", + "in": "query", + "description": "True to duplicate the asset, event if the file has been uploaded.", + "schema": { + "type": "boolean" + }, + "x-position": 4 + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "file": { + "type": "string", + "format": "binary" + }, + "url": { + "type": "string" + }, + "name": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Asset created or updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetDto" + } + } + } + }, + "400": { + "description": "Asset request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "413": { + "description": "Asset exceeds the maximum upload size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postUpsertAsset" + }, + "put": { + "tags": [ + "Assets" + ], + "summary": "Update an asset.", + "operationId": "Assets_PutAsset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the asset.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The asset object that needs to updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AnnotateAssetDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Asset updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetDto" + } + } + } + }, + "400": { + "description": "Asset request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Asset or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putAsset" + }, + "delete": { + "tags": [ + "Assets" + ], + "summary": "Delete an asset.", + "operationId": "Assets_DeleteAsset", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the asset to delete.", + "schema": { + "type": "string" + }, + "x-position": 2 + }, + { + "name": "checkReferrers", + "in": "query", + "description": "True to check referrers of this asset.", + "schema": { + "type": "boolean" + }, + "x-position": 3 + }, + { + "name": "permanent", + "in": "query", + "description": "True to delete the asset permanently.", + "schema": { + "type": "boolean" + }, + "x-position": 4 + } + ], + "responses": { + "204": { + "description": "Asset deleted." + }, + "404": { + "description": "Asset or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteAsset" + } + }, + "/api/apps/$app$/assets/bulk": { + "post": { + "tags": [ + "Assets" + ], + "summary": "Bulk update assets.", + "operationId": "Assets_BulkUpdateAssets", + "requestBody": { + "x-name": "request", + "description": "The bulk update request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BulkUpdateAssetsDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "Assets created, update or delete.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BulkResultDto" + } + } + } + } + }, + "400": { + "description": "Assets request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "bulkUpdateAssets" + } + }, + "/api/apps/$app$/assets/{id}/content": { + "put": { + "tags": [ + "Assets" + ], + "summary": "Replace asset content.", + "description": "Use multipart request to upload an asset.", + "operationId": "Assets_PutAssetContent", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the asset.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "file": { + "type": "string", + "format": "binary" + }, + "url": { + "type": "string" + }, + "name": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Asset updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetDto" + } + } + } + }, + "400": { + "description": "Asset request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "413": { + "description": "Asset exceeds the maximum upload size.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Asset or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putAssetContent" + } + }, + "/api/apps/$app$/assets/{id}/parent": { + "put": { + "tags": [ + "Assets" + ], + "summary": "Moves the asset.", + "operationId": "Assets_PutAssetParent", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the asset.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The asset object that needs to updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MoveAssetDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Asset moved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetDto" + } + } + } + }, + "400": { + "description": "Asset request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Asset or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putAssetParent" + } + }, + "/api/apps/$app$/assets/scripts": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get the app asset scripts.", + "operationId": "AppAssets_GetAssetScripts", + "responses": { + "200": { + "description": "Asset scripts returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetScriptsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getAssetScripts" + }, + "put": { + "tags": [ + "Apps" + ], + "summary": "Update the asset scripts.", + "operationId": "AppAssets_PutAssetScripts", + "requestBody": { + "x-name": "request", + "description": "The values to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateAssetScriptsDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "Asset scripts updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetScriptsDto" + } + } + } + }, + "400": { + "description": "Asset request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putAssetScripts" + } + }, + "/api/apps/$app$/clients": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get app clients.", + "description": "Gets all configured clients for the app with the specified name.", + "operationId": "AppClients_GetClients", + "responses": { + "200": { + "description": "Clients returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getClients" + }, + "post": { + "tags": [ + "Apps" + ], + "summary": "Create a new app client.", + "description": "Create a new client for the app with the specified name.\nThe client secret is auto generated on the server and returned. The client does not expire, the access token is valid for 30 days.", + "operationId": "AppClients_PostClient", + "requestBody": { + "x-name": "request", + "description": "Client object that needs to be added to the app.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateClientDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "201": { + "description": "Client created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientsDto" + } + } + } + }, + "400": { + "description": "Client request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postClient" + } + }, + "/api/apps/$app$/clients/{id}": { + "put": { + "tags": [ + "Apps" + ], + "summary": "Updates an app client.", + "description": "Only the display name can be changed, create a new client if necessary.", + "operationId": "AppClients_PutClient", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the client that must be updated.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "Client object that needs to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateClientDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Client updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientsDto" + } + } + } + }, + "400": { + "description": "Client request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Client or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putClient" + }, + "delete": { + "tags": [ + "Apps" + ], + "summary": "Revoke an app client.", + "description": "The application that uses this client credentials cannot access the API after it has been revoked.", + "operationId": "AppClients_DeleteClient", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the client that must be deleted.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Client deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ClientsDto" + } + } + } + }, + "404": { + "description": "Client or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteClient" + } + }, + "/api/apps/$app$/contributors": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get app contributors.", + "operationId": "AppContributors_GetContributors", + "responses": { + "200": { + "description": "Contributors returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContributorsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getContributors" + }, + "post": { + "tags": [ + "Apps" + ], + "summary": "Assign contributor to app.", + "operationId": "AppContributors_PostContributor", + "requestBody": { + "x-name": "request", + "description": "Contributor object that needs to be added to the app.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssignContributorDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "201": { + "description": "Contributor assigned to app.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContributorsDto" + } + } + } + }, + "400": { + "description": "Contributor request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postContributor" + } + }, + "/api/apps/$app$/contributors/me": { + "delete": { + "tags": [ + "Apps" + ], + "summary": "Remove yourself.", + "operationId": "AppContributors_DeleteMyself", + "responses": { + "200": { + "description": "Contributor removed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContributorsDto" + } + } + } + }, + "404": { + "description": "Contributor or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteMyself" + } + }, + "/api/apps/$app$/contributors/{id}": { + "delete": { + "tags": [ + "Apps" + ], + "summary": "Remove contributor.", + "operationId": "AppContributors_DeleteContributor", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the contributor.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Contributor removed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ContributorsDto" + } + } + } + }, + "404": { + "description": "Contributor or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteContributor" + } + }, + "/api/apps/$app$/image": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get the app image.", + "operationId": "AppImage_GetImage", + "responses": { + "200": { + "description": "App image found and content or (resized) image returned.", + "content": { + "application/octet-stream": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getImage" + }, + "post": { + "tags": [ + "Apps" + ], + "summary": "Upload the app image.", + "operationId": "Apps_UploadImage", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "file": { + "type": "string", + "format": "binary" + }, + "url": { + "type": "string" + }, + "name": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "App image uploaded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppDto" + } + } + } + }, + "400": { + "description": "App request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "uploadImage" + }, + "delete": { + "tags": [ + "Apps" + ], + "summary": "Remove the app image.", + "operationId": "Apps_DeleteImage", + "responses": { + "200": { + "description": "App image removed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteImage" + } + }, + "/api/apps/$app$/languages": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get app languages.", + "operationId": "AppLanguages_GetLanguages", + "responses": { + "200": { + "description": "Languages returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppLanguagesDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getLanguages" + }, + "post": { + "tags": [ + "Apps" + ], + "summary": "Add an app language.", + "operationId": "AppLanguages_PostLanguage", + "requestBody": { + "x-name": "request", + "description": "The language to add to the app.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddLanguageDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "201": { + "description": "Language created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppLanguagesDto" + } + } + } + }, + "400": { + "description": "Language request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postLanguage" + } + }, + "/api/apps/$app$/languages/{language}": { + "put": { + "tags": [ + "Apps" + ], + "summary": "Updates an app language.", + "operationId": "AppLanguages_PutLanguage", + "parameters": [ + { + "name": "language", + "in": "path", + "required": true, + "description": "The language to update.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The language object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateLanguageDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Language updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppLanguagesDto" + } + } + } + }, + "400": { + "description": "Language request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Language or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putLanguage" + }, + "delete": { + "tags": [ + "Apps" + ], + "summary": "Deletes an app language.", + "operationId": "AppLanguages_DeleteLanguage", + "parameters": [ + { + "name": "language", + "in": "path", + "required": true, + "description": "The language to delete from the app.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Language deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppLanguagesDto" + } + } + } + }, + "400": { + "description": "Language is master language.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Language or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteLanguage" + } + }, + "/api/apps/$app$/roles": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get app roles.", + "operationId": "AppRoles_GetRoles", + "responses": { + "200": { + "description": "Roles returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RolesDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getRoles" + }, + "post": { + "tags": [ + "Apps" + ], + "summary": "Add role to app.", + "operationId": "AppRoles_PostRole", + "requestBody": { + "x-name": "request", + "description": "Role object that needs to be added to the app.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddRoleDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "201": { + "description": "Role created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RolesDto" + } + } + } + }, + "400": { + "description": "Role request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postRole" + } + }, + "/api/apps/$app$/roles/permissions": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get app permissions.", + "operationId": "AppRoles_GetPermissions", + "responses": { + "200": { + "description": "App permissions returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getPermissions" + } + }, + "/api/apps/$app$/roles/{roleName}": { + "put": { + "tags": [ + "Apps" + ], + "summary": "Update an app role.", + "operationId": "AppRoles_PutRole", + "parameters": [ + { + "name": "roleName", + "in": "path", + "required": true, + "description": "The name of the role to be updated.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "Role to be updated for the app.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateRoleDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Role updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RolesDto" + } + } + } + }, + "400": { + "description": "Role request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Role or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putRole" + }, + "delete": { + "tags": [ + "Apps" + ], + "summary": "Remove role from app.", + "operationId": "AppRoles_DeleteRole", + "parameters": [ + { + "name": "roleName", + "in": "path", + "required": true, + "description": "The name of the role.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Role deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RolesDto" + } + } + } + }, + "400": { + "description": "Role is in use by contributor or client or a default role.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Role or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteRole" + } + }, + "/api/apps": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get your apps.", + "description": "You can only retrieve the list of apps when you are authenticated as a user (OpenID implicit flow).\nYou will retrieve all apps, where you are assigned as a contributor.", + "operationId": "Apps_GetApps", + "responses": { + "200": { + "description": "Apps returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AppDto" + } + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "security": [ + { + "squidex-oauth-auth": [] + } + ], + "x-method-name": "getApps" + }, + "post": { + "tags": [ + "Apps" + ], + "summary": "Create a new app.", + "description": "You can only create an app when you are authenticated as a user (OpenID implicit flow).\nYou will be assigned as owner of the new app automatically.", + "operationId": "Apps_PostApp", + "requestBody": { + "x-name": "request", + "description": "The app object that needs to be added to Squidex.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateAppDto" + } + } + }, + "required": true, + "x-position": 1 + }, + "responses": { + "201": { + "description": "App created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppDto" + } + } + } + }, + "400": { + "description": "App request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "409": { + "description": "App name is already in use.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postApp" + } + }, + "/api/teams/{team}/apps": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get team apps.", + "description": "You can only retrieve the list of apps when you are authenticated as a user (OpenID implicit flow).\nYou will retrieve all apps, where you are assigned as a contributor.", + "operationId": "Apps_GetTeamApps", + "parameters": [ + { + "name": "team", + "in": "path", + "required": true, + "description": "The ID of the team.", + "schema": { + "type": "string" + }, + "x-position": 1 + } + ], + "responses": { + "200": { + "description": "Apps returned.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AppDto" + } + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getTeamApps" + } + }, + "/api/apps/$app$": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get an app by name.", + "operationId": "Apps_GetApp", + "responses": { + "200": { + "description": "Apps returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getApp" + }, + "put": { + "tags": [ + "Apps" + ], + "summary": "Update the app.", + "operationId": "Apps_PutApp", + "requestBody": { + "x-name": "request", + "description": "The values to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateAppDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "App updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppDto" + } + } + } + }, + "400": { + "description": "App request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putApp" + }, + "delete": { + "tags": [ + "Apps" + ], + "summary": "Delete the app.", + "operationId": "Apps_DeleteApp", + "responses": { + "204": { + "description": "App deleted." + }, + "404": { + "description": "App not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteApp" + } + }, + "/api/apps/$app$/team": { + "put": { + "tags": [ + "Apps" + ], + "summary": "Transfer the app.", + "operationId": "Apps_PutAppTeam", + "requestBody": { + "x-name": "request", + "description": "The team information.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransferToTeamDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "App transferred.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppDto" + } + } + } + }, + "400": { + "description": "App request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putAppTeam" + } + }, + "/api/apps/$app$/settings": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get the app settings.", + "operationId": "AppSettings_GetSettings", + "responses": { + "200": { + "description": "App settings returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppSettingsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getSettings" + }, + "put": { + "tags": [ + "Apps" + ], + "summary": "Update the settings.", + "operationId": "AppSettings_PutSettings", + "requestBody": { + "x-name": "request", + "description": "The values to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateAppSettingsDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "App updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AppSettingsDto" + } + } + } + }, + "400": { + "description": "App request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putSettings" + } + }, + "/api/apps/$app$/workflows": { + "get": { + "tags": [ + "Apps" + ], + "summary": "Get app workflow.", + "operationId": "AppWorkflows_GetWorkflows", + "responses": { + "200": { + "description": "Workflows returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowsDto" + } + } + } + }, + "404": { + "description": "App not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "getWorkflows" + }, + "post": { + "tags": [ + "Apps" + ], + "summary": "Create a workflow.", + "operationId": "AppWorkflows_PostWorkflow", + "requestBody": { + "x-name": "request", + "description": "The new workflow.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AddWorkflowDto" + } + } + }, + "required": true, + "x-position": 2 + }, + "responses": { + "200": { + "description": "Workflow created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowsDto" + } + } + } + }, + "400": { + "description": "Workflow request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Workflow or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "postWorkflow" + } + }, + "/api/apps/$app$/workflows/{id}": { + "put": { + "tags": [ + "Apps" + ], + "summary": "Update a workflow.", + "operationId": "AppWorkflows_PutWorkflow", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the workflow to update.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "requestBody": { + "x-name": "request", + "description": "The new workflow.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateWorkflowDto" + } + } + }, + "required": true, + "x-position": 3 + }, + "responses": { + "200": { + "description": "Workflow updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowsDto" + } + } + } + }, + "400": { + "description": "Workflow request not valid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "404": { + "description": "Workflow or app not found." + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "putWorkflow" + }, + "delete": { + "tags": [ + "Apps" + ], + "summary": "Delete a workflow.", + "operationId": "AppWorkflows_DeleteWorkflow", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "The ID of the workflow to update.", + "schema": { + "type": "string" + }, + "x-position": 2 + } + ], + "responses": { + "200": { + "description": "Workflow deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WorkflowsDto" + } + } + } + }, + "404": { + "description": "Workflow or app not found." + }, + "400": { + "description": "Validation error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + }, + "500": { + "description": "Operation failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ErrorDto" + } + } + } + } + }, + "x-method-name": "deleteWorkflow" + } + } + }, + "components": { + "schemas": { + "ErrorDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "message", + "statusCode" + ], + "properties": { + "message": { + "type": "string", + "description": "Error message.", + "minLength": 1 + }, + "errorCode": { + "type": "string", + "description": "The error code.", + "nullable": true + }, + "traceId": { + "type": "string", + "description": "The optional trace id.", + "nullable": true + }, + "type": { + "type": "string", + "description": "Link to the error details.", + "nullable": true + }, + "details": { + "type": "array", + "description": "Detailed error messages.", + "nullable": true, + "items": { + "type": "string" + } + }, + "statusCode": { + "type": "integer", + "description": "Status code of the http response.", + "format": "int32" + } + } + }, + "UserProperty": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "value" + ], + "properties": { + "name": { + "type": "string", + "minLength": 1 + }, + "value": { + "type": "string", + "minLength": 1 + } + } + }, + "UpdateSettingDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "value" + ], + "properties": { + "value": { + "description": "The value for the setting." + } + } + }, + "UsersDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "total", + "items" + ], + "properties": { + "total": { + "type": "integer", + "description": "The total number of users.", + "format": "int64" + }, + "items": { + "type": "array", + "description": "The users.", + "items": { + "$ref": "#/components/schemas/UserDto" + } + } + } + } + ] + }, + "UserDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "email", + "displayName", + "isLocked", + "permissions" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the user." + }, + "email": { + "type": "string", + "description": "The email of the user. Unique value." + }, + "displayName": { + "type": "string", + "description": "The display name (usually first name and last name) of the user." + }, + "isLocked": { + "type": "boolean", + "description": "Determines if the user is locked." + }, + "permissions": { + "type": "array", + "description": "Additional permissions for the user.", + "items": { + "type": "string" + } + } + } + } + ] + }, + "Resource": { + "type": "object", + "x-abstract": true, + "additionalProperties": false, + "required": [ + "_links" + ], + "properties": { + "_links": { + "type": "object", + "description": "The links.", + "additionalProperties": { + "$ref": "#/components/schemas/ResourceLink" + } + } + } + }, + "ResourceLink": { + "type": "object", + "additionalProperties": false, + "required": [ + "href", + "method" + ], + "properties": { + "href": { + "type": "string", + "description": "The link url.", + "minLength": 1 + }, + "method": { + "type": "string", + "description": "The link method.", + "minLength": 1 + }, + "metadata": { + "type": "string", + "description": "Additional data about the link.", + "nullable": true + } + } + }, + "CreateUserDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "email", + "displayName", + "password", + "permissions" + ], + "properties": { + "email": { + "type": "string", + "description": "The email of the user. Unique value.", + "minLength": 1 + }, + "displayName": { + "type": "string", + "description": "The display name (usually first name and last name) of the user.", + "minLength": 1 + }, + "password": { + "type": "string", + "description": "The password of the user.", + "minLength": 1 + }, + "permissions": { + "type": "array", + "description": "Additional permissions for the user.", + "items": { + "type": "string" + } + } + } + }, + "UpdateUserDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "email", + "displayName", + "permissions" + ], + "properties": { + "email": { + "type": "string", + "description": "The email of the user. Unique value.", + "minLength": 1 + }, + "displayName": { + "type": "string", + "description": "The display name (usually first name and last name) of the user.", + "minLength": 1 + }, + "password": { + "type": "string", + "description": "The password of the user.", + "nullable": true + }, + "permissions": { + "type": "array", + "description": "Additional permissions for the user.", + "items": { + "type": "string" + } + } + } + }, + "ResourcesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false + } + ] + }, + "UpdateProfileDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "answers": { + "type": "object", + "description": "The answers from a questionaire.", + "nullable": true, + "additionalProperties": { + "type": "string", + "nullable": true + } + } + } + }, + "TranslationDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "status", + "result" + ], + "properties": { + "status": { + "description": "The result of the translation.", + "$ref": "#/components/schemas/TranslationStatus" + }, + "result": { + "description": "The result of the translation.", + "deprecated": true, + "x-deprecatedMessage": "Use Status property now.", + "$ref": "#/components/schemas/TranslationStatus" + }, + "text": { + "type": "string", + "description": "The translated text.", + "nullable": true + } + } + }, + "TranslationStatus": { + "type": "string", + "description": "", + "x-enumNames": [ + "Translated", + "LanguageNotSupported", + "NotTranslated", + "NotConfigured", + "Unauthorized", + "Failed" + ], + "enum": [ + "Translated", + "LanguageNotSupported", + "NotTranslated", + "NotConfigured", + "Unauthorized", + "Failed" + ] + }, + "TranslateDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "text", + "targetLanguage" + ], + "properties": { + "text": { + "type": "string", + "description": "The text to translate.", + "minLength": 1 + }, + "targetLanguage": { + "type": "string", + "description": "The target language." + }, + "sourceLanguage": { + "type": "string", + "description": "The optional source language." + } + } + }, + "TemplatesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "The event consumers.", + "items": { + "$ref": "#/components/schemas/TemplateDto" + } + } + } + } + ] + }, + "TemplateDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "title", + "description", + "isStarter" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the template." + }, + "title": { + "type": "string", + "description": "The title of the template." + }, + "description": { + "type": "string", + "description": "The description of the template." + }, + "isStarter": { + "type": "boolean", + "description": "True, if the template is a starter." + } + } + } + ] + }, + "TemplateDetailsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "details" + ], + "properties": { + "details": { + "type": "string", + "description": "The details of the template." + } + } + } + ] + }, + "ContributorsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "items", + "maxContributors" + ], + "properties": { + "items": { + "type": "array", + "description": "The contributors.", + "items": { + "$ref": "#/components/schemas/ContributorDto" + } + }, + "maxContributors": { + "type": "integer", + "description": "The maximum number of allowed contributors.", + "format": "int64" + }, + "_meta": { + "description": "The metadata to provide information about this request.", + "nullable": true, + "$ref": "#/components/schemas/ContributorsMetadata" + } + } + } + ] + }, + "ContributorDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "contributorId", + "contributorName", + "contributorEmail" + ], + "properties": { + "contributorId": { + "type": "string", + "description": "The ID of the user that contributes to the app." + }, + "contributorName": { + "type": "string", + "description": "The display name." + }, + "contributorEmail": { + "type": "string", + "description": "The email address." + }, + "role": { + "type": "string", + "description": "The role of the contributor.", + "nullable": true + } + } + } + ] + }, + "ContributorsMetadata": { + "type": "object", + "additionalProperties": false, + "required": [ + "isInvited" + ], + "properties": { + "isInvited": { + "type": "string", + "description": "Indicates whether the user has been invited." + } + } + }, + "AssignContributorDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "contributorId" + ], + "properties": { + "contributorId": { + "type": "string", + "description": "The id or email of the user to add to the app.", + "minLength": 1 + }, + "role": { + "type": "string", + "description": "The role of the contributor.", + "nullable": true + }, + "invite": { + "type": "boolean", + "description": "Set to true to invite the user if he does not exist." + } + } + }, + "TeamDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "name", + "version", + "created", + "lastModified" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the team." + }, + "name": { + "type": "string", + "description": "The name of the team." + }, + "version": { + "type": "integer", + "description": "The version of the team.", + "format": "int64" + }, + "created": { + "type": "string", + "description": "The timestamp when the team has been created.", + "format": "date-time" + }, + "lastModified": { + "type": "string", + "description": "The timestamp when the team has been modified last.", + "format": "date-time" + }, + "roleName": { + "type": "string", + "description": "The role name of the user.", + "nullable": true + } + } + } + ] + }, + "CreateTeamDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the team.", + "minLength": 1 + } + } + }, + "UpdateTeamDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the team.", + "minLength": 1 + } + } + }, + "AuthSchemeResponseDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "scheme": { + "description": "The auth scheme if configured.", + "nullable": true, + "$ref": "#/components/schemas/AuthSchemeDto" + } + } + } + ] + }, + "AuthSchemeDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "domain", + "displayName", + "clientId", + "clientSecret", + "authority" + ], + "properties": { + "domain": { + "type": "string", + "description": "The domain name of your user accounts.", + "minLength": 1 + }, + "displayName": { + "type": "string", + "description": "The display name for buttons.", + "minLength": 1 + }, + "clientId": { + "type": "string", + "description": "The client ID.", + "minLength": 1 + }, + "clientSecret": { + "type": "string", + "description": "The client secret.", + "minLength": 1 + }, + "authority": { + "type": "string", + "description": "The authority URL.", + "minLength": 1 + }, + "signoutRedirectUrl": { + "type": "string", + "description": "The URL to redirect after a signout.", + "nullable": true + } + } + }, + "AuthSchemeValueDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "scheme": { + "description": "The auth scheme if configured.", + "nullable": true, + "$ref": "#/components/schemas/AuthSchemeDto" + } + } + }, + "LogDownloadDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "downloadUrl": { + "type": "string", + "description": "The url to download the log.", + "nullable": true + } + } + }, + "CallsUsageDtoDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "totalCalls", + "totalBytes", + "monthCalls", + "monthBytes", + "blockingApiCalls", + "allowedBytes", + "allowedCalls", + "averageElapsedMs", + "details" + ], + "properties": { + "totalCalls": { + "type": "integer", + "description": "The total number of API calls.", + "format": "int64" + }, + "totalBytes": { + "type": "integer", + "description": "The total number of bytes transferred.", + "format": "int64" + }, + "monthCalls": { + "type": "integer", + "description": "The total number of API calls this month.", + "format": "int64" + }, + "monthBytes": { + "type": "integer", + "description": "The total number of bytes transferred this month.", + "format": "int64" + }, + "blockingApiCalls": { + "type": "integer", + "description": "The amount of calls that will block the app.", + "format": "int64" + }, + "allowedBytes": { + "type": "integer", + "description": "The included API traffic.", + "format": "int64" + }, + "allowedCalls": { + "type": "integer", + "description": "The included API calls.", + "format": "int64" + }, + "averageElapsedMs": { + "type": "number", + "description": "The average duration in milliseconds.", + "format": "double" + }, + "details": { + "type": "object", + "description": "The statistics by date and group.", + "additionalProperties": { + "type": "array", + "items": { + "$ref": "#/components/schemas/CallsUsagePerDateDto" + } + } + } + } + }, + "CallsUsagePerDateDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "date", + "totalCalls", + "totalBytes", + "averageElapsedMs" + ], + "properties": { + "date": { + "type": "string", + "description": "The date when the usage was tracked.", + "format": "date" + }, + "totalCalls": { + "type": "integer", + "description": "The total number of API calls.", + "format": "int64" + }, + "totalBytes": { + "type": "integer", + "description": "The total number of bytes transferred.", + "format": "int64" + }, + "averageElapsedMs": { + "type": "number", + "description": "The average duration in milliseconds.", + "format": "double" + } + } + }, + "CurrentStorageDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "size", + "maxAllowed" + ], + "properties": { + "size": { + "type": "integer", + "description": "The size in bytes.", + "format": "int64" + }, + "maxAllowed": { + "type": "integer", + "description": "The maximum allowed asset size.", + "format": "int64" + } + } + }, + "StorageUsagePerDateDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "date", + "totalCount", + "totalSize" + ], + "properties": { + "date": { + "type": "string", + "description": "The date when the usage was tracked.", + "format": "date" + }, + "totalCount": { + "type": "integer", + "description": "The number of assets.", + "format": "int64" + }, + "totalSize": { + "type": "integer", + "description": "The size in bytes.", + "format": "int64" + } + } + }, + "SearchResultDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "type" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the search result." + }, + "type": { + "description": "The type of the search result.", + "$ref": "#/components/schemas/SearchResultType" + }, + "label": { + "type": "string", + "description": "An optional label.", + "nullable": true + } + } + } + ] + }, + "SearchResultType": { + "type": "string", + "description": "", + "x-enumNames": [ + "Asset", + "Content", + "Dashboard", + "Setting", + "Rule", + "Schema" + ], + "enum": [ + "Asset", + "Content", + "Dashboard", + "Setting", + "Rule", + "Schema" + ] + }, + "SchemaDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "createdBy", + "lastModifiedBy", + "name", + "properties", + "scripts", + "previewUrls", + "fieldsInLists", + "fieldsInReferences", + "fields", + "id", + "type", + "isSingleton", + "isPublished", + "created", + "lastModified", + "version", + "fieldRules" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the schema." + }, + "createdBy": { + "type": "string", + "description": "The user that has created the schema." + }, + "lastModifiedBy": { + "type": "string", + "description": "The user that has updated the schema." + }, + "name": { + "type": "string", + "description": "The name of the schema. Unique within the app.", + "minLength": 1, + "pattern": "^[a-z0-9]+(\\-[a-z0-9]+)*$" + }, + "type": { + "description": "The type of the schema.", + "$ref": "#/components/schemas/SchemaType" + }, + "category": { + "type": "string", + "description": "The name of the category.", + "nullable": true + }, + "properties": { + "description": "The schema properties.", + "$ref": "#/components/schemas/SchemaPropertiesDto" + }, + "isSingleton": { + "type": "boolean", + "description": "Indicates if the schema is a singleton.", + "deprecated": true, + "x-deprecatedMessage": "Use 'type' field now." + }, + "isPublished": { + "type": "boolean", + "description": "Indicates if the schema is published." + }, + "created": { + "type": "string", + "description": "The date and time when the schema has been created.", + "format": "date-time" + }, + "lastModified": { + "type": "string", + "description": "The date and time when the schema has been modified last.", + "format": "date-time" + }, + "version": { + "type": "integer", + "description": "The version of the schema.", + "format": "int64" + }, + "scripts": { + "description": "The scripts.", + "$ref": "#/components/schemas/SchemaScriptsDto" + }, + "previewUrls": { + "type": "object", + "description": "The preview Urls.", + "additionalProperties": { + "type": "string" + } + }, + "fieldsInLists": { + "type": "array", + "description": "The name of fields that are used in content lists.", + "items": { + "type": "string" + } + }, + "fieldsInReferences": { + "type": "array", + "description": "The name of fields that are used in content references.", + "items": { + "type": "string" + } + }, + "fieldRules": { + "type": "array", + "description": "The field rules.", + "items": { + "$ref": "#/components/schemas/FieldRuleDto" + } + }, + "fields": { + "type": "array", + "description": "The list of fields.", + "items": { + "$ref": "#/components/schemas/FieldDto" + } + } + } + } + ] + }, + "SchemaType": { + "type": "string", + "description": "", + "x-enumNames": [ + "Default", + "Singleton", + "Component" + ], + "enum": [ + "Default", + "Singleton", + "Component" + ] + }, + "SchemaPropertiesDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "validateOnPublish" + ], + "properties": { + "label": { + "type": "string", + "description": "Optional label for the editor.", + "maxLength": 100, + "minLength": 0, + "nullable": true + }, + "hints": { + "type": "string", + "description": "Hints to describe the schema.", + "maxLength": 1000, + "minLength": 0, + "nullable": true + }, + "contentsSidebarUrl": { + "type": "string", + "description": "The url to a the sidebar plugin for content lists.", + "nullable": true + }, + "contentSidebarUrl": { + "type": "string", + "description": "The url to a the sidebar plugin for content items.", + "nullable": true + }, + "contentEditorUrl": { + "type": "string", + "description": "The url to the editor plugin.", + "nullable": true + }, + "contentsEditorUrl": { + "type": "string", + "description": "The url to the editor plugin.", + "nullable": true + }, + "contentsListUrl": { + "type": "string", + "description": "The url to the content list plugin.", + "nullable": true + }, + "validateOnPublish": { + "type": "boolean", + "description": "True to validate the content items on publish." + }, + "tags": { + "type": "array", + "description": "Tags for automation processes.", + "nullable": true, + "items": { + "type": "string" + } + } + } + }, + "SchemaScriptsDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "query": { + "type": "string", + "description": "The script that is executed for each content when querying contents.", + "nullable": true + }, + "queryPre": { + "type": "string", + "description": "The script that is executed for all contents when querying contents.", + "nullable": true + }, + "create": { + "type": "string", + "description": "The script that is executed when creating a content.", + "nullable": true + }, + "update": { + "type": "string", + "description": "The script that is executed when updating a content.", + "nullable": true + }, + "delete": { + "type": "string", + "description": "The script that is executed when deleting a content.", + "nullable": true + }, + "change": { + "type": "string", + "description": "The script that is executed when change a content status.", + "nullable": true + } + } + }, + "FieldRuleDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "action", + "field" + ], + "properties": { + "action": { + "description": "The action to perform when the condition is met.", + "$ref": "#/components/schemas/FieldRuleAction" + }, + "field": { + "type": "string", + "description": "The field to update.", + "minLength": 1 + }, + "condition": { + "type": "string", + "description": "The condition.", + "nullable": true + } + } + }, + "FieldRuleAction": { + "type": "string", + "description": "", + "x-enumNames": [ + "Disable", + "Hide", + "Require" + ], + "enum": [ + "Disable", + "Hide", + "Require" + ] + }, + "FieldDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "partitioning", + "properties", + "fieldId", + "isHidden", + "isLocked", + "isDisabled" + ], + "properties": { + "fieldId": { + "type": "integer", + "description": "The ID of the field.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "The name of the field. Must be unique within the schema.", + "minLength": 1, + "pattern": "^[a-z0-9]+(\\-[a-z0-9]+)*$" + }, + "isHidden": { + "type": "boolean", + "description": "Defines if the field is hidden." + }, + "isLocked": { + "type": "boolean", + "description": "Defines if the field is locked." + }, + "isDisabled": { + "type": "boolean", + "description": "Defines if the field is disabled." + }, + "partitioning": { + "type": "string", + "description": "Defines the partitioning of the field.", + "minLength": 1 + }, + "properties": { + "description": "The field properties.", + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + "nested": { + "type": "array", + "description": "The nested fields.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/NestedFieldDto" + } + } + } + } + ] + }, + "FieldPropertiesDto": { + "type": "object", + "discriminator": { + "propertyName": "fieldType", + "mapping": { + "Array": "#/components/schemas/ArrayFieldPropertiesDto", + "Assets": "#/components/schemas/AssetsFieldPropertiesDto", + "Boolean": "#/components/schemas/BooleanFieldPropertiesDto", + "Component": "#/components/schemas/ComponentFieldPropertiesDto", + "Components": "#/components/schemas/ComponentsFieldPropertiesDto", + "DateTime": "#/components/schemas/DateTimeFieldPropertiesDto", + "Geolocation": "#/components/schemas/GeolocationFieldPropertiesDto", + "Json": "#/components/schemas/JsonFieldPropertiesDto", + "Number": "#/components/schemas/NumberFieldPropertiesDto", + "References": "#/components/schemas/ReferencesFieldPropertiesDto", + "RichText": "#/components/schemas/RichTextFieldPropertiesDto", + "String": "#/components/schemas/StringFieldPropertiesDto", + "Tags": "#/components/schemas/TagsFieldPropertiesDto", + "UI": "#/components/schemas/UIFieldPropertiesDto" + } + }, + "x-abstract": true, + "additionalProperties": false, + "required": [ + "fieldType" + ], + "properties": { + "label": { + "type": "string", + "description": "Optional label for the editor.", + "maxLength": 100, + "minLength": 0, + "nullable": true + }, + "hints": { + "type": "string", + "description": "Hints to describe the field.", + "maxLength": 1000, + "minLength": 0, + "nullable": true + }, + "placeholder": { + "type": "string", + "description": "Placeholder to show when no value has been entered.", + "maxLength": 100, + "minLength": 0, + "nullable": true + }, + "isRequired": { + "type": "boolean", + "description": "Indicates if the field is required." + }, + "isRequiredOnPublish": { + "type": "boolean", + "description": "Indicates if the field is required when publishing." + }, + "isHalfWidth": { + "type": "boolean", + "description": "Indicates if the field should be rendered with half width only." + }, + "editorUrl": { + "type": "string", + "description": "Optional url to the editor.", + "nullable": true + }, + "tags": { + "type": "array", + "description": "Tags for automation processes.", + "nullable": true, + "items": { + "type": "string" + } + }, + "fieldType": { + "type": "string" + } + } + }, + "ArrayFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "minItems": { + "type": "integer", + "description": "The minimum allowed items for the field value.", + "format": "int32", + "nullable": true + }, + "maxItems": { + "type": "integer", + "description": "The maximum allowed items for the field value.", + "format": "int32", + "nullable": true + }, + "calculatedDefaultValue": { + "description": "The calculated default value for the field value.", + "$ref": "#/components/schemas/ArrayCalculatedDefaultValue" + }, + "uniqueFields": { + "type": "array", + "description": "The fields that must be unique.", + "nullable": true, + "items": { + "type": "string" + } + } + } + } + ] + }, + "ArrayCalculatedDefaultValue": { + "type": "string", + "description": "", + "x-enumNames": [ + "EmptyArray", + "Null" + ], + "enum": [ + "EmptyArray", + "Null" + ] + }, + "AssetsFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "previewMode": { + "description": "The preview mode for the asset.", + "$ref": "#/components/schemas/AssetPreviewMode" + }, + "defaultValues": { + "description": "The language specific default value as a list of asset ids.", + "nullable": true, + "$ref": "#/components/schemas/LocalizedValueOfReadonlyListOfString" + }, + "defaultValue": { + "type": "array", + "description": "The default value as a list of asset ids.", + "nullable": true, + "items": { + "type": "string" + } + }, + "folderId": { + "type": "string", + "description": "The initial id to the folder.", + "nullable": true + }, + "previewFormat": { + "type": "string", + "description": "The preview format.", + "nullable": true + }, + "minItems": { + "type": "integer", + "description": "The minimum allowed items for the field value.", + "format": "int32", + "nullable": true + }, + "maxItems": { + "type": "integer", + "description": "The maximum allowed items for the field value.", + "format": "int32", + "nullable": true + }, + "minSize": { + "type": "integer", + "description": "The minimum file size in bytes.", + "format": "int32", + "nullable": true + }, + "maxSize": { + "type": "integer", + "description": "The maximum file size in bytes.", + "format": "int32", + "nullable": true + }, + "minWidth": { + "type": "integer", + "description": "The minimum image width in pixels.", + "format": "int32", + "nullable": true + }, + "maxWidth": { + "type": "integer", + "description": "The maximum image width in pixels.", + "format": "int32", + "nullable": true + }, + "minHeight": { + "type": "integer", + "description": "The minimum image height in pixels.", + "format": "int32", + "nullable": true + }, + "maxHeight": { + "type": "integer", + "description": "The maximum image height in pixels.", + "format": "int32", + "nullable": true + }, + "aspectWidth": { + "type": "integer", + "description": "The image aspect width in pixels.", + "format": "int32", + "nullable": true + }, + "aspectHeight": { + "type": "integer", + "description": "The image aspect height in pixels.", + "format": "int32", + "nullable": true + }, + "expectedType": { + "description": "The expected type.", + "nullable": true, + "$ref": "#/components/schemas/AssetType" + }, + "resolveFirst": { + "type": "boolean", + "description": "True to resolve first asset in the content list." + }, + "mustBeImage": { + "type": "boolean", + "description": "True to resolve first image in the content list.", + "deprecated": true, + "x-deprecatedMessage": "Use 'expectedType' field now" + }, + "resolveImage": { + "type": "boolean", + "description": "True to resolve first image in the content list.", + "deprecated": true, + "x-deprecatedMessage": "Use 'resolveFirst' field now" + }, + "allowedExtensions": { + "type": "array", + "description": "The allowed file extensions.", + "nullable": true, + "items": { + "type": "string" + } + }, + "allowDuplicates": { + "type": "boolean", + "description": "True, if duplicate values are allowed." + } + } + } + ] + }, + "AssetPreviewMode": { + "type": "string", + "description": "", + "x-enumNames": [ + "ImageAndFileName", + "Image", + "FileName" + ], + "enum": [ + "ImageAndFileName", + "Image", + "FileName" + ] + }, + "LocalizedValueOfReadonlyListOfString": { + "type": "object", + "additionalProperties": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "AssetType": { + "type": "string", + "description": "", + "x-enumNames": [ + "Unknown", + "Image", + "Audio", + "Video" + ], + "enum": [ + "Unknown", + "Image", + "Audio", + "Video" + ] + }, + "BooleanFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "defaultValues": { + "description": "The language specific default value for the field value.", + "nullable": true, + "$ref": "#/components/schemas/LocalizedValueOfNullableBoolean" + }, + "defaultValue": { + "type": "boolean", + "description": "The default value for the field value.", + "nullable": true + }, + "inlineEditable": { + "type": "boolean", + "description": "Indicates that the inline editor is enabled for this field." + }, + "editor": { + "description": "The editor that is used to manage this field.", + "$ref": "#/components/schemas/BooleanFieldEditor" + } + } + } + ] + }, + "LocalizedValueOfNullableBoolean": { + "type": "object", + "additionalProperties": { + "type": "boolean", + "nullable": true + } + }, + "BooleanFieldEditor": { + "type": "string", + "description": "", + "x-enumNames": [ + "Checkbox", + "Toggle" + ], + "enum": [ + "Checkbox", + "Toggle" + ] + }, + "ComponentFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "schemaIds": { + "type": "array", + "description": "The ID of the embedded schemas.", + "nullable": true, + "items": { + "type": "string" + } + } + } + } + ] + }, + "ComponentsFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "minItems": { + "type": "integer", + "description": "The minimum allowed items for the field value.", + "format": "int32", + "nullable": true + }, + "maxItems": { + "type": "integer", + "description": "The maximum allowed items for the field value.", + "format": "int32", + "nullable": true + }, + "calculatedDefaultValue": { + "description": "The calculated default value for the field value.", + "$ref": "#/components/schemas/ArrayCalculatedDefaultValue" + }, + "schemaIds": { + "type": "array", + "description": "The ID of the embedded schemas.", + "nullable": true, + "items": { + "type": "string" + } + }, + "uniqueFields": { + "type": "array", + "description": "The fields that must be unique.", + "nullable": true, + "items": { + "type": "string" + } + } + } + } + ] + }, + "DateTimeFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "defaultValues": { + "description": "The language specific default value for the field value.", + "nullable": true, + "$ref": "#/components/schemas/LocalizedValueOfNullableInstant" + }, + "defaultValue": { + "type": "string", + "description": "The default value for the field value.", + "format": "date-time", + "nullable": true + }, + "maxValue": { + "type": "string", + "description": "The maximum allowed value for the field value.", + "format": "date-time", + "nullable": true + }, + "minValue": { + "type": "string", + "description": "The minimum allowed value for the field value.", + "format": "date-time", + "nullable": true + }, + "format": { + "type": "string", + "description": "The format pattern when displayed in the UI.", + "nullable": true + }, + "editor": { + "description": "The editor that is used to manage this field.", + "$ref": "#/components/schemas/DateTimeFieldEditor" + }, + "calculatedDefaultValue": { + "description": "The calculated default value for the field value.", + "nullable": true, + "$ref": "#/components/schemas/DateTimeCalculatedDefaultValue" + } + } + } + ] + }, + "LocalizedValueOfNullableInstant": { + "type": "object", + "additionalProperties": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "DateTimeFieldEditor": { + "type": "string", + "description": "", + "x-enumNames": [ + "Date", + "DateTime" + ], + "enum": [ + "Date", + "DateTime" + ] + }, + "DateTimeCalculatedDefaultValue": { + "type": "string", + "description": "", + "x-enumNames": [ + "Now", + "Today" + ], + "enum": [ + "Now", + "Today" + ] + }, + "GeolocationFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "editor": { + "description": "The editor that is used to manage this field.", + "$ref": "#/components/schemas/GeolocationFieldEditor" + } + } + } + ] + }, + "GeolocationFieldEditor": { + "type": "string", + "description": "", + "x-enumNames": [ + "Map" + ], + "enum": [ + "Map" + ] + }, + "JsonFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "graphQLSchema": { + "type": "string", + "description": "The GraphQL schema.", + "nullable": true + } + } + } + ] + }, + "NumberFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "defaultValues": { + "description": "The language specific default value for the field value.", + "nullable": true, + "$ref": "#/components/schemas/LocalizedValueOfNullableDouble" + }, + "defaultValue": { + "type": "number", + "description": "The default value for the field value.", + "format": "double", + "nullable": true + }, + "maxValue": { + "type": "number", + "description": "The maximum allowed value for the field value.", + "format": "double", + "nullable": true + }, + "minValue": { + "type": "number", + "description": "The minimum allowed value for the field value.", + "format": "double", + "nullable": true + }, + "allowedValues": { + "type": "array", + "description": "The allowed values for the field value.", + "nullable": true, + "items": { + "type": "number", + "format": "double" + } + }, + "isUnique": { + "type": "boolean", + "description": "Indicates if the field value must be unique. Ignored for nested fields and localized fields." + }, + "inlineEditable": { + "type": "boolean", + "description": "Indicates that the inline editor is enabled for this field." + }, + "editor": { + "description": "The editor that is used to manage this field.", + "$ref": "#/components/schemas/NumberFieldEditor" + } + } + } + ] + }, + "LocalizedValueOfNullableDouble": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double", + "nullable": true + } + }, + "NumberFieldEditor": { + "type": "string", + "description": "", + "x-enumNames": [ + "Input", + "Radio", + "Dropdown", + "Stars" + ], + "enum": [ + "Input", + "Radio", + "Dropdown", + "Stars" + ] + }, + "ReferencesFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "defaultValues": { + "description": "The language specific default value as a list of content ids.", + "nullable": true, + "$ref": "#/components/schemas/LocalizedValueOfReadonlyListOfString" + }, + "defaultValue": { + "type": "array", + "description": "The default value as a list of content ids.", + "nullable": true, + "items": { + "type": "string" + } + }, + "minItems": { + "type": "integer", + "description": "The minimum allowed items for the field value.", + "format": "int32", + "nullable": true + }, + "maxItems": { + "type": "integer", + "description": "The maximum allowed items for the field value.", + "format": "int32", + "nullable": true + }, + "allowDuplicates": { + "type": "boolean", + "description": "True, if duplicate values are allowed." + }, + "resolveReference": { + "type": "boolean", + "description": "True to resolve references in the content list." + }, + "mustBePublished": { + "type": "boolean", + "description": "True when all references must be published." + }, + "query": { + "type": "string", + "description": "The initial query that is applied in the UI.", + "nullable": true + }, + "editor": { + "description": "The editor that is used to manage this field.", + "$ref": "#/components/schemas/ReferencesFieldEditor" + }, + "schemaIds": { + "type": "array", + "description": "The ID of the referenced schemas.", + "nullable": true, + "items": { + "type": "string" + } + } + } + } + ] + }, + "ReferencesFieldEditor": { + "type": "string", + "description": "", + "x-enumNames": [ + "List", + "Dropdown", + "Tags", + "Checkboxes", + "Input", + "Radio" + ], + "enum": [ + "List", + "Dropdown", + "Tags", + "Checkboxes", + "Input", + "Radio" + ] + }, + "RichTextFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "folderId": { + "type": "string", + "description": "The initial id to the folder when the control supports file uploads.", + "nullable": true + }, + "minLength": { + "type": "integer", + "description": "The minimum allowed length for the field value.", + "format": "int32", + "nullable": true + }, + "maxLength": { + "type": "integer", + "description": "The maximum allowed length for the field value.", + "format": "int32", + "nullable": true + }, + "minCharacters": { + "type": "integer", + "description": "The minimum allowed of normal characters for the field value.", + "format": "int32", + "nullable": true + }, + "maxCharacters": { + "type": "integer", + "description": "The maximum allowed of normal characters for the field value.", + "format": "int32", + "nullable": true + }, + "minWords": { + "type": "integer", + "description": "The minimum allowed number of words for the field value.", + "format": "int32", + "nullable": true + }, + "maxWords": { + "type": "integer", + "description": "The maximum allowed number of words for the field value.", + "format": "int32", + "nullable": true + }, + "classNames": { + "type": "array", + "description": "The class names for the editor.", + "nullable": true, + "items": { + "type": "string" + } + }, + "schemaIds": { + "type": "array", + "description": "The allowed schema ids that can be embedded.", + "nullable": true, + "items": { + "type": "string" + } + } + } + } + ] + }, + "StringFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "defaultValues": { + "description": "The language specific default value for the field value.", + "nullable": true, + "$ref": "#/components/schemas/LocalizedValueOfString" + }, + "defaultValue": { + "type": "string", + "description": "The default value for the field value.", + "nullable": true + }, + "pattern": { + "type": "string", + "description": "The pattern to enforce a specific format for the field value.", + "nullable": true + }, + "patternMessage": { + "type": "string", + "description": "The validation message for the pattern.", + "nullable": true + }, + "folderId": { + "type": "string", + "description": "The initial id to the folder when the control supports file uploads.", + "nullable": true + }, + "minLength": { + "type": "integer", + "description": "The minimum allowed length for the field value.", + "format": "int32", + "nullable": true + }, + "maxLength": { + "type": "integer", + "description": "The maximum allowed length for the field value.", + "format": "int32", + "nullable": true + }, + "minCharacters": { + "type": "integer", + "description": "The minimum allowed of normal characters for the field value.", + "format": "int32", + "nullable": true + }, + "maxCharacters": { + "type": "integer", + "description": "The maximum allowed of normal characters for the field value.", + "format": "int32", + "nullable": true + }, + "minWords": { + "type": "integer", + "description": "The minimum allowed number of words for the field value.", + "format": "int32", + "nullable": true + }, + "maxWords": { + "type": "integer", + "description": "The maximum allowed number of words for the field value.", + "format": "int32", + "nullable": true + }, + "classNames": { + "type": "array", + "description": "The class names for the editor.", + "nullable": true, + "items": { + "type": "string" + } + }, + "allowedValues": { + "type": "array", + "description": "The allowed values for the field value.", + "nullable": true, + "items": { + "type": "string" + } + }, + "schemaIds": { + "type": "array", + "description": "The allowed schema ids that can be embedded.", + "nullable": true, + "items": { + "type": "string" + } + }, + "isUnique": { + "type": "boolean", + "description": "Indicates if the field value must be unique. Ignored for nested fields and localized fields." + }, + "isEmbeddable": { + "type": "boolean", + "description": "Indicates that other content items or references are embedded." + }, + "inlineEditable": { + "type": "boolean", + "description": "Indicates that the inline editor is enabled for this field." + }, + "createEnum": { + "type": "boolean", + "description": "Indicates whether GraphQL Enum should be created." + }, + "contentType": { + "description": "How the string content should be interpreted.", + "$ref": "#/components/schemas/StringContentType" + }, + "editor": { + "description": "The editor that is used to manage this field.", + "$ref": "#/components/schemas/StringFieldEditor" + } + } + } + ] + }, + "LocalizedValueOfString": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "StringContentType": { + "type": "string", + "description": "", + "x-enumNames": [ + "Unspecified", + "Html", + "Markdown" + ], + "enum": [ + "Unspecified", + "Html", + "Markdown" + ] + }, + "StringFieldEditor": { + "type": "string", + "description": "", + "x-enumNames": [ + "Input", + "Color", + "Markdown", + "Dropdown", + "Html", + "Radio", + "RichText", + "Slug", + "StockPhoto", + "TextArea" + ], + "enum": [ + "Input", + "Color", + "Markdown", + "Dropdown", + "Html", + "Radio", + "RichText", + "Slug", + "StockPhoto", + "TextArea" + ] + }, + "TagsFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "defaultValues": { + "description": "The language specific default value for the field value.", + "nullable": true, + "$ref": "#/components/schemas/LocalizedValueOfReadonlyListOfString" + }, + "defaultValue": { + "type": "array", + "description": "The default value.", + "nullable": true, + "items": { + "type": "string" + } + }, + "minItems": { + "type": "integer", + "description": "The minimum allowed items for the field value.", + "format": "int32", + "nullable": true + }, + "maxItems": { + "type": "integer", + "description": "The maximum allowed items for the field value.", + "format": "int32", + "nullable": true + }, + "allowedValues": { + "type": "array", + "description": "The allowed values for the field value.", + "nullable": true, + "items": { + "type": "string" + } + }, + "createEnum": { + "type": "boolean", + "description": "Indicates whether GraphQL Enum should be created." + }, + "editor": { + "description": "The editor that is used to manage this field.", + "$ref": "#/components/schemas/TagsFieldEditor" + } + } + } + ] + }, + "TagsFieldEditor": { + "type": "string", + "description": "", + "x-enumNames": [ + "Tags", + "Checkboxes", + "Dropdown" + ], + "enum": [ + "Tags", + "Checkboxes", + "Dropdown" + ] + }, + "UIFieldPropertiesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "editor": { + "description": "The editor that is used to manage this field.", + "$ref": "#/components/schemas/UIFieldEditor" + } + } + } + ] + }, + "UIFieldEditor": { + "type": "string", + "description": "", + "x-enumNames": [ + "Separator" + ], + "enum": [ + "Separator" + ] + }, + "NestedFieldDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "properties", + "fieldId", + "isHidden", + "isLocked", + "isDisabled" + ], + "properties": { + "fieldId": { + "type": "integer", + "description": "The ID of the field.", + "format": "int64" + }, + "name": { + "type": "string", + "description": "The name of the field. Must be unique within the schema.", + "minLength": 1, + "pattern": "^[a-z0-9]+(\\-[a-z0-9]+)*$" + }, + "isHidden": { + "type": "boolean", + "description": "Defines if the field is hidden." + }, + "isLocked": { + "type": "boolean", + "description": "Defines if the field is locked." + }, + "isDisabled": { + "type": "boolean", + "description": "Defines if the field is disabled." + }, + "properties": { + "description": "The field properties.", + "$ref": "#/components/schemas/FieldPropertiesDto" + } + } + } + ] + }, + "AddFieldDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "properties" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the field. Must be unique within the schema.", + "minLength": 1, + "pattern": "^[a-zA-Z0-9]+(\\-[a-zA-Z0-9]+)*$" + }, + "partitioning": { + "type": "string", + "description": "Determines the optional partitioning of the field.", + "nullable": true + }, + "properties": { + "description": "The field properties.", + "$ref": "#/components/schemas/FieldPropertiesDto" + } + } + }, + "ConfigureUIFieldsDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "fieldsInLists": { + "type": "array", + "description": "The name of fields that are used in content lists.", + "nullable": true, + "items": { + "type": "string" + } + }, + "fieldsInReferences": { + "type": "array", + "description": "The name of fields that are used in content references.", + "nullable": true, + "items": { + "type": "string" + } + } + } + }, + "ReorderFieldsDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "fieldIds" + ], + "properties": { + "fieldIds": { + "type": "array", + "description": "The field ids in the target order.", + "items": { + "type": "integer", + "format": "int64" + } + } + } + }, + "UpdateFieldDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "properties" + ], + "properties": { + "properties": { + "description": "The field properties.", + "$ref": "#/components/schemas/FieldPropertiesDto" + } + } + }, + "SchemasDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "The schemas.", + "items": { + "$ref": "#/components/schemas/SchemaDto" + } + } + } + } + ] + }, + "CreateSchemaDto": { + "allOf": [ + { + "$ref": "#/components/schemas/UpsertSchemaDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the schema.", + "minLength": 1, + "pattern": "^[a-z0-9]+(\\-[a-z0-9]+)*$" + }, + "type": { + "description": "The type of the schema.", + "$ref": "#/components/schemas/SchemaType" + }, + "isSingleton": { + "type": "boolean", + "description": "Set to true to allow a single content item only.", + "deprecated": true, + "x-deprecatedMessage": "Use 'type' field now." + } + } + } + ] + }, + "UpsertSchemaDto": { + "type": "object", + "x-abstract": true, + "additionalProperties": false, + "properties": { + "properties": { + "description": "The optional properties.", + "nullable": true, + "$ref": "#/components/schemas/SchemaPropertiesDto" + }, + "scripts": { + "description": "The optional scripts.", + "nullable": true, + "$ref": "#/components/schemas/SchemaScriptsDto" + }, + "fieldsInReferences": { + "type": "array", + "description": "The names of the fields that should be used in references.", + "nullable": true, + "items": { + "type": "string" + } + }, + "fieldsInLists": { + "type": "array", + "description": "The names of the fields that should be shown in lists, including meta fields.", + "nullable": true, + "items": { + "type": "string" + } + }, + "fields": { + "type": "array", + "description": "Optional fields.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/UpsertSchemaFieldDto" + } + }, + "previewUrls": { + "type": "object", + "description": "The optional preview urls.", + "nullable": true, + "additionalProperties": { + "type": "string" + } + }, + "fieldRules": { + "type": "array", + "description": "The optional field Rules.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/FieldRuleDto" + } + }, + "category": { + "type": "string", + "description": "The category.", + "nullable": true + }, + "isPublished": { + "type": "boolean", + "description": "Set it to true to autopublish the schema." + } + } + }, + "UpsertSchemaFieldDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "properties" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the field. Must be unique within the schema.", + "minLength": 1, + "pattern": "^[a-zA-Z0-9]+(\\-[a-zA-Z0-9]+)*$" + }, + "isHidden": { + "type": "boolean", + "description": "Defines if the field is hidden." + }, + "isLocked": { + "type": "boolean", + "description": "Defines if the field is locked." + }, + "isDisabled": { + "type": "boolean", + "description": "Defines if the field is disabled." + }, + "partitioning": { + "type": "string", + "description": "Determines the optional partitioning of the field.", + "nullable": true + }, + "properties": { + "description": "The field properties.", + "$ref": "#/components/schemas/FieldPropertiesDto" + }, + "nested": { + "type": "array", + "description": "The nested fields.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/UpsertSchemaNestedFieldDto" + } + } + } + }, + "UpsertSchemaNestedFieldDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "properties" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the field. Must be unique within the schema.", + "minLength": 1, + "pattern": "^[a-zA-Z0-9]+(\\-[a-zA-Z0-9]+)*$" + }, + "isHidden": { + "type": "boolean", + "description": "Defines if the field is hidden." + }, + "isLocked": { + "type": "boolean", + "description": "Defines if the field is locked." + }, + "isDisabled": { + "type": "boolean", + "description": "Defines if the field is disabled." + }, + "properties": { + "description": "The field properties.", + "$ref": "#/components/schemas/FieldPropertiesDto" + } + } + }, + "UpdateSchemaDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "label": { + "type": "string", + "description": "Optional label for the editor.", + "maxLength": 100, + "minLength": 0, + "nullable": true + }, + "hints": { + "type": "string", + "description": "Hints to describe the schema.", + "maxLength": 1000, + "minLength": 0, + "nullable": true + }, + "contentsSidebarUrl": { + "type": "string", + "description": "The url to a the sidebar plugin for content lists.", + "nullable": true + }, + "contentSidebarUrl": { + "type": "string", + "description": "The url to a the sidebar plugin for content items.", + "nullable": true + }, + "contentsListUrl": { + "type": "string", + "description": "The url to the content list plugin.", + "nullable": true + }, + "validateOnPublish": { + "type": "boolean", + "description": "True to validate the content items on publish." + }, + "tags": { + "type": "array", + "description": "Tags for automation processes.", + "nullable": true, + "items": { + "type": "string" + } + } + } + }, + "SynchronizeSchemaDto": { + "allOf": [ + { + "$ref": "#/components/schemas/UpsertSchemaDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "noFieldDeletion": { + "type": "boolean", + "description": "True, when fields should not be deleted." + }, + "noFieldRecreation": { + "type": "boolean", + "description": "True, when fields with different types should not be recreated." + } + } + } + ] + }, + "ChangeCategoryDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The name of the category.", + "nullable": true + } + } + }, + "ConfigurePreviewUrlsDto": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "ConfigureFieldRulesDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "fieldRules": { + "type": "array", + "description": "The field rules to configure.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/FieldRuleDto" + } + } + } + }, + "RuleElementDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "description", + "display", + "properties" + ], + "properties": { + "description": { + "type": "string", + "description": "Describes the action or trigger type." + }, + "display": { + "type": "string", + "description": "The label for the action or trigger type." + }, + "title": { + "type": "string", + "description": "Optional title.", + "nullable": true + }, + "iconColor": { + "type": "string", + "description": "The color for the icon.", + "nullable": true + }, + "iconImage": { + "type": "string", + "description": "The image for the icon.", + "nullable": true + }, + "readMore": { + "type": "string", + "description": "The optional link to the product that is integrated.", + "nullable": true + }, + "properties": { + "type": "array", + "description": "The properties.", + "items": { + "$ref": "#/components/schemas/RuleElementPropertyDto" + } + } + } + }, + "RuleElementPropertyDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "editor", + "name", + "display", + "isFormattable", + "isRequired" + ], + "properties": { + "editor": { + "description": "The html editor.", + "$ref": "#/components/schemas/RuleFieldEditor" + }, + "name": { + "type": "string", + "description": "The name of the editor." + }, + "display": { + "type": "string", + "description": "The label to use." + }, + "options": { + "type": "array", + "description": "The options, if the editor is a dropdown.", + "nullable": true, + "items": { + "type": "string" + } + }, + "description": { + "type": "string", + "description": "The optional description.", + "nullable": true + }, + "isFormattable": { + "type": "boolean", + "description": "Indicates if the property is formattable." + }, + "isRequired": { + "type": "boolean", + "description": "Indicates if the property is required." + } + } + }, + "RuleFieldEditor": { + "type": "string", + "description": "", + "x-enumNames": [ + "Checkbox", + "Dropdown", + "Email", + "Javascript", + "Number", + "Password", + "Text", + "TextArea", + "Url" + ], + "enum": [ + "Checkbox", + "Dropdown", + "Email", + "Javascript", + "Number", + "Password", + "Text", + "TextArea", + "Url" + ] + }, + "RulesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "The rules.", + "items": { + "$ref": "#/components/schemas/RuleDto" + } + }, + "runningRuleId": { + "type": "string", + "description": "The ID of the rule that is currently rerunning.", + "nullable": true + } + } + } + ] + }, + "RuleDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "createdBy", + "lastModifiedBy", + "created", + "lastModified", + "version", + "isEnabled", + "trigger", + "action", + "numSucceeded", + "numFailed" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the rule." + }, + "createdBy": { + "type": "string", + "description": "The user that has created the rule." + }, + "lastModifiedBy": { + "type": "string", + "description": "The user that has updated the rule." + }, + "created": { + "type": "string", + "description": "The date and time when the rule has been created.", + "format": "date-time" + }, + "lastModified": { + "type": "string", + "description": "The date and time when the rule has been modified last.", + "format": "date-time" + }, + "version": { + "type": "integer", + "description": "The version of the rule.", + "format": "int64" + }, + "isEnabled": { + "type": "boolean", + "description": "Determines if the rule is enabled." + }, + "name": { + "type": "string", + "description": "Optional rule name.", + "nullable": true + }, + "trigger": { + "description": "The trigger properties.", + "$ref": "#/components/schemas/RuleTriggerDto" + }, + "action": { + "description": "The action properties.", + "$ref": "#/components/schemas/RuleActionDto" + }, + "numSucceeded": { + "type": "integer", + "description": "The number of completed executions.", + "format": "int64" + }, + "numFailed": { + "type": "integer", + "description": "The number of failed executions.", + "format": "int64" + }, + "lastExecuted": { + "type": "string", + "description": "The date and time when the rule was executed the last time.", + "format": "date-time", + "deprecated": true, + "x-deprecatedMessage": "Removed when migrated to new rule statistics.", + "nullable": true + } + } + } + ] + }, + "RuleTriggerDto": { + "type": "object", + "discriminator": { + "propertyName": "triggerType", + "mapping": { + "AssetChanged": "#/components/schemas/AssetChangedRuleTriggerDto", + "Comment": "#/components/schemas/CommentRuleTriggerDto", + "ContentChanged": "#/components/schemas/ContentChangedRuleTriggerDto", + "Manual": "#/components/schemas/ManualRuleTriggerDto", + "SchemaChanged": "#/components/schemas/SchemaChangedRuleTriggerDto", + "Usage": "#/components/schemas/UsageRuleTriggerDto" + } + }, + "x-abstract": true, + "additionalProperties": false, + "required": [ + "triggerType" + ], + "properties": { + "triggerType": { + "type": "string" + } + } + }, + "AssetChangedRuleTriggerDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleTriggerDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "condition": { + "type": "string", + "description": "Javascript condition when to trigger.", + "nullable": true + } + } + } + ] + }, + "CommentRuleTriggerDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleTriggerDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "condition": { + "type": "string", + "description": "Javascript condition when to trigger.", + "nullable": true + } + } + } + ] + }, + "ContentChangedRuleTriggerDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleTriggerDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "handleAll" + ], + "properties": { + "schemas": { + "type": "array", + "description": "The schema settings.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/SchemaCondition" + } + }, + "referencedSchemas": { + "type": "array", + "description": "The schema references.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/SchemaCondition" + } + }, + "handleAll": { + "type": "boolean", + "description": "Determines whether the trigger should handle all content changes events." + } + } + } + ] + }, + "SchemaCondition": { + "type": "object", + "additionalProperties": false, + "required": [ + "schemaId" + ], + "properties": { + "schemaId": { + "type": "string" + }, + "condition": { + "type": "string", + "nullable": true + } + } + }, + "ManualRuleTriggerDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleTriggerDto" + }, + { + "type": "object", + "additionalProperties": false + } + ] + }, + "SchemaChangedRuleTriggerDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleTriggerDto" + }, + { + "type": "object", + "additionalProperties": false, + "properties": { + "condition": { + "type": "string", + "description": "Javascript condition when to trigger.", + "nullable": true + } + } + } + ] + }, + "UsageRuleTriggerDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleTriggerDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "limit" + ], + "properties": { + "limit": { + "type": "integer", + "description": "The number of monthly api calls.", + "format": "int32" + }, + "numDays": { + "type": "integer", + "description": "The number of days to check or null for the current month.", + "format": "int32", + "maximum": 30.0, + "minimum": 1.0, + "nullable": true + } + } + } + ] + }, + "RuleActionDto": { + "type": "object", + "discriminator": { + "propertyName": "actionType", + "mapping": { + "Algolia": "#/components/schemas/AlgoliaRuleActionDto", + "AzureQueue": "#/components/schemas/AzureQueueRuleActionDto", + "Comment": "#/components/schemas/CommentRuleActionDto", + "CreateContent": "#/components/schemas/CreateContentRuleActionDto", + "Discourse": "#/components/schemas/DiscourseRuleActionDto", + "ElasticSearch": "#/components/schemas/ElasticSearchRuleActionDto", + "Email": "#/components/schemas/EmailRuleActionDto", + "Fastly": "#/components/schemas/FastlyRuleActionDto", + "Medium": "#/components/schemas/MediumRuleActionDto", + "Notification": "#/components/schemas/NotificationRuleActionDto", + "OpenSearch": "#/components/schemas/OpenSearchRuleActionDto", + "Prerender": "#/components/schemas/PrerenderRuleActionDto", + "Script": "#/components/schemas/ScriptRuleActionDto", + "SignalR": "#/components/schemas/SignalRRuleActionDto", + "Slack": "#/components/schemas/SlackRuleActionDto", + "Tweet": "#/components/schemas/TweetRuleActionDto", + "Typesense": "#/components/schemas/TypesenseRuleActionDto", + "Webhook": "#/components/schemas/WebhookRuleActionDto" + } + }, + "x-abstract": true, + "additionalProperties": false, + "required": [ + "actionType" + ], + "properties": { + "actionType": { + "type": "string" + } + } + }, + "AlgoliaRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "appId", + "apiKey", + "indexName" + ], + "properties": { + "appId": { + "title": "Application Id", + "type": "string", + "description": "The application ID.", + "minLength": 1 + }, + "apiKey": { + "title": "Api Key", + "type": "string", + "description": "The API key to grant access to Squidex.", + "minLength": 1 + }, + "indexName": { + "title": "Index Name", + "type": "string", + "description": "The name of the index.", + "minLength": 1 + }, + "document": { + "title": "Document", + "type": "string", + "description": "The optional custom document.", + "nullable": true + }, + "delete": { + "title": "Deletion", + "type": "string", + "description": "The condition when to delete the entry.", + "nullable": true + } + } + } + ] + }, + "AzureQueueRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "connectionString", + "queue" + ], + "properties": { + "connectionString": { + "title": "Connection", + "type": "string", + "description": "The connection string to the storage account.", + "minLength": 1 + }, + "queue": { + "title": "Queue", + "type": "string", + "description": "The name of the queue.", + "minLength": 1 + }, + "payload": { + "title": "Payload (Optional)", + "type": "string", + "description": "Leave it empty to use the full event as body.", + "nullable": true + } + } + } + ] + }, + "CommentRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "text" + ], + "properties": { + "text": { + "title": "Text", + "type": "string", + "description": "The comment text.", + "minLength": 1 + }, + "client": { + "title": "Client", + "type": "string", + "description": "An optional client name.", + "nullable": true + } + } + } + ] + }, + "CreateContentRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "data", + "schema", + "client", + "publish" + ], + "properties": { + "data": { + "title": "Data", + "type": "string", + "description": "The content data.", + "minLength": 1 + }, + "schema": { + "title": "Schema", + "type": "string", + "description": "The name of the schema.", + "minLength": 1 + }, + "client": { + "title": "Client", + "type": "string", + "description": "An optional client name." + }, + "publish": { + "title": "Publish", + "type": "boolean", + "description": "Publish the content." + } + } + } + ] + }, + "DiscourseRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "url", + "apiKey", + "apiUsername", + "text" + ], + "properties": { + "url": { + "title": "Server Url", + "type": "string", + "description": "The url to the discourse server.", + "format": "uri", + "minLength": 1 + }, + "apiKey": { + "title": "Api Key", + "type": "string", + "description": "The api key to authenticate to your discourse server.", + "minLength": 1 + }, + "apiUsername": { + "title": "Api User", + "type": "string", + "description": "The api username to authenticate to your discourse server.", + "minLength": 1 + }, + "text": { + "title": "Text", + "type": "string", + "description": "The text as markdown.", + "minLength": 1 + }, + "title": { + "title": "Title", + "type": "string", + "description": "The optional title when creating new topics.", + "nullable": true + }, + "topic": { + "title": "Topic", + "type": "integer", + "description": "The optional topic id.", + "format": "int32", + "nullable": true + }, + "category": { + "title": "Category", + "type": "integer", + "description": "The optional category id.", + "format": "int32", + "nullable": true + } + } + } + ] + }, + "ElasticSearchRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "host", + "indexName" + ], + "properties": { + "host": { + "title": "Server Url", + "type": "string", + "description": "The url to the instance or cluster.", + "format": "uri", + "minLength": 1 + }, + "indexName": { + "title": "Index Name", + "type": "string", + "description": "The name of the index.", + "minLength": 1 + }, + "username": { + "title": "Username", + "type": "string", + "description": "The optional username.", + "nullable": true + }, + "password": { + "title": "Password", + "type": "string", + "description": "The optional password.", + "nullable": true + }, + "document": { + "title": "Document", + "type": "string", + "description": "The optional custom document.", + "nullable": true + }, + "delete": { + "title": "Deletion", + "type": "string", + "description": "The condition when to delete the document.", + "nullable": true + } + } + } + ] + }, + "EmailRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "serverHost", + "serverPort", + "messageFrom", + "messageTo", + "messageSubject", + "messageBody", + "serverUsername", + "serverPassword" + ], + "properties": { + "serverHost": { + "title": "Server Host", + "type": "string", + "description": "The IP address or host to the SMTP server.", + "minLength": 1 + }, + "serverPort": { + "title": "Server Port", + "type": "integer", + "description": "The port to the SMTP server.", + "format": "int32" + }, + "serverUsername": { + "title": "Username", + "type": "string", + "description": "The username for the SMTP server." + }, + "serverPassword": { + "title": "Password", + "type": "string", + "description": "The password for the SMTP server." + }, + "messageFrom": { + "title": "From Address", + "type": "string", + "description": "The email sending address.", + "minLength": 1 + }, + "messageTo": { + "title": "To Address", + "type": "string", + "description": "The email message will be sent to.", + "minLength": 1 + }, + "messageSubject": { + "title": "Subject", + "type": "string", + "description": "The subject line for this email message.", + "minLength": 1 + }, + "messageBody": { + "title": "Body", + "type": "string", + "description": "The message body.", + "minLength": 1 + } + } + } + ] + }, + "FastlyRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "apiKey", + "serviceId" + ], + "properties": { + "apiKey": { + "title": "Api Key", + "type": "string", + "description": "The API key to grant access to Squidex.", + "minLength": 1 + }, + "serviceId": { + "title": "Service Id", + "type": "string", + "description": "The ID of the fastly service.", + "minLength": 1 + } + } + } + ] + }, + "MediumRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "accessToken", + "title", + "content", + "isHtml" + ], + "properties": { + "accessToken": { + "title": "Access Token", + "type": "string", + "description": "The self issued access token.", + "minLength": 1 + }, + "title": { + "title": "Title", + "type": "string", + "description": "The title, used for the url.", + "minLength": 1 + }, + "content": { + "title": "Content", + "type": "string", + "description": "The content, either html or markdown.", + "minLength": 1 + }, + "canonicalUrl": { + "title": "Canonical Url", + "type": "string", + "description": "The original home of this content, if it was originally published elsewhere.", + "nullable": true + }, + "tags": { + "title": "Tags", + "type": "string", + "description": "The optional comma separated list of tags.", + "nullable": true + }, + "publicationId": { + "title": "Publication Id", + "type": "string", + "description": "Optional publication id.", + "nullable": true + }, + "isHtml": { + "title": "Is Html", + "type": "boolean", + "description": "Indicates whether the content is markdown or html." + } + } + } + ] + }, + "NotificationRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "user", + "text" + ], + "properties": { + "user": { + "title": "User", + "type": "string", + "description": "The user id or email.", + "minLength": 1 + }, + "text": { + "title": "Title", + "type": "string", + "description": "The text to send.", + "minLength": 1 + }, + "url": { + "title": "Url", + "type": "string", + "description": "The optional url to attach to the notification.", + "nullable": true + }, + "client": { + "title": "Client", + "type": "string", + "description": "An optional client name.", + "nullable": true + } + } + } + ] + }, + "OpenSearchRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "host", + "indexName" + ], + "properties": { + "host": { + "title": "Server Url", + "type": "string", + "description": "The url to the instance or cluster.", + "format": "uri", + "minLength": 1 + }, + "indexName": { + "title": "Index Name", + "type": "string", + "description": "The name of the index.", + "minLength": 1 + }, + "username": { + "title": "Username", + "type": "string", + "description": "The optional username.", + "nullable": true + }, + "password": { + "title": "Password", + "type": "string", + "description": "The optional password.", + "nullable": true + }, + "document": { + "title": "Document", + "type": "string", + "description": "The optional custom document.", + "nullable": true + }, + "delete": { + "title": "Deletion", + "type": "string", + "description": "The condition when to delete the document.", + "nullable": true + } + } + } + ] + }, + "PrerenderRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "token", + "url" + ], + "properties": { + "token": { + "title": "Token", + "type": "string", + "description": "The prerender token from your account.", + "minLength": 1 + }, + "url": { + "title": "Url", + "type": "string", + "description": "The url to recache.", + "minLength": 1 + } + } + } + ] + }, + "ScriptRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "script" + ], + "properties": { + "script": { + "title": "Script", + "type": "string", + "description": "The script to render.", + "minLength": 1 + } + } + } + ] + }, + "SignalRRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "connectionString", + "hubName", + "action" + ], + "properties": { + "connectionString": { + "title": "Connection", + "type": "string", + "description": "The connection string to the Azure SignalR.", + "minLength": 1 + }, + "hubName": { + "title": "Hub Name", + "type": "string", + "description": "The name of the hub.", + "minLength": 1 + }, + "action": { + "title": "Action", + "description": "* Broadcast = send to all users.\n * User = send to all target users(s).\n * Group = send to all target group(s).", + "$ref": "#/components/schemas/ActionTypeEnum" + }, + "methodName": { + "title": "Methode Name", + "type": "string", + "description": "Set the Name of the hub method received by the customer.", + "nullable": true + }, + "target": { + "title": "Target (Optional)", + "type": "string", + "description": "Define target users or groups by id or name. One item per line. Not needed for Broadcast action.", + "nullable": true + }, + "payload": { + "title": "Payload (Optional)", + "type": "string", + "description": "Leave it empty to use the full event as body.", + "nullable": true + } + } + } + ] + }, + "ActionTypeEnum": { + "type": "string", + "description": "", + "x-enumNames": [ + "Broadcast", + "User", + "Group" + ], + "enum": [ + "Broadcast", + "User", + "Group" + ] + }, + "SlackRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "webhookUrl", + "text" + ], + "properties": { + "webhookUrl": { + "title": "Webhook Url", + "type": "string", + "description": "The slack webhook url.", + "format": "uri", + "minLength": 1 + }, + "text": { + "title": "Text", + "type": "string", + "description": "The text that is sent as message to slack.", + "minLength": 1 + } + } + } + ] + }, + "TweetRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "accessToken", + "accessSecret", + "text" + ], + "properties": { + "accessToken": { + "title": "Access Token", + "type": "string", + "description": " The generated access token.", + "minLength": 1 + }, + "accessSecret": { + "title": "Access Secret", + "type": "string", + "description": " The generated access secret.", + "minLength": 1 + }, + "text": { + "title": "Text", + "type": "string", + "description": "The text that is sent as tweet to twitter.", + "minLength": 1 + } + } + } + ] + }, + "TypesenseRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "host", + "indexName", + "apiKey" + ], + "properties": { + "host": { + "title": "Server Url", + "type": "string", + "description": "The url to the instance or cluster.", + "format": "uri", + "minLength": 1 + }, + "indexName": { + "title": "Index Name", + "type": "string", + "description": "The name of the index.", + "minLength": 1 + }, + "apiKey": { + "title": "Api Key", + "type": "string", + "description": "The api key.", + "minLength": 1 + }, + "document": { + "title": "Document", + "type": "string", + "description": "The optional custom document.", + "nullable": true + }, + "delete": { + "title": "Deletion", + "type": "string", + "description": "The condition when to delete the document.", + "nullable": true + } + } + } + ] + }, + "WebhookRuleActionDto": { + "allOf": [ + { + "$ref": "#/components/schemas/RuleActionDto" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "url", + "method" + ], + "properties": { + "url": { + "title": "Url", + "type": "string", + "description": "The url to the webhook.", + "format": "uri", + "minLength": 1 + }, + "method": { + "title": "Method", + "description": "The type of the request.", + "$ref": "#/components/schemas/WebhookMethod" + }, + "payload": { + "title": "Payload (Optional)", + "type": "string", + "description": "Leave it empty to use the full event as body.", + "nullable": true + }, + "payloadType": { + "title": "Payload Type", + "type": "string", + "description": "The mime type of the payload.", + "nullable": true + }, + "headers": { + "title": "Headers (Optional)", + "type": "string", + "description": "The message headers in the format '[Key]=[Value]', one entry per line.", + "nullable": true + }, + "sharedSecret": { + "title": "Shared Secret", + "type": "string", + "description": "The shared secret that is used to calculate the payload signature.", + "nullable": true + } + } + } + ] + }, + "WebhookMethod": { + "type": "string", + "description": "", + "x-enumNames": [ + "POST", + "PUT", + "GET", + "DELETE", + "PATCH" + ], + "enum": [ + "POST", + "PUT", + "GET", + "DELETE", + "PATCH" + ] + }, + "CreateRuleDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "trigger", + "action" + ], + "properties": { + "trigger": { + "description": "The trigger properties.", + "$ref": "#/components/schemas/RuleTriggerDto" + }, + "action": { + "description": "The action properties.", + "$ref": "#/components/schemas/RuleActionDto" + } + } + }, + "UpdateRuleDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "Optional rule name.", + "nullable": true + }, + "trigger": { + "description": "The trigger properties.", + "nullable": true, + "$ref": "#/components/schemas/RuleTriggerDto" + }, + "action": { + "description": "The action properties.", + "nullable": true, + "$ref": "#/components/schemas/RuleActionDto" + }, + "isEnabled": { + "type": "boolean", + "description": "Enable or disable the rule.", + "nullable": true + } + } + }, + "SimulatedRuleEventsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "total", + "items" + ], + "properties": { + "total": { + "type": "integer", + "description": "The total number of simulated rule events.", + "format": "int64" + }, + "items": { + "type": "array", + "description": "The simulated rule events.", + "items": { + "$ref": "#/components/schemas/SimulatedRuleEventDto" + } + } + } + } + ] + }, + "SimulatedRuleEventDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "eventId", + "uniqueId", + "eventName", + "event", + "skipReasons" + ], + "properties": { + "eventId": { + "type": "string", + "description": "The unique event id.", + "format": "guid", + "minLength": 1 + }, + "uniqueId": { + "type": "string", + "description": "The the unique id of the simulated event.", + "minLength": 1 + }, + "eventName": { + "type": "string", + "description": "The name of the event.", + "minLength": 1 + }, + "event": { + "description": "The source event." + }, + "enrichedEvent": { + "description": "The enriched event.", + "nullable": true + }, + "actionName": { + "type": "string", + "description": "The data for the action.", + "nullable": true + }, + "actionData": { + "type": "string", + "description": "The name of the action.", + "nullable": true + }, + "error": { + "type": "string", + "description": "The name of the event.", + "nullable": true + }, + "skipReasons": { + "type": "array", + "description": "The reason why the event has been skipped.", + "items": { + "$ref": "#/components/schemas/SkipReason" + } + } + } + }, + "SkipReason": { + "type": "string", + "description": "", + "x-enumFlags": true, + "x-enumNames": [ + "None", + "ConditionDoesNotMatch", + "ConditionPrecheckDoesNotMatch", + "Disabled", + "Failed", + "FromRule", + "NoAction", + "NoTrigger", + "TooOld", + "WrongEvent", + "WrongEventForTrigger" + ], + "enum": [ + "None", + "ConditionDoesNotMatch", + "ConditionPrecheckDoesNotMatch", + "Disabled", + "Failed", + "FromRule", + "NoAction", + "NoTrigger", + "TooOld", + "WrongEvent", + "WrongEventForTrigger" + ] + }, + "RuleEventsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "total", + "items" + ], + "properties": { + "total": { + "type": "integer", + "description": "The total number of rule events.", + "format": "int64" + }, + "items": { + "type": "array", + "description": "The rule events.", + "items": { + "$ref": "#/components/schemas/RuleEventDto" + } + } + } + } + ] + }, + "RuleEventDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "created", + "description", + "eventName", + "numCalls", + "result", + "jobResult" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the event." + }, + "created": { + "type": "string", + "description": "The time when the event has been created.", + "format": "date-time" + }, + "description": { + "type": "string", + "description": "The description." + }, + "eventName": { + "type": "string", + "description": "The name of the event." + }, + "lastDump": { + "type": "string", + "description": "The last dump.", + "nullable": true + }, + "numCalls": { + "type": "integer", + "description": "The number of calls.", + "format": "int32" + }, + "nextAttempt": { + "type": "string", + "description": "The next attempt.", + "format": "date-time", + "nullable": true + }, + "result": { + "description": "The result of the event.", + "$ref": "#/components/schemas/RuleResult" + }, + "jobResult": { + "description": "The result of the job.", + "$ref": "#/components/schemas/RuleJobResult" + } + } + } + ] + }, + "RuleResult": { + "type": "string", + "description": "", + "x-enumNames": [ + "Pending", + "Success", + "Failed", + "Timeout" + ], + "enum": [ + "Pending", + "Success", + "Failed", + "Timeout" + ] + }, + "RuleJobResult": { + "type": "string", + "description": "", + "x-enumNames": [ + "Pending", + "Success", + "Retry", + "Failed", + "Cancelled" + ], + "enum": [ + "Pending", + "Success", + "Retry", + "Failed", + "Cancelled" + ] + }, + "PlansDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "plans", + "locked" + ], + "properties": { + "plans": { + "type": "array", + "description": "The available plans.", + "items": { + "$ref": "#/components/schemas/PlanDto" + } + }, + "currentPlanId": { + "type": "string", + "description": "The current plan id.", + "nullable": true + }, + "planOwner": { + "type": "string", + "description": "The plan owner.", + "nullable": true + }, + "portalLink": { + "type": "string", + "description": "The link to the management portal.", + "format": "uri", + "nullable": true + }, + "referral": { + "description": "The referral management.", + "nullable": true, + "$ref": "#/components/schemas/ReferralInfo" + }, + "locked": { + "description": "The reason why the plan cannot be changed.", + "$ref": "#/components/schemas/PlansLockedReason" + } + } + }, + "PlanDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "name", + "costs", + "maxApiBytes", + "maxApiCalls", + "maxAssetSize", + "maxContributors" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the plan." + }, + "name": { + "type": "string", + "description": "The name of the plan." + }, + "costs": { + "type": "string", + "description": "The monthly costs of the plan." + }, + "confirmText": { + "type": "string", + "description": "An optional confirm text for the monthly subscription.", + "nullable": true + }, + "yearlyConfirmText": { + "type": "string", + "description": "An optional confirm text for the yearly subscription.", + "nullable": true + }, + "yearlyCosts": { + "type": "string", + "description": "The yearly costs of the plan.", + "nullable": true + }, + "yearlyId": { + "type": "string", + "description": "The yearly ID of the plan.", + "nullable": true + }, + "maxApiBytes": { + "type": "integer", + "description": "The maximum number of API traffic.", + "format": "int64" + }, + "maxApiCalls": { + "type": "integer", + "description": "The maximum number of API calls.", + "format": "int64" + }, + "maxAssetSize": { + "type": "integer", + "description": "The maximum allowed asset size.", + "format": "int64" + }, + "maxContributors": { + "type": "integer", + "description": "The maximum number of contributors.", + "format": "int32" + } + } + }, + "ReferralInfo": { + "type": "object", + "additionalProperties": false, + "required": [ + "code", + "earned", + "condition" + ], + "properties": { + "code": { + "type": "string" + }, + "earned": { + "type": "string" + }, + "condition": { + "type": "string" + } + } + }, + "PlansLockedReason": { + "type": "string", + "description": "", + "x-enumNames": [ + "None", + "NotOwner", + "NoPermission", + "ManagedByTeam" + ], + "enum": [ + "None", + "NotOwner", + "NoPermission", + "ManagedByTeam" + ] + }, + "PlanChangedDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "redirectUri": { + "type": "string", + "description": "Optional redirect uri.", + "nullable": true + } + } + }, + "ChangePlanDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "planId" + ], + "properties": { + "planId": { + "type": "string", + "description": "The new plan id.", + "minLength": 1 + } + } + }, + "ExposedValues": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "FeaturesDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "features", + "version" + ], + "properties": { + "features": { + "type": "array", + "description": "The latest features.", + "items": { + "$ref": "#/components/schemas/FeatureDto" + } + }, + "version": { + "type": "integer", + "description": "The recent version.", + "format": "int32" + } + } + }, + "FeatureDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "text" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the feature." + }, + "text": { + "type": "string", + "description": "The description text." + } + } + }, + "LanguageDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "iso2Code", + "englishName", + "nativeName" + ], + "properties": { + "iso2Code": { + "type": "string", + "description": "The iso code of the language." + }, + "englishName": { + "type": "string", + "description": "The english name of the language." + }, + "nativeName": { + "type": "string", + "description": "The native name of the language." + } + } + }, + "JobsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "The jobs.", + "items": { + "$ref": "#/components/schemas/JobDto" + } + } + } + } + ] + }, + "JobDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "started", + "status", + "taskName", + "description", + "taskArguments", + "log", + "canDownload" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the job." + }, + "started": { + "type": "string", + "description": "The time when the job has been started.", + "format": "date-time" + }, + "stopped": { + "type": "string", + "description": "The time when the job has been stopped.", + "format": "date-time", + "nullable": true + }, + "status": { + "description": "The status of the operation.", + "$ref": "#/components/schemas/JobStatus" + }, + "taskName": { + "type": "string", + "description": "The name of the task." + }, + "description": { + "type": "string", + "description": "The description of the job." + }, + "taskArguments": { + "type": "object", + "description": "The arguments for the job.", + "additionalProperties": { + "type": "string" + } + }, + "log": { + "type": "array", + "description": "The list of log items.", + "items": { + "$ref": "#/components/schemas/JobLogMessageDto" + } + }, + "canDownload": { + "type": "boolean", + "description": "Indicates whether the job can be downloaded." + } + } + } + ] + }, + "JobStatus": { + "type": "string", + "description": "", + "x-enumNames": [ + "Created", + "Started", + "Completed", + "Cancelled", + "Failed" + ], + "enum": [ + "Created", + "Started", + "Completed", + "Cancelled", + "Failed" + ] + }, + "JobLogMessageDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "timestamp", + "message" + ], + "properties": { + "timestamp": { + "type": "string", + "description": "The timestamp.", + "format": "date-time" + }, + "message": { + "type": "string", + "description": "The log message." + } + } + }, + "HistoryEventDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "message", + "eventType", + "actor", + "eventId", + "created", + "version" + ], + "properties": { + "message": { + "type": "string", + "description": "The message for the event." + }, + "eventType": { + "type": "string", + "description": "The type of the original event." + }, + "actor": { + "type": "string", + "description": "The user who called the action." + }, + "eventId": { + "type": "string", + "description": "Gets a unique id for the event." + }, + "created": { + "type": "string", + "description": "The time when the event happened.", + "format": "date-time" + }, + "version": { + "type": "integer", + "description": "The version identifier.", + "format": "int64" + } + } + }, + "EventConsumersDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "The event consumers.", + "items": { + "$ref": "#/components/schemas/EventConsumerDto" + } + } + } + } + ] + }, + "EventConsumerDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "isStopped", + "isResetting", + "count" + ], + "properties": { + "isStopped": { + "type": "boolean", + "description": "Indicates if the event consumer has been started." + }, + "isResetting": { + "type": "boolean", + "description": "Indicates if the event consumer is resetting at the moment." + }, + "count": { + "type": "integer", + "description": "The number of handled events.", + "format": "int32" + }, + "name": { + "type": "string", + "description": "The name of the event consumer.", + "minLength": 1 + }, + "error": { + "type": "string", + "description": "The error details if the event consumer has been stopped after a failure.", + "nullable": true + }, + "position": { + "type": "string", + "description": "The position within the vent stream.", + "nullable": true + } + } + } + ] + }, + "ContentsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "total", + "items", + "statuses" + ], + "properties": { + "total": { + "type": "integer", + "description": "The total number of content items.", + "format": "int64" + }, + "items": { + "type": "array", + "description": "The content items.", + "items": { + "$ref": "#/components/schemas/ContentDto" + } + }, + "statuses": { + "type": "array", + "description": "The possible statuses.", + "items": { + "$ref": "#/components/schemas/StatusInfoDto" + } + } + } + } + ] + }, + "ContentDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "createdBy", + "lastModifiedBy", + "data", + "created", + "lastModified", + "status", + "statusColor", + "schemaId", + "isDeleted", + "version" + ], + "properties": { + "id": { + "type": "string", + "description": "The if of the content item." + }, + "createdBy": { + "type": "string", + "description": "The user that has created the content item." + }, + "lastModifiedBy": { + "type": "string", + "description": "The user that has updated the content item." + }, + "data": { + "description": "The data of the content item." + }, + "referenceData": { + "description": "The reference data for the frontend UI.", + "nullable": true, + "$ref": "#/components/schemas/ContentData" + }, + "created": { + "type": "string", + "description": "The date and time when the content item has been created.", + "format": "date-time" + }, + "lastModified": { + "type": "string", + "description": "The date and time when the content item has been modified last.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "The status of the content." + }, + "newStatus": { + "type": "string", + "description": "The new status of the content.", + "nullable": true + }, + "statusColor": { + "type": "string", + "description": "The color of the status." + }, + "newStatusColor": { + "type": "string", + "description": "The color of the new status.", + "nullable": true + }, + "editToken": { + "type": "string", + "description": "The UI token.", + "nullable": true + }, + "scheduleJob": { + "description": "The scheduled status.", + "nullable": true, + "$ref": "#/components/schemas/ScheduleJobDto" + }, + "schemaId": { + "type": "string", + "description": "The ID of the schema." + }, + "schemaName": { + "type": "string", + "description": "The name of the schema.", + "nullable": true + }, + "schemaDisplayName": { + "type": "string", + "description": "The display name of the schema.", + "nullable": true + }, + "referenceFields": { + "type": "array", + "description": "The reference fields.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/FieldDto" + } + }, + "isDeleted": { + "type": "boolean", + "description": "Indicates whether the content is deleted." + }, + "version": { + "type": "integer", + "description": "The version of the content.", + "format": "int64" + } + } + } + ] + }, + "ContentData": { + "type": "object", + "additionalProperties": { + "nullable": true, + "$ref": "#/components/schemas/ContentFieldData" + } + }, + "ContentFieldData": { + "type": "object", + "additionalProperties": {} + }, + "ScheduleJobDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "status", + "dueTime", + "color", + "scheduledBy" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the schedule job." + }, + "status": { + "type": "string", + "description": "The new status." + }, + "dueTime": { + "type": "string", + "description": "The target date and time when the content should be scheduled.", + "format": "date-time" + }, + "color": { + "type": "string", + "description": "The color of the scheduled status." + }, + "scheduledBy": { + "type": "string", + "description": "The user who schedule the content." + } + } + }, + "StatusInfoDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "status", + "color" + ], + "properties": { + "status": { + "type": "string", + "description": "The name of the status." + }, + "color": { + "type": "string", + "description": "The color of the status." + } + } + }, + "QueryDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "ids": { + "type": "array", + "description": "The optional list of ids to query.", + "nullable": true, + "items": { + "type": "string" + } + }, + "oData": { + "type": "string", + "description": "The optional odata query.", + "nullable": true + }, + "q": { + "description": "The optional json query.", + "nullable": true + }, + "parentId": { + "type": "string", + "description": "The parent id (for assets).", + "nullable": true + } + } + }, + "BulkResultDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "jobIndex" + ], + "properties": { + "error": { + "description": "The error when the bulk job failed.", + "nullable": true, + "$ref": "#/components/schemas/ErrorDto" + }, + "jobIndex": { + "type": "integer", + "description": "The index of the bulk job where the result belongs to. The order can change.", + "format": "int32" + }, + "id": { + "type": "string", + "description": "The ID of the entity that has been handled successfully or not.", + "nullable": true + }, + "contentId": { + "type": "string", + "description": "The ID of the entity that has been handled successfully or not.", + "deprecated": true, + "x-deprecatedMessage": "Use 'id' field now.", + "nullable": true + } + } + }, + "ImportContentsDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "datas" + ], + "properties": { + "datas": { + "type": "array", + "description": "The data to import.", + "items": { + "$ref": "#/components/schemas/ContentData" + } + }, + "publish": { + "type": "boolean", + "description": "True to automatically publish the content.", + "deprecated": true, + "x-deprecatedMessage": "Use bulk endpoint now." + }, + "doNotScript": { + "type": "boolean", + "description": "True to turn off scripting for faster inserts. Default: true." + }, + "optimizeValidation": { + "type": "boolean", + "description": "True to turn off costly validation: Unique checks, asset checks and reference checks. Default: true." + } + } + }, + "BulkUpdateContentsDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "jobs" + ], + "properties": { + "jobs": { + "type": "array", + "description": "The contents to update or insert.", + "items": { + "$ref": "#/components/schemas/BulkUpdateContentsJobDto" + } + }, + "publish": { + "type": "boolean", + "description": "True to automatically publish the content.", + "deprecated": true, + "x-deprecatedMessage": "Use 'jobs.status' fields now." + }, + "doNotScript": { + "type": "boolean", + "description": "True to turn off scripting for faster inserts. Default: true." + }, + "enrichRequiredFields": { + "type": "boolean", + "description": "True, to also enrich required fields. Default: false.\n " + }, + "doNotValidate": { + "type": "boolean", + "description": "True to turn off validation for faster inserts. Default: false." + }, + "doNotValidateWorkflow": { + "type": "boolean", + "description": "True to turn off validation of workflow rules. Default: false." + }, + "checkReferrers": { + "type": "boolean", + "description": "True to check referrers of deleted contents." + }, + "optimizeValidation": { + "type": "boolean", + "description": "True to turn off costly validation: Unique checks, asset checks and reference checks. Default: true." + } + } + }, + "BulkUpdateContentsJobDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "query": { + "description": "An optional query to identify the content to update.", + "nullable": true, + "$ref": "#/components/schemas/QueryJsonDto" + }, + "id": { + "type": "string", + "description": "An optional ID of the content to update.", + "nullable": true + }, + "data": { + "description": "The data of the content when type is set to 'Upsert', 'Create', 'Update' or 'Patch.", + "nullable": true, + "$ref": "#/components/schemas/ContentData" + }, + "status": { + "type": "string", + "description": "The new status when the type is set to 'ChangeStatus' or 'Upsert'.", + "nullable": true + }, + "dueTime": { + "type": "string", + "description": "The due time.", + "format": "date-time", + "nullable": true + }, + "type": { + "description": "The update type.", + "$ref": "#/components/schemas/BulkUpdateContentType" + }, + "schema": { + "type": "string", + "description": "The optional schema id or name.", + "nullable": true + }, + "patch": { + "type": "boolean", + "description": "Makes the update as patch." + }, + "permanent": { + "type": "boolean", + "description": "True to delete the content permanently." + }, + "enrichDefaults": { + "type": "boolean", + "description": "Enrich the data with the default values when updating a content item." + }, + "expectedCount": { + "type": "integer", + "description": "The number of expected items. Set it to a higher number to update multiple items when a query is defined.", + "format": "int64" + }, + "expectedVersion": { + "type": "integer", + "description": "The expected version.", + "format": "int64" + } + } + }, + "QueryJsonDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "skip", + "take", + "random", + "top" + ], + "properties": { + "filter": { + "nullable": true + }, + "fullText": { + "type": "string", + "nullable": true + }, + "skip": { + "type": "integer", + "format": "int64" + }, + "take": { + "type": "integer", + "format": "int64" + }, + "random": { + "type": "integer", + "format": "int64" + }, + "top": { + "type": "integer", + "format": "int64" + }, + "sort": { + "type": "array", + "nullable": true, + "items": { + "$ref": "#/components/schemas/SortNode" + } + } + } + }, + "SortNode": { + "type": "object", + "additionalProperties": false, + "required": [ + "path", + "order" + ], + "properties": { + "path": { + "type": "string" + }, + "order": { + "$ref": "#/components/schemas/SortOrder" + } + } + }, + "SortOrder": { + "type": "string", + "description": "", + "x-enumNames": [ + "Ascending", + "Descending" + ], + "enum": [ + "Ascending", + "Descending" + ] + }, + "BulkUpdateContentType": { + "type": "string", + "description": "", + "x-enumNames": [ + "Upsert", + "ChangeStatus", + "Create", + "Delete", + "Patch", + "Update", + "Validate", + "EnrichDefaults" + ], + "enum": [ + "Upsert", + "ChangeStatus", + "Create", + "Delete", + "Patch", + "Update", + "Validate", + "EnrichDefaults" + ] + }, + "ChangeStatusDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "status" + ], + "properties": { + "status": { + "type": "string", + "description": "The new status." + }, + "dueTime": { + "type": "string", + "description": "The due time.", + "format": "date-time", + "nullable": true + }, + "checkReferrers": { + "type": "boolean", + "description": "True to check referrers of this content." + } + } + }, + "AllContentsByPostDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "ids": { + "type": "array", + "description": "The list of ids to query.", + "nullable": true, + "items": { + "type": "string" + } + }, + "scheduledFrom": { + "type": "string", + "description": "The start of the schedule.", + "format": "date-time", + "nullable": true + }, + "scheduledTo": { + "type": "string", + "description": "The end of the schedule.", + "format": "date-time", + "nullable": true + }, + "referencing": { + "type": "string", + "description": "The ID of the referencing content item.", + "nullable": true + }, + "references": { + "type": "string", + "description": "The ID of the reference content item.", + "nullable": true + }, + "oData": { + "type": "string", + "description": "The optional odata query.", + "nullable": true + }, + "q": { + "description": "The optional json query.", + "nullable": true + } + } + }, + "BackupJobsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "deprecated": true, + "x-deprecatedMessage": "Use Jobs endpoint.", + "additionalProperties": false, + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "The backups.", + "items": { + "$ref": "#/components/schemas/BackupJobDto" + } + } + } + } + ] + }, + "BackupJobDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "deprecated": true, + "x-deprecatedMessage": "Use Jobs endpoint.", + "additionalProperties": false, + "required": [ + "id", + "started", + "handledEvents", + "handledAssets", + "status" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the backup job." + }, + "started": { + "type": "string", + "description": "The time when the job has been started.", + "format": "date-time" + }, + "stopped": { + "type": "string", + "description": "The time when the job has been stopped.", + "format": "date-time", + "nullable": true + }, + "handledEvents": { + "type": "integer", + "description": "The number of handled events.", + "format": "int32" + }, + "handledAssets": { + "type": "integer", + "description": "The number of handled assets.", + "format": "int32" + }, + "status": { + "description": "The status of the operation.", + "$ref": "#/components/schemas/JobStatus" + } + } + } + ] + }, + "RestoreJobDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "url", + "log", + "started", + "status" + ], + "properties": { + "url": { + "type": "string", + "description": "The uri to load from.", + "format": "uri" + }, + "log": { + "type": "array", + "description": "The status log.", + "items": { + "type": "string" + } + }, + "started": { + "type": "string", + "description": "The time when the job has been started.", + "format": "date-time" + }, + "stopped": { + "type": "string", + "description": "The time when the job has been stopped.", + "format": "date-time", + "nullable": true + }, + "status": { + "description": "The status of the operation.", + "$ref": "#/components/schemas/JobStatus" + } + } + }, + "RestoreRequestDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "url" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the app.", + "pattern": "^[a-z0-9]+(\\-[a-z0-9]+)*$", + "nullable": true + }, + "url": { + "type": "string", + "description": "The url to the restore file.", + "format": "uri", + "minLength": 1 + } + } + }, + "ResizeMode": { + "type": "string", + "description": "", + "x-enumNames": [ + "Crop", + "CropUpsize", + "Pad", + "BoxPad", + "Max", + "Min", + "Stretch" + ], + "enum": [ + "Crop", + "CropUpsize", + "Pad", + "BoxPad", + "Max", + "Min", + "Stretch" + ] + }, + "ImageFormat": { + "type": "string", + "description": "", + "x-enumNames": [ + "AVIF", + "BMP", + "GIF", + "JPEG", + "PNG", + "TGA", + "TIFF", + "WEBP" + ], + "enum": [ + "AVIF", + "BMP", + "GIF", + "JPEG", + "PNG", + "TGA", + "TIFF", + "WEBP" + ] + }, + "AssetFoldersDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "total", + "items", + "path" + ], + "properties": { + "total": { + "type": "integer", + "description": "The total number of assets.", + "format": "int64" + }, + "items": { + "type": "array", + "description": "The assets folders.", + "items": { + "$ref": "#/components/schemas/AssetFolderDto" + } + }, + "path": { + "type": "array", + "description": "The path to the current folder.", + "items": { + "$ref": "#/components/schemas/AssetFolderDto" + } + } + } + } + ] + }, + "AssetFolderDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "parentId", + "folderName", + "version" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the asset." + }, + "parentId": { + "type": "string", + "description": "The ID of the parent folder. Empty for files without parent." + }, + "folderName": { + "type": "string", + "description": "The folder name." + }, + "version": { + "type": "integer", + "description": "The version of the asset folder.", + "format": "int64" + } + } + } + ] + }, + "AssetFolderScope": { + "type": "string", + "description": "", + "x-enumNames": [ + "PathAndItems", + "Path", + "Items" + ], + "enum": [ + "PathAndItems", + "Path", + "Items" + ] + }, + "CreateAssetFolderDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "folderName" + ], + "properties": { + "folderName": { + "type": "string", + "description": "The name of the folder.", + "minLength": 1 + }, + "parentId": { + "type": "string", + "description": "The ID of the parent folder." + } + } + }, + "RenameAssetFolderDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "folderName" + ], + "properties": { + "folderName": { + "type": "string", + "description": "The name of the folder.", + "minLength": 1 + } + } + }, + "MoveAssetFolderDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "parentId": { + "type": "string", + "description": "The parent folder id." + } + } + }, + "RenameTagDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "tagName" + ], + "properties": { + "tagName": { + "type": "string", + "description": "The new name for the tag.", + "minLength": 1 + } + } + }, + "AssetsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "total", + "items" + ], + "properties": { + "total": { + "type": "integer", + "description": "The total number of assets.", + "format": "int64" + }, + "items": { + "type": "array", + "description": "The assets.", + "items": { + "$ref": "#/components/schemas/AssetDto" + } + } + } + } + ] + }, + "AssetDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "parentId", + "fileName", + "isProtected", + "slug", + "mimeType", + "fileType", + "metadataText", + "metadata", + "fileSize", + "fileVersion", + "type", + "createdBy", + "lastModifiedBy", + "created", + "lastModified", + "version", + "isImage" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the asset." + }, + "parentId": { + "type": "string", + "description": "The ID of the parent folder. Empty for files without parent." + }, + "fileName": { + "type": "string", + "description": "The file name." + }, + "fileHash": { + "type": "string", + "description": "The file hash.", + "nullable": true + }, + "isProtected": { + "type": "boolean", + "description": "True, when the asset is not public." + }, + "slug": { + "type": "string", + "description": "The slug." + }, + "mimeType": { + "type": "string", + "description": "The mime type." + }, + "fileType": { + "type": "string", + "description": "The file type." + }, + "metadataText": { + "type": "string", + "description": "The formatted text representation of the metadata." + }, + "editToken": { + "type": "string", + "description": "The UI token.", + "nullable": true + }, + "metadata": { + "type": "object", + "description": "The asset metadata.", + "additionalProperties": { + "description": "Any" + } + }, + "tags": { + "type": "array", + "description": "The asset tags.", + "nullable": true, + "items": { + "type": "string" + } + }, + "fileSize": { + "type": "integer", + "description": "The size of the file in bytes.", + "format": "int64" + }, + "fileVersion": { + "type": "integer", + "description": "The version of the file.", + "format": "int64" + }, + "type": { + "description": "The type of the asset.", + "$ref": "#/components/schemas/AssetType" + }, + "createdBy": { + "type": "string", + "description": "The user that has created the schema." + }, + "lastModifiedBy": { + "type": "string", + "description": "The user that has updated the asset." + }, + "created": { + "type": "string", + "description": "The date and time when the asset has been created.", + "format": "date-time" + }, + "lastModified": { + "type": "string", + "description": "The date and time when the asset has been modified last.", + "format": "date-time" + }, + "version": { + "type": "integer", + "description": "The version of the asset.", + "format": "int64" + }, + "_meta": { + "description": "The metadata.", + "nullable": true, + "$ref": "#/components/schemas/AssetMeta" + }, + "isImage": { + "type": "boolean", + "description": "Determines of the created file is an image.", + "deprecated": true, + "x-deprecatedMessage": "Use 'type' field now." + }, + "pixelWidth": { + "type": "integer", + "description": "The width of the image in pixels if the asset is an image.", + "format": "int32", + "deprecated": true, + "x-deprecatedMessage": "Use 'metadata' field now.", + "nullable": true + }, + "pixelHeight": { + "type": "integer", + "description": "The height of the image in pixels if the asset is an image.", + "format": "int32", + "deprecated": true, + "x-deprecatedMessage": "Use 'metadata' field now.", + "nullable": true + } + } + } + ] + }, + "AssetMeta": { + "type": "object", + "additionalProperties": false, + "required": [ + "isDuplicate" + ], + "properties": { + "isDuplicate": { + "type": "string", + "description": "Indicates whether the asset is a duplicate." + } + } + }, + "BulkUpdateAssetsDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "jobs": { + "type": "array", + "description": "The contents to update or insert.", + "nullable": true, + "items": { + "$ref": "#/components/schemas/BulkUpdateAssetsJobDto" + } + }, + "checkReferrers": { + "type": "boolean", + "description": "True to check referrers of deleted assets." + }, + "optimizeValidation": { + "type": "boolean", + "description": "True to turn off costly validation: Folder checks. Default: true." + }, + "doNotScript": { + "type": "boolean", + "description": "True to turn off scripting for faster inserts. Default: true." + } + } + }, + "BulkUpdateAssetsJobDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "An optional ID of the asset to update." + }, + "type": { + "description": "The update type.", + "$ref": "#/components/schemas/BulkUpdateAssetType" + }, + "parentId": { + "type": "string", + "description": "The parent folder id." + }, + "fileName": { + "type": "string", + "description": "The new name of the asset.", + "nullable": true + }, + "slug": { + "type": "string", + "description": "The new slug of the asset.", + "nullable": true + }, + "isProtected": { + "type": "boolean", + "description": "True, when the asset is not public.", + "nullable": true + }, + "tags": { + "type": "array", + "description": "The new asset tags.", + "nullable": true, + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The asset metadata.", + "nullable": true, + "additionalProperties": { + "description": "Any" + } + }, + "permanent": { + "type": "boolean", + "description": "True to delete the asset permanently." + }, + "expectedVersion": { + "type": "integer", + "description": "The expected version.", + "format": "int64" + } + } + }, + "BulkUpdateAssetType": { + "type": "string", + "description": "", + "x-enumNames": [ + "Annotate", + "Move", + "Delete" + ], + "enum": [ + "Annotate", + "Move", + "Delete" + ] + }, + "AnnotateAssetDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "fileName": { + "type": "string", + "description": "The new name of the asset.", + "nullable": true + }, + "slug": { + "type": "string", + "description": "The new slug of the asset.", + "nullable": true + }, + "isProtected": { + "type": "boolean", + "description": "True, when the asset is not public.", + "nullable": true + }, + "tags": { + "type": "array", + "description": "The new asset tags.", + "nullable": true, + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The asset metadata.", + "nullable": true, + "additionalProperties": { + "description": "Any" + } + } + } + }, + "MoveAssetDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "parentId": { + "type": "string", + "description": "The parent folder id." + } + } + }, + "AssetScriptsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "version" + ], + "properties": { + "query": { + "type": "string", + "description": "The script that is executed for each asset when querying assets.", + "nullable": true + }, + "queryPre": { + "type": "string", + "description": "The script that is executed for all assets when querying assets.", + "nullable": true + }, + "create": { + "type": "string", + "description": "The script that is executed when creating an asset.", + "nullable": true + }, + "update": { + "type": "string", + "description": "The script that is executed when updating a content.", + "nullable": true + }, + "annotate": { + "type": "string", + "description": "The script that is executed when annotating a content.", + "nullable": true + }, + "move": { + "type": "string", + "description": "The script that is executed when moving a content.", + "nullable": true + }, + "delete": { + "type": "string", + "description": "The script that is executed when deleting a content.", + "nullable": true + }, + "version": { + "type": "integer", + "description": "The version of the app.", + "format": "int64" + } + } + } + ] + }, + "UpdateAssetScriptsDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "query": { + "type": "string", + "description": "The script that is executed for each asset when querying assets.", + "nullable": true + }, + "queryPre": { + "type": "string", + "description": "The script that is executed for all assets when querying assets.", + "nullable": true + }, + "create": { + "type": "string", + "description": "The script that is executed when creating an asset.", + "nullable": true + }, + "update": { + "type": "string", + "description": "The script that is executed when updating a content.", + "nullable": true + }, + "annotate": { + "type": "string", + "description": "The script that is executed when annotating a content.", + "nullable": true + }, + "move": { + "type": "string", + "description": "The script that is executed when moving a content.", + "nullable": true + }, + "delete": { + "type": "string", + "description": "The script that is executed when deleting a content.", + "nullable": true + } + } + }, + "ClientsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "The clients.", + "items": { + "$ref": "#/components/schemas/ClientDto" + } + } + } + } + ] + }, + "ClientDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "secret", + "name", + "apiCallsLimit", + "apiTrafficLimit", + "allowAnonymous" + ], + "properties": { + "id": { + "type": "string", + "description": "The client id." + }, + "secret": { + "type": "string", + "description": "The client secret." + }, + "name": { + "type": "string", + "description": "The client name." + }, + "role": { + "type": "string", + "description": "The role of the client.", + "nullable": true + }, + "apiCallsLimit": { + "type": "integer", + "description": "The number of allowed api calls per month for this client.", + "format": "int64" + }, + "apiTrafficLimit": { + "type": "integer", + "description": "The number of allowed api traffic bytes per month for this client.", + "format": "int64" + }, + "allowAnonymous": { + "type": "boolean", + "description": "True to allow anonymous access without an access token for this client." + } + } + } + ] + }, + "CreateClientDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the client.", + "minLength": 1, + "pattern": "^[a-z0-9]+(\\-[a-z0-9]+)*$" + } + } + }, + "UpdateClientDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "type": "string", + "description": "The new display name of the client.", + "maxLength": 20, + "minLength": 0, + "nullable": true + }, + "role": { + "type": "string", + "description": "The role of the client.", + "nullable": true + }, + "allowAnonymous": { + "type": "boolean", + "description": "True to allow anonymous access without an access token for this client.", + "nullable": true + }, + "apiCallsLimit": { + "type": "integer", + "description": "The number of allowed api calls per month for this client.", + "format": "int64", + "nullable": true + }, + "apiTrafficLimit": { + "type": "integer", + "description": "The number of allowed api traffic bytes per month for this client.", + "format": "int64", + "nullable": true + } + } + }, + "AppLanguagesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "The languages.", + "items": { + "$ref": "#/components/schemas/AppLanguageDto" + } + } + } + } + ] + }, + "AppLanguageDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "iso2Code", + "englishName", + "fallback", + "isMaster", + "isOptional" + ], + "properties": { + "iso2Code": { + "type": "string", + "description": "The iso code of the language." + }, + "englishName": { + "type": "string", + "description": "The english name of the language." + }, + "fallback": { + "type": "array", + "description": "The fallback languages.", + "items": { + "type": "string" + } + }, + "isMaster": { + "type": "boolean", + "description": "Indicates if the language is the master language." + }, + "isOptional": { + "type": "boolean", + "description": "Indicates if the language is optional." + } + } + } + ] + }, + "AddLanguageDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "language" + ], + "properties": { + "language": { + "type": "string", + "description": "The language to add." + } + } + }, + "UpdateLanguageDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "isMaster": { + "type": "boolean", + "description": "Set the value to true to make the language the master.", + "nullable": true + }, + "isOptional": { + "type": "boolean", + "description": "Set the value to true to make the language optional." + }, + "fallback": { + "type": "array", + "description": "Optional fallback languages.", + "nullable": true, + "items": { + "type": "string" + } + } + } + }, + "RolesDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "items" + ], + "properties": { + "items": { + "type": "array", + "description": "The roles.", + "items": { + "$ref": "#/components/schemas/RoleDto" + } + } + } + } + ] + }, + "RoleDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "numClients", + "numContributors", + "isDefaultRole", + "permissions", + "properties" + ], + "properties": { + "name": { + "type": "string", + "description": "The role name." + }, + "numClients": { + "type": "integer", + "description": "The number of clients with this role.", + "format": "int32" + }, + "numContributors": { + "type": "integer", + "description": "The number of contributors with this role.", + "format": "int32" + }, + "isDefaultRole": { + "type": "boolean", + "description": "Indicates if the role is an builtin default role." + }, + "permissions": { + "type": "array", + "description": "Associated list of permissions.", + "items": { + "type": "string" + } + }, + "properties": { + "type": "object", + "description": "Associated list of UI properties.", + "additionalProperties": { + "description": "Any" + } + } + } + } + ] + }, + "AddRoleDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "The role name.", + "minLength": 1 + } + } + }, + "UpdateRoleDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "permissions" + ], + "properties": { + "permissions": { + "type": "array", + "description": "Associated list of permissions.", + "items": { + "type": "string" + } + }, + "properties": { + "type": "object", + "description": "Associated list of UI properties.", + "additionalProperties": { + "description": "Any" + } + } + } + }, + "AppDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "name", + "version", + "created", + "lastModified", + "permissions", + "canAccessApi", + "canAccessContent", + "roleProperties" + ], + "properties": { + "id": { + "type": "string", + "description": "The ID of the app." + }, + "name": { + "type": "string", + "description": "The name of the app.", + "pattern": "^[a-z0-9]+(\\-[a-z0-9]+)*$" + }, + "label": { + "type": "string", + "description": "The optional label of the app.", + "nullable": true + }, + "description": { + "type": "string", + "description": "The optional description of the app.", + "nullable": true + }, + "version": { + "type": "integer", + "description": "The version of the app.", + "format": "int64" + }, + "created": { + "type": "string", + "description": "The timestamp when the app has been created.", + "format": "date-time" + }, + "lastModified": { + "type": "string", + "description": "The timestamp when the app has been modified last.", + "format": "date-time" + }, + "teamId": { + "type": "string", + "description": "The ID of the team.", + "nullable": true + }, + "permissions": { + "type": "array", + "description": "The permission level of the user.", + "items": { + "type": "string" + } + }, + "canAccessApi": { + "type": "boolean", + "description": "Indicates if the user can access the api.", + "deprecated": true, + "x-deprecatedMessage": "Use 'roleProperties' field now." + }, + "canAccessContent": { + "type": "boolean", + "description": "Indicates if the user can access at least one content." + }, + "roleName": { + "type": "string", + "description": "The role name of the user.", + "nullable": true + }, + "roleProperties": { + "type": "object", + "description": "The properties from the role.", + "additionalProperties": { + "description": "Any" + } + } + } + } + ] + }, + "CreateAppDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the app.", + "minLength": 1, + "pattern": "^[a-z0-9]+(\\-[a-z0-9]+)*$" + }, + "template": { + "type": "string", + "description": "Initialize the app with the inbuilt template.", + "nullable": true + } + } + }, + "UpdateAppDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "label": { + "type": "string", + "description": "The optional label of your app.", + "nullable": true + }, + "description": { + "type": "string", + "description": "The optional description of your app.", + "nullable": true + } + } + }, + "TransferToTeamDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "teamId": { + "type": "string", + "description": "The ID of the team.", + "nullable": true + } + } + }, + "AppSettingsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "patterns", + "editors", + "hideScheduler", + "hideDateTimeModeButton", + "version" + ], + "properties": { + "patterns": { + "type": "array", + "description": "The configured app patterns.", + "items": { + "$ref": "#/components/schemas/PatternDto" + } + }, + "editors": { + "type": "array", + "description": "The configured UI editors.", + "items": { + "$ref": "#/components/schemas/EditorDto" + } + }, + "hideScheduler": { + "type": "boolean", + "description": "Hide the scheduler for content items." + }, + "hideDateTimeModeButton": { + "type": "boolean", + "description": "Hide the datetime mode button." + }, + "version": { + "type": "integer", + "description": "The version of the app.", + "format": "int64" + } + } + } + ] + }, + "PatternDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "regex" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the suggestion." + }, + "regex": { + "type": "string", + "description": "The regex pattern." + }, + "message": { + "type": "string", + "description": "The regex message.", + "nullable": true + } + } + }, + "EditorDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "url" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the editor." + }, + "url": { + "type": "string", + "description": "The url to the editor." + } + } + }, + "UpdateAppSettingsDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "patterns", + "editors" + ], + "properties": { + "patterns": { + "type": "array", + "description": "The configured app patterns.", + "items": { + "$ref": "#/components/schemas/PatternDto" + } + }, + "editors": { + "type": "array", + "description": "The configured UI editors.", + "items": { + "$ref": "#/components/schemas/EditorDto" + } + }, + "hideScheduler": { + "type": "boolean", + "description": "Hide the scheduler for content items." + }, + "hideDateTimeModeButton": { + "type": "boolean", + "description": "Hide the datetime mode button." + } + } + }, + "WorkflowsDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "items", + "errors" + ], + "properties": { + "items": { + "type": "array", + "description": "The workflow.", + "items": { + "$ref": "#/components/schemas/WorkflowDto" + } + }, + "errors": { + "type": "array", + "description": "The errros that should be fixed.", + "items": { + "type": "string" + } + } + } + } + ] + }, + "WorkflowDto": { + "allOf": [ + { + "$ref": "#/components/schemas/Resource" + }, + { + "type": "object", + "additionalProperties": false, + "required": [ + "id", + "steps", + "initial" + ], + "properties": { + "id": { + "type": "string", + "description": "The workflow id." + }, + "name": { + "type": "string", + "description": "The name of the workflow.", + "nullable": true + }, + "steps": { + "type": "object", + "description": "The workflow steps.", + "additionalProperties": { + "$ref": "#/components/schemas/WorkflowStepDto" + } + }, + "schemaIds": { + "type": "array", + "description": "The schema ids.", + "nullable": true, + "items": { + "type": "string" + } + }, + "initial": { + "type": "string", + "description": "The initial step." + } + } + } + ] + }, + "WorkflowStepDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "transitions": { + "type": "object", + "description": "The transitions.", + "additionalProperties": { + "$ref": "#/components/schemas/WorkflowTransitionDto" + } + }, + "color": { + "type": "string", + "description": "The optional color.", + "nullable": true + }, + "validate": { + "type": "boolean", + "description": "True if the content should be validated when moving to this step." + }, + "noUpdate": { + "type": "boolean", + "description": "Indicates if updates should not be allowed." + }, + "noUpdateExpression": { + "type": "string", + "description": "Optional expression that must evaluate to true when you want to prevent updates.", + "nullable": true + }, + "noUpdateRoles": { + "type": "array", + "description": "Optional list of roles to restrict the updates for users with these roles.", + "nullable": true, + "items": { + "type": "string" + } + } + } + }, + "WorkflowTransitionDto": { + "type": "object", + "additionalProperties": false, + "properties": { + "expression": { + "type": "string", + "description": "The optional expression.", + "nullable": true + }, + "roles": { + "type": "array", + "description": "The optional restricted role.", + "nullable": true, + "items": { + "type": "string" + } + } + } + }, + "AddWorkflowDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the workflow.", + "minLength": 1 + } + } + }, + "UpdateWorkflowDto": { + "type": "object", + "additionalProperties": false, + "required": [ + "steps", + "initial" + ], + "properties": { + "name": { + "type": "string", + "description": "The name of the workflow.", + "nullable": true + }, + "steps": { + "type": "object", + "description": "The workflow steps.", + "additionalProperties": { + "$ref": "#/components/schemas/WorkflowStepDto" + } + }, + "schemaIds": { + "type": "array", + "description": "The schema ids.", + "nullable": true, + "items": { + "type": "string" + } + }, + "initial": { + "type": "string", + "description": "The initial step." + } + } + } + } + }, + "externalDocs": { + "url": "https://docs.squidex.io" + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index aed36fe..369ba54 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include 'sample-app' \ No newline at end of file +rootProject.name = "openapi-java-client" \ No newline at end of file diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml new file mode 100644 index 0000000..59e69e0 --- /dev/null +++ b/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/src/main/java/com/squidex/api/AccessToken.java b/src/main/java/com/squidex/api/AccessToken.java index 5e84848..f3c3efc 100644 --- a/src/main/java/com/squidex/api/AccessToken.java +++ b/src/main/java/com/squidex/api/AccessToken.java @@ -1,35 +1,35 @@ package com.squidex.api; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - import java.time.Instant; +@SuppressWarnings("ClassCanBeRecord") public final class AccessToken { private final String accessToken; - private final int expiresIn; - private final Instant expiresAt; + private final long expiresIn; + private final long expiresAt; - @JsonCreator() - public AccessToken( - @JsonProperty("access_token")String accessToken, - @JsonProperty("expires_in")int expiresIn) { + public AccessToken(String accessToken, long expiresIn, long expiresAt) { this.accessToken = accessToken; this.expiresIn = expiresIn; - this.expiresAt = Instant.now().plusSeconds(expiresIn); + this.expiresAt = expiresAt; } public String getAccessToken() { return accessToken; } - public int getExpiresIn() { + public long getExpiresIn() { return expiresIn; } - @JsonIgnore() - public Instant getExpiresAt() { + public long getExpiresAt() { return expiresAt; } + + public boolean isExpired() { + long now = Instant.now().toEpochMilli(); + + return expiresAt < now; + } } + diff --git a/src/main/java/com/squidex/api/AccessTokenResponse.java b/src/main/java/com/squidex/api/AccessTokenResponse.java new file mode 100644 index 0000000..4767f3c --- /dev/null +++ b/src/main/java/com/squidex/api/AccessTokenResponse.java @@ -0,0 +1,32 @@ +package com.squidex.api; + +import com.google.gson.annotations.SerializedName; + +import java.time.Instant; + +public class AccessTokenResponse { + @SerializedName("access_token") + private String accessToken; + @SerializedName("expires_in") + private long expiresIn; + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public long getExpiresIn() { + return expiresIn; + } + + public void setExpiresIn(long expiresIn) { + this.expiresIn = expiresIn; + } + + public AccessToken toToken() { + return new AccessToken(accessToken, expiresIn, expiresIn + Instant.now().toEpochMilli()); + } +} diff --git a/src/main/java/com/squidex/api/AuthInterceptor.java b/src/main/java/com/squidex/api/AuthInterceptor.java index e2f5bc0..620aa0e 100644 --- a/src/main/java/com/squidex/api/AuthInterceptor.java +++ b/src/main/java/com/squidex/api/AuthInterceptor.java @@ -1,24 +1,32 @@ package com.squidex.api; -import com.squidex.api.core.Environment; -import com.squidex.api.core.ObjectMappers; -import okhttp3.*; +import com.google.gson.Gson; + import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.time.Instant; import java.util.Objects; +import okhttp3.FormBody; +import okhttp3.HttpUrl; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + public final class AuthInterceptor implements Interceptor { - private final Environment environment; + private final Gson gson = new Gson(); + private final String baseUrl; private final String clientId; private final String clientSecret; private final TokenStore tokenStore; private final OkHttpClient httpClient; - public AuthInterceptor(OkHttpClient httpClient, Environment environment, String clientId, String clientSecret, TokenStore tokenStore) { + public AuthInterceptor(OkHttpClient httpClient, String baseUrl, String clientId, String clientSecret, TokenStore tokenStore) { this.httpClient = httpClient; - this.environment = environment; + this.baseUrl = baseUrl; this.clientId = clientId; this.clientSecret = clientSecret; this.tokenStore = tokenStore; @@ -30,7 +38,7 @@ public Response intercept(@NotNull Chain chain) throws IOException { Request originalRequest = chain.request(); AccessToken token = this.tokenStore.get(); - if (token != null && token.getExpiresAt().isBefore(Instant.now())) { + if (token != null && token.isExpired()) { // The token has been expired, therefore also remove it from the store for other calls. token = null; this.tokenStore.clear(); @@ -42,11 +50,12 @@ public Response intercept(@NotNull Chain chain) throws IOException { } Request requestWithHeader = originalRequest.newBuilder() - .header("Authorization", String.format("Bearer %s", token.getAccessToken())) - .build(); + .header("Authorization", String.format("Bearer %s", token.getAccessToken())) + .build(); Response response = chain.proceed(requestWithHeader); if (response.code() == 401) { + response.close(); this.tokenStore.clear(); return intercept(chain); @@ -57,26 +66,26 @@ public Response intercept(@NotNull Chain chain) throws IOException { private AccessToken acquireToken() throws IOException { RequestBody formBody = new FormBody.Builder() - .add("grant_type", "client_credentials") - .add("client_id", this.clientId) - .add("client_secret", this.clientSecret) - .add("scope", "squidex-api") - .build(); + .add("grant_type", "client_credentials") + .add("client_id", this.clientId) + .add("client_secret", this.clientSecret) + .add("scope", "squidex-api") + .build(); - HttpUrl tokenUrl = Objects.requireNonNull(HttpUrl.parse(this.environment.getUrl())) - .newBuilder() - .addPathSegments("identity-server/connect/token") - .build(); + HttpUrl tokenUrl = Objects.requireNonNull(HttpUrl.parse(baseUrl)) + .newBuilder() + .addPathSegments("identity-server/connect/token") + .build(); Request tokenRequest = new Request.Builder() - .url(tokenUrl.url()) - .post(formBody) - .build(); + .url(tokenUrl.url()) + .post(formBody) + .build(); AccessToken token; try (Response response = this.httpClient.newCall(tokenRequest).execute()) { assert response.body() != null; - token = ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AccessToken.class); + token = gson.fromJson(response.body().string(), AccessTokenResponse.class).toToken(); } return token; diff --git a/src/main/java/com/squidex/api/SquidexApiClient.java b/src/main/java/com/squidex/api/SquidexApiClient.java deleted file mode 100644 index cfc49b5..0000000 --- a/src/main/java/com/squidex/api/SquidexApiClient.java +++ /dev/null @@ -1,196 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api; - -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.Suppliers; -import com.squidex.api.resources.apps.AppsClient; -import com.squidex.api.resources.assets.AssetsClient; -import com.squidex.api.resources.backups.BackupsClient; -import com.squidex.api.resources.comments.CommentsClient; -import com.squidex.api.resources.contents.ContentsClient; -import com.squidex.api.resources.diagnostics.DiagnosticsClient; -import com.squidex.api.resources.eventconsumers.EventConsumersClient; -import com.squidex.api.resources.history.HistoryClient; -import com.squidex.api.resources.languages.LanguagesClient; -import com.squidex.api.resources.news.NewsClient; -import com.squidex.api.resources.notifications.NotificationsClient; -import com.squidex.api.resources.ping.PingClient; -import com.squidex.api.resources.plans.PlansClient; -import com.squidex.api.resources.rules.RulesClient; -import com.squidex.api.resources.schemas.SchemasClient; -import com.squidex.api.resources.search.SearchClient; -import com.squidex.api.resources.statistics.StatisticsClient; -import com.squidex.api.resources.teams.TeamsClient; -import com.squidex.api.resources.templates.TemplatesClient; -import com.squidex.api.resources.translations.TranslationsClient; -import com.squidex.api.resources.usermanagement.UserManagementClient; -import com.squidex.api.resources.users.UsersClient; -import java.util.function.Supplier; - -public class SquidexApiClient { - protected final ClientOptions clientOptions; - - protected final Supplier userManagementClient; - - protected final Supplier usersClient; - - protected final Supplier translationsClient; - - protected final Supplier templatesClient; - - protected final Supplier teamsClient; - - protected final Supplier statisticsClient; - - protected final Supplier searchClient; - - protected final Supplier schemasClient; - - protected final Supplier rulesClient; - - protected final Supplier plansClient; - - protected final Supplier pingClient; - - protected final Supplier newsClient; - - protected final Supplier languagesClient; - - protected final Supplier historyClient; - - protected final Supplier eventConsumersClient; - - protected final Supplier diagnosticsClient; - - protected final Supplier contentsClient; - - protected final Supplier commentsClient; - - protected final Supplier notificationsClient; - - protected final Supplier backupsClient; - - protected final Supplier assetsClient; - - protected final Supplier appsClient; - - public SquidexApiClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.userManagementClient = Suppliers.memoize(() -> new UserManagementClient(clientOptions)); - this.usersClient = Suppliers.memoize(() -> new UsersClient(clientOptions)); - this.translationsClient = Suppliers.memoize(() -> new TranslationsClient(clientOptions)); - this.templatesClient = Suppliers.memoize(() -> new TemplatesClient(clientOptions)); - this.teamsClient = Suppliers.memoize(() -> new TeamsClient(clientOptions)); - this.statisticsClient = Suppliers.memoize(() -> new StatisticsClient(clientOptions)); - this.searchClient = Suppliers.memoize(() -> new SearchClient(clientOptions)); - this.schemasClient = Suppliers.memoize(() -> new SchemasClient(clientOptions)); - this.rulesClient = Suppliers.memoize(() -> new RulesClient(clientOptions)); - this.plansClient = Suppliers.memoize(() -> new PlansClient(clientOptions)); - this.pingClient = Suppliers.memoize(() -> new PingClient(clientOptions)); - this.newsClient = Suppliers.memoize(() -> new NewsClient(clientOptions)); - this.languagesClient = Suppliers.memoize(() -> new LanguagesClient(clientOptions)); - this.historyClient = Suppliers.memoize(() -> new HistoryClient(clientOptions)); - this.eventConsumersClient = Suppliers.memoize(() -> new EventConsumersClient(clientOptions)); - this.diagnosticsClient = Suppliers.memoize(() -> new DiagnosticsClient(clientOptions)); - this.contentsClient = Suppliers.memoize(() -> new ContentsClient(clientOptions)); - this.commentsClient = Suppliers.memoize(() -> new CommentsClient(clientOptions)); - this.notificationsClient = Suppliers.memoize(() -> new NotificationsClient(clientOptions)); - this.backupsClient = Suppliers.memoize(() -> new BackupsClient(clientOptions)); - this.assetsClient = Suppliers.memoize(() -> new AssetsClient(clientOptions)); - this.appsClient = Suppliers.memoize(() -> new AppsClient(clientOptions)); - } - - public UserManagementClient userManagement() { - return this.userManagementClient.get(); - } - - public UsersClient users() { - return this.usersClient.get(); - } - - public TranslationsClient translations() { - return this.translationsClient.get(); - } - - public TemplatesClient templates() { - return this.templatesClient.get(); - } - - public TeamsClient teams() { - return this.teamsClient.get(); - } - - public StatisticsClient statistics() { - return this.statisticsClient.get(); - } - - public SearchClient search() { - return this.searchClient.get(); - } - - public SchemasClient schemas() { - return this.schemasClient.get(); - } - - public RulesClient rules() { - return this.rulesClient.get(); - } - - public PlansClient plans() { - return this.plansClient.get(); - } - - public PingClient ping() { - return this.pingClient.get(); - } - - public NewsClient news() { - return this.newsClient.get(); - } - - public LanguagesClient languages() { - return this.languagesClient.get(); - } - - public HistoryClient history() { - return this.historyClient.get(); - } - - public EventConsumersClient eventConsumers() { - return this.eventConsumersClient.get(); - } - - public DiagnosticsClient diagnostics() { - return this.diagnosticsClient.get(); - } - - public ContentsClient contents() { - return this.contentsClient.get(); - } - - public CommentsClient comments() { - return this.commentsClient.get(); - } - - public NotificationsClient notifications() { - return this.notificationsClient.get(); - } - - public BackupsClient backups() { - return this.backupsClient.get(); - } - - public AssetsClient assets() { - return this.assetsClient.get(); - } - - public AppsClient apps() { - return this.appsClient.get(); - } - - public static SquidexApiClientBuilder builder() { - return new SquidexApiClientBuilder(); - } -} diff --git a/src/main/java/com/squidex/api/SquidexApiClientBuilder.java b/src/main/java/com/squidex/api/SquidexApiClientBuilder.java deleted file mode 100644 index 84455c7..0000000 --- a/src/main/java/com/squidex/api/SquidexApiClientBuilder.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api; - -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.Environment; - -public final class SquidexApiClientBuilder { - private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); - - private Environment environment = Environment.DEFAULT; - - public SquidexApiClientBuilder token(String token) { - this.clientOptionsBuilder.addHeader("Authorization", "Bearer " + token); - return this; - } - - public SquidexApiClientBuilder environment(Environment environment) { - this.environment = environment; - return this; - } - - public SquidexApiClientBuilder url(String url) { - this.environment = Environment.custom(url); - return this; - } - - public SquidexApiClientBuilder appName(String appName) { - clientOptionsBuilder.appName(appName); - return this; - } - - public SquidexApiClient build() { - clientOptionsBuilder.environment(this.environment); - return new SquidexApiClient(clientOptionsBuilder.build()); - } -} diff --git a/src/main/java/com/squidex/api/SquidexClient.java b/src/main/java/com/squidex/api/SquidexClient.java index ff0a458..62a3692 100644 --- a/src/main/java/com/squidex/api/SquidexClient.java +++ b/src/main/java/com/squidex/api/SquidexClient.java @@ -1,193 +1,192 @@ package com.squidex.api; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.Suppliers; -import com.squidex.api.resources.apps.AppsClient; -import com.squidex.api.resources.assets.AssetsClient; -import com.squidex.api.resources.backups.BackupsClient; -import com.squidex.api.resources.comments.CommentsClient; -import com.squidex.api.resources.contents.ContentsClient; -import com.squidex.api.resources.diagnostics.DiagnosticsClient; -import com.squidex.api.resources.eventconsumers.EventConsumersClient; -import com.squidex.api.resources.history.HistoryClient; -import com.squidex.api.resources.languages.LanguagesClient; -import com.squidex.api.resources.news.NewsClient; -import com.squidex.api.resources.notifications.NotificationsClient; -import com.squidex.api.resources.ping.PingClient; -import com.squidex.api.resources.plans.PlansClient; -import com.squidex.api.resources.rules.RulesClient; -import com.squidex.api.resources.schemas.SchemasClient; -import com.squidex.api.resources.search.SearchClient; -import com.squidex.api.resources.statistics.StatisticsClient; -import com.squidex.api.resources.teams.TeamsClient; -import com.squidex.api.resources.templates.TemplatesClient; -import com.squidex.api.resources.translations.TranslationsClient; -import com.squidex.api.resources.usermanagement.UserManagementClient; -import com.squidex.api.resources.users.UsersClient; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.api.AppsApi; +import com.squidex.api.core.api.AssetsApi; +import com.squidex.api.core.api.BackupsApi; +import com.squidex.api.core.api.ContentsApi; +import com.squidex.api.core.api.DiagnosticsApi; +import com.squidex.api.core.api.EventConsumersApi; +import com.squidex.api.core.api.HistoryApi; +import com.squidex.api.core.api.LanguagesApi; +import com.squidex.api.core.api.NewsApi; +import com.squidex.api.core.api.PingApi; +import com.squidex.api.core.api.PlansApi; +import com.squidex.api.core.api.RulesApi; +import com.squidex.api.core.api.SchemasApi; +import com.squidex.api.core.api.SearchApi; +import com.squidex.api.core.api.StatisticsApi; +import com.squidex.api.core.api.TeamsApi; +import com.squidex.api.core.api.TemplatesApi; +import com.squidex.api.core.api.TranslationsApi; +import com.squidex.api.core.api.UserManagementApi; +import com.squidex.api.core.api.UsersApi; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; import java.util.function.Supplier; public class SquidexClient { - protected final ClientOptions clientOptions; - - protected final Supplier userManagementClient; - - protected final Supplier usersClient; - - protected final Supplier translationsClient; - - protected final Supplier templatesClient; - - protected final Supplier teamsClient; - - protected final Supplier statisticsClient; - - protected final Supplier searchClient; - - protected final Supplier schemasClient; - - protected final Supplier rulesClient; - - protected final Supplier plansClient; - - protected final Supplier pingClient; - - protected final Supplier newsClient; - - protected final Supplier languagesClient; - - protected final Supplier historyClient; - - protected final Supplier eventConsumersClient; - - protected final Supplier diagnosticsClient; - - protected final Supplier contentsClient; - - protected final Supplier commentsClient; - - protected final Supplier notificationsClient; - - protected final Supplier backupsClient; - - protected final Supplier assetsClient; + private final Supplier appsApi; + private final Supplier assetsApi; + private final Supplier backupsApi; + private final Supplier contentsApi; + private final Supplier diagnosticsApi; + private final Supplier eventConsumersApi; + private final Supplier historyApi; + private final Supplier languagesApi; + private final Supplier newsApi; + private final Supplier pingApi; + private final Supplier plansApi; + private final Supplier rulesApi; + private final Supplier schemasApi; + private final Supplier searchApi; + private final Supplier statisticsApi; + private final Supplier teamsApi; + private final Supplier templatesApi; + private final Supplier translationsApi; + private final Supplier userManagementApi; + private final Supplier usersApi; + private final String appName; + private final String clientId; + private final String clientSecret; + private final String baseUrl; + + public SquidexClient(ApiClient apiClient, String appName, String clientId, String clientSecret, String baseUrl) { + this.appName = appName; + this.clientId = clientId; + this.clientSecret = clientSecret; + this.baseUrl = baseUrl; + this.appsApi = memoize(() -> new AppsApi(apiClient)); + this.assetsApi = memoize(() -> new AssetsApi(apiClient)); + this.backupsApi = memoize(() -> new BackupsApi(apiClient)); + this.contentsApi = memoize(() -> new ContentsApi(apiClient)); + this.diagnosticsApi = memoize(() -> new DiagnosticsApi(apiClient)); + this.eventConsumersApi = memoize(() -> new EventConsumersApi(apiClient)); + this.historyApi = memoize(() -> new HistoryApi(apiClient)); + this.languagesApi = memoize(() -> new LanguagesApi(apiClient)); + this.newsApi = memoize(() -> new NewsApi(apiClient)); + this.pingApi = memoize(() -> new PingApi(apiClient)); + this.plansApi = memoize(() -> new PlansApi(apiClient)); + this.rulesApi = memoize(() -> new RulesApi(apiClient)); + this.schemasApi = memoize(() -> new SchemasApi(apiClient)); + this.searchApi = memoize(() -> new SearchApi(apiClient)); + this.statisticsApi = memoize(() -> new StatisticsApi(apiClient)); + this.teamsApi = memoize(() -> new TeamsApi(apiClient)); + this.templatesApi = memoize(() -> new TemplatesApi(apiClient)); + this.translationsApi = memoize(() -> new TranslationsApi(apiClient)); + this.userManagementApi = memoize(() -> new UserManagementApi(apiClient)); + this.usersApi = memoize(() -> new UsersApi(apiClient)); + } + + static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } - protected final Supplier appsClient; + public static SquidexClientBuilder builder() { + return new SquidexClientBuilder(); + } - public SquidexClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.userManagementClient = Suppliers.memoize(() -> new UserManagementClient(clientOptions)); - this.usersClient = Suppliers.memoize(() -> new UsersClient(clientOptions)); - this.translationsClient = Suppliers.memoize(() -> new TranslationsClient(clientOptions)); - this.templatesClient = Suppliers.memoize(() -> new TemplatesClient(clientOptions)); - this.teamsClient = Suppliers.memoize(() -> new TeamsClient(clientOptions)); - this.statisticsClient = Suppliers.memoize(() -> new StatisticsClient(clientOptions)); - this.searchClient = Suppliers.memoize(() -> new SearchClient(clientOptions)); - this.schemasClient = Suppliers.memoize(() -> new SchemasClient(clientOptions)); - this.rulesClient = Suppliers.memoize(() -> new RulesClient(clientOptions)); - this.plansClient = Suppliers.memoize(() -> new PlansClient(clientOptions)); - this.pingClient = Suppliers.memoize(() -> new PingClient(clientOptions)); - this.newsClient = Suppliers.memoize(() -> new NewsClient(clientOptions)); - this.languagesClient = Suppliers.memoize(() -> new LanguagesClient(clientOptions)); - this.historyClient = Suppliers.memoize(() -> new HistoryClient(clientOptions)); - this.eventConsumersClient = Suppliers.memoize(() -> new EventConsumersClient(clientOptions)); - this.diagnosticsClient = Suppliers.memoize(() -> new DiagnosticsClient(clientOptions)); - this.contentsClient = Suppliers.memoize(() -> new ContentsClient(clientOptions)); - this.commentsClient = Suppliers.memoize(() -> new CommentsClient(clientOptions)); - this.notificationsClient = Suppliers.memoize(() -> new NotificationsClient(clientOptions)); - this.backupsClient = Suppliers.memoize(() -> new BackupsClient(clientOptions)); - this.assetsClient = Suppliers.memoize(() -> new AssetsClient(clientOptions)); - this.appsClient = Suppliers.memoize(() -> new AppsClient(clientOptions)); + public String getAppName() { + return appName; } - public UserManagementClient userManagement() { - return this.userManagementClient.get(); + public String getClientId() { + return clientId; } - public UsersClient users() { - return this.usersClient.get(); + public String getClientSecret() { + return clientSecret; } - public TranslationsClient translations() { - return this.translationsClient.get(); + public String getBaseUrl() { + return baseUrl; } - public TemplatesClient templates() { - return this.templatesClient.get(); + public UserManagementApi userManagement() { + return this.userManagementApi.get(); } - public TeamsClient teams() { - return this.teamsClient.get(); + public UsersApi users() { + return this.usersApi.get(); } - public StatisticsClient statistics() { - return this.statisticsClient.get(); + public TranslationsApi translations() { + return this.translationsApi.get(); } - public SearchClient search() { - return this.searchClient.get(); + public TemplatesApi templates() { + return this.templatesApi.get(); } - public SchemasClient schemas() { - return this.schemasClient.get(); + public TeamsApi teams() { + return this.teamsApi.get(); } - public RulesClient rules() { - return this.rulesClient.get(); + public StatisticsApi statistics() { + return this.statisticsApi.get(); } - public PlansClient plans() { - return this.plansClient.get(); + public SearchApi search() { + return this.searchApi.get(); } - public PingClient ping() { - return this.pingClient.get(); + public SchemasApi schemas() { + return this.schemasApi.get(); } - public NewsClient news() { - return this.newsClient.get(); + public RulesApi rules() { + return this.rulesApi.get(); } - public LanguagesClient languages() { - return this.languagesClient.get(); + public PlansApi plans() { + return this.plansApi.get(); } - public HistoryClient history() { - return this.historyClient.get(); + public PingApi ping() { + return this.pingApi.get(); } - public EventConsumersClient eventConsumers() { - return this.eventConsumersClient.get(); + public NewsApi news() { + return this.newsApi.get(); } - public DiagnosticsClient diagnostics() { - return this.diagnosticsClient.get(); + public LanguagesApi languages() { + return this.languagesApi.get(); } - public ContentsClient contents() { - return this.contentsClient.get(); + public HistoryApi history() { + return this.historyApi.get(); } - public CommentsClient comments() { - return this.commentsClient.get(); + public EventConsumersApi eventConsumers() { + return this.eventConsumersApi.get(); } - public NotificationsClient notifications() { - return this.notificationsClient.get(); + public DiagnosticsApi diagnostics() { + return this.diagnosticsApi.get(); } - public BackupsClient backups() { - return this.backupsClient.get(); + public ContentsApi contents() { + return this.contentsApi.get(); } - public AssetsClient assets() { - return this.assetsClient.get(); + public BackupsApi backups() { + return this.backupsApi.get(); } - public AppsClient apps() { - return this.appsClient.get(); + public AssetsApi assets() { + return this.assetsApi.get(); } - public static SquidexClientBuilder builder() { - return new SquidexClientBuilder(); + public AppsApi apps() { + return this.appsApi.get(); } } diff --git a/src/main/java/com/squidex/api/SquidexClientBuilder.java b/src/main/java/com/squidex/api/SquidexClientBuilder.java index bff83c6..fea6939 100644 --- a/src/main/java/com/squidex/api/SquidexClientBuilder.java +++ b/src/main/java/com/squidex/api/SquidexClientBuilder.java @@ -1,30 +1,33 @@ package com.squidex.api; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.Environment; -import okhttp3.OkHttpClient; +import com.squidex.api.core.ApiClient; + +import org.jetbrains.annotations.NotNull; -import javax.net.ssl.*; +import java.io.IOException; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; -public final class SquidexClientBuilder { - private final ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; - private Environment environment = Environment.DEFAULT; +import okhttp3.Interceptor; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +public final class SquidexClientBuilder { + private String baseUrl = "https://cloud.squidex.io"; private String clientId; private String clientSecret; + private String appName; private TokenStore tokenStore; private OkHttpClient httpClient; private boolean trustAllCerts; - public SquidexClientBuilder environment(Environment environment) { - this.environment = environment; - return this; - } - - public SquidexClientBuilder url(String url) { - this.environment = Environment.custom(url); + public SquidexClientBuilder baseUrl(String baseUrl) { + this.baseUrl = baseUrl; return this; } @@ -51,24 +54,38 @@ public SquidexClientBuilder tokenStore(TokenStore tokenStore) { return this; } + public TokenStore tokenStore() { + return this.tokenStore; + } + public SquidexClientBuilder httpClient(OkHttpClient httpClient) { this.httpClient = httpClient; return this; } + public OkHttpClient httpClient() { + return this.httpClient; + } + public SquidexClientBuilder appName(String appName) { - this.clientOptionsBuilder.appName(appName); + this.appName = appName; return this; } - public SquidexClientBuilder trustAllCerts() { - this.trustAllCerts = true; + public String appName() { + return this.appName; + } + + public SquidexClientBuilder trustAllCerts(Boolean trustAllCerts) { + this.trustAllCerts = trustAllCerts; return this; } - public SquidexClient build() { - clientOptionsBuilder.environment(this.environment); + public boolean trustAllCerts() { + return this.trustAllCerts; + } + public SquidexClient build() { if (this.tokenStore == null) { this.tokenStore = new InMemoryTokenStore(); } @@ -89,35 +106,51 @@ public void checkServerTrusted(java.security.cert.X509Certificate[] chain, Strin @Override public java.security.cert.X509Certificate[] getAcceptedIssuers() { - return new java.security.cert.X509Certificate[] {}; + return new java.security.cert.X509Certificate[]{}; } }; try { SSLContext sslContext = SSLContext.getInstance("SSL"); - sslContext.init(null, new TrustManager[] { trustAllCerts }, new java.security.SecureRandom()); + sslContext.init(null, new TrustManager[]{trustAllCerts}, new java.security.SecureRandom()); this.httpClient = this.httpClient.newBuilder() - .sslSocketFactory(sslContext.getSocketFactory(), trustAllCerts) - .build(); + .sslSocketFactory(sslContext.getSocketFactory(), trustAllCerts) + .build(); } catch (NoSuchAlgorithmException | KeyManagementException e) { throw new RuntimeException(e); } } AuthInterceptor interceptor = new AuthInterceptor( - this.httpClient, - this.environment, - this.clientId, - this.clientSecret, - this.tokenStore); + this.httpClient, + this.baseUrl, + this.clientId, + this.clientSecret, + this.tokenStore); this.httpClient = this.httpClient.newBuilder() - .addInterceptor(interceptor) - .build(); + .addInterceptor(interceptor) + .addInterceptor(new Interceptor() { + @NotNull + @Override + public Response intercept(@NotNull Chain chain) throws IOException { + Request originalRequest = chain.request(); + + Request newRequest = + originalRequest.newBuilder() + .url(originalRequest.url().url().toString().replace("$app$", appName)) + .build(); + + return chain.proceed(newRequest); + } + }) + .build(); - clientOptionsBuilder.httpClient(this.httpClient); + ApiClient apiClient = new ApiClient(this.httpClient); + apiClient.setBasePath(this.baseUrl); + apiClient.setVerifyingSsl(!this.trustAllCerts); - return new SquidexClient(clientOptionsBuilder.build()); + return new SquidexClient(apiClient, this.appName, this.clientId, this.clientSecret, this.baseUrl); } } diff --git a/src/main/java/com/squidex/api/TokenStore.java b/src/main/java/com/squidex/api/TokenStore.java index 4b95ef6..589a2e3 100644 --- a/src/main/java/com/squidex/api/TokenStore.java +++ b/src/main/java/com/squidex/api/TokenStore.java @@ -6,5 +6,4 @@ public interface TokenStore { void set(AccessToken token); void clear(); -} - +} \ No newline at end of file diff --git a/src/main/java/com/squidex/api/core/ApiCallback.java b/src/main/java/com/squidex/api/core/ApiCallback.java new file mode 100644 index 0000000..33f03ea --- /dev/null +++ b/src/main/java/com/squidex/api/core/ApiCallback.java @@ -0,0 +1,62 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import java.io.IOException; + +import java.util.Map; +import java.util.List; + +/** + * Callback for asynchronous API call. + * + * @param The return type + */ +public interface ApiCallback { + /** + * This is called when the API call fails. + * + * @param e The exception causing the failure + * @param statusCode Status code of the response if available, otherwise it would be 0 + * @param responseHeaders Headers of the response if available, otherwise it would be null + */ + void onFailure(ApiException e, int statusCode, Map> responseHeaders); + + /** + * This is called when the API call succeeded. + * + * @param result The result deserialized from response + * @param statusCode Status code of the response + * @param responseHeaders Headers of the response + */ + void onSuccess(T result, int statusCode, Map> responseHeaders); + + /** + * This is called when the API upload processing. + * + * @param bytesWritten bytes Written + * @param contentLength content length of request body + * @param done write end + */ + void onUploadProgress(long bytesWritten, long contentLength, boolean done); + + /** + * This is called when the API download processing. + * + * @param bytesRead bytes Read + * @param contentLength content length of the response + * @param done Read end + */ + void onDownloadProgress(long bytesRead, long contentLength, boolean done); +} diff --git a/src/main/java/com/squidex/api/core/ApiClient.java b/src/main/java/com/squidex/api/core/ApiClient.java new file mode 100644 index 0000000..3607985 --- /dev/null +++ b/src/main/java/com/squidex/api/core/ApiClient.java @@ -0,0 +1,1586 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import okhttp3.*; +import okhttp3.internal.http.HttpMethod; +import okhttp3.internal.tls.OkHostnameVerifier; +import okhttp3.logging.HttpLoggingInterceptor; +import okhttp3.logging.HttpLoggingInterceptor.Level; +import okio.Buffer; +import okio.BufferedSink; +import okio.Okio; + +import javax.net.ssl.*; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.URI; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.security.GeneralSecurityException; +import java.security.KeyStore; +import java.security.SecureRandom; +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; +import java.time.format.DateTimeFormatter; +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.squidex.api.core.auth.Authentication; +import com.squidex.api.core.auth.HttpBasicAuth; +import com.squidex.api.core.auth.HttpBearerAuth; +import com.squidex.api.core.auth.ApiKeyAuth; + +/** + *

ApiClient class.

+ */ +public class ApiClient { + + private String basePath = "https://cloud.squidex.io"; + protected List servers = new ArrayList(Arrays.asList( + new ServerConfiguration( + "https://cloud.squidex.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(); + private String tempFolderPath = null; + + private Map authentications; + + private DateFormat dateFormat; + private DateFormat datetimeFormat; + private boolean lenientDatetimeFormat; + private int dateLength; + + private InputStream sslCaCert; + private boolean verifyingSsl; + private KeyManager[] keyManagers; + + private OkHttpClient httpClient; + private JSON json; + + private HttpLoggingInterceptor loggingInterceptor; + + /** + * Basic constructor for ApiClient + */ + public ApiClient() { + init(); + initHttpClient(); + + // Setup authentications (key: authentication name, value: authentication). + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Basic constructor with custom OkHttpClient + * + * @param client a {@link okhttp3.OkHttpClient} object + */ + public ApiClient(OkHttpClient client) { + init(); + + httpClient = client; + + // Setup authentications (key: authentication name, value: authentication). + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void initHttpClient() { + initHttpClient(Collections.emptyList()); + } + + private void initHttpClient(List interceptors) { + OkHttpClient.Builder builder = new OkHttpClient.Builder(); + builder.addNetworkInterceptor(getProgressInterceptor()); + for (Interceptor interceptor: interceptors) { + builder.addInterceptor(interceptor); + } + + httpClient = builder.build(); + } + + private void init() { + verifyingSsl = true; + + json = new JSON(); + + // Set default User-Agent. + setUserAgent("OpenAPI-Generator/1.0.0.0/java"); + + authentications = new HashMap(); + } + + /** + * Get base path + * + * @return Base path + */ + public String getBasePath() { + return basePath; + } + + /** + * Set base path + * + * @param basePath Base path of the URL (e.g https://cloud.squidex.io + * @return An instance of OkHttpClient + */ + 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; + } + + /** + * Get HTTP client + * + * @return An instance of OkHttpClient + */ + public OkHttpClient getHttpClient() { + return httpClient; + } + + /** + * Set HTTP client, which must never be null. + * + * @param newHttpClient An instance of OkHttpClient + * @return Api Client + * @throws java.lang.NullPointerException when newHttpClient is null + */ + public ApiClient setHttpClient(OkHttpClient newHttpClient) { + this.httpClient = Objects.requireNonNull(newHttpClient, "HttpClient must not be null!"); + return this; + } + + /** + * Get JSON + * + * @return JSON object + */ + public JSON getJSON() { + return json; + } + + /** + * Set JSON + * + * @param json JSON object + * @return Api client + */ + public ApiClient setJSON(JSON json) { + this.json = json; + return this; + } + + /** + * True if isVerifyingSsl flag is on + * + * @return True if isVerifySsl flag is on + */ + public boolean isVerifyingSsl() { + return verifyingSsl; + } + + /** + * Configure whether to verify certificate and hostname when making https requests. + * Default to true. + * NOTE: Do NOT set to false in production code, otherwise you would face multiple types of cryptographic attacks. + * + * @param verifyingSsl True to verify TLS/SSL connection + * @return ApiClient + */ + public ApiClient setVerifyingSsl(boolean verifyingSsl) { + this.verifyingSsl = verifyingSsl; + applySslSettings(); + return this; + } + + /** + * Get SSL CA cert. + * + * @return Input stream to the SSL CA cert + */ + public InputStream getSslCaCert() { + return sslCaCert; + } + + /** + * Configure the CA certificate to be trusted when making https requests. + * Use null to reset to default. + * + * @param sslCaCert input stream for SSL CA cert + * @return ApiClient + */ + public ApiClient setSslCaCert(InputStream sslCaCert) { + this.sslCaCert = sslCaCert; + applySslSettings(); + return this; + } + + /** + *

Getter for the field keyManagers.

+ * + * @return an array of {@link javax.net.ssl.KeyManager} objects + */ + public KeyManager[] getKeyManagers() { + return keyManagers; + } + + /** + * Configure client keys to use for authorization in an SSL session. + * Use null to reset to default. + * + * @param managers The KeyManagers to use + * @return ApiClient + */ + public ApiClient setKeyManagers(KeyManager[] managers) { + this.keyManagers = managers; + applySslSettings(); + return this; + } + + /** + *

Getter for the field dateFormat.

+ * + * @return a {@link java.text.DateFormat} object + */ + public DateFormat getDateFormat() { + return dateFormat; + } + + /** + *

Setter for the field dateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link com.squidex.api.core.ApiClient} object + */ + public ApiClient setDateFormat(DateFormat dateFormat) { + JSON.setDateFormat(dateFormat); + return this; + } + + /** + *

Set SqlDateFormat.

+ * + * @param dateFormat a {@link java.text.DateFormat} object + * @return a {@link com.squidex.api.core.ApiClient} object + */ + public ApiClient setSqlDateFormat(DateFormat dateFormat) { + JSON.setSqlDateFormat(dateFormat); + return this; + } + + /** + *

Set OffsetDateTimeFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.squidex.api.core.ApiClient} object + */ + public ApiClient setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + JSON.setOffsetDateTimeFormat(dateFormat); + return this; + } + + /** + *

Set LocalDateFormat.

+ * + * @param dateFormat a {@link java.time.format.DateTimeFormatter} object + * @return a {@link com.squidex.api.core.ApiClient} object + */ + public ApiClient setLocalDateFormat(DateTimeFormatter dateFormat) { + JSON.setLocalDateFormat(dateFormat); + return this; + } + + /** + *

Set LenientOnJson.

+ * + * @param lenientOnJson a boolean + * @return a {@link com.squidex.api.core.ApiClient} object + */ + public ApiClient setLenientOnJson(boolean lenientOnJson) { + JSON.setLenientOnJson(lenientOnJson); + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + * + * @return Map of authentication objects + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + + /** + * Helper method to set username for the first HTTP basic authentication. + * + * @param username Username + */ + public void setUsername(String username) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setUsername(username); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set password for the first HTTP basic authentication. + * + * @param password Password + */ + public void setPassword(String password) { + for (Authentication auth : authentications.values()) { + if (auth instanceof HttpBasicAuth) { + ((HttpBasicAuth) auth).setPassword(password); + return; + } + } + throw new RuntimeException("No HTTP basic authentication configured!"); + } + + /** + * Helper method to set API key value for the first API key authentication. + * + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + * + * @param apiKeyPrefix API key prefix + */ + public void setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set access token for the first OAuth2 authentication. + * + * @param accessToken Access token + */ + 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). + * + * @param userAgent HTTP request's user agent + * @return ApiClient + */ + public ApiClient setUserAgent(String userAgent) { + addDefaultHeader("User-Agent", userAgent); + return this; + } + + /** + * Add a default header. + * + * @param key The header's key + * @param value The header's value + * @return ApiClient + */ + public ApiClient addDefaultHeader(String key, String value) { + defaultHeaderMap.put(key, value); + return this; + } + + /** + * Add a default cookie. + * + * @param key The cookie's key + * @param value The cookie's value + * @return ApiClient + */ + public ApiClient addDefaultCookie(String key, String value) { + defaultCookieMap.put(key, value); + return this; + } + + /** + * Check that whether debugging is enabled for this API client. + * + * @return True if debugging is enabled, false otherwise. + */ + public boolean isDebugging() { + return debugging; + } + + /** + * Enable/disable debugging for this API client. + * + * @param debugging To enable (true) or disable (false) debugging + * @return ApiClient + */ + public ApiClient setDebugging(boolean debugging) { + if (debugging != this.debugging) { + if (debugging) { + loggingInterceptor = new HttpLoggingInterceptor(); + loggingInterceptor.setLevel(Level.BODY); + httpClient = httpClient.newBuilder().addInterceptor(loggingInterceptor).build(); + } else { + final OkHttpClient.Builder builder = httpClient.newBuilder(); + builder.interceptors().remove(loggingInterceptor); + httpClient = builder.build(); + loggingInterceptor = null; + } + } + this.debugging = debugging; + return this; + } + + /** + * The path of temporary folder used to store downloaded files from endpoints + * with file response. The default value is null, i.e. using + * the system's default temporary folder. + * + * @see createTempFile + * @return Temporary folder path + */ + public String getTempFolderPath() { + return tempFolderPath; + } + + /** + * Set the temporary folder path (for downloading files) + * + * @param tempFolderPath Temporary folder path + * @return ApiClient + */ + public ApiClient setTempFolderPath(String tempFolderPath) { + this.tempFolderPath = tempFolderPath; + return this; + } + + /** + * Get connection timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getConnectTimeout() { + return httpClient.connectTimeoutMillis(); + } + + /** + * Sets the connect timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param connectionTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setConnectTimeout(int connectionTimeout) { + httpClient = httpClient.newBuilder().connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get read timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getReadTimeout() { + return httpClient.readTimeoutMillis(); + } + + /** + * Sets the read timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param readTimeout read timeout in milliseconds + * @return Api client + */ + public ApiClient setReadTimeout(int readTimeout) { + httpClient = httpClient.newBuilder().readTimeout(readTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + /** + * Get write timeout (in milliseconds). + * + * @return Timeout in milliseconds + */ + public int getWriteTimeout() { + return httpClient.writeTimeoutMillis(); + } + + /** + * Sets the write timeout (in milliseconds). + * A value of 0 means no timeout, otherwise values must be between 1 and + * {@link java.lang.Integer#MAX_VALUE}. + * + * @param writeTimeout connection timeout in milliseconds + * @return Api client + */ + public ApiClient setWriteTimeout(int writeTimeout) { + httpClient = httpClient.newBuilder().writeTimeout(writeTimeout, TimeUnit.MILLISECONDS).build(); + return this; + } + + + /** + * Format the given parameter object into string. + * + * @param param Parameter + * @return String representation of the parameter + */ + public String parameterToString(Object param) { + if (param == null) { + 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); + return jsonStr.substring(1, jsonStr.length() - 1); + } else if (param instanceof Collection) { + StringBuilder b = new StringBuilder(); + for (Object o : (Collection) param) { + if (b.length() > 0) { + b.append(","); + } + b.append(o); + } + return b.toString(); + } else { + return String.valueOf(param); + } + } + + /** + * Formats the specified query parameter to a list containing a single {@code Pair} object. + * + * Note that {@code value} must not be a collection. + * + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list containing a single {@code Pair} object. + */ + public List parameterToPair(String name, Object value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } + + params.add(new Pair(name, parameterToString(value))); + return params; + } + + /** + * Formats the specified collection query parameters to a list of {@code Pair} objects. + * + * Note that the values of each of the returned Pair objects are percent-encoded. + * + * @param collectionFormat The collection format of the parameter. + * @param name The name of the parameter. + * @param value The value of the parameter. + * @return A list of {@code Pair} objects. + */ + public List parameterToPairs(String collectionFormat, String name, Collection value) { + List params = new ArrayList(); + + // preconditions + if (name == null || name.isEmpty() || value == null || value.isEmpty()) { + return params; + } + + // create the params based on the collection format + if ("multi".equals(collectionFormat)) { + for (Object item : value) { + params.add(new Pair(name, escapeString(parameterToString(item)))); + } + return params; + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + // escape all delimiters except commas, which are URI reserved + // characters + if ("ssv".equals(collectionFormat)) { + delimiter = escapeString(" "); + } else if ("tsv".equals(collectionFormat)) { + delimiter = escapeString("\t"); + } else if ("pipes".equals(collectionFormat)) { + delimiter = escapeString("|"); + } + + StringBuilder sb = new StringBuilder(); + for (Object item : value) { + sb.append(delimiter); + sb.append(escapeString(parameterToString(item))); + } + + params.add(new Pair(name, sb.substring(delimiter.length()))); + + 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; + } + + 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. + * + * @param collectionFormat The collection format of the parameter. + * @param value The value of the parameter. + * @return String representation of the parameter + */ + public String collectionPathParameterToString(String collectionFormat, Collection value) { + // create the value based on the collection format + if ("multi".equals(collectionFormat)) { + // not valid for path params + return parameterToString(value); + } + + // collectionFormat is assumed to be "csv" by default + String delimiter = ","; + + if ("ssv".equals(collectionFormat)) { + delimiter = " "; + } else if ("tsv".equals(collectionFormat)) { + delimiter = "\t"; + } else if ("pipes".equals(collectionFormat)) { + delimiter = "|"; + } + + StringBuilder sb = new StringBuilder() ; + for (Object item : value) { + sb.append(delimiter); + sb.append(parameterToString(item)); + } + + return sb.substring(delimiter.length()); + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param filename The filename to be sanitized + * @return The sanitized filename + */ + public String sanitizeFilename(String filename) { + return filename.replaceAll(".*[/\\\\]", ""); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * "* / *" is also default to JSON + * @param mime MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public boolean isJsonMime(String mime) { + String jsonMime = "(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$"; + return mime != null && (mime.matches(jsonMime) || mime.equals("*/*")); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) { + return null; + } + for (String accept : accepts) { + if (isJsonMime(accept)) { + return accept; + } + } + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * returns null. If it matches "any", JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) { + return null; + } + + if (contentTypes[0].equals("*/*")) { + return "application/json"; + } + + for (String contentType : contentTypes) { + if (isJsonMime(contentType)) { + return contentType; + } + } + + return contentTypes[0]; + } + + /** + * Escape the given string to be used as URL query value. + * + * @param str String to be escaped + * @return Escaped string + */ + public String escapeString(String str) { + try { + return URLEncoder.encode(str, "utf8").replaceAll("\\+", "%20"); + } catch (UnsupportedEncodingException e) { + return str; + } + } + + /** + * Deserialize response body to Java object, according to the return type and + * the Content-Type response header. + * + * @param Type + * @param response HTTP response + * @param returnType The type of the Java object + * @return The deserialized Java object + * @throws com.squidex.api.core.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") + public T deserialize(Response response, Type returnType) throws ApiException { + if (response == null || returnType == null) { + return null; + } + + if ("byte[]".equals(returnType.toString())) { + // Handle binary response (byte array). + try { + return (T) response.body().bytes(); + } catch (IOException e) { + throw new ApiException(e); + } + } else if (returnType.equals(File.class)) { + // Handle file downloading. + return (T) downloadFileFromResponse(response); + } + + String respBody; + try { + if (response.body() != null) + respBody = response.body().string(); + else + respBody = null; + } catch (IOException e) { + throw new ApiException(e); + } + + if (respBody == null || "".equals(respBody)) { + return null; + } + + String contentType = response.headers().get("Content-Type"); + if (contentType == null) { + // ensuring a default content type + contentType = "application/json"; + } + if (isJsonMime(contentType)) { + return JSON.deserialize(respBody, returnType); + } else if (returnType.equals(String.class)) { + // Expecting string, return the raw response body. + return (T) respBody; + } else { + throw new ApiException( + "Content type \"" + contentType + "\" is not supported for type: " + returnType, + response.code(), + response.headers().toMultimap(), + respBody); + } + } + + /** + * Serialize the given Java object into request body according to the object's + * class and the request Content-Type. + * + * @param obj The Java object + * @param contentType The request Content-Type + * @return The serialized request body + * @throws com.squidex.api.core.ApiException If fail to serialize the given object + */ + public RequestBody serialize(Object obj, String contentType) throws ApiException { + if (obj instanceof byte[]) { + // Binary (byte array) body parameter support. + return RequestBody.create((byte[]) obj, MediaType.parse(contentType)); + } else if (obj instanceof File) { + // File body parameter support. + return RequestBody.create((File) obj, MediaType.parse(contentType)); + } else if ("text/plain".equals(contentType) && obj instanceof String) { + return RequestBody.create((String) obj, MediaType.parse(contentType)); + } else if (isJsonMime(contentType)) { + String content; + if (obj != null) { + 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"); + } + } + + /** + * Download file from the given response. + * + * @param response An instance of the Response object + * @throws com.squidex.api.core.ApiException If fail to read file content from response and write to disk + * @return Downloaded file + */ + public File downloadFileFromResponse(Response response) throws ApiException { + try { + File file = prepareDownloadFile(response); + BufferedSink sink = Okio.buffer(Okio.sink(file)); + sink.writeAll(response.body().source()); + sink.close(); + return file; + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * Prepare file for download + * + * @param response An instance of the Response object + * @return Prepared file for the download + * @throws java.io.IOException If fail to prepare file for download + */ + public File prepareDownloadFile(Response response) throws IOException { + String filename = null; + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && !"".equals(contentDisposition)) { + // Get filename from the Content-Disposition header. + Pattern pattern = Pattern.compile("filename=['\"]?([^'\"\\s]+)['\"]?"); + Matcher matcher = pattern.matcher(contentDisposition); + if (matcher.find()) { + filename = sanitizeFilename(matcher.group(1)); + } + } + + String prefix = null; + String suffix = null; + if (filename == null) { + prefix = "download-"; + suffix = ""; + } else { + int pos = filename.lastIndexOf("."); + if (pos == -1) { + prefix = filename + "-"; + } else { + prefix = filename.substring(0, pos) + "-"; + suffix = filename.substring(pos); + } + // Files.createTempFile requires the prefix to be at least three characters long + if (prefix.length() < 3) + prefix = "download-"; + } + + if (tempFolderPath == null) + return Files.createTempFile(prefix, suffix).toFile(); + else + return Files.createTempFile(Paths.get(tempFolderPath), prefix, suffix).toFile(); + } + + /** + * {@link #execute(Call, Type)} + * + * @param Type + * @param call An instance of the Call object + * @return ApiResponse<T> + * @throws com.squidex.api.core.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call) throws ApiException { + return execute(call, null); + } + + /** + * Execute HTTP call and deserialize the HTTP response body into the given return type. + * + * @param returnType The return type used to deserialize HTTP response body + * @param The return type corresponding to (same with) returnType + * @param call Call + * @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 com.squidex.api.core.ApiException If fail to execute the call + */ + public ApiResponse execute(Call call, Type returnType) throws ApiException { + try { + Response response = call.execute(); + T data = handleResponse(response, returnType); + return new ApiResponse(response.code(), response.headers().toMultimap(), data); + } catch (IOException e) { + throw new ApiException(e); + } + } + + /** + * {@link #executeAsync(Call, Type, ApiCallback)} + * + * @param Type + * @param call An instance of the Call object + * @param callback ApiCallback<T> + */ + public void executeAsync(Call call, ApiCallback callback) { + executeAsync(call, null, callback); + } + + /** + * Execute HTTP call asynchronously. + * + * @param Type + * @param call The callback to be executed when the API call finishes + * @param returnType Return type + * @param callback ApiCallback + * @see #execute(Call, Type) + */ + @SuppressWarnings("unchecked") + public void executeAsync(Call call, final Type returnType, final ApiCallback callback) { + call.enqueue(new Callback() { + @Override + public void onFailure(Call call, IOException e) { + callback.onFailure(new ApiException(e), 0, null); + } + + @Override + public void onResponse(Call call, Response response) throws IOException { + T result; + try { + result = (T) handleResponse(response, returnType); + } catch (ApiException e) { + callback.onFailure(e, response.code(), response.headers().toMultimap()); + return; + } catch (Exception e) { + callback.onFailure(new ApiException(e), response.code(), response.headers().toMultimap()); + return; + } + callback.onSuccess(result, response.code(), response.headers().toMultimap()); + } + }); + } + + /** + * Handle the given response, return the deserialized object when the response is successful. + * + * @param Type + * @param response Response + * @param returnType Return type + * @return Type + * @throws com.squidex.api.core.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 { + if (response.isSuccessful()) { + if (returnType == null || response.code() == 204) { + // returning null if the returnType is not defined, + // or the status code is 204 (No Content) + if (response.body() != null) { + try { + response.body().close(); + } catch (Exception e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + return null; + } else { + return deserialize(response, returnType); + } + } else { + String respBody = null; + if (response.body() != null) { + try { + respBody = response.body().string(); + } catch (IOException e) { + throw new ApiException(response.message(), e, response.code(), response.headers().toMultimap()); + } + } + throw new ApiException(response.message(), response.code(), response.headers().toMultimap(), respBody); + } + } + + /** + * 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 + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP call + * @throws com.squidex.api.core.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); + + return httpClient.newCall(request); + } + + /** + * 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 + * @param collectionQueryParams The collection query parameters + * @param body The request body object + * @param headerParams The header parameters + * @param cookieParams The cookie parameters + * @param formParams The form parameters + * @param authNames The authentications to apply + * @param callback Callback for upload/download progress + * @return The HTTP request + * @throws com.squidex.api.core.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 { + 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(contentTypePure)) { + reqBody = buildRequestBodyFormEncoding(formParams); + } else if ("multipart/form-data".equals(contentTypePure)) { + reqBody = buildRequestBodyMultipart(formParams); + } else if (body == null) { + if ("DELETE".equals(method)) { + // allow calling DELETE without sending a request body + reqBody = null; + } else { + // use an empty request body (for POST, PUT and PATCH) + reqBody = RequestBody.create("", contentType == null ? null : MediaType.parse(contentType)); + } + } else { + reqBody = serialize(body, contentType); + } + + List updatedQueryParams = new ArrayList<>(queryParams); + + // update parameters with authentication settings + updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url)); + + final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams)); + processHeaderParams(headerParams, reqBuilder); + processCookieParams(cookieParams, reqBuilder); + + // Associate callback with request (if not null) so interceptor can + // access it when creating ProgressResponseBody + reqBuilder.tag(callback); + + Request request = null; + + if (callback != null && reqBody != null) { + ProgressRequestBody progressRequestBody = new ProgressRequestBody(reqBody, callback); + request = reqBuilder.method(method, progressRequestBody).build(); + } else { + request = reqBuilder.method(method, reqBody).build(); + } + + return request; + } + + /** + * Build full URL by concatenating base path, the given sub path and query parameters. + * + * @param baseUrl The base URL + * @param path The sub path + * @param queryParams The query parameters + * @param collectionQueryParams The collection query parameters + * @return The full URL + */ + public String buildUrl(String baseUrl, String path, List queryParams, List collectionQueryParams) { + final StringBuilder url = new StringBuilder(); + if (baseUrl != null) { + url.append(baseUrl).append(path); + } else { + 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()) { + // support (constant) query string in `path`, e.g. "/posts?draft=1" + String prefix = path.contains("?") ? "&" : "?"; + for (Pair param : queryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + url.append(escapeString(param.getName())).append("=").append(escapeString(value)); + } + } + } + + if (collectionQueryParams != null && !collectionQueryParams.isEmpty()) { + String prefix = url.toString().contains("?") ? "&" : "?"; + for (Pair param : collectionQueryParams) { + if (param.getValue() != null) { + if (prefix != null) { + url.append(prefix); + prefix = null; + } else { + url.append("&"); + } + String value = parameterToString(param.getValue()); + // collection query parameter value already escaped as part of parameterToPairs + url.append(escapeString(param.getName())).append("=").append(value); + } + } + } + + return url.toString(); + } + + /** + * Set header parameters to the request builder, including default headers. + * + * @param headerParams Header parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processHeaderParams(Map headerParams, Request.Builder reqBuilder) { + for (Entry param : headerParams.entrySet()) { + reqBuilder.header(param.getKey(), parameterToString(param.getValue())); + } + for (Entry header : defaultHeaderMap.entrySet()) { + if (!headerParams.containsKey(header.getKey())) { + reqBuilder.header(header.getKey(), parameterToString(header.getValue())); + } + } + } + + /** + * Set cookie parameters to the request builder, including default cookies. + * + * @param cookieParams Cookie parameters in the form of Map + * @param reqBuilder Request.Builder + */ + public void processCookieParams(Map cookieParams, Request.Builder reqBuilder) { + for (Entry param : cookieParams.entrySet()) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + for (Entry param : defaultCookieMap.entrySet()) { + if (!cookieParams.containsKey(param.getKey())) { + reqBuilder.addHeader("Cookie", String.format("%s=%s", param.getKey(), param.getValue())); + } + } + } + + /** + * Update query and header parameters based on authentication settings. + * + * @param authNames The authentications to apply + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws com.squidex.api.core.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 { + for (String authName : authNames) { + Authentication auth = authentications.get(authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } + auth.applyToParams(queryParams, headerParams, cookieParams, payload, method, uri); + } + } + + /** + * Build a form-encoding request body with the given form parameters. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyFormEncoding(Map formParams) { + okhttp3.FormBody.Builder formBuilder = new okhttp3.FormBody.Builder(); + for (Entry param : formParams.entrySet()) { + formBuilder.add(param.getKey(), parameterToString(param.getValue())); + } + return formBuilder.build(); + } + + /** + * Build a multipart (file uploading) request body with the given form parameters, + * which could contain text fields and file fields. + * + * @param formParams Form parameters in the form of Map + * @return RequestBody + */ + public RequestBody buildRequestBodyMultipart(Map formParams) { + MultipartBody.Builder mpBuilder = new MultipartBody.Builder().setType(MultipartBody.FORM); + for (Entry param : formParams.entrySet()) { + if (param.getValue() instanceof File) { + File file = (File) param.getValue(); + 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 { + addPartToMultiPartBuilder(mpBuilder, param.getKey(), param.getValue()); + } + } + return mpBuilder.build(); + } + + /** + * Guess Content-Type header from the given file (defaults to "application/octet-stream"). + * + * @param file The given file + * @return The guessed Content-Type + */ + public String guessContentTypeFromFile(File file) { + String contentType = URLConnection.guessContentTypeFromName(file.getName()); + if (contentType == null) { + return "application/octet-stream"; + } else { + return contentType; + } + } + + /** + * 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. + */ + private Interceptor getProgressInterceptor() { + return new Interceptor() { + @Override + public Response intercept(Interceptor.Chain chain) throws IOException { + final Request request = chain.request(); + final Response originalResponse = chain.proceed(request); + if (request.tag() instanceof ApiCallback) { + final ApiCallback callback = (ApiCallback) request.tag(); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), callback)) + .build(); + } + return originalResponse; + } + }; + } + + /** + * Apply SSL related settings to httpClient according to the current values of + * verifyingSsl and sslCaCert. + */ + private void applySslSettings() { + try { + TrustManager[] trustManagers; + HostnameVerifier hostnameVerifier; + if (!verifyingSsl) { + trustManagers = new TrustManager[]{ + new X509TrustManager() { + @Override + public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public java.security.cert.X509Certificate[] getAcceptedIssuers() { + return new java.security.cert.X509Certificate[]{}; + } + } + }; + hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + } else { + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + + if (sslCaCert == null) { + trustManagerFactory.init((KeyStore) null); + } else { + char[] password = null; // Any password will work. + CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); + Collection certificates = certificateFactory.generateCertificates(sslCaCert); + if (certificates.isEmpty()) { + throw new IllegalArgumentException("expected non-empty set of trusted certificates"); + } + KeyStore caKeyStore = newEmptyKeyStore(password); + int index = 0; + for (Certificate certificate : certificates) { + String certificateAlias = "ca" + (index++); + caKeyStore.setCertificateEntry(certificateAlias, certificate); + } + trustManagerFactory.init(caKeyStore); + } + trustManagers = trustManagerFactory.getTrustManagers(); + hostnameVerifier = OkHostnameVerifier.INSTANCE; + } + + SSLContext sslContext = SSLContext.getInstance("TLS"); + sslContext.init(keyManagers, trustManagers, new SecureRandom()); + httpClient = httpClient.newBuilder() + .sslSocketFactory(sslContext.getSocketFactory(), (X509TrustManager) trustManagers[0]) + .hostnameVerifier(hostnameVerifier) + .build(); + } catch (GeneralSecurityException e) { + throw new RuntimeException(e); + } + } + + private KeyStore newEmptyKeyStore(char[] password) throws GeneralSecurityException { + try { + KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType()); + keyStore.load(null, password); + return keyStore; + } catch (IOException e) { + throw new AssertionError(e); + } + } + + /** + * Convert the HTTP request body to a string. + * + * @param requestBody The HTTP request object + * @return The string representation of the HTTP request body + * @throws com.squidex.api.core.ApiException If fail to serialize the request body object into a string + */ + private String requestBodyToString(RequestBody requestBody) throws ApiException { + if (requestBody != null) { + try { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return buffer.readUtf8(); + } catch (final IOException e) { + throw new ApiException(e); + } + } + + // empty http request body + return ""; + } +} diff --git a/src/main/java/com/squidex/api/core/ApiError.java b/src/main/java/com/squidex/api/core/ApiError.java deleted file mode 100644 index 97e34a0..0000000 --- a/src/main/java/com/squidex/api/core/ApiError.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.core; - -public final class ApiError extends RuntimeException { - private final int statusCode; - - private final Object body; - - public ApiError(int statusCode, Object body) { - this.statusCode = statusCode; - this.body = body; - } - - public int statusCode() { - return this.statusCode; - } - - public Object body() { - return this.body; - } - - @Override - public String toString() { - return "ApiError{" + "statusCode: " + statusCode + ", body: " + body + "}"; - } -} diff --git a/src/main/java/com/squidex/api/core/ApiException.java b/src/main/java/com/squidex/api/core/ApiException.java new file mode 100644 index 0000000..2c54f97 --- /dev/null +++ b/src/main/java/com/squidex/api/core/ApiException.java @@ -0,0 +1,167 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import java.util.Map; +import java.util.List; + + +/** + *

ApiException class.

+ */ +@SuppressWarnings("serial") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +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.

+ */ + public ApiException() {} + + /** + *

Constructor for ApiException.

+ * + * @param throwable a {@link java.lang.Throwable} object + */ + public ApiException(Throwable throwable) { + super(throwable); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + */ + public ApiException(String message) { + super(message); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders, String responseBody) { + super(message, throwable); + this.code = code; + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(String message, int code, Map> responseHeaders, String responseBody) { + this(message, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param message the error message + * @param throwable a {@link java.lang.Throwable} object + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + */ + public ApiException(String message, Throwable throwable, int code, Map> responseHeaders) { + this(message, throwable, code, responseHeaders, null); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, Map> responseHeaders, String responseBody) { + this("Response Code: " + code + " Response Body: " + responseBody, (Throwable) null, code, responseHeaders, responseBody); + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message a {@link java.lang.String} object + */ + public ApiException(int code, String message) { + super(message); + this.code = code; + } + + /** + *

Constructor for ApiException.

+ * + * @param code HTTP status code + * @param message the error message + * @param responseHeaders a {@link java.util.Map} of HTTP response headers + * @param responseBody the response body + */ + public ApiException(int code, String message, Map> responseHeaders, String responseBody) { + this(code, message); + this.responseHeaders = responseHeaders; + this.responseBody = responseBody; + } + + /** + * Get the HTTP status code. + * + * @return HTTP status code + */ + public int getCode() { + return code; + } + + /** + * Get the HTTP response headers. + * + * @return A map of list of string + */ + public Map> getResponseHeaders() { + return responseHeaders; + } + + /** + * Get the HTTP response body. + * + * @return Response body in the form of string + */ + 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/squidex/api/core/ApiResponse.java b/src/main/java/com/squidex/api/core/ApiResponse.java new file mode 100644 index 0000000..617755b --- /dev/null +++ b/src/main/java/com/squidex/api/core/ApiResponse.java @@ -0,0 +1,76 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import java.util.List; +import java.util.Map; + +/** + * API response returned by API call. + */ +public class ApiResponse { + final private int statusCode; + final private Map> headers; + final private T data; + + /** + *

Constructor for ApiResponse.

+ * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + */ + public ApiResponse(int statusCode, Map> headers) { + this(statusCode, headers, null); + } + + /** + *

Constructor for ApiResponse.

+ * + * @param statusCode The status code of HTTP response + * @param headers The headers of HTTP response + * @param data The object deserialized from response bod + */ + public ApiResponse(int statusCode, Map> headers, T data) { + this.statusCode = statusCode; + this.headers = headers; + this.data = data; + } + + /** + *

Get the status code.

+ * + * @return the status code + */ + public int getStatusCode() { + return statusCode; + } + + /** + *

Get the headers.

+ * + * @return a {@link java.util.Map} of headers + */ + public Map> getHeaders() { + return headers; + } + + /** + *

Get the data.

+ * + * @return the data + */ + public T getData() { + return data; + } +} diff --git a/src/main/java/com/squidex/api/core/ClientOptions.java b/src/main/java/com/squidex/api/core/ClientOptions.java deleted file mode 100644 index 3398069..0000000 --- a/src/main/java/com/squidex/api/core/ClientOptions.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.squidex.api.core; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Supplier; -import okhttp3.OkHttpClient; - -public final class ClientOptions { - private final Environment environment; - - private final Map headers; - - private final Map> headerSuppliers; - - private final OkHttpClient httpClient; - - private String appName; - - private ClientOptions( - Environment environment, - Map headers, - Map> headerSuppliers, - OkHttpClient httpClient, - String appName) { - this.environment = environment; - this.headers = new HashMap<>(); - this.headers.putAll(headers); - this.headers.putAll(Map.of( - "X-Fern-SDK-Name", - "com.squidex.fern:api-sdk", - "X-Fern-SDK-Version", - "0.0.7", - "X-Fern-Language", - "JAVA")); - this.headerSuppliers = headerSuppliers; - this.httpClient = httpClient; - this.appName = appName; - } - - public Environment environment() { - return this.environment; - } - - public Map headers(RequestOptions requestOptions) { - Map values = new HashMap<>(this.headers); - headerSuppliers.forEach((key, supplier) -> { - values.put(key, supplier.get()); - }); - if (requestOptions != null) { - values.putAll(requestOptions.getHeaders()); - } - return values; - } - - public OkHttpClient httpClient() { - return this.httpClient; - } - - public String appName() { - return this.appName; - } - - public static Builder builder() { - return new Builder(); - } - - public static final class Builder { - private Environment environment; - - private OkHttpClient httpClient; - - private final Map headers = new HashMap<>(); - - private final Map> headerSuppliers = new HashMap<>(); - - private String appName; - - public Builder environment(Environment environment) { - this.environment = environment; - return this; - } - - public Builder addHeader(String key, String value) { - this.headers.put(key, value); - return this; - } - - public Builder addHeader(String key, Supplier value) { - this.headerSuppliers.put(key, value); - return this; - } - - public Builder appName(String appName) { - this.appName = appName; - return this; - } - - public Builder httpClient(OkHttpClient httpClient) { - this.httpClient = httpClient; - return this; - } - - public ClientOptions build() { - if (this.httpClient == null) { - this.httpClient = new OkHttpClient(); - } - - return new ClientOptions(environment, headers, headerSuppliers, this.httpClient, this.appName); - } - } -} diff --git a/src/main/java/com/squidex/api/core/Configuration.java b/src/main/java/com/squidex/api/core/Configuration.java new file mode 100644 index 0000000..2505e65 --- /dev/null +++ b/src/main/java/com/squidex/api/core/Configuration.java @@ -0,0 +1,41 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class Configuration { + public static final String VERSION = "1.0.0.0"; + + private static ApiClient defaultApiClient = new ApiClient(); + + /** + * Get the default API client, which would be used when creating API + * instances without providing an API client. + * + * @return Default API client + */ + public static ApiClient getDefaultApiClient() { + return defaultApiClient; + } + + /** + * Set the default API client, which would be used when creating API + * instances without providing an API client. + * + * @param apiClient API client + */ + public static void setDefaultApiClient(ApiClient apiClient) { + defaultApiClient = apiClient; + } +} diff --git a/src/main/java/com/squidex/api/core/DateTimeDeserializer.java b/src/main/java/com/squidex/api/core/DateTimeDeserializer.java deleted file mode 100644 index 91d7746..0000000 --- a/src/main/java/com/squidex/api/core/DateTimeDeserializer.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.core; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonToken; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.module.SimpleModule; -import java.io.IOException; -import java.time.Instant; -import java.time.LocalDateTime; -import java.time.OffsetDateTime; -import java.time.ZoneOffset; -import java.time.format.DateTimeFormatter; -import java.time.temporal.TemporalAccessor; -import java.time.temporal.TemporalQueries; - -/** - * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. - */ -class DateTimeDeserializer extends JsonDeserializer { - private static final SimpleModule MODULE; - - static { - MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); - } - - /** - * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. - * - * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. - */ - public static SimpleModule getModule() { - return MODULE; - } - - @Override - public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { - JsonToken token = parser.currentToken(); - if (token == JsonToken.VALUE_NUMBER_INT) { - return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); - } else { - TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( - parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); - - if (temporal.query(TemporalQueries.offset()) == null) { - return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); - } else { - return OffsetDateTime.from(temporal); - } - } - } -} diff --git a/src/main/java/com/squidex/api/core/Environment.java b/src/main/java/com/squidex/api/core/Environment.java deleted file mode 100644 index 08db856..0000000 --- a/src/main/java/com/squidex/api/core/Environment.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.core; - -public final class Environment { - public static final Environment DEFAULT = new Environment("https://cloud.squidex.io"); - - private final String url; - - private Environment(String url) { - this.url = url; - } - - public String getUrl() { - return this.url; - } - - public static Environment custom(String url) { - return new Environment(url); - } -} diff --git a/src/main/java/com/squidex/api/core/GzipRequestInterceptor.java b/src/main/java/com/squidex/api/core/GzipRequestInterceptor.java new file mode 100644 index 0000000..bf84afa --- /dev/null +++ b/src/main/java/com/squidex/api/core/GzipRequestInterceptor.java @@ -0,0 +1,85 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSink; +import okio.GzipSink; +import okio.Okio; + +import java.io.IOException; + +/** + * Encodes request bodies using gzip. + * + * Taken from https://github.com/square/okhttp/issues/350 + */ +class GzipRequestInterceptor implements Interceptor { + @Override + public Response intercept(Chain chain) throws IOException { + Request originalRequest = chain.request(); + if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { + return chain.proceed(originalRequest); + } + + Request compressedRequest = originalRequest.newBuilder() + .header("Content-Encoding", "gzip") + .method(originalRequest.method(), forceContentLength(gzip(originalRequest.body()))) + .build(); + return chain.proceed(compressedRequest); + } + + private RequestBody forceContentLength(final RequestBody requestBody) throws IOException { + final Buffer buffer = new Buffer(); + requestBody.writeTo(buffer); + return new RequestBody() { + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() { + return buffer.size(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + sink.write(buffer.snapshot()); + } + }; + } + + private RequestBody gzip(final RequestBody body) { + return new RequestBody() { + @Override + public MediaType contentType() { + return body.contentType(); + } + + @Override + public long contentLength() { + return -1; // We don't know the compressed length in advance! + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); + body.writeTo(gzipSink); + gzipSink.close(); + } + }; + } +} diff --git a/src/main/java/com/squidex/api/core/JSON.java b/src/main/java/com/squidex/api/core/JSON.java new file mode 100644 index 0000000..49d406f --- /dev/null +++ b/src/main/java/com/squidex/api/core/JSON.java @@ -0,0 +1,1093 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +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.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.PostProcessor; +import io.gsonfire.TypeSelector; + +import okio.ByteString; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +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; + +/* + * A JSON utility class + * + * NOTE: in the future, this class may be converted to static, which may break + * backward-compatibility + */ +public class JSON { + 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() + .registerPostProcessor(com.squidex.api.types.ArrayFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.ArrayFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.ArrayFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("Array")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.AssetsFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.AssetsFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.AssetsFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("Assets")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.BooleanFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.BooleanFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.BooleanFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("Boolean")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.ComponentFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.ComponentFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.ComponentFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("Component")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.ComponentsFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.ComponentsFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.ComponentsFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("Components")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.DateTimeFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.DateTimeFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.DateTimeFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("DateTime")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.GeolocationFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.GeolocationFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.GeolocationFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("Geolocation")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.JsonFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.JsonFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.JsonFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("Json")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.NumberFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.NumberFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.NumberFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("Number")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.ReferencesFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.ReferencesFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.ReferencesFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("References")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.RichTextFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.RichTextFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.RichTextFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("RichText")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.StringFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.StringFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.StringFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("String")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.TagsFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.TagsFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.TagsFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("Tags")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.UIFieldPropertiesDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.UIFieldPropertiesDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.UIFieldPropertiesDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("fieldType", new JsonPrimitive("UI")); + } + } + }) + .registerTypeSelector(com.squidex.api.types.FieldPropertiesDto.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Array", com.squidex.api.types.ArrayFieldPropertiesDto.class); + classByDiscriminatorValue.put("Assets", com.squidex.api.types.AssetsFieldPropertiesDto.class); + classByDiscriminatorValue.put("Boolean", com.squidex.api.types.BooleanFieldPropertiesDto.class); + classByDiscriminatorValue.put("Component", com.squidex.api.types.ComponentFieldPropertiesDto.class); + classByDiscriminatorValue.put("Components", com.squidex.api.types.ComponentsFieldPropertiesDto.class); + classByDiscriminatorValue.put("DateTime", com.squidex.api.types.DateTimeFieldPropertiesDto.class); + classByDiscriminatorValue.put("Geolocation", com.squidex.api.types.GeolocationFieldPropertiesDto.class); + classByDiscriminatorValue.put("Json", com.squidex.api.types.JsonFieldPropertiesDto.class); + classByDiscriminatorValue.put("Number", com.squidex.api.types.NumberFieldPropertiesDto.class); + classByDiscriminatorValue.put("References", com.squidex.api.types.ReferencesFieldPropertiesDto.class); + classByDiscriminatorValue.put("RichText", com.squidex.api.types.RichTextFieldPropertiesDto.class); + classByDiscriminatorValue.put("String", com.squidex.api.types.StringFieldPropertiesDto.class); + classByDiscriminatorValue.put("Tags", com.squidex.api.types.TagsFieldPropertiesDto.class); + classByDiscriminatorValue.put("UI", com.squidex.api.types.UIFieldPropertiesDto.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "fieldType")); + } + }) + .registerPostProcessor(com.squidex.api.types.AlgoliaRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.AlgoliaRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.AlgoliaRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Algolia")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.AzureQueueRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.AzureQueueRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.AzureQueueRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("AzureQueue")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.CommentRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.CommentRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.CommentRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Comment")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.CreateContentRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.CreateContentRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.CreateContentRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("CreateContent")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.DiscourseRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.DiscourseRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.DiscourseRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Discourse")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.ElasticSearchRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.ElasticSearchRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.ElasticSearchRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("ElasticSearch")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.EmailRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.EmailRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.EmailRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Email")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.FastlyRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.FastlyRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.FastlyRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Fastly")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.MediumRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.MediumRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.MediumRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Medium")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.NotificationRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.NotificationRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.NotificationRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Notification")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.OpenSearchRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.OpenSearchRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.OpenSearchRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("OpenSearch")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.PrerenderRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.PrerenderRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.PrerenderRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Prerender")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.ScriptRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.ScriptRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.ScriptRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Script")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.SignalRRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.SignalRRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.SignalRRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("SignalR")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.SlackRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.SlackRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.SlackRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Slack")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.TweetRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.TweetRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.TweetRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Tweet")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.TypesenseRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.TypesenseRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.TypesenseRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Typesense")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.WebhookRuleActionDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.WebhookRuleActionDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.WebhookRuleActionDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("actionType", new JsonPrimitive("Webhook")); + } + } + }) + .registerTypeSelector(com.squidex.api.types.RuleActionDto.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Algolia", com.squidex.api.types.AlgoliaRuleActionDto.class); + classByDiscriminatorValue.put("AzureQueue", com.squidex.api.types.AzureQueueRuleActionDto.class); + classByDiscriminatorValue.put("Comment", com.squidex.api.types.CommentRuleActionDto.class); + classByDiscriminatorValue.put("CreateContent", com.squidex.api.types.CreateContentRuleActionDto.class); + classByDiscriminatorValue.put("Discourse", com.squidex.api.types.DiscourseRuleActionDto.class); + classByDiscriminatorValue.put("ElasticSearch", com.squidex.api.types.ElasticSearchRuleActionDto.class); + classByDiscriminatorValue.put("Email", com.squidex.api.types.EmailRuleActionDto.class); + classByDiscriminatorValue.put("Fastly", com.squidex.api.types.FastlyRuleActionDto.class); + classByDiscriminatorValue.put("Medium", com.squidex.api.types.MediumRuleActionDto.class); + classByDiscriminatorValue.put("Notification", com.squidex.api.types.NotificationRuleActionDto.class); + classByDiscriminatorValue.put("OpenSearch", com.squidex.api.types.OpenSearchRuleActionDto.class); + classByDiscriminatorValue.put("Prerender", com.squidex.api.types.PrerenderRuleActionDto.class); + classByDiscriminatorValue.put("Script", com.squidex.api.types.ScriptRuleActionDto.class); + classByDiscriminatorValue.put("SignalR", com.squidex.api.types.SignalRRuleActionDto.class); + classByDiscriminatorValue.put("Slack", com.squidex.api.types.SlackRuleActionDto.class); + classByDiscriminatorValue.put("Tweet", com.squidex.api.types.TweetRuleActionDto.class); + classByDiscriminatorValue.put("Typesense", com.squidex.api.types.TypesenseRuleActionDto.class); + classByDiscriminatorValue.put("Webhook", com.squidex.api.types.WebhookRuleActionDto.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "actionType")); + } + }) + .registerPostProcessor(com.squidex.api.types.AssetChangedRuleTriggerDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.AssetChangedRuleTriggerDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.AssetChangedRuleTriggerDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("triggerType", new JsonPrimitive("AssetChanged")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.CommentRuleTriggerDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.CommentRuleTriggerDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.CommentRuleTriggerDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("triggerType", new JsonPrimitive("Comment")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.ContentChangedRuleTriggerDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.ContentChangedRuleTriggerDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.ContentChangedRuleTriggerDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("triggerType", new JsonPrimitive("ContentChanged")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.ManualRuleTriggerDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.ManualRuleTriggerDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.ManualRuleTriggerDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("triggerType", new JsonPrimitive("Manual")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.SchemaChangedRuleTriggerDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.SchemaChangedRuleTriggerDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.SchemaChangedRuleTriggerDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("triggerType", new JsonPrimitive("SchemaChanged")); + } + } + }) + .registerPostProcessor(com.squidex.api.types.UsageRuleTriggerDto.class, new PostProcessor() { + @Override + public void postDeserialize(com.squidex.api.types.UsageRuleTriggerDto result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, com.squidex.api.types.UsageRuleTriggerDto src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("triggerType", new JsonPrimitive("Usage")); + } + } + }) + .registerTypeSelector(com.squidex.api.types.RuleTriggerDto.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("AssetChanged", com.squidex.api.types.AssetChangedRuleTriggerDto.class); + classByDiscriminatorValue.put("Comment", com.squidex.api.types.CommentRuleTriggerDto.class); + classByDiscriminatorValue.put("ContentChanged", com.squidex.api.types.ContentChangedRuleTriggerDto.class); + classByDiscriminatorValue.put("Manual", com.squidex.api.types.ManualRuleTriggerDto.class); + classByDiscriminatorValue.put("SchemaChanged", com.squidex.api.types.SchemaChangedRuleTriggerDto.class); + classByDiscriminatorValue.put("Usage", com.squidex.api.types.UsageRuleTriggerDto.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "triggerType")); + } + }) + ; + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + /** + * 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. + * @return The Java class that implements the OpenAPI schema + */ + 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 + ">"); + } + return clazz; + } + + 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.squidex.api.types.AddFieldDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AddLanguageDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AddRoleDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AddWorkflowDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AlgoliaRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AllContentsByPostDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AnnotateAssetDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AppDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AppLanguageDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AppLanguagesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AppSettingsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ArrayFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AssetChangedRuleTriggerDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AssetDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AssetFolderDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AssetFoldersDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AssetMeta.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AssetScriptsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AssetsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AssetsFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AssignContributorDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AuthSchemeDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AuthSchemeResponseDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AuthSchemeValueDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.AzureQueueRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.BackupJobDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.BackupJobsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.BooleanFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.BulkResultDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.BulkUpdateAssetsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.BulkUpdateAssetsJobDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.BulkUpdateContentsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.BulkUpdateContentsJobDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CallsUsageDtoDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CallsUsagePerDateDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ChangeCategoryDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ChangePlanDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ChangeStatusDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ClientDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ClientsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CommentRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CommentRuleTriggerDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ComponentFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ComponentsFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ConfigureFieldRulesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ConfigureUIFieldsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ContentChangedRuleTriggerDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ContentDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ContentsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ContributorDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ContributorsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ContributorsMetadata.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CreateAppDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CreateAssetFolderDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CreateClientDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CreateContentRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CreateRuleDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CreateSchemaDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CreateTeamDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CreateUserDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.CurrentStorageDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.DateTimeFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.DiscourseRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.EditorDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ElasticSearchRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.EmailRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ErrorDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.EventConsumerDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.EventConsumersDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.FastlyRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.FeatureDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.FeaturesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.FieldDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.FieldRuleDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.GeolocationFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.HistoryEventDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ImportContentsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.JobDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.JobLogMessageDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.JobsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.JsonFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.LanguageDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.LogDownloadDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ManualRuleTriggerDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.MediumRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.MoveAssetDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.MoveAssetFolderDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.NestedFieldDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.NotificationRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.NumberFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.OpenSearchRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.PatternDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.PlanChangedDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.PlanDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.PlansDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.PrerenderRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.QueryDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.QueryJsonDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ReferencesFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ReferralInfo.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RenameAssetFolderDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RenameTagDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ReorderFieldsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.Resource.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ResourceLink.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ResourcesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RestoreJobDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RestoreRequestDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RichTextFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RoleDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RolesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RuleDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RuleElementDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RuleElementPropertyDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RuleEventDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RuleEventsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.RulesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ScheduleJobDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SchemaChangedRuleTriggerDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SchemaCondition.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SchemaDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SchemaPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SchemaScriptsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SchemasDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.ScriptRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SearchResultDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SignalRRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SimulatedRuleEventDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SimulatedRuleEventsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SlackRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SortNode.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.StatusInfoDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.StorageUsagePerDateDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.StringFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.SynchronizeSchemaDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.TagsFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.TeamDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.TemplateDetailsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.TemplateDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.TemplatesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.TransferToTeamDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.TranslateDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.TranslationDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.TweetRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.TypesenseRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UIFieldPropertiesDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateAppDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateAppSettingsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateAssetScriptsDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateClientDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateFieldDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateLanguageDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateProfileDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateRoleDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateRuleDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateSchemaDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateSettingDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateTeamDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateUserDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpdateWorkflowDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpsertSchemaDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpsertSchemaFieldDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UpsertSchemaNestedFieldDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UsageRuleTriggerDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UserDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UserProperty.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.UsersDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.WebhookRuleActionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.WorkflowDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.WorkflowStepDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.WorkflowTransitionDto.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.squidex.api.types.WorkflowsDto.CustomTypeAdapterFactory()); + gson = gsonBuilder.create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public static Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + */ + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public static String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + 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 { + return gson.fromJson(body, returnType); + } + } 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 { + throw (e); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + 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) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } +} \ No newline at end of file diff --git a/src/main/java/com/squidex/api/core/ObjectMappers.java b/src/main/java/com/squidex/api/core/ObjectMappers.java deleted file mode 100644 index 13495dd..0000000 --- a/src/main/java/com/squidex/api/core/ObjectMappers.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.core; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.databind.json.JsonMapper; -import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import java.io.IOException; - -public final class ObjectMappers { - public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() - .addModule(new Jdk8Module()) - .addModule(new JavaTimeModule()) - .addModule(DateTimeDeserializer.getModule()) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) - .build(); - - private ObjectMappers() {} - - public static String stringify(Object o) { - try { - return JSON_MAPPER - .setSerializationInclusion(JsonInclude.Include.ALWAYS) - .writerWithDefaultPrettyPrinter() - .writeValueAsString(o); - } catch (IOException e) { - return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); - } - } -} diff --git a/src/main/java/com/squidex/api/core/Pair.java b/src/main/java/com/squidex/api/core/Pair.java new file mode 100644 index 0000000..d15d041 --- /dev/null +++ b/src/main/java/com/squidex/api/core/Pair.java @@ -0,0 +1,57 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + return true; + } +} diff --git a/src/main/java/com/squidex/api/core/ProgressRequestBody.java b/src/main/java/com/squidex/api/core/ProgressRequestBody.java new file mode 100644 index 0000000..90b24a5 --- /dev/null +++ b/src/main/java/com/squidex/api/core/ProgressRequestBody.java @@ -0,0 +1,73 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import okhttp3.MediaType; +import okhttp3.RequestBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSink; +import okio.ForwardingSink; +import okio.Okio; +import okio.Sink; + +public class ProgressRequestBody extends RequestBody { + + private final RequestBody requestBody; + + private final ApiCallback callback; + + public ProgressRequestBody(RequestBody requestBody, ApiCallback callback) { + this.requestBody = requestBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return requestBody.contentType(); + } + + @Override + public long contentLength() throws IOException { + return requestBody.contentLength(); + } + + @Override + public void writeTo(BufferedSink sink) throws IOException { + BufferedSink bufferedSink = Okio.buffer(sink(sink)); + requestBody.writeTo(bufferedSink); + bufferedSink.flush(); + } + + private Sink sink(Sink sink) { + return new ForwardingSink(sink) { + + long bytesWritten = 0L; + long contentLength = 0L; + + @Override + public void write(Buffer source, long byteCount) throws IOException { + super.write(source, byteCount); + if (contentLength == 0) { + contentLength = contentLength(); + } + + bytesWritten += byteCount; + callback.onUploadProgress(bytesWritten, contentLength, bytesWritten == contentLength); + } + }; + } +} diff --git a/src/main/java/com/squidex/api/core/ProgressResponseBody.java b/src/main/java/com/squidex/api/core/ProgressResponseBody.java new file mode 100644 index 0000000..deaaf53 --- /dev/null +++ b/src/main/java/com/squidex/api/core/ProgressResponseBody.java @@ -0,0 +1,70 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import okhttp3.MediaType; +import okhttp3.ResponseBody; + +import java.io.IOException; + +import okio.Buffer; +import okio.BufferedSource; +import okio.ForwardingSource; +import okio.Okio; +import okio.Source; + +public class ProgressResponseBody extends ResponseBody { + + private final ResponseBody responseBody; + private final ApiCallback callback; + private BufferedSource bufferedSource; + + public ProgressResponseBody(ResponseBody responseBody, ApiCallback callback) { + this.responseBody = responseBody; + this.callback = callback; + } + + @Override + public MediaType contentType() { + return responseBody.contentType(); + } + + @Override + public long contentLength() { + return responseBody.contentLength(); + } + + @Override + public BufferedSource source() { + if (bufferedSource == null) { + bufferedSource = Okio.buffer(source(responseBody.source())); + } + return bufferedSource; + } + + private Source source(Source source) { + return new ForwardingSource(source) { + long totalBytesRead = 0L; + + @Override + public long read(Buffer sink, long byteCount) throws IOException { + long bytesRead = super.read(sink, byteCount); + // read() returns the number of bytes read, or -1 if this source is exhausted. + totalBytesRead += bytesRead != -1 ? bytesRead : 0; + callback.onDownloadProgress(totalBytesRead, responseBody.contentLength(), bytesRead == -1); + return bytesRead; + } + }; + } +} diff --git a/src/main/java/com/squidex/api/core/RequestOptions.java b/src/main/java/com/squidex/api/core/RequestOptions.java deleted file mode 100644 index 0c6b4e8..0000000 --- a/src/main/java/com/squidex/api/core/RequestOptions.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.core; - -import java.util.HashMap; -import java.util.Map; - -public final class RequestOptions { - private final String token; - - private RequestOptions(String token) { - this.token = token; - } - - public Map getHeaders() { - Map headers = new HashMap<>(); - if (this.token != null) { - headers.put("Authorization", "Bearer " + this.token); - } - return headers; - } - - public static Builder builder() { - return new Builder(); - } - - public static final class Builder { - private String token = null; - - public Builder token(String token) { - this.token = token; - return this; - } - - public RequestOptions build() { - return new RequestOptions(token); - } - } -} diff --git a/src/main/java/com/squidex/api/core/RetryInterceptor.java b/src/main/java/com/squidex/api/core/RetryInterceptor.java deleted file mode 100644 index 2694508..0000000 --- a/src/main/java/com/squidex/api/core/RetryInterceptor.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.core; - -import java.io.IOException; -import java.time.Duration; -import java.util.Optional; -import java.util.Random; -import okhttp3.Interceptor; -import okhttp3.Response; - -public class RetryInterceptor implements Interceptor { - - private static final Duration ONE_SECOND = Duration.ofSeconds(1); - private final ExponentialBackoff backoff; - private final Random random = new Random(); - - public RetryInterceptor(int maxRetries) { - this.backoff = new ExponentialBackoff(maxRetries); - } - - @Override - public Response intercept(Chain chain) throws IOException { - Response response = chain.proceed(chain.request()); - - if (shouldRetry(response.code())) { - return retryChain(chain); - } - - return response; - } - - private Response retryChain(Chain chain) throws IOException { - Optional nextBackoff = this.backoff.nextBackoff(); - - while (nextBackoff.isPresent()) { - try { - Thread.sleep(nextBackoff.get().toMillis()); - } catch (InterruptedException e) { - throw new IOException("Interrupted while trying request", e); - } - Response response = chain.proceed(chain.request()); - if (shouldRetry(response.code())) { - nextBackoff = this.backoff.nextBackoff(); - } else { - return response; - } - } - - throw new IOException("Max retries reached"); - } - - private static boolean shouldRetry(int statusCode) { - return statusCode == 408 || statusCode == 409 || statusCode == 429 || statusCode >= 500; - } - - private final class ExponentialBackoff { - - private final int maxNumRetries; - - private int retryNumber = 0; - - ExponentialBackoff(int maxNumRetries) { - this.maxNumRetries = maxNumRetries; - } - - public Optional nextBackoff() { - retryNumber += 1; - if (retryNumber > maxNumRetries) { - return Optional.empty(); - } - - int upperBound = (int) Math.pow(2, retryNumber); - return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); - } - } -} diff --git a/src/main/java/com/squidex/api/core/ServerConfiguration.java b/src/main/java/com/squidex/api/core/ServerConfiguration.java new file mode 100644 index 0000000..c213d26 --- /dev/null +++ b/src/main/java/com/squidex/api/core/ServerConfiguration.java @@ -0,0 +1,72 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import java.util.Map; + +/** + * Representing a Server configuration. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ServerConfiguration { + public String URL; + public String description; + public Map variables; + + /** + * @param URL A URL to the target host. + * @param description A description of the host designated by the URL. + * @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template. + */ + public ServerConfiguration(String URL, String description, Map variables) { + this.URL = URL; + this.description = description; + this.variables = variables; + } + + /** + * Format URL template using given variables. + * + * @param variables A map between a variable name and its value. + * @return Formatted URL. + */ + public String URL(Map variables) { + String url = this.URL; + + // go through variables and replace placeholders + for (Map.Entry variable: this.variables.entrySet()) { + String name = variable.getKey(); + ServerVariable serverVariable = variable.getValue(); + String value = serverVariable.defaultValue; + + if (variables != null && variables.containsKey(name)) { + value = variables.get(name); + if (serverVariable.enumValues.size() > 0 && !serverVariable.enumValues.contains(value)) { + throw new IllegalArgumentException("The variable " + name + " in the server URL has invalid value " + value + "."); + } + } + url = url.replace("{" + name + "}", value); + } + return url; + } + + /** + * Format URL template using default server variables. + * + * @return Formatted URL. + */ + public String URL() { + return URL(null); + } +} diff --git a/src/main/java/com/squidex/api/core/ServerVariable.java b/src/main/java/com/squidex/api/core/ServerVariable.java new file mode 100644 index 0000000..264bca5 --- /dev/null +++ b/src/main/java/com/squidex/api/core/ServerVariable.java @@ -0,0 +1,37 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import java.util.HashSet; + +/** + * Representing a Server Variable for server URL template substitution. + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ServerVariable { + public String description; + public String defaultValue; + public HashSet enumValues = null; + + /** + * @param description A description for the server variable. + * @param defaultValue The default value to use for substitution. + * @param enumValues An enumeration of string values to be used if the substitution options are from a limited set. + */ + public ServerVariable(String description, String defaultValue, HashSet enumValues) { + this.description = description; + this.defaultValue = defaultValue; + this.enumValues = enumValues; + } +} diff --git a/src/main/java/com/squidex/api/core/StringUtil.java b/src/main/java/com/squidex/api/core/StringUtil.java new file mode 100644 index 0000000..fa54d0c --- /dev/null +++ b/src/main/java/com/squidex/api/core/StringUtil.java @@ -0,0 +1,83 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core; + +import java.util.Collection; +import java.util.Iterator; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } + + /** + * Join a list of strings with the given separator. + * + * @param list The list of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(Collection list, String separator) { + Iterator iterator = list.iterator(); + StringBuilder out = new StringBuilder(); + if (iterator.hasNext()) { + out.append(iterator.next()); + } + while (iterator.hasNext()) { + out.append(separator).append(iterator.next()); + } + return out.toString(); + } +} diff --git a/src/main/java/com/squidex/api/core/Suppliers.java b/src/main/java/com/squidex/api/core/Suppliers.java deleted file mode 100644 index ff8846f..0000000 --- a/src/main/java/com/squidex/api/core/Suppliers.java +++ /dev/null @@ -1,23 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.core; - -import java.util.Objects; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Supplier; - -public final class Suppliers { - private Suppliers() {} - - public static Supplier memoize(Supplier delegate) { - AtomicReference value = new AtomicReference<>(); - return () -> { - T val = value.get(); - if (val == null) { - val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); - } - return val; - }; - } -} diff --git a/src/main/java/com/squidex/api/core/api/AppsApi.java b/src/main/java/com/squidex/api/core/api/AppsApi.java new file mode 100644 index 0000000..8b9657d --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/AppsApi.java @@ -0,0 +1,5819 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.AddLanguageDto; +import com.squidex.api.types.AddRoleDto; +import com.squidex.api.types.AddWorkflowDto; +import com.squidex.api.types.AppDto; +import com.squidex.api.types.AppLanguagesDto; +import com.squidex.api.types.AppSettingsDto; +import com.squidex.api.types.AssetScriptsDto; +import com.squidex.api.types.AssignContributorDto; +import com.squidex.api.types.ClientsDto; +import com.squidex.api.types.ContributorsDto; +import com.squidex.api.types.CreateAppDto; +import com.squidex.api.types.CreateClientDto; +import com.squidex.api.types.ErrorDto; +import java.io.File; +import com.squidex.api.types.RolesDto; +import com.squidex.api.types.TransferToTeamDto; +import com.squidex.api.types.UpdateAppDto; +import com.squidex.api.types.UpdateAppSettingsDto; +import com.squidex.api.types.UpdateAssetScriptsDto; +import com.squidex.api.types.UpdateClientDto; +import com.squidex.api.types.UpdateLanguageDto; +import com.squidex.api.types.UpdateRoleDto; +import com.squidex.api.types.UpdateWorkflowDto; +import com.squidex.api.types.WorkflowsDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class AppsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AppsApi() { + this(Configuration.getDefaultApiClient()); + } + + public AppsApi(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; + } + + private okhttp3.Call getAssetScriptsCall(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 = "/api/apps/$app$/assets/scripts"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAssetScriptsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getAssetScriptsCall(_callback); + + } + + + private ApiResponse getAssetScriptsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getAssetScriptsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAssetScriptsAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAssetScriptsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappAssetsGetAssetScriptsRequest { + + private APIappAssetsGetAssetScriptsRequest() { + } + + /** + * Build call for getAssetScripts + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset scripts returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAssetScriptsCall(_callback); + } + + /** + * Execute getAssetScripts request + * @return AssetScriptsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset scripts returned. -
404 App not found. -
500 Operation failed. -
+ */ + public AssetScriptsDto execute() throws ApiException { + ApiResponse localVarResp = getAssetScriptsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getAssetScripts request with HTTP info returned + * @return ApiResponse<AssetScriptsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset scripts returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAssetScriptsWithHttpInfo(); + } + + /** + * Execute getAssetScripts request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Asset scripts returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAssetScriptsAsync(_callback); + } + } + + /** + * Get the app asset scripts. + * + * @return APIappAssetsGetAssetScriptsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset scripts returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappAssetsGetAssetScriptsRequest getAssetScripts() { + return new APIappAssetsGetAssetScriptsRequest(); + } + private okhttp3.Call putAssetScriptsCall(UpdateAssetScriptsDto updateAssetScriptsDto, 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 = updateAssetScriptsDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/assets/scripts"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putAssetScriptsValidateBeforeCall(UpdateAssetScriptsDto updateAssetScriptsDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'updateAssetScriptsDto' is set + if (updateAssetScriptsDto == null) { + throw new ApiException("Missing the required parameter 'updateAssetScriptsDto' when calling (Async)"); + } + + return putAssetScriptsCall(updateAssetScriptsDto, _callback); + + } + + + private ApiResponse putAssetScriptsWithHttpInfo(UpdateAssetScriptsDto updateAssetScriptsDto) throws ApiException { + okhttp3.Call localVarCall = putAssetScriptsValidateBeforeCall(updateAssetScriptsDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putAssetScriptsAsync(UpdateAssetScriptsDto updateAssetScriptsDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putAssetScriptsValidateBeforeCall(updateAssetScriptsDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappAssetsPutAssetScriptsRequest { + private final UpdateAssetScriptsDto updateAssetScriptsDto; + + private APIappAssetsPutAssetScriptsRequest(UpdateAssetScriptsDto updateAssetScriptsDto) { + this.updateAssetScriptsDto = updateAssetScriptsDto; + } + + /** + * Build call for putAssetScripts + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset scripts updated. -
400 Asset request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putAssetScriptsCall(updateAssetScriptsDto, _callback); + } + + /** + * Execute putAssetScripts request + * @return AssetScriptsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset scripts updated. -
400 Asset request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public AssetScriptsDto execute() throws ApiException { + ApiResponse localVarResp = putAssetScriptsWithHttpInfo(updateAssetScriptsDto); + return localVarResp.getData(); + } + + /** + * Execute putAssetScripts request with HTTP info returned + * @return ApiResponse<AssetScriptsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset scripts updated. -
400 Asset request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putAssetScriptsWithHttpInfo(updateAssetScriptsDto); + } + + /** + * Execute putAssetScripts request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Asset scripts updated. -
400 Asset request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putAssetScriptsAsync(updateAssetScriptsDto, _callback); + } + } + + /** + * Update the asset scripts. + * + * @param updateAssetScriptsDto The values to update. (required) + * @return APIappAssetsPutAssetScriptsRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset scripts updated. -
400 Asset request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappAssetsPutAssetScriptsRequest putAssetScripts(UpdateAssetScriptsDto updateAssetScriptsDto) { + return new APIappAssetsPutAssetScriptsRequest(updateAssetScriptsDto); + } + private okhttp3.Call deleteClientCall(String 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 = "/api/apps/$app$/clients/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteClientValidateBeforeCall(String 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 (Async)"); + } + + return deleteClientCall(id, _callback); + + } + + + private ApiResponse deleteClientWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteClientValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteClientAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteClientValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappClientsDeleteClientRequest { + private final String id; + + private APIappClientsDeleteClientRequest(String id) { + this.id = id; + } + + /** + * Build call for deleteClient + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Client deleted. -
404 Client or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteClientCall(id, _callback); + } + + /** + * Execute deleteClient request + * @return ClientsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Client deleted. -
404 Client or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ClientsDto execute() throws ApiException { + ApiResponse localVarResp = deleteClientWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute deleteClient request with HTTP info returned + * @return ApiResponse<ClientsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Client deleted. -
404 Client or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteClientWithHttpInfo(id); + } + + /** + * Execute deleteClient request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Client deleted. -
404 Client or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteClientAsync(id, _callback); + } + } + + /** + * Revoke an app client. + * The application that uses this client credentials cannot access the API after it has been revoked. + * @param id The ID of the client that must be deleted. (required) + * @return APIappClientsDeleteClientRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Client deleted. -
404 Client or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIappClientsDeleteClientRequest deleteClient(String id) { + return new APIappClientsDeleteClientRequest(id); + } + private okhttp3.Call getClientsCall(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 = "/api/apps/$app$/clients"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getClientsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getClientsCall(_callback); + + } + + + private ApiResponse getClientsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getClientsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getClientsAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getClientsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappClientsGetClientsRequest { + + private APIappClientsGetClientsRequest() { + } + + /** + * Build call for getClients + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Clients returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getClientsCall(_callback); + } + + /** + * Execute getClients request + * @return ClientsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Clients returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ClientsDto execute() throws ApiException { + ApiResponse localVarResp = getClientsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getClients request with HTTP info returned + * @return ApiResponse<ClientsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Clients returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getClientsWithHttpInfo(); + } + + /** + * Execute getClients request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Clients returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getClientsAsync(_callback); + } + } + + /** + * Get app clients. + * Gets all configured clients for the app with the specified name. + * @return APIappClientsGetClientsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Clients returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappClientsGetClientsRequest getClients() { + return new APIappClientsGetClientsRequest(); + } + private okhttp3.Call postClientCall(CreateClientDto createClientDto, 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 = createClientDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/clients"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postClientValidateBeforeCall(CreateClientDto createClientDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createClientDto' is set + if (createClientDto == null) { + throw new ApiException("Missing the required parameter 'createClientDto' when calling (Async)"); + } + + return postClientCall(createClientDto, _callback); + + } + + + private ApiResponse postClientWithHttpInfo(CreateClientDto createClientDto) throws ApiException { + okhttp3.Call localVarCall = postClientValidateBeforeCall(createClientDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postClientAsync(CreateClientDto createClientDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postClientValidateBeforeCall(createClientDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappClientsPostClientRequest { + private final CreateClientDto createClientDto; + + private APIappClientsPostClientRequest(CreateClientDto createClientDto) { + this.createClientDto = createClientDto; + } + + /** + * Build call for postClient + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Client created. -
400 Client request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postClientCall(createClientDto, _callback); + } + + /** + * Execute postClient request + * @return ClientsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Client created. -
400 Client request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ClientsDto execute() throws ApiException { + ApiResponse localVarResp = postClientWithHttpInfo(createClientDto); + return localVarResp.getData(); + } + + /** + * Execute postClient request with HTTP info returned + * @return ApiResponse<ClientsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Client created. -
400 Client request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postClientWithHttpInfo(createClientDto); + } + + /** + * Execute postClient request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
201 Client created. -
400 Client request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postClientAsync(createClientDto, _callback); + } + } + + /** + * Create a new app client. + * Create a new client for the app with the specified name. The client secret is auto generated on the server and returned. The client does not expire, the access token is valid for 30 days. + * @param createClientDto Client object that needs to be added to the app. (required) + * @return APIappClientsPostClientRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Client created. -
400 Client request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappClientsPostClientRequest postClient(CreateClientDto createClientDto) { + return new APIappClientsPostClientRequest(createClientDto); + } + private okhttp3.Call putClientCall(String id, UpdateClientDto updateClientDto, 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 = updateClientDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/clients/{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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putClientValidateBeforeCall(String id, UpdateClientDto updateClientDto, 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 (Async)"); + } + + // verify the required parameter 'updateClientDto' is set + if (updateClientDto == null) { + throw new ApiException("Missing the required parameter 'updateClientDto' when calling (Async)"); + } + + return putClientCall(id, updateClientDto, _callback); + + } + + + private ApiResponse putClientWithHttpInfo(String id, UpdateClientDto updateClientDto) throws ApiException { + okhttp3.Call localVarCall = putClientValidateBeforeCall(id, updateClientDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putClientAsync(String id, UpdateClientDto updateClientDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putClientValidateBeforeCall(id, updateClientDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappClientsPutClientRequest { + private final String id; + private final UpdateClientDto updateClientDto; + + private APIappClientsPutClientRequest(String id, UpdateClientDto updateClientDto) { + this.id = id; + this.updateClientDto = updateClientDto; + } + + /** + * Build call for putClient + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Client updated. -
400 Client request not valid. -
404 Client or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putClientCall(id, updateClientDto, _callback); + } + + /** + * Execute putClient request + * @return ClientsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Client updated. -
400 Client request not valid. -
404 Client or app not found. -
500 Operation failed. -
+ */ + public ClientsDto execute() throws ApiException { + ApiResponse localVarResp = putClientWithHttpInfo(id, updateClientDto); + return localVarResp.getData(); + } + + /** + * Execute putClient request with HTTP info returned + * @return ApiResponse<ClientsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Client updated. -
400 Client request not valid. -
404 Client or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putClientWithHttpInfo(id, updateClientDto); + } + + /** + * Execute putClient request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Client updated. -
400 Client request not valid. -
404 Client or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putClientAsync(id, updateClientDto, _callback); + } + } + + /** + * Updates an app client. + * Only the display name can be changed, create a new client if necessary. + * @param id The ID of the client that must be updated. (required) + * @param updateClientDto Client object that needs to be updated. (required) + * @return APIappClientsPutClientRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Client updated. -
400 Client request not valid. -
404 Client or app not found. -
500 Operation failed. -
+ */ + public APIappClientsPutClientRequest putClient(String id, UpdateClientDto updateClientDto) { + return new APIappClientsPutClientRequest(id, updateClientDto); + } + private okhttp3.Call deleteContributorCall(String 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 = "/api/apps/$app$/contributors/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteContributorValidateBeforeCall(String 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 (Async)"); + } + + return deleteContributorCall(id, _callback); + + } + + + private ApiResponse deleteContributorWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteContributorValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteContributorAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteContributorValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappContributorsDeleteContributorRequest { + private final String id; + + private APIappContributorsDeleteContributorRequest(String id) { + this.id = id; + } + + /** + * Build call for deleteContributor + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteContributorCall(id, _callback); + } + + /** + * Execute deleteContributor request + * @return ContributorsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ContributorsDto execute() throws ApiException { + ApiResponse localVarResp = deleteContributorWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute deleteContributor request with HTTP info returned + * @return ApiResponse<ContributorsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteContributorWithHttpInfo(id); + } + + /** + * Execute deleteContributor request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteContributorAsync(id, _callback); + } + } + + /** + * Remove contributor. + * + * @param id The ID of the contributor. (required) + * @return APIappContributorsDeleteContributorRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIappContributorsDeleteContributorRequest deleteContributor(String id) { + return new APIappContributorsDeleteContributorRequest(id); + } + private okhttp3.Call deleteMyselfCall(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 = "/api/apps/$app$/contributors/me"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteMyselfValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return deleteMyselfCall(_callback); + + } + + + private ApiResponse deleteMyselfWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = deleteMyselfValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteMyselfAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteMyselfValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappContributorsDeleteMyselfRequest { + + private APIappContributorsDeleteMyselfRequest() { + } + + /** + * Build call for deleteMyself + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteMyselfCall(_callback); + } + + /** + * Execute deleteMyself request + * @return ContributorsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ContributorsDto execute() throws ApiException { + ApiResponse localVarResp = deleteMyselfWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute deleteMyself request with HTTP info returned + * @return ApiResponse<ContributorsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteMyselfWithHttpInfo(); + } + + /** + * Execute deleteMyself request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteMyselfAsync(_callback); + } + } + + /** + * Remove yourself. + * + * @return APIappContributorsDeleteMyselfRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIappContributorsDeleteMyselfRequest deleteMyself() { + return new APIappContributorsDeleteMyselfRequest(); + } + private okhttp3.Call getContributorsCall(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 = "/api/apps/$app$/contributors"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getContributorsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getContributorsCall(_callback); + + } + + + private ApiResponse getContributorsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getContributorsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getContributorsAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getContributorsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappContributorsGetContributorsRequest { + + private APIappContributorsGetContributorsRequest() { + } + + /** + * Build call for getContributors + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contributors returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getContributorsCall(_callback); + } + + /** + * Execute getContributors request + * @return ContributorsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contributors returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ContributorsDto execute() throws ApiException { + ApiResponse localVarResp = getContributorsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getContributors request with HTTP info returned + * @return ApiResponse<ContributorsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contributors returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getContributorsWithHttpInfo(); + } + + /** + * Execute getContributors request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Contributors returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getContributorsAsync(_callback); + } + } + + /** + * Get app contributors. + * + * @return APIappContributorsGetContributorsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contributors returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappContributorsGetContributorsRequest getContributors() { + return new APIappContributorsGetContributorsRequest(); + } + private okhttp3.Call postContributorCall(AssignContributorDto assignContributorDto, 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 = assignContributorDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/contributors"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postContributorValidateBeforeCall(AssignContributorDto assignContributorDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'assignContributorDto' is set + if (assignContributorDto == null) { + throw new ApiException("Missing the required parameter 'assignContributorDto' when calling (Async)"); + } + + return postContributorCall(assignContributorDto, _callback); + + } + + + private ApiResponse postContributorWithHttpInfo(AssignContributorDto assignContributorDto) throws ApiException { + okhttp3.Call localVarCall = postContributorValidateBeforeCall(assignContributorDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postContributorAsync(AssignContributorDto assignContributorDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postContributorValidateBeforeCall(assignContributorDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappContributorsPostContributorRequest { + private final AssignContributorDto assignContributorDto; + + private APIappContributorsPostContributorRequest(AssignContributorDto assignContributorDto) { + this.assignContributorDto = assignContributorDto; + } + + /** + * Build call for postContributor + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Contributor assigned to app. -
400 Contributor request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postContributorCall(assignContributorDto, _callback); + } + + /** + * Execute postContributor request + * @return ContributorsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Contributor assigned to app. -
400 Contributor request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ContributorsDto execute() throws ApiException { + ApiResponse localVarResp = postContributorWithHttpInfo(assignContributorDto); + return localVarResp.getData(); + } + + /** + * Execute postContributor request with HTTP info returned + * @return ApiResponse<ContributorsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Contributor assigned to app. -
400 Contributor request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postContributorWithHttpInfo(assignContributorDto); + } + + /** + * Execute postContributor request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
201 Contributor assigned to app. -
400 Contributor request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postContributorAsync(assignContributorDto, _callback); + } + } + + /** + * Assign contributor to app. + * + * @param assignContributorDto Contributor object that needs to be added to the app. (required) + * @return APIappContributorsPostContributorRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Contributor assigned to app. -
400 Contributor request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappContributorsPostContributorRequest postContributor(AssignContributorDto assignContributorDto) { + return new APIappContributorsPostContributorRequest(assignContributorDto); + } + private okhttp3.Call getImageCall(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 = "/api/apps/$app$/image"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/octet-stream", + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getImageValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getImageCall(_callback); + + } + + + private ApiResponse getImageWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getImageValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getImageAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getImageValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappImageGetImageRequest { + + private APIappImageGetImageRequest() { + } + + /** + * Build call for getImage + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App image found and content or (resized) image returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getImageCall(_callback); + } + + /** + * Execute getImage request + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App image found and content or (resized) image returned. -
404 App not found. -
500 Operation failed. -
+ */ + public File execute() throws ApiException { + ApiResponse localVarResp = getImageWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getImage request with HTTP info returned + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App image found and content or (resized) image returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getImageWithHttpInfo(); + } + + /** + * Execute getImage request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 App image found and content or (resized) image returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getImageAsync(_callback); + } + } + + /** + * Get the app image. + * + * @return APIappImageGetImageRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App image found and content or (resized) image returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappImageGetImageRequest getImage() { + return new APIappImageGetImageRequest(); + } + private okhttp3.Call deleteLanguageCall(String language, 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 = "/api/apps/$app$/languages/{language}" + .replace("{" + "language" + "}", localVarApiClient.escapeString(language.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteLanguageValidateBeforeCall(String language, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'language' is set + if (language == null) { + throw new ApiException("Missing the required parameter 'language' when calling (Async)"); + } + + return deleteLanguageCall(language, _callback); + + } + + + private ApiResponse deleteLanguageWithHttpInfo(String language) throws ApiException { + okhttp3.Call localVarCall = deleteLanguageValidateBeforeCall(language, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteLanguageAsync(String language, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteLanguageValidateBeforeCall(language, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappLanguagesDeleteLanguageRequest { + private final String language; + + private APIappLanguagesDeleteLanguageRequest(String language) { + this.language = language; + } + + /** + * Build call for deleteLanguage + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Language deleted. -
400 Language is master language. -
404 Language or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteLanguageCall(language, _callback); + } + + /** + * Execute deleteLanguage request + * @return AppLanguagesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Language deleted. -
400 Language is master language. -
404 Language or app not found. -
500 Operation failed. -
+ */ + public AppLanguagesDto execute() throws ApiException { + ApiResponse localVarResp = deleteLanguageWithHttpInfo(language); + return localVarResp.getData(); + } + + /** + * Execute deleteLanguage request with HTTP info returned + * @return ApiResponse<AppLanguagesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Language deleted. -
400 Language is master language. -
404 Language or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteLanguageWithHttpInfo(language); + } + + /** + * Execute deleteLanguage request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Language deleted. -
400 Language is master language. -
404 Language or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteLanguageAsync(language, _callback); + } + } + + /** + * Deletes an app language. + * + * @param language The language to delete from the app. (required) + * @return APIappLanguagesDeleteLanguageRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Language deleted. -
400 Language is master language. -
404 Language or app not found. -
500 Operation failed. -
+ */ + public APIappLanguagesDeleteLanguageRequest deleteLanguage(String language) { + return new APIappLanguagesDeleteLanguageRequest(language); + } + private okhttp3.Call getLanguagesCall(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 = "/api/apps/$app$/languages"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getLanguagesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getLanguagesCall(_callback); + + } + + + private ApiResponse getLanguagesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getLanguagesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getLanguagesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getLanguagesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappLanguagesGetLanguagesRequest { + + private APIappLanguagesGetLanguagesRequest() { + } + + /** + * Build call for getLanguages + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Languages returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getLanguagesCall(_callback); + } + + /** + * Execute getLanguages request + * @return AppLanguagesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Languages returned. -
404 App not found. -
500 Operation failed. -
+ */ + public AppLanguagesDto execute() throws ApiException { + ApiResponse localVarResp = getLanguagesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getLanguages request with HTTP info returned + * @return ApiResponse<AppLanguagesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Languages returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getLanguagesWithHttpInfo(); + } + + /** + * Execute getLanguages request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Languages returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getLanguagesAsync(_callback); + } + } + + /** + * Get app languages. + * + * @return APIappLanguagesGetLanguagesRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Languages returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappLanguagesGetLanguagesRequest getLanguages() { + return new APIappLanguagesGetLanguagesRequest(); + } + private okhttp3.Call postLanguageCall(AddLanguageDto addLanguageDto, 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 = addLanguageDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/languages"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postLanguageValidateBeforeCall(AddLanguageDto addLanguageDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'addLanguageDto' is set + if (addLanguageDto == null) { + throw new ApiException("Missing the required parameter 'addLanguageDto' when calling (Async)"); + } + + return postLanguageCall(addLanguageDto, _callback); + + } + + + private ApiResponse postLanguageWithHttpInfo(AddLanguageDto addLanguageDto) throws ApiException { + okhttp3.Call localVarCall = postLanguageValidateBeforeCall(addLanguageDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postLanguageAsync(AddLanguageDto addLanguageDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postLanguageValidateBeforeCall(addLanguageDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappLanguagesPostLanguageRequest { + private final AddLanguageDto addLanguageDto; + + private APIappLanguagesPostLanguageRequest(AddLanguageDto addLanguageDto) { + this.addLanguageDto = addLanguageDto; + } + + /** + * Build call for postLanguage + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Language created. -
400 Language request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postLanguageCall(addLanguageDto, _callback); + } + + /** + * Execute postLanguage request + * @return AppLanguagesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Language created. -
400 Language request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public AppLanguagesDto execute() throws ApiException { + ApiResponse localVarResp = postLanguageWithHttpInfo(addLanguageDto); + return localVarResp.getData(); + } + + /** + * Execute postLanguage request with HTTP info returned + * @return ApiResponse<AppLanguagesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Language created. -
400 Language request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postLanguageWithHttpInfo(addLanguageDto); + } + + /** + * Execute postLanguage request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
201 Language created. -
400 Language request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postLanguageAsync(addLanguageDto, _callback); + } + } + + /** + * Add an app language. + * + * @param addLanguageDto The language to add to the app. (required) + * @return APIappLanguagesPostLanguageRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Language created. -
400 Language request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappLanguagesPostLanguageRequest postLanguage(AddLanguageDto addLanguageDto) { + return new APIappLanguagesPostLanguageRequest(addLanguageDto); + } + private okhttp3.Call putLanguageCall(String language, UpdateLanguageDto updateLanguageDto, 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 = updateLanguageDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/languages/{language}" + .replace("{" + "language" + "}", localVarApiClient.escapeString(language.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putLanguageValidateBeforeCall(String language, UpdateLanguageDto updateLanguageDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'language' is set + if (language == null) { + throw new ApiException("Missing the required parameter 'language' when calling (Async)"); + } + + // verify the required parameter 'updateLanguageDto' is set + if (updateLanguageDto == null) { + throw new ApiException("Missing the required parameter 'updateLanguageDto' when calling (Async)"); + } + + return putLanguageCall(language, updateLanguageDto, _callback); + + } + + + private ApiResponse putLanguageWithHttpInfo(String language, UpdateLanguageDto updateLanguageDto) throws ApiException { + okhttp3.Call localVarCall = putLanguageValidateBeforeCall(language, updateLanguageDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putLanguageAsync(String language, UpdateLanguageDto updateLanguageDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putLanguageValidateBeforeCall(language, updateLanguageDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappLanguagesPutLanguageRequest { + private final String language; + private final UpdateLanguageDto updateLanguageDto; + + private APIappLanguagesPutLanguageRequest(String language, UpdateLanguageDto updateLanguageDto) { + this.language = language; + this.updateLanguageDto = updateLanguageDto; + } + + /** + * Build call for putLanguage + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Language updated. -
400 Language request not valid. -
404 Language or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putLanguageCall(language, updateLanguageDto, _callback); + } + + /** + * Execute putLanguage request + * @return AppLanguagesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Language updated. -
400 Language request not valid. -
404 Language or app not found. -
500 Operation failed. -
+ */ + public AppLanguagesDto execute() throws ApiException { + ApiResponse localVarResp = putLanguageWithHttpInfo(language, updateLanguageDto); + return localVarResp.getData(); + } + + /** + * Execute putLanguage request with HTTP info returned + * @return ApiResponse<AppLanguagesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Language updated. -
400 Language request not valid. -
404 Language or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putLanguageWithHttpInfo(language, updateLanguageDto); + } + + /** + * Execute putLanguage request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Language updated. -
400 Language request not valid. -
404 Language or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putLanguageAsync(language, updateLanguageDto, _callback); + } + } + + /** + * Updates an app language. + * + * @param language The language to update. (required) + * @param updateLanguageDto The language object. (required) + * @return APIappLanguagesPutLanguageRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Language updated. -
400 Language request not valid. -
404 Language or app not found. -
500 Operation failed. -
+ */ + public APIappLanguagesPutLanguageRequest putLanguage(String language, UpdateLanguageDto updateLanguageDto) { + return new APIappLanguagesPutLanguageRequest(language, updateLanguageDto); + } + private okhttp3.Call deleteRoleCall(String roleName, 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 = "/api/apps/$app$/roles/{roleName}" + .replace("{" + "roleName" + "}", localVarApiClient.escapeString(roleName.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteRoleValidateBeforeCall(String roleName, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'roleName' is set + if (roleName == null) { + throw new ApiException("Missing the required parameter 'roleName' when calling (Async)"); + } + + return deleteRoleCall(roleName, _callback); + + } + + + private ApiResponse deleteRoleWithHttpInfo(String roleName) throws ApiException { + okhttp3.Call localVarCall = deleteRoleValidateBeforeCall(roleName, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteRoleAsync(String roleName, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteRoleValidateBeforeCall(roleName, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappRolesDeleteRoleRequest { + private final String roleName; + + private APIappRolesDeleteRoleRequest(String roleName) { + this.roleName = roleName; + } + + /** + * Build call for deleteRole + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Role deleted. -
400 Role is in use by contributor or client or a default role. -
404 Role or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteRoleCall(roleName, _callback); + } + + /** + * Execute deleteRole request + * @return RolesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Role deleted. -
400 Role is in use by contributor or client or a default role. -
404 Role or app not found. -
500 Operation failed. -
+ */ + public RolesDto execute() throws ApiException { + ApiResponse localVarResp = deleteRoleWithHttpInfo(roleName); + return localVarResp.getData(); + } + + /** + * Execute deleteRole request with HTTP info returned + * @return ApiResponse<RolesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Role deleted. -
400 Role is in use by contributor or client or a default role. -
404 Role or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteRoleWithHttpInfo(roleName); + } + + /** + * Execute deleteRole request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Role deleted. -
400 Role is in use by contributor or client or a default role. -
404 Role or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteRoleAsync(roleName, _callback); + } + } + + /** + * Remove role from app. + * + * @param roleName The name of the role. (required) + * @return APIappRolesDeleteRoleRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Role deleted. -
400 Role is in use by contributor or client or a default role. -
404 Role or app not found. -
500 Operation failed. -
+ */ + public APIappRolesDeleteRoleRequest deleteRole(String roleName) { + return new APIappRolesDeleteRoleRequest(roleName); + } + private okhttp3.Call getPermissionsCall(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 = "/api/apps/$app$/roles/permissions"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPermissionsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getPermissionsCall(_callback); + + } + + + private ApiResponse> getPermissionsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getPermissionsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getPermissionsAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getPermissionsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappRolesGetPermissionsRequest { + + private APIappRolesGetPermissionsRequest() { + } + + /** + * Build call for getPermissions + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App permissions returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getPermissionsCall(_callback); + } + + /** + * Execute getPermissions request + * @return List<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App permissions returned. -
404 App not found. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getPermissionsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getPermissions request with HTTP info returned + * @return ApiResponse<List<String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App permissions returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getPermissionsWithHttpInfo(); + } + + /** + * Execute getPermissions request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 App permissions returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getPermissionsAsync(_callback); + } + } + + /** + * Get app permissions. + * + * @return APIappRolesGetPermissionsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App permissions returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappRolesGetPermissionsRequest getPermissions() { + return new APIappRolesGetPermissionsRequest(); + } + private okhttp3.Call getRolesCall(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 = "/api/apps/$app$/roles"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getRolesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getRolesCall(_callback); + + } + + + private ApiResponse getRolesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getRolesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getRolesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getRolesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappRolesGetRolesRequest { + + private APIappRolesGetRolesRequest() { + } + + /** + * Build call for getRoles + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Roles returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getRolesCall(_callback); + } + + /** + * Execute getRoles request + * @return RolesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Roles returned. -
404 App not found. -
500 Operation failed. -
+ */ + public RolesDto execute() throws ApiException { + ApiResponse localVarResp = getRolesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getRoles request with HTTP info returned + * @return ApiResponse<RolesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Roles returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getRolesWithHttpInfo(); + } + + /** + * Execute getRoles request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Roles returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getRolesAsync(_callback); + } + } + + /** + * Get app roles. + * + * @return APIappRolesGetRolesRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Roles returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappRolesGetRolesRequest getRoles() { + return new APIappRolesGetRolesRequest(); + } + private okhttp3.Call postRoleCall(AddRoleDto addRoleDto, 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 = addRoleDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/roles"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postRoleValidateBeforeCall(AddRoleDto addRoleDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'addRoleDto' is set + if (addRoleDto == null) { + throw new ApiException("Missing the required parameter 'addRoleDto' when calling (Async)"); + } + + return postRoleCall(addRoleDto, _callback); + + } + + + private ApiResponse postRoleWithHttpInfo(AddRoleDto addRoleDto) throws ApiException { + okhttp3.Call localVarCall = postRoleValidateBeforeCall(addRoleDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postRoleAsync(AddRoleDto addRoleDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postRoleValidateBeforeCall(addRoleDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappRolesPostRoleRequest { + private final AddRoleDto addRoleDto; + + private APIappRolesPostRoleRequest(AddRoleDto addRoleDto) { + this.addRoleDto = addRoleDto; + } + + /** + * Build call for postRole + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Role created. -
400 Role request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postRoleCall(addRoleDto, _callback); + } + + /** + * Execute postRole request + * @return RolesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Role created. -
400 Role request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public RolesDto execute() throws ApiException { + ApiResponse localVarResp = postRoleWithHttpInfo(addRoleDto); + return localVarResp.getData(); + } + + /** + * Execute postRole request with HTTP info returned + * @return ApiResponse<RolesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Role created. -
400 Role request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postRoleWithHttpInfo(addRoleDto); + } + + /** + * Execute postRole request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
201 Role created. -
400 Role request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postRoleAsync(addRoleDto, _callback); + } + } + + /** + * Add role to app. + * + * @param addRoleDto Role object that needs to be added to the app. (required) + * @return APIappRolesPostRoleRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Role created. -
400 Role request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappRolesPostRoleRequest postRole(AddRoleDto addRoleDto) { + return new APIappRolesPostRoleRequest(addRoleDto); + } + private okhttp3.Call putRoleCall(String roleName, UpdateRoleDto updateRoleDto, 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 = updateRoleDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/roles/{roleName}" + .replace("{" + "roleName" + "}", localVarApiClient.escapeString(roleName.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putRoleValidateBeforeCall(String roleName, UpdateRoleDto updateRoleDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'roleName' is set + if (roleName == null) { + throw new ApiException("Missing the required parameter 'roleName' when calling (Async)"); + } + + // verify the required parameter 'updateRoleDto' is set + if (updateRoleDto == null) { + throw new ApiException("Missing the required parameter 'updateRoleDto' when calling (Async)"); + } + + return putRoleCall(roleName, updateRoleDto, _callback); + + } + + + private ApiResponse putRoleWithHttpInfo(String roleName, UpdateRoleDto updateRoleDto) throws ApiException { + okhttp3.Call localVarCall = putRoleValidateBeforeCall(roleName, updateRoleDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putRoleAsync(String roleName, UpdateRoleDto updateRoleDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putRoleValidateBeforeCall(roleName, updateRoleDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappRolesPutRoleRequest { + private final String roleName; + private final UpdateRoleDto updateRoleDto; + + private APIappRolesPutRoleRequest(String roleName, UpdateRoleDto updateRoleDto) { + this.roleName = roleName; + this.updateRoleDto = updateRoleDto; + } + + /** + * Build call for putRole + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Role updated. -
400 Role request not valid. -
404 Role or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putRoleCall(roleName, updateRoleDto, _callback); + } + + /** + * Execute putRole request + * @return RolesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Role updated. -
400 Role request not valid. -
404 Role or app not found. -
500 Operation failed. -
+ */ + public RolesDto execute() throws ApiException { + ApiResponse localVarResp = putRoleWithHttpInfo(roleName, updateRoleDto); + return localVarResp.getData(); + } + + /** + * Execute putRole request with HTTP info returned + * @return ApiResponse<RolesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Role updated. -
400 Role request not valid. -
404 Role or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putRoleWithHttpInfo(roleName, updateRoleDto); + } + + /** + * Execute putRole request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Role updated. -
400 Role request not valid. -
404 Role or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putRoleAsync(roleName, updateRoleDto, _callback); + } + } + + /** + * Update an app role. + * + * @param roleName The name of the role to be updated. (required) + * @param updateRoleDto Role to be updated for the app. (required) + * @return APIappRolesPutRoleRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Role updated. -
400 Role request not valid. -
404 Role or app not found. -
500 Operation failed. -
+ */ + public APIappRolesPutRoleRequest putRole(String roleName, UpdateRoleDto updateRoleDto) { + return new APIappRolesPutRoleRequest(roleName, updateRoleDto); + } + private okhttp3.Call getSettingsCall(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 = "/api/apps/$app$/settings"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSettingsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getSettingsCall(_callback); + + } + + + private ApiResponse getSettingsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getSettingsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getSettingsAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSettingsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappSettingsGetSettingsRequest { + + private APIappSettingsGetSettingsRequest() { + } + + /** + * Build call for getSettings + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App settings returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getSettingsCall(_callback); + } + + /** + * Execute getSettings request + * @return AppSettingsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App settings returned. -
404 App not found. -
500 Operation failed. -
+ */ + public AppSettingsDto execute() throws ApiException { + ApiResponse localVarResp = getSettingsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getSettings request with HTTP info returned + * @return ApiResponse<AppSettingsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App settings returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getSettingsWithHttpInfo(); + } + + /** + * Execute getSettings request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 App settings returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getSettingsAsync(_callback); + } + } + + /** + * Get the app settings. + * + * @return APIappSettingsGetSettingsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App settings returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappSettingsGetSettingsRequest getSettings() { + return new APIappSettingsGetSettingsRequest(); + } + private okhttp3.Call putSettingsCall(UpdateAppSettingsDto updateAppSettingsDto, 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 = updateAppSettingsDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/settings"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putSettingsValidateBeforeCall(UpdateAppSettingsDto updateAppSettingsDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'updateAppSettingsDto' is set + if (updateAppSettingsDto == null) { + throw new ApiException("Missing the required parameter 'updateAppSettingsDto' when calling (Async)"); + } + + return putSettingsCall(updateAppSettingsDto, _callback); + + } + + + private ApiResponse putSettingsWithHttpInfo(UpdateAppSettingsDto updateAppSettingsDto) throws ApiException { + okhttp3.Call localVarCall = putSettingsValidateBeforeCall(updateAppSettingsDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putSettingsAsync(UpdateAppSettingsDto updateAppSettingsDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putSettingsValidateBeforeCall(updateAppSettingsDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappSettingsPutSettingsRequest { + private final UpdateAppSettingsDto updateAppSettingsDto; + + private APIappSettingsPutSettingsRequest(UpdateAppSettingsDto updateAppSettingsDto) { + this.updateAppSettingsDto = updateAppSettingsDto; + } + + /** + * Build call for putSettings + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App updated. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putSettingsCall(updateAppSettingsDto, _callback); + } + + /** + * Execute putSettings request + * @return AppSettingsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App updated. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public AppSettingsDto execute() throws ApiException { + ApiResponse localVarResp = putSettingsWithHttpInfo(updateAppSettingsDto); + return localVarResp.getData(); + } + + /** + * Execute putSettings request with HTTP info returned + * @return ApiResponse<AppSettingsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App updated. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putSettingsWithHttpInfo(updateAppSettingsDto); + } + + /** + * Execute putSettings request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 App updated. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putSettingsAsync(updateAppSettingsDto, _callback); + } + } + + /** + * Update the settings. + * + * @param updateAppSettingsDto The values to update. (required) + * @return APIappSettingsPutSettingsRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App updated. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappSettingsPutSettingsRequest putSettings(UpdateAppSettingsDto updateAppSettingsDto) { + return new APIappSettingsPutSettingsRequest(updateAppSettingsDto); + } + private okhttp3.Call deleteWorkflowCall(String 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 = "/api/apps/$app$/workflows/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteWorkflowValidateBeforeCall(String 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 (Async)"); + } + + return deleteWorkflowCall(id, _callback); + + } + + + private ApiResponse deleteWorkflowWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteWorkflowValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteWorkflowAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteWorkflowValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappWorkflowsDeleteWorkflowRequest { + private final String id; + + private APIappWorkflowsDeleteWorkflowRequest(String id) { + this.id = id; + } + + /** + * Build call for deleteWorkflow + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow deleted. -
404 Workflow or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteWorkflowCall(id, _callback); + } + + /** + * Execute deleteWorkflow request + * @return WorkflowsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow deleted. -
404 Workflow or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public WorkflowsDto execute() throws ApiException { + ApiResponse localVarResp = deleteWorkflowWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute deleteWorkflow request with HTTP info returned + * @return ApiResponse<WorkflowsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow deleted. -
404 Workflow or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteWorkflowWithHttpInfo(id); + } + + /** + * Execute deleteWorkflow request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Workflow deleted. -
404 Workflow or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteWorkflowAsync(id, _callback); + } + } + + /** + * Delete a workflow. + * + * @param id The ID of the workflow to update. (required) + * @return APIappWorkflowsDeleteWorkflowRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow deleted. -
404 Workflow or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIappWorkflowsDeleteWorkflowRequest deleteWorkflow(String id) { + return new APIappWorkflowsDeleteWorkflowRequest(id); + } + private okhttp3.Call getWorkflowsCall(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 = "/api/apps/$app$/workflows"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getWorkflowsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getWorkflowsCall(_callback); + + } + + + private ApiResponse getWorkflowsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getWorkflowsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getWorkflowsAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getWorkflowsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappWorkflowsGetWorkflowsRequest { + + private APIappWorkflowsGetWorkflowsRequest() { + } + + /** + * Build call for getWorkflows + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Workflows returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getWorkflowsCall(_callback); + } + + /** + * Execute getWorkflows request + * @return WorkflowsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Workflows returned. -
404 App not found. -
500 Operation failed. -
+ */ + public WorkflowsDto execute() throws ApiException { + ApiResponse localVarResp = getWorkflowsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getWorkflows request with HTTP info returned + * @return ApiResponse<WorkflowsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Workflows returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getWorkflowsWithHttpInfo(); + } + + /** + * Execute getWorkflows request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Workflows returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getWorkflowsAsync(_callback); + } + } + + /** + * Get app workflow. + * + * @return APIappWorkflowsGetWorkflowsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Workflows returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappWorkflowsGetWorkflowsRequest getWorkflows() { + return new APIappWorkflowsGetWorkflowsRequest(); + } + private okhttp3.Call postWorkflowCall(AddWorkflowDto addWorkflowDto, 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 = addWorkflowDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/workflows"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postWorkflowValidateBeforeCall(AddWorkflowDto addWorkflowDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'addWorkflowDto' is set + if (addWorkflowDto == null) { + throw new ApiException("Missing the required parameter 'addWorkflowDto' when calling (Async)"); + } + + return postWorkflowCall(addWorkflowDto, _callback); + + } + + + private ApiResponse postWorkflowWithHttpInfo(AddWorkflowDto addWorkflowDto) throws ApiException { + okhttp3.Call localVarCall = postWorkflowValidateBeforeCall(addWorkflowDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postWorkflowAsync(AddWorkflowDto addWorkflowDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postWorkflowValidateBeforeCall(addWorkflowDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappWorkflowsPostWorkflowRequest { + private final AddWorkflowDto addWorkflowDto; + + private APIappWorkflowsPostWorkflowRequest(AddWorkflowDto addWorkflowDto) { + this.addWorkflowDto = addWorkflowDto; + } + + /** + * Build call for postWorkflow + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow created. -
400 Workflow request not valid. -
404 Workflow or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postWorkflowCall(addWorkflowDto, _callback); + } + + /** + * Execute postWorkflow request + * @return WorkflowsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow created. -
400 Workflow request not valid. -
404 Workflow or app not found. -
500 Operation failed. -
+ */ + public WorkflowsDto execute() throws ApiException { + ApiResponse localVarResp = postWorkflowWithHttpInfo(addWorkflowDto); + return localVarResp.getData(); + } + + /** + * Execute postWorkflow request with HTTP info returned + * @return ApiResponse<WorkflowsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow created. -
400 Workflow request not valid. -
404 Workflow or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postWorkflowWithHttpInfo(addWorkflowDto); + } + + /** + * Execute postWorkflow request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Workflow created. -
400 Workflow request not valid. -
404 Workflow or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postWorkflowAsync(addWorkflowDto, _callback); + } + } + + /** + * Create a workflow. + * + * @param addWorkflowDto The new workflow. (required) + * @return APIappWorkflowsPostWorkflowRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow created. -
400 Workflow request not valid. -
404 Workflow or app not found. -
500 Operation failed. -
+ */ + public APIappWorkflowsPostWorkflowRequest postWorkflow(AddWorkflowDto addWorkflowDto) { + return new APIappWorkflowsPostWorkflowRequest(addWorkflowDto); + } + private okhttp3.Call putWorkflowCall(String id, UpdateWorkflowDto updateWorkflowDto, 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 = updateWorkflowDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/workflows/{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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putWorkflowValidateBeforeCall(String id, UpdateWorkflowDto updateWorkflowDto, 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 (Async)"); + } + + // verify the required parameter 'updateWorkflowDto' is set + if (updateWorkflowDto == null) { + throw new ApiException("Missing the required parameter 'updateWorkflowDto' when calling (Async)"); + } + + return putWorkflowCall(id, updateWorkflowDto, _callback); + + } + + + private ApiResponse putWorkflowWithHttpInfo(String id, UpdateWorkflowDto updateWorkflowDto) throws ApiException { + okhttp3.Call localVarCall = putWorkflowValidateBeforeCall(id, updateWorkflowDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putWorkflowAsync(String id, UpdateWorkflowDto updateWorkflowDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putWorkflowValidateBeforeCall(id, updateWorkflowDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappWorkflowsPutWorkflowRequest { + private final String id; + private final UpdateWorkflowDto updateWorkflowDto; + + private APIappWorkflowsPutWorkflowRequest(String id, UpdateWorkflowDto updateWorkflowDto) { + this.id = id; + this.updateWorkflowDto = updateWorkflowDto; + } + + /** + * Build call for putWorkflow + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow updated. -
400 Workflow request not valid. -
404 Workflow or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putWorkflowCall(id, updateWorkflowDto, _callback); + } + + /** + * Execute putWorkflow request + * @return WorkflowsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow updated. -
400 Workflow request not valid. -
404 Workflow or app not found. -
500 Operation failed. -
+ */ + public WorkflowsDto execute() throws ApiException { + ApiResponse localVarResp = putWorkflowWithHttpInfo(id, updateWorkflowDto); + return localVarResp.getData(); + } + + /** + * Execute putWorkflow request with HTTP info returned + * @return ApiResponse<WorkflowsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow updated. -
400 Workflow request not valid. -
404 Workflow or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putWorkflowWithHttpInfo(id, updateWorkflowDto); + } + + /** + * Execute putWorkflow request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Workflow updated. -
400 Workflow request not valid. -
404 Workflow or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putWorkflowAsync(id, updateWorkflowDto, _callback); + } + } + + /** + * Update a workflow. + * + * @param id The ID of the workflow to update. (required) + * @param updateWorkflowDto The new workflow. (required) + * @return APIappWorkflowsPutWorkflowRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Workflow updated. -
400 Workflow request not valid. -
404 Workflow or app not found. -
500 Operation failed. -
+ */ + public APIappWorkflowsPutWorkflowRequest putWorkflow(String id, UpdateWorkflowDto updateWorkflowDto) { + return new APIappWorkflowsPutWorkflowRequest(id, updateWorkflowDto); + } + private okhttp3.Call deleteAppCall(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 = "/api/apps/$app$"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteAppValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return deleteAppCall(_callback); + + } + + + private ApiResponse deleteAppWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = deleteAppValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteAppAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteAppValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIappsDeleteAppRequest { + + private APIappsDeleteAppRequest() { + } + + /** + * Build call for deleteApp + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 App deleted. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteAppCall(_callback); + } + + /** + * Execute deleteApp request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 App deleted. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteAppWithHttpInfo(); + } + + /** + * Execute deleteApp request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 App deleted. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteAppWithHttpInfo(); + } + + /** + * Execute deleteApp request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 App deleted. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteAppAsync(_callback); + } + } + + /** + * Delete the app. + * + * @return APIappsDeleteAppRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 App deleted. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIappsDeleteAppRequest deleteApp() { + return new APIappsDeleteAppRequest(); + } + private okhttp3.Call deleteImageCall(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 = "/api/apps/$app$/image"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteImageValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return deleteImageCall(_callback); + + } + + + private ApiResponse deleteImageWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = deleteImageValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteImageAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteImageValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappsDeleteImageRequest { + + private APIappsDeleteImageRequest() { + } + + /** + * Build call for deleteImage + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App image removed. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteImageCall(_callback); + } + + /** + * Execute deleteImage request + * @return AppDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App image removed. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public AppDto execute() throws ApiException { + ApiResponse localVarResp = deleteImageWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute deleteImage request with HTTP info returned + * @return ApiResponse<AppDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App image removed. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteImageWithHttpInfo(); + } + + /** + * Execute deleteImage request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 App image removed. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteImageAsync(_callback); + } + } + + /** + * Remove the app image. + * + * @return APIappsDeleteImageRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App image removed. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIappsDeleteImageRequest deleteImage() { + return new APIappsDeleteImageRequest(); + } + private okhttp3.Call getAppCall(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 = "/api/apps/$app$"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAppValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getAppCall(_callback); + + } + + + private ApiResponse getAppWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getAppValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAppAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAppValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappsGetAppRequest { + + private APIappsGetAppRequest() { + } + + /** + * Build call for getApp + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Apps returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAppCall(_callback); + } + + /** + * Execute getApp request + * @return AppDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Apps returned. -
404 App not found. -
500 Operation failed. -
+ */ + public AppDto execute() throws ApiException { + ApiResponse localVarResp = getAppWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getApp request with HTTP info returned + * @return ApiResponse<AppDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Apps returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAppWithHttpInfo(); + } + + /** + * Execute getApp request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Apps returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAppAsync(_callback); + } + } + + /** + * Get an app by name. + * + * @return APIappsGetAppRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Apps returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappsGetAppRequest getApp() { + return new APIappsGetAppRequest(); + } + private okhttp3.Call getAppsCall(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 = "/api/apps"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAppsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getAppsCall(_callback); + + } + + + private ApiResponse> getAppsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getAppsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAppsAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getAppsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappsGetAppsRequest { + + private APIappsGetAppsRequest() { + } + + /** + * Build call for getApps + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Apps returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAppsCall(_callback); + } + + /** + * Execute getApps request + * @return List<AppDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Apps returned. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getAppsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getApps request with HTTP info returned + * @return ApiResponse<List<AppDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Apps returned. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getAppsWithHttpInfo(); + } + + /** + * Execute getApps request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Apps returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getAppsAsync(_callback); + } + } + + /** + * Get your apps. + * You can only retrieve the list of apps when you are authenticated as a user (OpenID implicit flow). You will retrieve all apps, where you are assigned as a contributor. + * @return APIappsGetAppsRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Apps returned. -
500 Operation failed. -
+ */ + public APIappsGetAppsRequest getApps() { + return new APIappsGetAppsRequest(); + } + private okhttp3.Call getTeamAppsCall(String team, 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 = "/api/teams/{team}/apps" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTeamAppsValidateBeforeCall(String team, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + return getTeamAppsCall(team, _callback); + + } + + + private ApiResponse> getTeamAppsWithHttpInfo(String team) throws ApiException { + okhttp3.Call localVarCall = getTeamAppsValidateBeforeCall(team, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getTeamAppsAsync(String team, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getTeamAppsValidateBeforeCall(team, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappsGetTeamAppsRequest { + private final String team; + + private APIappsGetTeamAppsRequest(String team) { + this.team = team; + } + + /** + * Build call for getTeamApps + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Apps returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getTeamAppsCall(team, _callback); + } + + /** + * Execute getTeamApps request + * @return List<AppDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Apps returned. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getTeamAppsWithHttpInfo(team); + return localVarResp.getData(); + } + + /** + * Execute getTeamApps request with HTTP info returned + * @return ApiResponse<List<AppDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Apps returned. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getTeamAppsWithHttpInfo(team); + } + + /** + * Execute getTeamApps request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Apps returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getTeamAppsAsync(team, _callback); + } + } + + /** + * Get team apps. + * You can only retrieve the list of apps when you are authenticated as a user (OpenID implicit flow). You will retrieve all apps, where you are assigned as a contributor. + * @param team The ID of the team. (required) + * @return APIappsGetTeamAppsRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Apps returned. -
500 Operation failed. -
+ */ + public APIappsGetTeamAppsRequest getTeamApps(String team) { + return new APIappsGetTeamAppsRequest(team); + } + private okhttp3.Call postAppCall(CreateAppDto createAppDto, 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 = createAppDto; + + // create path and map variables + String localVarPath = "/api/apps"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postAppValidateBeforeCall(CreateAppDto createAppDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createAppDto' is set + if (createAppDto == null) { + throw new ApiException("Missing the required parameter 'createAppDto' when calling (Async)"); + } + + return postAppCall(createAppDto, _callback); + + } + + + private ApiResponse postAppWithHttpInfo(CreateAppDto createAppDto) throws ApiException { + okhttp3.Call localVarCall = postAppValidateBeforeCall(createAppDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postAppAsync(CreateAppDto createAppDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postAppValidateBeforeCall(createAppDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappsPostAppRequest { + private final CreateAppDto createAppDto; + + private APIappsPostAppRequest(CreateAppDto createAppDto) { + this.createAppDto = createAppDto; + } + + /** + * Build call for postApp + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 App created. -
400 App request not valid. -
409 App name is already in use. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postAppCall(createAppDto, _callback); + } + + /** + * Execute postApp request + * @return AppDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 App created. -
400 App request not valid. -
409 App name is already in use. -
500 Operation failed. -
+ */ + public AppDto execute() throws ApiException { + ApiResponse localVarResp = postAppWithHttpInfo(createAppDto); + return localVarResp.getData(); + } + + /** + * Execute postApp request with HTTP info returned + * @return ApiResponse<AppDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 App created. -
400 App request not valid. -
409 App name is already in use. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postAppWithHttpInfo(createAppDto); + } + + /** + * Execute postApp request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
201 App created. -
400 App request not valid. -
409 App name is already in use. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postAppAsync(createAppDto, _callback); + } + } + + /** + * Create a new app. + * You can only create an app when you are authenticated as a user (OpenID implicit flow). You will be assigned as owner of the new app automatically. + * @param createAppDto The app object that needs to be added to Squidex. (required) + * @return APIappsPostAppRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 App created. -
400 App request not valid. -
409 App name is already in use. -
500 Operation failed. -
+ */ + public APIappsPostAppRequest postApp(CreateAppDto createAppDto) { + return new APIappsPostAppRequest(createAppDto); + } + private okhttp3.Call putAppCall(UpdateAppDto updateAppDto, 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 = updateAppDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putAppValidateBeforeCall(UpdateAppDto updateAppDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'updateAppDto' is set + if (updateAppDto == null) { + throw new ApiException("Missing the required parameter 'updateAppDto' when calling (Async)"); + } + + return putAppCall(updateAppDto, _callback); + + } + + + private ApiResponse putAppWithHttpInfo(UpdateAppDto updateAppDto) throws ApiException { + okhttp3.Call localVarCall = putAppValidateBeforeCall(updateAppDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putAppAsync(UpdateAppDto updateAppDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putAppValidateBeforeCall(updateAppDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappsPutAppRequest { + private final UpdateAppDto updateAppDto; + + private APIappsPutAppRequest(UpdateAppDto updateAppDto) { + this.updateAppDto = updateAppDto; + } + + /** + * Build call for putApp + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App updated. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putAppCall(updateAppDto, _callback); + } + + /** + * Execute putApp request + * @return AppDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App updated. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public AppDto execute() throws ApiException { + ApiResponse localVarResp = putAppWithHttpInfo(updateAppDto); + return localVarResp.getData(); + } + + /** + * Execute putApp request with HTTP info returned + * @return ApiResponse<AppDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App updated. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putAppWithHttpInfo(updateAppDto); + } + + /** + * Execute putApp request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 App updated. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putAppAsync(updateAppDto, _callback); + } + } + + /** + * Update the app. + * + * @param updateAppDto The values to update. (required) + * @return APIappsPutAppRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App updated. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappsPutAppRequest putApp(UpdateAppDto updateAppDto) { + return new APIappsPutAppRequest(updateAppDto); + } + private okhttp3.Call putAppTeamCall(TransferToTeamDto transferToTeamDto, 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 = transferToTeamDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/team"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putAppTeamValidateBeforeCall(TransferToTeamDto transferToTeamDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'transferToTeamDto' is set + if (transferToTeamDto == null) { + throw new ApiException("Missing the required parameter 'transferToTeamDto' when calling (Async)"); + } + + return putAppTeamCall(transferToTeamDto, _callback); + + } + + + private ApiResponse putAppTeamWithHttpInfo(TransferToTeamDto transferToTeamDto) throws ApiException { + okhttp3.Call localVarCall = putAppTeamValidateBeforeCall(transferToTeamDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putAppTeamAsync(TransferToTeamDto transferToTeamDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putAppTeamValidateBeforeCall(transferToTeamDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappsPutAppTeamRequest { + private final TransferToTeamDto transferToTeamDto; + + private APIappsPutAppTeamRequest(TransferToTeamDto transferToTeamDto) { + this.transferToTeamDto = transferToTeamDto; + } + + /** + * Build call for putAppTeam + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App transferred. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putAppTeamCall(transferToTeamDto, _callback); + } + + /** + * Execute putAppTeam request + * @return AppDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App transferred. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public AppDto execute() throws ApiException { + ApiResponse localVarResp = putAppTeamWithHttpInfo(transferToTeamDto); + return localVarResp.getData(); + } + + /** + * Execute putAppTeam request with HTTP info returned + * @return ApiResponse<AppDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App transferred. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putAppTeamWithHttpInfo(transferToTeamDto); + } + + /** + * Execute putAppTeam request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 App transferred. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putAppTeamAsync(transferToTeamDto, _callback); + } + } + + /** + * Transfer the app. + * + * @param transferToTeamDto The team information. (required) + * @return APIappsPutAppTeamRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App transferred. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappsPutAppTeamRequest putAppTeam(TransferToTeamDto transferToTeamDto) { + return new APIappsPutAppTeamRequest(transferToTeamDto); + } + private okhttp3.Call uploadImageCall(File file, String url, String name, 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 = "/api/apps/$app$/image"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (file != null) { + localVarFormParams.put("file", file); + } + + if (url != null) { + localVarFormParams.put("url", url); + } + + if (name != null) { + localVarFormParams.put("name", name); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call uploadImageValidateBeforeCall(File file, String url, String name, final ApiCallback _callback) throws ApiException { + return uploadImageCall(file, url, name, _callback); + + } + + + private ApiResponse uploadImageWithHttpInfo(File file, String url, String name) throws ApiException { + okhttp3.Call localVarCall = uploadImageValidateBeforeCall(file, url, name, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call uploadImageAsync(File file, String url, String name, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = uploadImageValidateBeforeCall(file, url, name, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappsUploadImageRequest { + private File file; + private String url; + private String name; + + private APIappsUploadImageRequest() { + } + + /** + * Set file + * @param file (optional) + * @return APIappsUploadImageRequest + */ + public APIappsUploadImageRequest file(File file) { + this.file = file; + return this; + } + + /** + * Set url + * @param url (optional) + * @return APIappsUploadImageRequest + */ + public APIappsUploadImageRequest url(String url) { + this.url = url; + return this; + } + + /** + * Set name + * @param name (optional) + * @return APIappsUploadImageRequest + */ + public APIappsUploadImageRequest name(String name) { + this.name = name; + return this; + } + + /** + * Build call for uploadImage + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App image uploaded. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return uploadImageCall(file, url, name, _callback); + } + + /** + * Execute uploadImage request + * @return AppDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App image uploaded. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public AppDto execute() throws ApiException { + ApiResponse localVarResp = uploadImageWithHttpInfo(file, url, name); + return localVarResp.getData(); + } + + /** + * Execute uploadImage request with HTTP info returned + * @return ApiResponse<AppDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App image uploaded. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return uploadImageWithHttpInfo(file, url, name); + } + + /** + * Execute uploadImage request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 App image uploaded. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return uploadImageAsync(file, url, name, _callback); + } + } + + /** + * Upload the app image. + * + * @return APIappsUploadImageRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 App image uploaded. -
400 App request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappsUploadImageRequest uploadImage() { + return new APIappsUploadImageRequest(); + } +} diff --git a/src/main/java/com/squidex/api/core/api/AssetsApi.java b/src/main/java/com/squidex/api/core/api/AssetsApi.java new file mode 100644 index 0000000..228ba58 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/AssetsApi.java @@ -0,0 +1,4155 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.AnnotateAssetDto; +import com.squidex.api.types.AssetDto; +import com.squidex.api.types.AssetFolderDto; +import com.squidex.api.types.AssetFolderScope; +import com.squidex.api.types.AssetFoldersDto; +import com.squidex.api.types.AssetsDto; +import java.math.BigDecimal; +import com.squidex.api.types.BulkResultDto; +import com.squidex.api.types.BulkUpdateAssetsDto; +import com.squidex.api.types.CreateAssetFolderDto; +import com.squidex.api.types.ErrorDto; +import java.io.File; +import com.squidex.api.types.ImageFormat; +import com.squidex.api.types.MoveAssetDto; +import com.squidex.api.types.MoveAssetFolderDto; +import com.squidex.api.types.QueryDto; +import com.squidex.api.types.RenameAssetFolderDto; +import com.squidex.api.types.RenameTagDto; +import com.squidex.api.types.ResizeMode; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class AssetsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public AssetsApi() { + this(Configuration.getDefaultApiClient()); + } + + public AssetsApi(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; + } + + private okhttp3.Call getAssetContentCall(String id, Long version, Long cache, Integer download, Integer width, Integer height, Integer quality, ResizeMode mode, String bg, Float focusX, Float focusY, Boolean nofocus, Boolean auto, Boolean force, Boolean deleted, ImageFormat format, 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 = "/api/assets/{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(); + + if (version != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("version", version)); + } + + if (cache != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("cache", cache)); + } + + if (download != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("download", download)); + } + + if (width != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("width", width)); + } + + if (height != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("height", height)); + } + + if (quality != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("quality", quality)); + } + + if (mode != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("mode", mode)); + } + + if (bg != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("bg", bg)); + } + + if (focusX != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("focusX", focusX)); + } + + if (focusY != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("focusY", focusY)); + } + + if (nofocus != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("nofocus", nofocus)); + } + + if (auto != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("auto", auto)); + } + + if (force != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("force", force)); + } + + if (deleted != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("deleted", deleted)); + } + + if (format != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("format", format)); + } + + final String[] localVarAccepts = { + "application/octet-stream", + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getAssetContentValidateBeforeCall(String id, Long version, Long cache, Integer download, Integer width, Integer height, Integer quality, ResizeMode mode, String bg, Float focusX, Float focusY, Boolean nofocus, Boolean auto, Boolean force, Boolean deleted, ImageFormat format, 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 (Async)"); + } + + return getAssetContentCall(id, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format, _callback); + + } + + + private ApiResponse getAssetContentWithHttpInfo(String id, Long version, Long cache, Integer download, Integer width, Integer height, Integer quality, ResizeMode mode, String bg, Float focusX, Float focusY, Boolean nofocus, Boolean auto, Boolean force, Boolean deleted, ImageFormat format) throws ApiException { + okhttp3.Call localVarCall = getAssetContentValidateBeforeCall(id, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAssetContentAsync(String id, Long version, Long cache, Integer download, Integer width, Integer height, Integer quality, ResizeMode mode, String bg, Float focusX, Float focusY, Boolean nofocus, Boolean auto, Boolean force, Boolean deleted, ImageFormat format, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAssetContentValidateBeforeCall(id, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetContentGetAssetContentRequest { + private final String id; + private Long version; + private Long cache; + private Integer download; + private Integer width; + private Integer height; + private Integer quality; + private ResizeMode mode; + private String bg; + private Float focusX; + private Float focusY; + private Boolean nofocus; + private Boolean auto; + private Boolean force; + private Boolean deleted; + private ImageFormat format; + + private APIassetContentGetAssetContentRequest(String id) { + this.id = id; + } + + /** + * Set version + * @param version The optional version of the asset. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest version(Long version) { + this.version = version; + return this; + } + + /** + * Set cache + * @param cache The cache duration in seconds. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest cache(Long cache) { + this.cache = cache; + return this; + } + + /** + * Set download + * @param download Set it to 0 to prevent download. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest download(Integer download) { + this.download = download; + return this; + } + + /** + * Set width + * @param width The target width of the asset, if it is an image. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest width(Integer width) { + this.width = width; + return this; + } + + /** + * Set height + * @param height The target height of the asset, if it is an image. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest height(Integer height) { + this.height = height; + return this; + } + + /** + * Set quality + * @param quality Optional image quality, it is is an jpeg image. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest quality(Integer quality) { + this.quality = quality; + return this; + } + + /** + * Set mode + * @param mode The resize mode when the width and height is defined. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest mode(ResizeMode mode) { + this.mode = mode; + return this; + } + + /** + * Set bg + * @param bg Optional background color. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest bg(String bg) { + this.bg = bg; + return this; + } + + /** + * Set focusX + * @param focusX Override the y focus point. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest focusX(Float focusX) { + this.focusX = focusX; + return this; + } + + /** + * Set focusY + * @param focusY Override the x focus point. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest focusY(Float focusY) { + this.focusY = focusY; + return this; + } + + /** + * Set nofocus + * @param nofocus True to ignore the asset focus point if any. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest nofocus(Boolean nofocus) { + this.nofocus = nofocus; + return this; + } + + /** + * Set auto + * @param auto True to use auto format. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest auto(Boolean auto) { + this.auto = auto; + return this; + } + + /** + * Set force + * @param force True to force a new resize even if it already stored. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest force(Boolean force) { + this.force = force; + return this; + } + + /** + * Set deleted + * @param deleted Also return deleted content items. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest deleted(Boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + * Set format + * @param format True to force a new resize even if it already stored. (optional) + * @return APIassetContentGetAssetContentRequest + */ + public APIassetContentGetAssetContentRequest format(ImageFormat format) { + this.format = format; + return this; + } + + /** + * Build call for getAssetContent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found and content or (resized) image returned. -
404 Asset or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAssetContentCall(id, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format, _callback); + } + + /** + * Execute getAssetContent request + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found and content or (resized) image returned. -
404 Asset or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public File execute() throws ApiException { + ApiResponse localVarResp = getAssetContentWithHttpInfo(id, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format); + return localVarResp.getData(); + } + + /** + * Execute getAssetContent request with HTTP info returned + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found and content or (resized) image returned. -
404 Asset or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAssetContentWithHttpInfo(id, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format); + } + + /** + * Execute getAssetContent request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Asset found and content or (resized) image returned. -
404 Asset or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAssetContentAsync(id, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format, _callback); + } + } + + /** + * Get the asset content. + * + * @param id The ID of the asset. (required) + * @return APIassetContentGetAssetContentRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found and content or (resized) image returned. -
404 Asset or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public APIassetContentGetAssetContentRequest getAssetContent(String id) { + return new APIassetContentGetAssetContentRequest(id); + } + private okhttp3.Call getAssetContentBySlugCall(String idOrSlug, Long version, Long cache, Integer download, Integer width, Integer height, Integer quality, ResizeMode mode, String bg, Float focusX, Float focusY, Boolean nofocus, Boolean auto, Boolean force, Boolean deleted, ImageFormat format, 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 = "/api/assets/$app$/{idOrSlug}/" + .replace("{" + "idOrSlug" + "}", localVarApiClient.escapeString(idOrSlug.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (version != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("version", version)); + } + + if (cache != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("cache", cache)); + } + + if (download != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("download", download)); + } + + if (width != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("width", width)); + } + + if (height != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("height", height)); + } + + if (quality != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("quality", quality)); + } + + if (mode != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("mode", mode)); + } + + if (bg != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("bg", bg)); + } + + if (focusX != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("focusX", focusX)); + } + + if (focusY != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("focusY", focusY)); + } + + if (nofocus != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("nofocus", nofocus)); + } + + if (auto != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("auto", auto)); + } + + if (force != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("force", force)); + } + + if (deleted != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("deleted", deleted)); + } + + if (format != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("format", format)); + } + + final String[] localVarAccepts = { + "application/octet-stream", + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAssetContentBySlugValidateBeforeCall(String idOrSlug, Long version, Long cache, Integer download, Integer width, Integer height, Integer quality, ResizeMode mode, String bg, Float focusX, Float focusY, Boolean nofocus, Boolean auto, Boolean force, Boolean deleted, ImageFormat format, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'idOrSlug' is set + if (idOrSlug == null) { + throw new ApiException("Missing the required parameter 'idOrSlug' when calling (Async)"); + } + + return getAssetContentBySlugCall(idOrSlug, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format, _callback); + + } + + + private ApiResponse getAssetContentBySlugWithHttpInfo(String idOrSlug, Long version, Long cache, Integer download, Integer width, Integer height, Integer quality, ResizeMode mode, String bg, Float focusX, Float focusY, Boolean nofocus, Boolean auto, Boolean force, Boolean deleted, ImageFormat format) throws ApiException { + okhttp3.Call localVarCall = getAssetContentBySlugValidateBeforeCall(idOrSlug, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAssetContentBySlugAsync(String idOrSlug, Long version, Long cache, Integer download, Integer width, Integer height, Integer quality, ResizeMode mode, String bg, Float focusX, Float focusY, Boolean nofocus, Boolean auto, Boolean force, Boolean deleted, ImageFormat format, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAssetContentBySlugValidateBeforeCall(idOrSlug, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetContentGetAssetContentBySlugRequest { + private final String idOrSlug; + private Long version; + private Long cache; + private Integer download; + private Integer width; + private Integer height; + private Integer quality; + private ResizeMode mode; + private String bg; + private Float focusX; + private Float focusY; + private Boolean nofocus; + private Boolean auto; + private Boolean force; + private Boolean deleted; + private ImageFormat format; + + private APIassetContentGetAssetContentBySlugRequest(String idOrSlug) { + this.idOrSlug = idOrSlug; + } + + /** + * Set version + * @param version The optional version of the asset. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest version(Long version) { + this.version = version; + return this; + } + + /** + * Set cache + * @param cache The cache duration in seconds. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest cache(Long cache) { + this.cache = cache; + return this; + } + + /** + * Set download + * @param download Set it to 0 to prevent download. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest download(Integer download) { + this.download = download; + return this; + } + + /** + * Set width + * @param width The target width of the asset, if it is an image. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest width(Integer width) { + this.width = width; + return this; + } + + /** + * Set height + * @param height The target height of the asset, if it is an image. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest height(Integer height) { + this.height = height; + return this; + } + + /** + * Set quality + * @param quality Optional image quality, it is is an jpeg image. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest quality(Integer quality) { + this.quality = quality; + return this; + } + + /** + * Set mode + * @param mode The resize mode when the width and height is defined. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest mode(ResizeMode mode) { + this.mode = mode; + return this; + } + + /** + * Set bg + * @param bg Optional background color. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest bg(String bg) { + this.bg = bg; + return this; + } + + /** + * Set focusX + * @param focusX Override the y focus point. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest focusX(Float focusX) { + this.focusX = focusX; + return this; + } + + /** + * Set focusY + * @param focusY Override the x focus point. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest focusY(Float focusY) { + this.focusY = focusY; + return this; + } + + /** + * Set nofocus + * @param nofocus True to ignore the asset focus point if any. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest nofocus(Boolean nofocus) { + this.nofocus = nofocus; + return this; + } + + /** + * Set auto + * @param auto True to use auto format. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest auto(Boolean auto) { + this.auto = auto; + return this; + } + + /** + * Set force + * @param force True to force a new resize even if it already stored. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest force(Boolean force) { + this.force = force; + return this; + } + + /** + * Set deleted + * @param deleted Also return deleted content items. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest deleted(Boolean deleted) { + this.deleted = deleted; + return this; + } + + /** + * Set format + * @param format True to force a new resize even if it already stored. (optional) + * @return APIassetContentGetAssetContentBySlugRequest + */ + public APIassetContentGetAssetContentBySlugRequest format(ImageFormat format) { + this.format = format; + return this; + } + + /** + * Build call for getAssetContentBySlug + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found and content or (resized) image returned. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAssetContentBySlugCall(idOrSlug, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format, _callback); + } + + /** + * Execute getAssetContentBySlug request + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found and content or (resized) image returned. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public File execute() throws ApiException { + ApiResponse localVarResp = getAssetContentBySlugWithHttpInfo(idOrSlug, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format); + return localVarResp.getData(); + } + + /** + * Execute getAssetContentBySlug request with HTTP info returned + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found and content or (resized) image returned. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAssetContentBySlugWithHttpInfo(idOrSlug, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format); + } + + /** + * Execute getAssetContentBySlug request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Asset found and content or (resized) image returned. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAssetContentBySlugAsync(idOrSlug, version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, deleted, format, _callback); + } + } + + /** + * Get the asset content. + * + * @param idOrSlug The id or slug of the asset. (required) + * @return APIassetContentGetAssetContentBySlugRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found and content or (resized) image returned. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public APIassetContentGetAssetContentBySlugRequest getAssetContentBySlug(String idOrSlug) { + return new APIassetContentGetAssetContentBySlugRequest(idOrSlug); + } + private okhttp3.Call deleteAssetFolderCall(String 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 = "/api/apps/$app$/assets/folders/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteAssetFolderValidateBeforeCall(String 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 (Async)"); + } + + return deleteAssetFolderCall(id, _callback); + + } + + + private ApiResponse deleteAssetFolderWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteAssetFolderValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteAssetFolderAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteAssetFolderValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIassetFoldersDeleteAssetFolderRequest { + private final String id; + + private APIassetFoldersDeleteAssetFolderRequest(String id) { + this.id = id; + } + + /** + * Build call for deleteAssetFolder + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Asset folder deleted. -
404 Asset folder or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteAssetFolderCall(id, _callback); + } + + /** + * Execute deleteAssetFolder request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Asset folder deleted. -
404 Asset folder or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteAssetFolderWithHttpInfo(id); + } + + /** + * Execute deleteAssetFolder request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Asset folder deleted. -
404 Asset folder or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteAssetFolderWithHttpInfo(id); + } + + /** + * Execute deleteAssetFolder request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Asset folder deleted. -
404 Asset folder or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteAssetFolderAsync(id, _callback); + } + } + + /** + * Delete an asset folder. + * + * @param id The ID of the asset folder to delete. (required) + * @return APIassetFoldersDeleteAssetFolderRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Asset folder deleted. -
404 Asset folder or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIassetFoldersDeleteAssetFolderRequest deleteAssetFolder(String id) { + return new APIassetFoldersDeleteAssetFolderRequest(id); + } + private okhttp3.Call getAssetFoldersCall(String parentId, AssetFolderScope scope, 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 = "/api/apps/$app$/assets/folders"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (parentId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("parentId", parentId)); + } + + if (scope != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("scope", scope)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAssetFoldersValidateBeforeCall(String parentId, AssetFolderScope scope, final ApiCallback _callback) throws ApiException { + return getAssetFoldersCall(parentId, scope, _callback); + + } + + + private ApiResponse getAssetFoldersWithHttpInfo(String parentId, AssetFolderScope scope) throws ApiException { + okhttp3.Call localVarCall = getAssetFoldersValidateBeforeCall(parentId, scope, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAssetFoldersAsync(String parentId, AssetFolderScope scope, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAssetFoldersValidateBeforeCall(parentId, scope, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetFoldersGetAssetFoldersRequest { + private String parentId; + private AssetFolderScope scope; + + private APIassetFoldersGetAssetFoldersRequest() { + } + + /** + * Set parentId + * @param parentId The optional parent folder id. (optional) + * @return APIassetFoldersGetAssetFoldersRequest + */ + public APIassetFoldersGetAssetFoldersRequest parentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * Set scope + * @param scope The scope of the query. (optional) + * @return APIassetFoldersGetAssetFoldersRequest + */ + public APIassetFoldersGetAssetFoldersRequest scope(AssetFolderScope scope) { + this.scope = scope; + return this; + } + + /** + * Build call for getAssetFolders + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset folders returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAssetFoldersCall(parentId, scope, _callback); + } + + /** + * Execute getAssetFolders request + * @return AssetFoldersDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset folders returned. -
404 App not found. -
500 Operation failed. -
+ */ + public AssetFoldersDto execute() throws ApiException { + ApiResponse localVarResp = getAssetFoldersWithHttpInfo(parentId, scope); + return localVarResp.getData(); + } + + /** + * Execute getAssetFolders request with HTTP info returned + * @return ApiResponse<AssetFoldersDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset folders returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAssetFoldersWithHttpInfo(parentId, scope); + } + + /** + * Execute getAssetFolders request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Asset folders returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAssetFoldersAsync(parentId, scope, _callback); + } + } + + /** + * Get asset folders. + * Get all asset folders for the app. + * @return APIassetFoldersGetAssetFoldersRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset folders returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIassetFoldersGetAssetFoldersRequest getAssetFolders() { + return new APIassetFoldersGetAssetFoldersRequest(); + } + private okhttp3.Call postAssetFolderCall(CreateAssetFolderDto createAssetFolderDto, 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 = createAssetFolderDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/assets/folders"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postAssetFolderValidateBeforeCall(CreateAssetFolderDto createAssetFolderDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createAssetFolderDto' is set + if (createAssetFolderDto == null) { + throw new ApiException("Missing the required parameter 'createAssetFolderDto' when calling (Async)"); + } + + return postAssetFolderCall(createAssetFolderDto, _callback); + + } + + + private ApiResponse postAssetFolderWithHttpInfo(CreateAssetFolderDto createAssetFolderDto) throws ApiException { + okhttp3.Call localVarCall = postAssetFolderValidateBeforeCall(createAssetFolderDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postAssetFolderAsync(CreateAssetFolderDto createAssetFolderDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postAssetFolderValidateBeforeCall(createAssetFolderDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetFoldersPostAssetFolderRequest { + private final CreateAssetFolderDto createAssetFolderDto; + + private APIassetFoldersPostAssetFolderRequest(CreateAssetFolderDto createAssetFolderDto) { + this.createAssetFolderDto = createAssetFolderDto; + } + + /** + * Build call for postAssetFolder + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Asset folder created. -
400 Asset folder request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postAssetFolderCall(createAssetFolderDto, _callback); + } + + /** + * Execute postAssetFolder request + * @return AssetFolderDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Asset folder created. -
400 Asset folder request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public AssetFolderDto execute() throws ApiException { + ApiResponse localVarResp = postAssetFolderWithHttpInfo(createAssetFolderDto); + return localVarResp.getData(); + } + + /** + * Execute postAssetFolder request with HTTP info returned + * @return ApiResponse<AssetFolderDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Asset folder created. -
400 Asset folder request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postAssetFolderWithHttpInfo(createAssetFolderDto); + } + + /** + * Execute postAssetFolder request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
201 Asset folder created. -
400 Asset folder request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postAssetFolderAsync(createAssetFolderDto, _callback); + } + } + + /** + * Create an asset folder. + * + * @param createAssetFolderDto The asset folder object that needs to be added to the App. (required) + * @return APIassetFoldersPostAssetFolderRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Asset folder created. -
400 Asset folder request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIassetFoldersPostAssetFolderRequest postAssetFolder(CreateAssetFolderDto createAssetFolderDto) { + return new APIassetFoldersPostAssetFolderRequest(createAssetFolderDto); + } + private okhttp3.Call putAssetFolderCall(String id, RenameAssetFolderDto renameAssetFolderDto, 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 = renameAssetFolderDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/assets/folders/{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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putAssetFolderValidateBeforeCall(String id, RenameAssetFolderDto renameAssetFolderDto, 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 (Async)"); + } + + // verify the required parameter 'renameAssetFolderDto' is set + if (renameAssetFolderDto == null) { + throw new ApiException("Missing the required parameter 'renameAssetFolderDto' when calling (Async)"); + } + + return putAssetFolderCall(id, renameAssetFolderDto, _callback); + + } + + + private ApiResponse putAssetFolderWithHttpInfo(String id, RenameAssetFolderDto renameAssetFolderDto) throws ApiException { + okhttp3.Call localVarCall = putAssetFolderValidateBeforeCall(id, renameAssetFolderDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putAssetFolderAsync(String id, RenameAssetFolderDto renameAssetFolderDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putAssetFolderValidateBeforeCall(id, renameAssetFolderDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetFoldersPutAssetFolderRequest { + private final String id; + private final RenameAssetFolderDto renameAssetFolderDto; + + private APIassetFoldersPutAssetFolderRequest(String id, RenameAssetFolderDto renameAssetFolderDto) { + this.id = id; + this.renameAssetFolderDto = renameAssetFolderDto; + } + + /** + * Build call for putAssetFolder + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset folder updated. -
400 Asset folder request not valid. -
404 Asset folder or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putAssetFolderCall(id, renameAssetFolderDto, _callback); + } + + /** + * Execute putAssetFolder request + * @return AssetFolderDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset folder updated. -
400 Asset folder request not valid. -
404 Asset folder or app not found. -
500 Operation failed. -
+ */ + public AssetFolderDto execute() throws ApiException { + ApiResponse localVarResp = putAssetFolderWithHttpInfo(id, renameAssetFolderDto); + return localVarResp.getData(); + } + + /** + * Execute putAssetFolder request with HTTP info returned + * @return ApiResponse<AssetFolderDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset folder updated. -
400 Asset folder request not valid. -
404 Asset folder or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putAssetFolderWithHttpInfo(id, renameAssetFolderDto); + } + + /** + * Execute putAssetFolder request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Asset folder updated. -
400 Asset folder request not valid. -
404 Asset folder or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putAssetFolderAsync(id, renameAssetFolderDto, _callback); + } + } + + /** + * Update an asset folder. + * + * @param id The ID of the asset folder. (required) + * @param renameAssetFolderDto The asset folder object that needs to updated. (required) + * @return APIassetFoldersPutAssetFolderRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset folder updated. -
400 Asset folder request not valid. -
404 Asset folder or app not found. -
500 Operation failed. -
+ */ + public APIassetFoldersPutAssetFolderRequest putAssetFolder(String id, RenameAssetFolderDto renameAssetFolderDto) { + return new APIassetFoldersPutAssetFolderRequest(id, renameAssetFolderDto); + } + private okhttp3.Call putAssetFolderParentCall(String id, MoveAssetFolderDto moveAssetFolderDto, 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 = moveAssetFolderDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/assets/folders/{id}/parent" + .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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putAssetFolderParentValidateBeforeCall(String id, MoveAssetFolderDto moveAssetFolderDto, 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 (Async)"); + } + + // verify the required parameter 'moveAssetFolderDto' is set + if (moveAssetFolderDto == null) { + throw new ApiException("Missing the required parameter 'moveAssetFolderDto' when calling (Async)"); + } + + return putAssetFolderParentCall(id, moveAssetFolderDto, _callback); + + } + + + private ApiResponse putAssetFolderParentWithHttpInfo(String id, MoveAssetFolderDto moveAssetFolderDto) throws ApiException { + okhttp3.Call localVarCall = putAssetFolderParentValidateBeforeCall(id, moveAssetFolderDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putAssetFolderParentAsync(String id, MoveAssetFolderDto moveAssetFolderDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putAssetFolderParentValidateBeforeCall(id, moveAssetFolderDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetFoldersPutAssetFolderParentRequest { + private final String id; + private final MoveAssetFolderDto moveAssetFolderDto; + + private APIassetFoldersPutAssetFolderParentRequest(String id, MoveAssetFolderDto moveAssetFolderDto) { + this.id = id; + this.moveAssetFolderDto = moveAssetFolderDto; + } + + /** + * Build call for putAssetFolderParent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset folder moved. -
400 Asset folder request not valid. -
404 Asset folder or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putAssetFolderParentCall(id, moveAssetFolderDto, _callback); + } + + /** + * Execute putAssetFolderParent request + * @return AssetFolderDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset folder moved. -
400 Asset folder request not valid. -
404 Asset folder or app not found. -
500 Operation failed. -
+ */ + public AssetFolderDto execute() throws ApiException { + ApiResponse localVarResp = putAssetFolderParentWithHttpInfo(id, moveAssetFolderDto); + return localVarResp.getData(); + } + + /** + * Execute putAssetFolderParent request with HTTP info returned + * @return ApiResponse<AssetFolderDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset folder moved. -
400 Asset folder request not valid. -
404 Asset folder or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putAssetFolderParentWithHttpInfo(id, moveAssetFolderDto); + } + + /** + * Execute putAssetFolderParent request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Asset folder moved. -
400 Asset folder request not valid. -
404 Asset folder or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putAssetFolderParentAsync(id, moveAssetFolderDto, _callback); + } + } + + /** + * Move an asset folder. + * + * @param id The ID of the asset folder. (required) + * @param moveAssetFolderDto The asset folder object that needs to updated. (required) + * @return APIassetFoldersPutAssetFolderParentRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset folder moved. -
400 Asset folder request not valid. -
404 Asset folder or app not found. -
500 Operation failed. -
+ */ + public APIassetFoldersPutAssetFolderParentRequest putAssetFolderParent(String id, MoveAssetFolderDto moveAssetFolderDto) { + return new APIassetFoldersPutAssetFolderParentRequest(id, moveAssetFolderDto); + } + private okhttp3.Call bulkUpdateAssetsCall(BulkUpdateAssetsDto bulkUpdateAssetsDto, 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 = bulkUpdateAssetsDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/assets/bulk"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call bulkUpdateAssetsValidateBeforeCall(BulkUpdateAssetsDto bulkUpdateAssetsDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'bulkUpdateAssetsDto' is set + if (bulkUpdateAssetsDto == null) { + throw new ApiException("Missing the required parameter 'bulkUpdateAssetsDto' when calling (Async)"); + } + + return bulkUpdateAssetsCall(bulkUpdateAssetsDto, _callback); + + } + + + private ApiResponse> bulkUpdateAssetsWithHttpInfo(BulkUpdateAssetsDto bulkUpdateAssetsDto) throws ApiException { + okhttp3.Call localVarCall = bulkUpdateAssetsValidateBeforeCall(bulkUpdateAssetsDto, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call bulkUpdateAssetsAsync(BulkUpdateAssetsDto bulkUpdateAssetsDto, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = bulkUpdateAssetsValidateBeforeCall(bulkUpdateAssetsDto, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsBulkUpdateAssetsRequest { + private final BulkUpdateAssetsDto bulkUpdateAssetsDto; + + private APIassetsBulkUpdateAssetsRequest(BulkUpdateAssetsDto bulkUpdateAssetsDto) { + this.bulkUpdateAssetsDto = bulkUpdateAssetsDto; + } + + /** + * Build call for bulkUpdateAssets + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Assets created, update or delete. -
400 Assets request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return bulkUpdateAssetsCall(bulkUpdateAssetsDto, _callback); + } + + /** + * Execute bulkUpdateAssets request + * @return List<BulkResultDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Assets created, update or delete. -
400 Assets request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = bulkUpdateAssetsWithHttpInfo(bulkUpdateAssetsDto); + return localVarResp.getData(); + } + + /** + * Execute bulkUpdateAssets request with HTTP info returned + * @return ApiResponse<List<BulkResultDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Assets created, update or delete. -
400 Assets request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return bulkUpdateAssetsWithHttpInfo(bulkUpdateAssetsDto); + } + + /** + * Execute bulkUpdateAssets request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Assets created, update or delete. -
400 Assets request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return bulkUpdateAssetsAsync(bulkUpdateAssetsDto, _callback); + } + } + + /** + * Bulk update assets. + * + * @param bulkUpdateAssetsDto The bulk update request. (required) + * @return APIassetsBulkUpdateAssetsRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Assets created, update or delete. -
400 Assets request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIassetsBulkUpdateAssetsRequest bulkUpdateAssets(BulkUpdateAssetsDto bulkUpdateAssetsDto) { + return new APIassetsBulkUpdateAssetsRequest(bulkUpdateAssetsDto); + } + private okhttp3.Call deleteAssetCall(String id, Boolean checkReferrers, Boolean permanent, 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 = "/api/apps/$app$/assets/{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(); + + if (checkReferrers != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("checkReferrers", checkReferrers)); + } + + if (permanent != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("permanent", permanent)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteAssetValidateBeforeCall(String id, Boolean checkReferrers, Boolean permanent, 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 (Async)"); + } + + return deleteAssetCall(id, checkReferrers, permanent, _callback); + + } + + + private ApiResponse deleteAssetWithHttpInfo(String id, Boolean checkReferrers, Boolean permanent) throws ApiException { + okhttp3.Call localVarCall = deleteAssetValidateBeforeCall(id, checkReferrers, permanent, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteAssetAsync(String id, Boolean checkReferrers, Boolean permanent, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteAssetValidateBeforeCall(id, checkReferrers, permanent, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIassetsDeleteAssetRequest { + private final String id; + private Boolean checkReferrers; + private Boolean permanent; + + private APIassetsDeleteAssetRequest(String id) { + this.id = id; + } + + /** + * Set checkReferrers + * @param checkReferrers True to check referrers of this asset. (optional) + * @return APIassetsDeleteAssetRequest + */ + public APIassetsDeleteAssetRequest checkReferrers(Boolean checkReferrers) { + this.checkReferrers = checkReferrers; + return this; + } + + /** + * Set permanent + * @param permanent True to delete the asset permanently. (optional) + * @return APIassetsDeleteAssetRequest + */ + public APIassetsDeleteAssetRequest permanent(Boolean permanent) { + this.permanent = permanent; + return this; + } + + /** + * Build call for deleteAsset + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Asset deleted. -
404 Asset or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteAssetCall(id, checkReferrers, permanent, _callback); + } + + /** + * Execute deleteAsset request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Asset deleted. -
404 Asset or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteAssetWithHttpInfo(id, checkReferrers, permanent); + } + + /** + * Execute deleteAsset request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Asset deleted. -
404 Asset or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteAssetWithHttpInfo(id, checkReferrers, permanent); + } + + /** + * Execute deleteAsset request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Asset deleted. -
404 Asset or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteAssetAsync(id, checkReferrers, permanent, _callback); + } + } + + /** + * Delete an asset. + * + * @param id The ID of the asset to delete. (required) + * @return APIassetsDeleteAssetRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Asset deleted. -
404 Asset or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIassetsDeleteAssetRequest deleteAsset(String id) { + return new APIassetsDeleteAssetRequest(id); + } + private okhttp3.Call getAssetCall(String 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 = "/api/apps/$app$/assets/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAssetValidateBeforeCall(String 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 (Async)"); + } + + return getAssetCall(id, _callback); + + } + + + private ApiResponse getAssetWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getAssetValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAssetAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAssetValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsGetAssetRequest { + private final String id; + + private APIassetsGetAssetRequest(String id) { + this.id = id; + } + + /** + * Build call for getAsset + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAssetCall(id, _callback); + } + + /** + * Execute getAsset request + * @return AssetDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public AssetDto execute() throws ApiException { + ApiResponse localVarResp = getAssetWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute getAsset request with HTTP info returned + * @return ApiResponse<AssetDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAssetWithHttpInfo(id); + } + + /** + * Execute getAsset request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Asset found. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAssetAsync(id, _callback); + } + } + + /** + * Get an asset by id. + * + * @param id The ID of the asset to retrieve. (required) + * @return APIassetsGetAssetRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Asset found. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public APIassetsGetAssetRequest getAsset(String id) { + return new APIassetsGetAssetRequest(id); + } + private okhttp3.Call getAssetsCall(String parentId, String ids, String q, BigDecimal $top, BigDecimal $skip, String $orderby, String $filter, Boolean noTotal, Boolean noSlowTotal, 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 = "/api/apps/$app$/assets"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (parentId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("parentId", parentId)); + } + + if (ids != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("ids", ids)); + } + + if (q != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("q", q)); + } + + if ($top != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("$top", $top)); + } + + if ($skip != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("$skip", $skip)); + } + + if ($orderby != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("$orderby", $orderby)); + } + + if ($filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("$filter", $filter)); + } + + if (noTotal != null) { + localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + } + + if (noSlowTotal != null) { + localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAssetsValidateBeforeCall(String parentId, String ids, String q, BigDecimal $top, BigDecimal $skip, String $orderby, String $filter, Boolean noTotal, Boolean noSlowTotal, final ApiCallback _callback) throws ApiException { + return getAssetsCall(parentId, ids, q, $top, $skip, $orderby, $filter, noTotal, noSlowTotal, _callback); + + } + + + private ApiResponse getAssetsWithHttpInfo(String parentId, String ids, String q, BigDecimal $top, BigDecimal $skip, String $orderby, String $filter, Boolean noTotal, Boolean noSlowTotal) throws ApiException { + okhttp3.Call localVarCall = getAssetsValidateBeforeCall(parentId, ids, q, $top, $skip, $orderby, $filter, noTotal, noSlowTotal, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAssetsAsync(String parentId, String ids, String q, BigDecimal $top, BigDecimal $skip, String $orderby, String $filter, Boolean noTotal, Boolean noSlowTotal, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAssetsValidateBeforeCall(parentId, ids, q, $top, $skip, $orderby, $filter, noTotal, noSlowTotal, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsGetAssetsRequest { + private String parentId; + private String ids; + private String q; + private BigDecimal $top; + private BigDecimal $skip; + private String $orderby; + private String $filter; + private Boolean noTotal; + private Boolean noSlowTotal; + + private APIassetsGetAssetsRequest() { + } + + /** + * Set parentId + * @param parentId The optional parent folder id. (optional) + * @return APIassetsGetAssetsRequest + */ + public APIassetsGetAssetsRequest parentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * Set ids + * @param ids The optional asset ids. (optional) + * @return APIassetsGetAssetsRequest + */ + public APIassetsGetAssetsRequest ids(String ids) { + this.ids = ids; + return this; + } + + /** + * Set q + * @param q The optional json query. (optional) + * @return APIassetsGetAssetsRequest + */ + public APIassetsGetAssetsRequest q(String q) { + this.q = q; + return this; + } + + /** + * Set $top + * @param $top Optional number of items to take. (optional) + * @return APIassetsGetAssetsRequest + */ + public APIassetsGetAssetsRequest $top(BigDecimal $top) { + this.$top = $top; + return this; + } + + /** + * Set $skip + * @param $skip Optional number of items to skip. (optional) + * @return APIassetsGetAssetsRequest + */ + public APIassetsGetAssetsRequest $skip(BigDecimal $skip) { + this.$skip = $skip; + return this; + } + + /** + * Set $orderby + * @param $orderby Optional OData order definition. (optional) + * @return APIassetsGetAssetsRequest + */ + public APIassetsGetAssetsRequest $orderby(String $orderby) { + this.$orderby = $orderby; + return this; + } + + /** + * Set $filter + * @param $filter Optional OData filter. (optional) + * @return APIassetsGetAssetsRequest + */ + public APIassetsGetAssetsRequest $filter(String $filter) { + this.$filter = $filter; + return this; + } + + /** + * Set noTotal + * @param noTotal Do not return the total amount. (optional) + * @return APIassetsGetAssetsRequest + */ + public APIassetsGetAssetsRequest noTotal(Boolean noTotal) { + this.noTotal = noTotal; + return this; + } + + /** + * Set noSlowTotal + * @param noSlowTotal Do not return the total amount, if it would be slow. (optional) + * @return APIassetsGetAssetsRequest + */ + public APIassetsGetAssetsRequest noSlowTotal(Boolean noSlowTotal) { + this.noSlowTotal = noSlowTotal; + return this; + } + + /** + * Build call for getAssets + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Assets returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAssetsCall(parentId, ids, q, $top, $skip, $orderby, $filter, noTotal, noSlowTotal, _callback); + } + + /** + * Execute getAssets request + * @return AssetsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Assets returned. -
404 App not found. -
500 Operation failed. -
+ */ + public AssetsDto execute() throws ApiException { + ApiResponse localVarResp = getAssetsWithHttpInfo(parentId, ids, q, $top, $skip, $orderby, $filter, noTotal, noSlowTotal); + return localVarResp.getData(); + } + + /** + * Execute getAssets request with HTTP info returned + * @return ApiResponse<AssetsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Assets returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAssetsWithHttpInfo(parentId, ids, q, $top, $skip, $orderby, $filter, noTotal, noSlowTotal); + } + + /** + * Execute getAssets request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Assets returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAssetsAsync(parentId, ids, q, $top, $skip, $orderby, $filter, noTotal, noSlowTotal, _callback); + } + } + + /** + * Get assets. + * Get all assets for the app. + * @return APIassetsGetAssetsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Assets returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIassetsGetAssetsRequest getAssets() { + return new APIassetsGetAssetsRequest(); + } + private okhttp3.Call getAssetsPostCall(QueryDto queryDto, Boolean noTotal, Boolean noSlowTotal, 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 = queryDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/assets/query"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (noTotal != null) { + localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + } + + if (noSlowTotal != null) { + localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAssetsPostValidateBeforeCall(QueryDto queryDto, Boolean noTotal, Boolean noSlowTotal, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'queryDto' is set + if (queryDto == null) { + throw new ApiException("Missing the required parameter 'queryDto' when calling (Async)"); + } + + return getAssetsPostCall(queryDto, noTotal, noSlowTotal, _callback); + + } + + + private ApiResponse getAssetsPostWithHttpInfo(QueryDto queryDto, Boolean noTotal, Boolean noSlowTotal) throws ApiException { + okhttp3.Call localVarCall = getAssetsPostValidateBeforeCall(queryDto, noTotal, noSlowTotal, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAssetsPostAsync(QueryDto queryDto, Boolean noTotal, Boolean noSlowTotal, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAssetsPostValidateBeforeCall(queryDto, noTotal, noSlowTotal, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsGetAssetsPostRequest { + private final QueryDto queryDto; + private Boolean noTotal; + private Boolean noSlowTotal; + + private APIassetsGetAssetsPostRequest(QueryDto queryDto) { + this.queryDto = queryDto; + } + + /** + * Set noTotal + * @param noTotal Do not return the total amount. (optional) + * @return APIassetsGetAssetsPostRequest + */ + public APIassetsGetAssetsPostRequest noTotal(Boolean noTotal) { + this.noTotal = noTotal; + return this; + } + + /** + * Set noSlowTotal + * @param noSlowTotal Do not return the total amount, if it would be slow. (optional) + * @return APIassetsGetAssetsPostRequest + */ + public APIassetsGetAssetsPostRequest noSlowTotal(Boolean noSlowTotal) { + this.noSlowTotal = noSlowTotal; + return this; + } + + /** + * Build call for getAssetsPost + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Assets returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAssetsPostCall(queryDto, noTotal, noSlowTotal, _callback); + } + + /** + * Execute getAssetsPost request + * @return AssetsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Assets returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public AssetsDto execute() throws ApiException { + ApiResponse localVarResp = getAssetsPostWithHttpInfo(queryDto, noTotal, noSlowTotal); + return localVarResp.getData(); + } + + /** + * Execute getAssetsPost request with HTTP info returned + * @return ApiResponse<AssetsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Assets returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAssetsPostWithHttpInfo(queryDto, noTotal, noSlowTotal); + } + + /** + * Execute getAssetsPost request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Assets returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAssetsPostAsync(queryDto, noTotal, noSlowTotal, _callback); + } + } + + /** + * Get assets. + * Get all assets for the app. + * @param queryDto The required query object. (required) + * @return APIassetsGetAssetsPostRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Assets returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIassetsGetAssetsPostRequest getAssetsPost(QueryDto queryDto) { + return new APIassetsGetAssetsPostRequest(queryDto); + } + private okhttp3.Call getTagsCall(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 = "/api/apps/$app$/assets/tags"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTagsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getTagsCall(_callback); + + } + + + private ApiResponse> getTagsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getTagsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getTagsAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getTagsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsGetTagsRequest { + + private APIassetsGetTagsRequest() { + } + + /** + * Build call for getTags + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Assets tags returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getTagsCall(_callback); + } + + /** + * Execute getTags request + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Assets tags returned. -
404 App not found. -
500 Operation failed. -
+ */ + public Map execute() throws ApiException { + ApiResponse> localVarResp = getTagsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getTags request with HTTP info returned + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Assets tags returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getTagsWithHttpInfo(); + } + + /** + * Execute getTags request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Assets tags returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getTagsAsync(_callback); + } + } + + /** + * Get assets tags. + * Get all tags for assets. + * @return APIassetsGetTagsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Assets tags returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIassetsGetTagsRequest getTags() { + return new APIassetsGetTagsRequest(); + } + private okhttp3.Call postAssetCall(String parentId, String id, Boolean duplicate, File file, String url, String name, 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 = "/api/apps/$app$/assets"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (file != null) { + localVarFormParams.put("file", file); + } + + if (url != null) { + localVarFormParams.put("url", url); + } + + if (name != null) { + localVarFormParams.put("name", name); + } + + if (parentId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("ParentId", parentId)); + } + + if (id != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("id", id)); + } + + if (duplicate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("duplicate", duplicate)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postAssetValidateBeforeCall(String parentId, String id, Boolean duplicate, File file, String url, String name, final ApiCallback _callback) throws ApiException { + return postAssetCall(parentId, id, duplicate, file, url, name, _callback); + + } + + + private ApiResponse postAssetWithHttpInfo(String parentId, String id, Boolean duplicate, File file, String url, String name) throws ApiException { + okhttp3.Call localVarCall = postAssetValidateBeforeCall(parentId, id, duplicate, file, url, name, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postAssetAsync(String parentId, String id, Boolean duplicate, File file, String url, String name, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postAssetValidateBeforeCall(parentId, id, duplicate, file, url, name, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsPostAssetRequest { + private String parentId; + private String id; + private Boolean duplicate; + private File file; + private String url; + private String name; + + private APIassetsPostAssetRequest() { + } + + /** + * Set parentId + * @param parentId The optional parent folder id. (optional) + * @return APIassetsPostAssetRequest + */ + public APIassetsPostAssetRequest parentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * Set id + * @param id The optional custom asset id. (optional) + * @return APIassetsPostAssetRequest + */ + public APIassetsPostAssetRequest id(String id) { + this.id = id; + return this; + } + + /** + * Set duplicate + * @param duplicate True to duplicate the asset, event if the file has been uploaded. (optional) + * @return APIassetsPostAssetRequest + */ + public APIassetsPostAssetRequest duplicate(Boolean duplicate) { + this.duplicate = duplicate; + return this; + } + + /** + * Set file + * @param file (optional) + * @return APIassetsPostAssetRequest + */ + public APIassetsPostAssetRequest file(File file) { + this.file = file; + return this; + } + + /** + * Set url + * @param url (optional) + * @return APIassetsPostAssetRequest + */ + public APIassetsPostAssetRequest url(String url) { + this.url = url; + return this; + } + + /** + * Set name + * @param name (optional) + * @return APIassetsPostAssetRequest + */ + public APIassetsPostAssetRequest name(String name) { + this.name = name; + return this; + } + + /** + * Build call for postAsset + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Asset created. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postAssetCall(parentId, id, duplicate, file, url, name, _callback); + } + + /** + * Execute postAsset request + * @return AssetDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Asset created. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 App not found. -
500 Operation failed. -
+ */ + public AssetDto execute() throws ApiException { + ApiResponse localVarResp = postAssetWithHttpInfo(parentId, id, duplicate, file, url, name); + return localVarResp.getData(); + } + + /** + * Execute postAsset request with HTTP info returned + * @return ApiResponse<AssetDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Asset created. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postAssetWithHttpInfo(parentId, id, duplicate, file, url, name); + } + + /** + * Execute postAsset request (asynchronously) + * @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 + + + + + + + +
Status Code Description Response Headers
201 Asset created. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postAssetAsync(parentId, id, duplicate, file, url, name, _callback); + } + } + + /** + * Upload a new asset. + * You can only upload one file at a time. The mime type of the file is not calculated by Squidex and is required correctly. + * @return APIassetsPostAssetRequest + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Asset created. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 App not found. -
500 Operation failed. -
+ */ + public APIassetsPostAssetRequest postAsset() { + return new APIassetsPostAssetRequest(); + } + private okhttp3.Call postUpsertAssetCall(String id, String parentId, Boolean duplicate, File file, String url, String name, 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 = "/api/apps/$app$/assets/{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(); + + if (file != null) { + localVarFormParams.put("file", file); + } + + if (url != null) { + localVarFormParams.put("url", url); + } + + if (name != null) { + localVarFormParams.put("name", name); + } + + if (parentId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("parentId", parentId)); + } + + if (duplicate != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("duplicate", duplicate)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postUpsertAssetValidateBeforeCall(String id, String parentId, Boolean duplicate, File file, String url, String name, 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 (Async)"); + } + + return postUpsertAssetCall(id, parentId, duplicate, file, url, name, _callback); + + } + + + private ApiResponse postUpsertAssetWithHttpInfo(String id, String parentId, Boolean duplicate, File file, String url, String name) throws ApiException { + okhttp3.Call localVarCall = postUpsertAssetValidateBeforeCall(id, parentId, duplicate, file, url, name, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postUpsertAssetAsync(String id, String parentId, Boolean duplicate, File file, String url, String name, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postUpsertAssetValidateBeforeCall(id, parentId, duplicate, file, url, name, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsPostUpsertAssetRequest { + private final String id; + private String parentId; + private Boolean duplicate; + private File file; + private String url; + private String name; + + private APIassetsPostUpsertAssetRequest(String id) { + this.id = id; + } + + /** + * Set parentId + * @param parentId The optional parent folder id. (optional) + * @return APIassetsPostUpsertAssetRequest + */ + public APIassetsPostUpsertAssetRequest parentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * Set duplicate + * @param duplicate True to duplicate the asset, event if the file has been uploaded. (optional) + * @return APIassetsPostUpsertAssetRequest + */ + public APIassetsPostUpsertAssetRequest duplicate(Boolean duplicate) { + this.duplicate = duplicate; + return this; + } + + /** + * Set file + * @param file (optional) + * @return APIassetsPostUpsertAssetRequest + */ + public APIassetsPostUpsertAssetRequest file(File file) { + this.file = file; + return this; + } + + /** + * Set url + * @param url (optional) + * @return APIassetsPostUpsertAssetRequest + */ + public APIassetsPostUpsertAssetRequest url(String url) { + this.url = url; + return this; + } + + /** + * Set name + * @param name (optional) + * @return APIassetsPostUpsertAssetRequest + */ + public APIassetsPostUpsertAssetRequest name(String name) { + this.name = name; + return this; + } + + /** + * Build call for postUpsertAsset + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Asset created or updated. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postUpsertAssetCall(id, parentId, duplicate, file, url, name, _callback); + } + + /** + * Execute postUpsertAsset request + * @return AssetDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Asset created or updated. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 App not found. -
500 Operation failed. -
+ */ + public AssetDto execute() throws ApiException { + ApiResponse localVarResp = postUpsertAssetWithHttpInfo(id, parentId, duplicate, file, url, name); + return localVarResp.getData(); + } + + /** + * Execute postUpsertAsset request with HTTP info returned + * @return ApiResponse<AssetDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Asset created or updated. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postUpsertAssetWithHttpInfo(id, parentId, duplicate, file, url, name); + } + + /** + * Execute postUpsertAsset request (asynchronously) + * @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 + + + + + + + +
Status Code Description Response Headers
200 Asset created or updated. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postUpsertAssetAsync(id, parentId, duplicate, file, url, name, _callback); + } + } + + /** + * Upsert an asset. + * You can only upload one file at a time. The mime type of the file is not calculated by Squidex and is required correctly. + * @param id The optional custom asset id. (required) + * @return APIassetsPostUpsertAssetRequest + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Asset created or updated. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 App not found. -
500 Operation failed. -
+ */ + public APIassetsPostUpsertAssetRequest postUpsertAsset(String id) { + return new APIassetsPostUpsertAssetRequest(id); + } + private okhttp3.Call putAssetCall(String id, AnnotateAssetDto annotateAssetDto, 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 = annotateAssetDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/assets/{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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putAssetValidateBeforeCall(String id, AnnotateAssetDto annotateAssetDto, 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 (Async)"); + } + + // verify the required parameter 'annotateAssetDto' is set + if (annotateAssetDto == null) { + throw new ApiException("Missing the required parameter 'annotateAssetDto' when calling (Async)"); + } + + return putAssetCall(id, annotateAssetDto, _callback); + + } + + + private ApiResponse putAssetWithHttpInfo(String id, AnnotateAssetDto annotateAssetDto) throws ApiException { + okhttp3.Call localVarCall = putAssetValidateBeforeCall(id, annotateAssetDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putAssetAsync(String id, AnnotateAssetDto annotateAssetDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putAssetValidateBeforeCall(id, annotateAssetDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsPutAssetRequest { + private final String id; + private final AnnotateAssetDto annotateAssetDto; + + private APIassetsPutAssetRequest(String id, AnnotateAssetDto annotateAssetDto) { + this.id = id; + this.annotateAssetDto = annotateAssetDto; + } + + /** + * Build call for putAsset + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset updated. -
400 Asset request not valid. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putAssetCall(id, annotateAssetDto, _callback); + } + + /** + * Execute putAsset request + * @return AssetDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset updated. -
400 Asset request not valid. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public AssetDto execute() throws ApiException { + ApiResponse localVarResp = putAssetWithHttpInfo(id, annotateAssetDto); + return localVarResp.getData(); + } + + /** + * Execute putAsset request with HTTP info returned + * @return ApiResponse<AssetDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset updated. -
400 Asset request not valid. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putAssetWithHttpInfo(id, annotateAssetDto); + } + + /** + * Execute putAsset request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Asset updated. -
400 Asset request not valid. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putAssetAsync(id, annotateAssetDto, _callback); + } + } + + /** + * Update an asset. + * + * @param id The ID of the asset. (required) + * @param annotateAssetDto The asset object that needs to updated. (required) + * @return APIassetsPutAssetRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset updated. -
400 Asset request not valid. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public APIassetsPutAssetRequest putAsset(String id, AnnotateAssetDto annotateAssetDto) { + return new APIassetsPutAssetRequest(id, annotateAssetDto); + } + private okhttp3.Call putAssetContentCall(String id, File file, String url, String name, 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 = "/api/apps/$app$/assets/{id}/content" + .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 (file != null) { + localVarFormParams.put("file", file); + } + + if (url != null) { + localVarFormParams.put("url", url); + } + + if (name != null) { + localVarFormParams.put("name", name); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "multipart/form-data" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putAssetContentValidateBeforeCall(String id, File file, String url, String name, 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 (Async)"); + } + + return putAssetContentCall(id, file, url, name, _callback); + + } + + + private ApiResponse putAssetContentWithHttpInfo(String id, File file, String url, String name) throws ApiException { + okhttp3.Call localVarCall = putAssetContentValidateBeforeCall(id, file, url, name, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putAssetContentAsync(String id, File file, String url, String name, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putAssetContentValidateBeforeCall(id, file, url, name, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsPutAssetContentRequest { + private final String id; + private File file; + private String url; + private String name; + + private APIassetsPutAssetContentRequest(String id) { + this.id = id; + } + + /** + * Set file + * @param file (optional) + * @return APIassetsPutAssetContentRequest + */ + public APIassetsPutAssetContentRequest file(File file) { + this.file = file; + return this; + } + + /** + * Set url + * @param url (optional) + * @return APIassetsPutAssetContentRequest + */ + public APIassetsPutAssetContentRequest url(String url) { + this.url = url; + return this; + } + + /** + * Set name + * @param name (optional) + * @return APIassetsPutAssetContentRequest + */ + public APIassetsPutAssetContentRequest name(String name) { + this.name = name; + return this; + } + + /** + * Build call for putAssetContent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Asset updated. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putAssetContentCall(id, file, url, name, _callback); + } + + /** + * Execute putAssetContent request + * @return AssetDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Asset updated. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public AssetDto execute() throws ApiException { + ApiResponse localVarResp = putAssetContentWithHttpInfo(id, file, url, name); + return localVarResp.getData(); + } + + /** + * Execute putAssetContent request with HTTP info returned + * @return ApiResponse<AssetDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Asset updated. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putAssetContentWithHttpInfo(id, file, url, name); + } + + /** + * Execute putAssetContent request (asynchronously) + * @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 + + + + + + + +
Status Code Description Response Headers
200 Asset updated. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putAssetContentAsync(id, file, url, name, _callback); + } + } + + /** + * Replace asset content. + * Use multipart request to upload an asset. + * @param id The ID of the asset. (required) + * @return APIassetsPutAssetContentRequest + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 Asset updated. -
400 Asset request not valid. -
413 Asset exceeds the maximum upload size. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public APIassetsPutAssetContentRequest putAssetContent(String id) { + return new APIassetsPutAssetContentRequest(id); + } + private okhttp3.Call putAssetParentCall(String id, MoveAssetDto moveAssetDto, 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 = moveAssetDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/assets/{id}/parent" + .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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putAssetParentValidateBeforeCall(String id, MoveAssetDto moveAssetDto, 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 (Async)"); + } + + // verify the required parameter 'moveAssetDto' is set + if (moveAssetDto == null) { + throw new ApiException("Missing the required parameter 'moveAssetDto' when calling (Async)"); + } + + return putAssetParentCall(id, moveAssetDto, _callback); + + } + + + private ApiResponse putAssetParentWithHttpInfo(String id, MoveAssetDto moveAssetDto) throws ApiException { + okhttp3.Call localVarCall = putAssetParentValidateBeforeCall(id, moveAssetDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putAssetParentAsync(String id, MoveAssetDto moveAssetDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putAssetParentValidateBeforeCall(id, moveAssetDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsPutAssetParentRequest { + private final String id; + private final MoveAssetDto moveAssetDto; + + private APIassetsPutAssetParentRequest(String id, MoveAssetDto moveAssetDto) { + this.id = id; + this.moveAssetDto = moveAssetDto; + } + + /** + * Build call for putAssetParent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset moved. -
400 Asset request not valid. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putAssetParentCall(id, moveAssetDto, _callback); + } + + /** + * Execute putAssetParent request + * @return AssetDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset moved. -
400 Asset request not valid. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public AssetDto execute() throws ApiException { + ApiResponse localVarResp = putAssetParentWithHttpInfo(id, moveAssetDto); + return localVarResp.getData(); + } + + /** + * Execute putAssetParent request with HTTP info returned + * @return ApiResponse<AssetDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset moved. -
400 Asset request not valid. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putAssetParentWithHttpInfo(id, moveAssetDto); + } + + /** + * Execute putAssetParent request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Asset moved. -
400 Asset request not valid. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putAssetParentAsync(id, moveAssetDto, _callback); + } + } + + /** + * Moves the asset. + * + * @param id The ID of the asset. (required) + * @param moveAssetDto The asset object that needs to updated. (required) + * @return APIassetsPutAssetParentRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset moved. -
400 Asset request not valid. -
404 Asset or app not found. -
500 Operation failed. -
+ */ + public APIassetsPutAssetParentRequest putAssetParent(String id, MoveAssetDto moveAssetDto) { + return new APIassetsPutAssetParentRequest(id, moveAssetDto); + } + private okhttp3.Call putTagCall(String name, RenameTagDto renameTagDto, 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 = renameTagDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/assets/tags/{name}" + .replace("{" + "name" + "}", localVarApiClient.escapeString(name.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putTagValidateBeforeCall(String name, RenameTagDto renameTagDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling (Async)"); + } + + // verify the required parameter 'renameTagDto' is set + if (renameTagDto == null) { + throw new ApiException("Missing the required parameter 'renameTagDto' when calling (Async)"); + } + + return putTagCall(name, renameTagDto, _callback); + + } + + + private ApiResponse> putTagWithHttpInfo(String name, RenameTagDto renameTagDto) throws ApiException { + okhttp3.Call localVarCall = putTagValidateBeforeCall(name, renameTagDto, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putTagAsync(String name, RenameTagDto renameTagDto, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = putTagValidateBeforeCall(name, renameTagDto, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIassetsPutTagRequest { + private final String name; + private final RenameTagDto renameTagDto; + + private APIassetsPutTagRequest(String name, RenameTagDto renameTagDto) { + this.name = name; + this.renameTagDto = renameTagDto; + } + + /** + * Build call for putTag + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset tag renamed and new tags returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putTagCall(name, renameTagDto, _callback); + } + + /** + * Execute putTag request + * @return Map<String, Integer> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset tag renamed and new tags returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public Map execute() throws ApiException { + ApiResponse> localVarResp = putTagWithHttpInfo(name, renameTagDto); + return localVarResp.getData(); + } + + /** + * Execute putTag request with HTTP info returned + * @return ApiResponse<Map<String, Integer>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset tag renamed and new tags returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return putTagWithHttpInfo(name, renameTagDto); + } + + /** + * Execute putTag request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Asset tag renamed and new tags returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return putTagAsync(name, renameTagDto, _callback); + } + } + + /** + * Rename an asset tag. + * + * @param name The tag to return. (required) + * @param renameTagDto The required request object. (required) + * @return APIassetsPutTagRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Asset tag renamed and new tags returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIassetsPutTagRequest putTag(String name, RenameTagDto renameTagDto) { + return new APIassetsPutTagRequest(name, renameTagDto); + } +} diff --git a/src/main/java/com/squidex/api/core/api/BackupsApi.java b/src/main/java/com/squidex/api/core/api/BackupsApi.java new file mode 100644 index 0000000..22fb90a --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/BackupsApi.java @@ -0,0 +1,1257 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.BackupJobsDto; +import com.squidex.api.types.ErrorDto; +import java.io.File; +import com.squidex.api.types.RestoreJobDto; +import com.squidex.api.types.RestoreRequestDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class BackupsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public BackupsApi() { + this(Configuration.getDefaultApiClient()); + } + + public BackupsApi(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; + } + + private okhttp3.Call getBackupContentCall(String 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 = "/api/apps/$app$/backups/{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/octet-stream", + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getBackupContentValidateBeforeCall(String 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 (Async)"); + } + + return getBackupContentCall(id, _callback); + + } + + + private ApiResponse getBackupContentWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getBackupContentValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getBackupContentAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getBackupContentValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIbackupContentGetBackupContentRequest { + private final String id; + + private APIbackupContentGetBackupContentRequest(String id) { + this.id = id; + } + + /** + * Build call for getBackupContent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backup found and content returned. -
404 Backup or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getBackupContentCall(id, _callback); + } + + /** + * Execute getBackupContent request + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backup found and content returned. -
404 Backup or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public File execute() throws ApiException { + ApiResponse localVarResp = getBackupContentWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute getBackupContent request with HTTP info returned + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backup found and content returned. -
404 Backup or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public ApiResponse executeWithHttpInfo() throws ApiException { + return getBackupContentWithHttpInfo(id); + } + + /** + * Execute getBackupContent request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Backup found and content returned. -
404 Backup or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getBackupContentAsync(id, _callback); + } + } + + /** + * Get the backup content. + * + * @param id The ID of the backup. (required) + * @return APIbackupContentGetBackupContentRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backup found and content returned. -
404 Backup or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public APIbackupContentGetBackupContentRequest getBackupContent(String id) { + return new APIbackupContentGetBackupContentRequest(id); + } + private okhttp3.Call getBackupContentV2Call(String id, String appId, String app, 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 = "/api/apps/backups/{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(); + + if (appId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("appId", appId)); + } + + if (app != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("app", app)); + } + + final String[] localVarAccepts = { + "application/octet-stream", + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getBackupContentV2ValidateBeforeCall(String id, String appId, String app, 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 (Async)"); + } + + return getBackupContentV2Call(id, appId, app, _callback); + + } + + + private ApiResponse getBackupContentV2WithHttpInfo(String id, String appId, String app) throws ApiException { + okhttp3.Call localVarCall = getBackupContentV2ValidateBeforeCall(id, appId, app, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getBackupContentV2Async(String id, String appId, String app, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getBackupContentV2ValidateBeforeCall(id, appId, app, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIbackupContentGetBackupContentV2Request { + private final String id; + private String appId; + private String app; + + private APIbackupContentGetBackupContentV2Request(String id) { + this.id = id; + } + + /** + * Set appId + * @param appId The ID of the app. (optional) + * @return APIbackupContentGetBackupContentV2Request + */ + public APIbackupContentGetBackupContentV2Request appId(String appId) { + this.appId = appId; + return this; + } + + /** + * Set app + * @param app The name of the app. (optional, default to ) + * @return APIbackupContentGetBackupContentV2Request + */ + public APIbackupContentGetBackupContentV2Request app(String app) { + this.app = app; + return this; + } + + /** + * Build call for getBackupContentV2 + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backup found and content returned. -
404 Backup or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getBackupContentV2Call(id, appId, app, _callback); + } + + /** + * Execute getBackupContentV2 request + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backup found and content returned. -
404 Backup or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public File execute() throws ApiException { + ApiResponse localVarResp = getBackupContentV2WithHttpInfo(id, appId, app); + return localVarResp.getData(); + } + + /** + * Execute getBackupContentV2 request with HTTP info returned + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backup found and content returned. -
404 Backup or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public ApiResponse executeWithHttpInfo() throws ApiException { + return getBackupContentV2WithHttpInfo(id, appId, app); + } + + /** + * Execute getBackupContentV2 request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Backup found and content returned. -
404 Backup or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getBackupContentV2Async(id, appId, app, _callback); + } + } + + /** + * Get the backup content. + * + * @param id The ID of the backup. (required) + * @return APIbackupContentGetBackupContentV2Request + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backup found and content returned. -
404 Backup or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public APIbackupContentGetBackupContentV2Request getBackupContentV2(String id) { + return new APIbackupContentGetBackupContentV2Request(id); + } + private okhttp3.Call deleteBackupCall(String 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 = "/api/apps/$app$/backups/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteBackupValidateBeforeCall(String 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 (Async)"); + } + + return deleteBackupCall(id, _callback); + + } + + + private ApiResponse deleteBackupWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteBackupValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteBackupAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteBackupValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIbackupsDeleteBackupRequest { + private final String id; + + private APIbackupsDeleteBackupRequest(String id) { + this.id = id; + } + + /** + * Build call for deleteBackup + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Backup deleted. -
404 Backup or app not found. -
400 Validation error. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteBackupCall(id, _callback); + } + + /** + * Execute deleteBackup request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Backup deleted. -
404 Backup or app not found. -
400 Validation error. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public void execute() throws ApiException { + deleteBackupWithHttpInfo(id); + } + + /** + * Execute deleteBackup request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Backup deleted. -
404 Backup or app not found. -
400 Validation error. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteBackupWithHttpInfo(id); + } + + /** + * Execute deleteBackup request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Backup deleted. -
404 Backup or app not found. -
400 Validation error. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteBackupAsync(id, _callback); + } + } + + /** + * Delete a backup. + * + * @param id The ID of the backup to delete. (required) + * @return APIbackupsDeleteBackupRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Backup deleted. -
404 Backup or app not found. -
400 Validation error. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public APIbackupsDeleteBackupRequest deleteBackup(String id) { + return new APIbackupsDeleteBackupRequest(id); + } + private okhttp3.Call getBackupsCall(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 = "/api/apps/$app$/backups"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getBackupsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getBackupsCall(_callback); + + } + + + private ApiResponse getBackupsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getBackupsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getBackupsAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getBackupsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIbackupsGetBackupsRequest { + + private APIbackupsGetBackupsRequest() { + } + + /** + * Build call for getBackups + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backups returned. -
404 App not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getBackupsCall(_callback); + } + + /** + * Execute getBackups request + * @return BackupJobsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backups returned. -
404 App not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public BackupJobsDto execute() throws ApiException { + ApiResponse localVarResp = getBackupsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getBackups request with HTTP info returned + * @return ApiResponse<BackupJobsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backups returned. -
404 App not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public ApiResponse executeWithHttpInfo() throws ApiException { + return getBackupsWithHttpInfo(); + } + + /** + * Execute getBackups request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Backups returned. -
404 App not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getBackupsAsync(_callback); + } + } + + /** + * Get all backup jobs. + * + * @return APIbackupsGetBackupsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Backups returned. -
404 App not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public APIbackupsGetBackupsRequest getBackups() { + return new APIbackupsGetBackupsRequest(); + } + private okhttp3.Call postBackupCall(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 = "/api/apps/$app$/backups"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postBackupValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return postBackupCall(_callback); + + } + + + private ApiResponse postBackupWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = postBackupValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call postBackupAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postBackupValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIbackupsPostBackupRequest { + + private APIbackupsPostBackupRequest() { + } + + /** + * Build call for postBackup + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Backup started. -
400 Backup contingent reached. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postBackupCall(_callback); + } + + /** + * Execute postBackup request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Backup started. -
400 Backup contingent reached. -
404 App not found. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + postBackupWithHttpInfo(); + } + + /** + * Execute postBackup request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Backup started. -
400 Backup contingent reached. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postBackupWithHttpInfo(); + } + + /** + * Execute postBackup request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Backup started. -
400 Backup contingent reached. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postBackupAsync(_callback); + } + } + + /** + * Start a new backup. + * + * @return APIbackupsPostBackupRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Backup started. -
400 Backup contingent reached. -
404 App not found. -
500 Operation failed. -
+ */ + public APIbackupsPostBackupRequest postBackup() { + return new APIbackupsPostBackupRequest(); + } + private okhttp3.Call getRestoreJobCall(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 = "/api/apps/restore"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getRestoreJobValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getRestoreJobCall(_callback); + + } + + + private ApiResponse getRestoreJobWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getRestoreJobValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getRestoreJobAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getRestoreJobValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrestoreGetRestoreJobRequest { + + private APIrestoreGetRestoreJobRequest() { + } + + /** + * Build call for getRestoreJob + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Status returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getRestoreJobCall(_callback); + } + + /** + * Execute getRestoreJob request + * @return RestoreJobDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Status returned. -
500 Operation failed. -
+ */ + public RestoreJobDto execute() throws ApiException { + ApiResponse localVarResp = getRestoreJobWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getRestoreJob request with HTTP info returned + * @return ApiResponse<RestoreJobDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Status returned. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getRestoreJobWithHttpInfo(); + } + + /** + * Execute getRestoreJob request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Status returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getRestoreJobAsync(_callback); + } + } + + /** + * Get current restore status. + * + * @return APIrestoreGetRestoreJobRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Status returned. -
500 Operation failed. -
+ */ + public APIrestoreGetRestoreJobRequest getRestoreJob() { + return new APIrestoreGetRestoreJobRequest(); + } + private okhttp3.Call postRestoreJobCall(RestoreRequestDto restoreRequestDto, 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 = restoreRequestDto; + + // create path and map variables + String localVarPath = "/api/apps/restore"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postRestoreJobValidateBeforeCall(RestoreRequestDto restoreRequestDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'restoreRequestDto' is set + if (restoreRequestDto == null) { + throw new ApiException("Missing the required parameter 'restoreRequestDto' when calling (Async)"); + } + + return postRestoreJobCall(restoreRequestDto, _callback); + + } + + + private ApiResponse postRestoreJobWithHttpInfo(RestoreRequestDto restoreRequestDto) throws ApiException { + okhttp3.Call localVarCall = postRestoreJobValidateBeforeCall(restoreRequestDto, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call postRestoreJobAsync(RestoreRequestDto restoreRequestDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postRestoreJobValidateBeforeCall(restoreRequestDto, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIrestorePostRestoreJobRequest { + private final RestoreRequestDto restoreRequestDto; + + private APIrestorePostRestoreJobRequest(RestoreRequestDto restoreRequestDto) { + this.restoreRequestDto = restoreRequestDto; + } + + /** + * Build call for postRestoreJob + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Restore operation started. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postRestoreJobCall(restoreRequestDto, _callback); + } + + /** + * Execute postRestoreJob request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Restore operation started. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + postRestoreJobWithHttpInfo(restoreRequestDto); + } + + /** + * Execute postRestoreJob request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Restore operation started. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postRestoreJobWithHttpInfo(restoreRequestDto); + } + + /** + * Execute postRestoreJob request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
204 Restore operation started. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postRestoreJobAsync(restoreRequestDto, _callback); + } + } + + /** + * Restore a backup. + * + * @param restoreRequestDto The backup to restore. (required) + * @return APIrestorePostRestoreJobRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Restore operation started. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrestorePostRestoreJobRequest postRestoreJob(RestoreRequestDto restoreRequestDto) { + return new APIrestorePostRestoreJobRequest(restoreRequestDto); + } +} diff --git a/src/main/java/com/squidex/api/core/api/ContentsApi.java b/src/main/java/com/squidex/api/core/api/ContentsApi.java new file mode 100644 index 0000000..0ddfe5d --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/ContentsApi.java @@ -0,0 +1,6061 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.AllContentsByPostDto; +import java.math.BigDecimal; +import com.squidex.api.types.BulkResultDto; +import com.squidex.api.types.BulkUpdateContentsDto; +import com.squidex.api.types.ChangeStatusDto; +import com.squidex.api.types.ContentDto; +import com.squidex.api.types.ContentsDto; +import com.squidex.api.types.ErrorDto; +import java.io.File; +import com.squidex.api.types.ImportContentsDto; +import java.time.OffsetDateTime; +import com.squidex.api.types.QueryDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class ContentsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public ContentsApi() { + this(Configuration.getDefaultApiClient()); + } + + public ContentsApi(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; + } + + private okhttp3.Call bulkUpdateContentsCall(String schema, BulkUpdateContentsDto bulkUpdateContentsDto, 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 = bulkUpdateContentsDto; + + // create path and map variables + String localVarPath = "/api/content/$app$/{schema}/bulk" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call bulkUpdateContentsValidateBeforeCall(String schema, BulkUpdateContentsDto bulkUpdateContentsDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'bulkUpdateContentsDto' is set + if (bulkUpdateContentsDto == null) { + throw new ApiException("Missing the required parameter 'bulkUpdateContentsDto' when calling (Async)"); + } + + return bulkUpdateContentsCall(schema, bulkUpdateContentsDto, _callback); + + } + + + private ApiResponse> bulkUpdateContentsWithHttpInfo(String schema, BulkUpdateContentsDto bulkUpdateContentsDto) throws ApiException { + okhttp3.Call localVarCall = bulkUpdateContentsValidateBeforeCall(schema, bulkUpdateContentsDto, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call bulkUpdateContentsAsync(String schema, BulkUpdateContentsDto bulkUpdateContentsDto, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = bulkUpdateContentsValidateBeforeCall(schema, bulkUpdateContentsDto, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsBulkUpdateContentsRequest { + private final String schema; + private final BulkUpdateContentsDto bulkUpdateContentsDto; + + private APIcontentsBulkUpdateContentsRequest(String schema, BulkUpdateContentsDto bulkUpdateContentsDto) { + this.schema = schema; + this.bulkUpdateContentsDto = bulkUpdateContentsDto; + } + + /** + * Build call for bulkUpdateContents + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 -
400 Contents request not valid. -
404 Contents references, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return bulkUpdateContentsCall(schema, bulkUpdateContentsDto, _callback); + } + + /** + * Execute bulkUpdateContents request + * @return List<BulkResultDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 -
400 Contents request not valid. -
404 Contents references, schema or app not found. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = bulkUpdateContentsWithHttpInfo(schema, bulkUpdateContentsDto); + return localVarResp.getData(); + } + + /** + * Execute bulkUpdateContents request with HTTP info returned + * @return ApiResponse<List<BulkResultDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 -
400 Contents request not valid. -
404 Contents references, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return bulkUpdateContentsWithHttpInfo(schema, bulkUpdateContentsDto); + } + + /** + * Execute bulkUpdateContents request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 -
400 Contents request not valid. -
404 Contents references, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return bulkUpdateContentsAsync(schema, bulkUpdateContentsDto, _callback); + } + } + + /** + * Bulk update content items. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param bulkUpdateContentsDto The bulk update request. (required) + * @return APIcontentsBulkUpdateContentsRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 -
400 Contents request not valid. -
404 Contents references, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsBulkUpdateContentsRequest bulkUpdateContents(String schema, BulkUpdateContentsDto bulkUpdateContentsDto) { + return new APIcontentsBulkUpdateContentsRequest(schema, bulkUpdateContentsDto); + } + private okhttp3.Call createDraftCall(String schema, String id, Boolean unpublished, String languages, 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 = "/api/content/$app$/{schema}/{id}/draft" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call createDraftValidateBeforeCall(String schema, String id, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return createDraftCall(schema, id, unpublished, languages, _callback); + + } + + + private ApiResponse createDraftWithHttpInfo(String schema, String id, Boolean unpublished, String languages) throws ApiException { + okhttp3.Call localVarCall = createDraftValidateBeforeCall(schema, id, unpublished, languages, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call createDraftAsync(String schema, String id, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = createDraftValidateBeforeCall(schema, id, unpublished, languages, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsCreateDraftRequest { + private final String schema; + private final String id; + private Boolean unpublished; + private String languages; + + private APIcontentsCreateDraftRequest(String schema, String id) { + this.schema = schema; + this.id = id; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsCreateDraftRequest + */ + public APIcontentsCreateDraftRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsCreateDraftRequest + */ + public APIcontentsCreateDraftRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Build call for createDraft + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content draft created. -
404 Content, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return createDraftCall(schema, id, unpublished, languages, _callback); + } + + /** + * Execute createDraft request + * @return ContentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content draft created. -
404 Content, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ContentDto execute() throws ApiException { + ApiResponse localVarResp = createDraftWithHttpInfo(schema, id, unpublished, languages); + return localVarResp.getData(); + } + + /** + * Execute createDraft request with HTTP info returned + * @return ApiResponse<ContentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content draft created. -
404 Content, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return createDraftWithHttpInfo(schema, id, unpublished, languages); + } + + /** + * Execute createDraft request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Content draft created. -
404 Content, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return createDraftAsync(schema, id, unpublished, languages, _callback); + } + } + + /** + * Create a new draft version. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content item to create the draft for. (required) + * @return APIcontentsCreateDraftRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content draft created. -
404 Content, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIcontentsCreateDraftRequest createDraft(String schema, String id) { + return new APIcontentsCreateDraftRequest(schema, id); + } + private okhttp3.Call deleteContentCall(String schema, String id, Boolean checkReferrers, Boolean permanent, 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 = "/api/content/$app$/{schema}/{id}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (checkReferrers != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("checkReferrers", checkReferrers)); + } + + if (permanent != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("permanent", permanent)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteContentValidateBeforeCall(String schema, String id, Boolean checkReferrers, Boolean permanent, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return deleteContentCall(schema, id, checkReferrers, permanent, _callback); + + } + + + private ApiResponse deleteContentWithHttpInfo(String schema, String id, Boolean checkReferrers, Boolean permanent) throws ApiException { + okhttp3.Call localVarCall = deleteContentValidateBeforeCall(schema, id, checkReferrers, permanent, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteContentAsync(String schema, String id, Boolean checkReferrers, Boolean permanent, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteContentValidateBeforeCall(schema, id, checkReferrers, permanent, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIcontentsDeleteContentRequest { + private final String schema; + private final String id; + private Boolean checkReferrers; + private Boolean permanent; + + private APIcontentsDeleteContentRequest(String schema, String id) { + this.schema = schema; + this.id = id; + } + + /** + * Set checkReferrers + * @param checkReferrers True to check referrers of this content. (optional) + * @return APIcontentsDeleteContentRequest + */ + public APIcontentsDeleteContentRequest checkReferrers(Boolean checkReferrers) { + this.checkReferrers = checkReferrers; + return this; + } + + /** + * Set permanent + * @param permanent True to delete the content permanently. (optional) + * @return APIcontentsDeleteContentRequest + */ + public APIcontentsDeleteContentRequest permanent(Boolean permanent) { + this.permanent = permanent; + return this; + } + + /** + * Build call for deleteContent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Content deleted. -
400 Content cannot be deleted. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteContentCall(schema, id, checkReferrers, permanent, _callback); + } + + /** + * Execute deleteContent request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Content deleted. -
400 Content cannot be deleted. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteContentWithHttpInfo(schema, id, checkReferrers, permanent); + } + + /** + * Execute deleteContent request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Content deleted. -
400 Content cannot be deleted. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteContentWithHttpInfo(schema, id, checkReferrers, permanent); + } + + /** + * Execute deleteContent request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Content deleted. -
400 Content cannot be deleted. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteContentAsync(schema, id, checkReferrers, permanent, _callback); + } + } + + /** + * Delete a content item. + * You can create an generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content item to delete. (required) + * @return APIcontentsDeleteContentRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Content deleted. -
400 Content cannot be deleted. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsDeleteContentRequest deleteContent(String schema, String id) { + return new APIcontentsDeleteContentRequest(schema, id); + } + private okhttp3.Call deleteContentStatusCall(String schema, String id, Boolean unpublished, String languages, 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 = "/api/content/$app$/{schema}/{id}/status" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteContentStatusValidateBeforeCall(String schema, String id, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return deleteContentStatusCall(schema, id, unpublished, languages, _callback); + + } + + + private ApiResponse deleteContentStatusWithHttpInfo(String schema, String id, Boolean unpublished, String languages) throws ApiException { + okhttp3.Call localVarCall = deleteContentStatusValidateBeforeCall(schema, id, unpublished, languages, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteContentStatusAsync(String schema, String id, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteContentStatusValidateBeforeCall(schema, id, unpublished, languages, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsDeleteContentStatusRequest { + private final String schema; + private final String id; + private Boolean unpublished; + private String languages; + + private APIcontentsDeleteContentStatusRequest(String schema, String id) { + this.schema = schema; + this.id = id; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsDeleteContentStatusRequest + */ + public APIcontentsDeleteContentStatusRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsDeleteContentStatusRequest + */ + public APIcontentsDeleteContentStatusRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Build call for deleteContentStatus + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content status change cancelled. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteContentStatusCall(schema, id, unpublished, languages, _callback); + } + + /** + * Execute deleteContentStatus request + * @return ContentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content status change cancelled. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ContentDto execute() throws ApiException { + ApiResponse localVarResp = deleteContentStatusWithHttpInfo(schema, id, unpublished, languages); + return localVarResp.getData(); + } + + /** + * Execute deleteContentStatus request with HTTP info returned + * @return ApiResponse<ContentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content status change cancelled. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteContentStatusWithHttpInfo(schema, id, unpublished, languages); + } + + /** + * Execute deleteContentStatus request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Content status change cancelled. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteContentStatusAsync(schema, id, unpublished, languages, _callback); + } + } + + /** + * Cancel status change of a content item. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content item to cancel. (required) + * @return APIcontentsDeleteContentStatusRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content status change cancelled. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsDeleteContentStatusRequest deleteContentStatus(String schema, String id) { + return new APIcontentsDeleteContentStatusRequest(schema, id); + } + private okhttp3.Call deleteVersionCall(String schema, String id, Boolean unpublished, String languages, 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 = "/api/content/$app$/{schema}/{id}/draft" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteVersionValidateBeforeCall(String schema, String id, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return deleteVersionCall(schema, id, unpublished, languages, _callback); + + } + + + private ApiResponse deleteVersionWithHttpInfo(String schema, String id, Boolean unpublished, String languages) throws ApiException { + okhttp3.Call localVarCall = deleteVersionValidateBeforeCall(schema, id, unpublished, languages, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteVersionAsync(String schema, String id, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteVersionValidateBeforeCall(schema, id, unpublished, languages, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsDeleteVersionRequest { + private final String schema; + private final String id; + private Boolean unpublished; + private String languages; + + private APIcontentsDeleteVersionRequest(String schema, String id) { + this.schema = schema; + this.id = id; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsDeleteVersionRequest + */ + public APIcontentsDeleteVersionRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsDeleteVersionRequest + */ + public APIcontentsDeleteVersionRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Build call for deleteVersion + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content draft deleted. -
404 Content, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteVersionCall(schema, id, unpublished, languages, _callback); + } + + /** + * Execute deleteVersion request + * @return ContentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content draft deleted. -
404 Content, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ContentDto execute() throws ApiException { + ApiResponse localVarResp = deleteVersionWithHttpInfo(schema, id, unpublished, languages); + return localVarResp.getData(); + } + + /** + * Execute deleteVersion request with HTTP info returned + * @return ApiResponse<ContentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content draft deleted. -
404 Content, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteVersionWithHttpInfo(schema, id, unpublished, languages); + } + + /** + * Execute deleteVersion request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Content draft deleted. -
404 Content, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteVersionAsync(schema, id, unpublished, languages, _callback); + } + } + + /** + * Delete the draft version. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content item to delete the draft from. (required) + * @return APIcontentsDeleteVersionRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content draft deleted. -
404 Content, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIcontentsDeleteVersionRequest deleteVersion(String schema, String id) { + return new APIcontentsDeleteVersionRequest(schema, id); + } + private okhttp3.Call getContentCall(String schema, String id, Long version, String fields, Boolean flatten, String languages, Boolean unpublished, 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 = "/api/content/$app$/{schema}/{id}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (version != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("version", version)); + } + + if (fields != null) { + localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + } + + if (flatten != null) { + localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getContentValidateBeforeCall(String schema, String id, Long version, String fields, Boolean flatten, String languages, Boolean unpublished, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return getContentCall(schema, id, version, fields, flatten, languages, unpublished, _callback); + + } + + + private ApiResponse getContentWithHttpInfo(String schema, String id, Long version, String fields, Boolean flatten, String languages, Boolean unpublished) throws ApiException { + okhttp3.Call localVarCall = getContentValidateBeforeCall(schema, id, version, fields, flatten, languages, unpublished, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getContentAsync(String schema, String id, Long version, String fields, Boolean flatten, String languages, Boolean unpublished, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getContentValidateBeforeCall(schema, id, version, fields, flatten, languages, unpublished, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsGetContentRequest { + private final String schema; + private final String id; + private Long version; + private String fields; + private Boolean flatten; + private String languages; + private Boolean unpublished; + + private APIcontentsGetContentRequest(String schema, String id) { + this.schema = schema; + this.id = id; + } + + /** + * Set version + * @param version The optional version. (optional, default to -2) + * @return APIcontentsGetContentRequest + */ + public APIcontentsGetContentRequest version(Long version) { + this.version = version; + return this; + } + + /** + * Set fields + * @param fields The list of content fields (comma-separated). (optional) + * @return APIcontentsGetContentRequest + */ + public APIcontentsGetContentRequest fields(String fields) { + this.fields = fields; + return this; + } + + /** + * Set flatten + * @param flatten Provide the data as flat object. (optional) + * @return APIcontentsGetContentRequest + */ + public APIcontentsGetContentRequest flatten(Boolean flatten) { + this.flatten = flatten; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsGetContentRequest + */ + public APIcontentsGetContentRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsGetContentRequest + */ + public APIcontentsGetContentRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Build call for getContent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getContentCall(schema, id, version, fields, flatten, languages, unpublished, _callback); + } + + /** + * Execute getContent request + * @return ContentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ContentDto execute() throws ApiException { + ApiResponse localVarResp = getContentWithHttpInfo(schema, id, version, fields, flatten, languages, unpublished); + return localVarResp.getData(); + } + + /** + * Execute getContent request with HTTP info returned + * @return ApiResponse<ContentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getContentWithHttpInfo(schema, id, version, fields, flatten, languages, unpublished); + } + + /** + * Execute getContent request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Content returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getContentAsync(schema, id, version, fields, flatten, languages, unpublished, _callback); + } + } + + /** + * Get a content item. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content to fetch. (required) + * @return APIcontentsGetContentRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsGetContentRequest getContent(String schema, String id) { + return new APIcontentsGetContentRequest(schema, id); + } + private okhttp3.Call getContentValidityCall(String schema, String 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 = "/api/content/$app$/{schema}/{id}/validity" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getContentValidityValidateBeforeCall(String schema, String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return getContentValidityCall(schema, id, _callback); + + } + + + private ApiResponse getContentValidityWithHttpInfo(String schema, String id) throws ApiException { + okhttp3.Call localVarCall = getContentValidityValidateBeforeCall(schema, id, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call getContentValidityAsync(String schema, String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getContentValidityValidateBeforeCall(schema, id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIcontentsGetContentValidityRequest { + private final String schema; + private final String id; + + private APIcontentsGetContentValidityRequest(String schema, String id) { + this.schema = schema; + this.id = id; + } + + /** + * Build call for getContentValidity + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Content is valid. -
400 Content not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getContentValidityCall(schema, id, _callback); + } + + /** + * Execute getContentValidity request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Content is valid. -
400 Content not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + getContentValidityWithHttpInfo(schema, id); + } + + /** + * Execute getContentValidity request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Content is valid. -
400 Content not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getContentValidityWithHttpInfo(schema, id); + } + + /** + * Execute getContentValidity request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Content is valid. -
400 Content not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getContentValidityAsync(schema, id, _callback); + } + } + + /** + * Get a content item validity. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content to fetch. (required) + * @return APIcontentsGetContentValidityRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Content is valid. -
400 Content not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsGetContentValidityRequest getContentValidity(String schema, String id) { + return new APIcontentsGetContentValidityRequest(schema, id); + } + private okhttp3.Call getContentVersionCall(String schema, String id, Integer version, Boolean unpublished, String languages, 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 = "/api/content/$app$/{schema}/{id}/{version}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .replace("{" + "id" + "}", localVarApiClient.escapeString(id.toString())) + .replace("{" + "version" + "}", localVarApiClient.escapeString(version.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + final String[] localVarAccepts = { + "application/octet-stream", + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call getContentVersionValidateBeforeCall(String schema, String id, Integer version, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + // verify the required parameter 'version' is set + if (version == null) { + throw new ApiException("Missing the required parameter 'version' when calling (Async)"); + } + + return getContentVersionCall(schema, id, version, unpublished, languages, _callback); + + } + + + private ApiResponse getContentVersionWithHttpInfo(String schema, String id, Integer version, Boolean unpublished, String languages) throws ApiException { + okhttp3.Call localVarCall = getContentVersionValidateBeforeCall(schema, id, version, unpublished, languages, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getContentVersionAsync(String schema, String id, Integer version, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getContentVersionValidateBeforeCall(schema, id, version, unpublished, languages, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsGetContentVersionRequest { + private final String schema; + private final String id; + private final Integer version; + private Boolean unpublished; + private String languages; + + private APIcontentsGetContentVersionRequest(String schema, String id, Integer version) { + this.schema = schema; + this.id = id; + this.version = version; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsGetContentVersionRequest + */ + public APIcontentsGetContentVersionRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsGetContentVersionRequest + */ + public APIcontentsGetContentVersionRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Build call for getContentVersion + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content version returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getContentVersionCall(schema, id, version, unpublished, languages, _callback); + } + + /** + * Execute getContentVersion request + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content version returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public File execute() throws ApiException { + ApiResponse localVarResp = getContentVersionWithHttpInfo(schema, id, version, unpublished, languages); + return localVarResp.getData(); + } + + /** + * Execute getContentVersion request with HTTP info returned + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content version returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public ApiResponse executeWithHttpInfo() throws ApiException { + return getContentVersionWithHttpInfo(schema, id, version, unpublished, languages); + } + + /** + * Execute getContentVersion request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Content version returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getContentVersionAsync(schema, id, version, unpublished, languages, _callback); + } + } + + /** + * Get a content by version. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content to fetch. (required) + * @param version The version fo the content to fetch. (required) + * @return APIcontentsGetContentVersionRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content version returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public APIcontentsGetContentVersionRequest getContentVersion(String schema, String id, Integer version) { + return new APIcontentsGetContentVersionRequest(schema, id, version); + } + private okhttp3.Call getContentsCall(String schema, String ids, String q, String $search, BigDecimal $top, BigDecimal $skip, String $orderby, String $filter, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, 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 = "/api/content/$app$/{schema}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (ids != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("ids", ids)); + } + + if (q != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("q", q)); + } + + if ($search != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("$search", $search)); + } + + if ($top != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("$top", $top)); + } + + if ($skip != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("$skip", $skip)); + } + + if ($orderby != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("$orderby", $orderby)); + } + + if ($filter != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("$filter", $filter)); + } + + if (fields != null) { + localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + } + + if (flatten != null) { + localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + if (noSlowTotal != null) { + localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + } + + if (noTotal != null) { + localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getContentsValidateBeforeCall(String schema, String ids, String q, String $search, BigDecimal $top, BigDecimal $skip, String $orderby, String $filter, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + return getContentsCall(schema, ids, q, $search, $top, $skip, $orderby, $filter, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + + } + + + private ApiResponse getContentsWithHttpInfo(String schema, String ids, String q, String $search, BigDecimal $top, BigDecimal $skip, String $orderby, String $filter, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished) throws ApiException { + okhttp3.Call localVarCall = getContentsValidateBeforeCall(schema, ids, q, $search, $top, $skip, $orderby, $filter, fields, flatten, languages, noSlowTotal, noTotal, unpublished, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getContentsAsync(String schema, String ids, String q, String $search, BigDecimal $top, BigDecimal $skip, String $orderby, String $filter, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getContentsValidateBeforeCall(schema, ids, q, $search, $top, $skip, $orderby, $filter, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsGetContentsRequest { + private final String schema; + private String ids; + private String q; + private String $search; + private BigDecimal $top; + private BigDecimal $skip; + private String $orderby; + private String $filter; + private String fields; + private Boolean flatten; + private String languages; + private Boolean noSlowTotal; + private Boolean noTotal; + private Boolean unpublished; + + private APIcontentsGetContentsRequest(String schema) { + this.schema = schema; + } + + /** + * Set ids + * @param ids The optional ids of the content to fetch. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest ids(String ids) { + this.ids = ids; + return this; + } + + /** + * Set q + * @param q The optional json query. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest q(String q) { + this.q = q; + return this; + } + + /** + * Set $search + * @param $search Optional number of items to skip. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest $search(String $search) { + this.$search = $search; + return this; + } + + /** + * Set $top + * @param $top Optional number of items to take. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest $top(BigDecimal $top) { + this.$top = $top; + return this; + } + + /** + * Set $skip + * @param $skip Optional number of items to skip. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest $skip(BigDecimal $skip) { + this.$skip = $skip; + return this; + } + + /** + * Set $orderby + * @param $orderby Optional OData order definition. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest $orderby(String $orderby) { + this.$orderby = $orderby; + return this; + } + + /** + * Set $filter + * @param $filter Optional OData filter. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest $filter(String $filter) { + this.$filter = $filter; + return this; + } + + /** + * Set fields + * @param fields The list of content fields (comma-separated). (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest fields(String fields) { + this.fields = fields; + return this; + } + + /** + * Set flatten + * @param flatten Provide the data as flat object. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest flatten(Boolean flatten) { + this.flatten = flatten; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Set noSlowTotal + * @param noSlowTotal Do not return the total amount, if it would be slow. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest noSlowTotal(Boolean noSlowTotal) { + this.noSlowTotal = noSlowTotal; + return this; + } + + /** + * Set noTotal + * @param noTotal Do not return the total amount. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest noTotal(Boolean noTotal) { + this.noTotal = noTotal; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsGetContentsRequest + */ + public APIcontentsGetContentsRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Build call for getContents + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getContentsCall(schema, ids, q, $search, $top, $skip, $orderby, $filter, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + } + + /** + * Execute getContents request + * @return ContentsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ContentsDto execute() throws ApiException { + ApiResponse localVarResp = getContentsWithHttpInfo(schema, ids, q, $search, $top, $skip, $orderby, $filter, fields, flatten, languages, noSlowTotal, noTotal, unpublished); + return localVarResp.getData(); + } + + /** + * Execute getContents request with HTTP info returned + * @return ApiResponse<ContentsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getContentsWithHttpInfo(schema, ids, q, $search, $top, $skip, $orderby, $filter, fields, flatten, languages, noSlowTotal, noTotal, unpublished); + } + + /** + * Execute getContents request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getContentsAsync(schema, ids, q, $search, $top, $skip, $orderby, $filter, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + } + } + + /** + * Queries contents. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @return APIcontentsGetContentsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsGetContentsRequest getContents(String schema) { + return new APIcontentsGetContentsRequest(schema); + } + private okhttp3.Call getContentsPostCall(String schema, QueryDto queryDto, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, 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 = queryDto; + + // create path and map variables + String localVarPath = "/api/content/$app$/{schema}/query" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (fields != null) { + localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + } + + if (flatten != null) { + localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + if (noSlowTotal != null) { + localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + } + + if (noTotal != null) { + localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getContentsPostValidateBeforeCall(String schema, QueryDto queryDto, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'queryDto' is set + if (queryDto == null) { + throw new ApiException("Missing the required parameter 'queryDto' when calling (Async)"); + } + + return getContentsPostCall(schema, queryDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + + } + + + private ApiResponse getContentsPostWithHttpInfo(String schema, QueryDto queryDto, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished) throws ApiException { + okhttp3.Call localVarCall = getContentsPostValidateBeforeCall(schema, queryDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getContentsPostAsync(String schema, QueryDto queryDto, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getContentsPostValidateBeforeCall(schema, queryDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsGetContentsPostRequest { + private final String schema; + private final QueryDto queryDto; + private String fields; + private Boolean flatten; + private String languages; + private Boolean noSlowTotal; + private Boolean noTotal; + private Boolean unpublished; + + private APIcontentsGetContentsPostRequest(String schema, QueryDto queryDto) { + this.schema = schema; + this.queryDto = queryDto; + } + + /** + * Set fields + * @param fields The list of content fields (comma-separated). (optional) + * @return APIcontentsGetContentsPostRequest + */ + public APIcontentsGetContentsPostRequest fields(String fields) { + this.fields = fields; + return this; + } + + /** + * Set flatten + * @param flatten Provide the data as flat object. (optional) + * @return APIcontentsGetContentsPostRequest + */ + public APIcontentsGetContentsPostRequest flatten(Boolean flatten) { + this.flatten = flatten; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsGetContentsPostRequest + */ + public APIcontentsGetContentsPostRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Set noSlowTotal + * @param noSlowTotal Do not return the total amount, if it would be slow. (optional) + * @return APIcontentsGetContentsPostRequest + */ + public APIcontentsGetContentsPostRequest noSlowTotal(Boolean noSlowTotal) { + this.noSlowTotal = noSlowTotal; + return this; + } + + /** + * Set noTotal + * @param noTotal Do not return the total amount. (optional) + * @return APIcontentsGetContentsPostRequest + */ + public APIcontentsGetContentsPostRequest noTotal(Boolean noTotal) { + this.noTotal = noTotal; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsGetContentsPostRequest + */ + public APIcontentsGetContentsPostRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Build call for getContentsPost + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getContentsPostCall(schema, queryDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + } + + /** + * Execute getContentsPost request + * @return ContentsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ContentsDto execute() throws ApiException { + ApiResponse localVarResp = getContentsPostWithHttpInfo(schema, queryDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished); + return localVarResp.getData(); + } + + /** + * Execute getContentsPost request with HTTP info returned + * @return ApiResponse<ContentsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getContentsPostWithHttpInfo(schema, queryDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished); + } + + /** + * Execute getContentsPost request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getContentsPostAsync(schema, queryDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + } + } + + /** + * Queries contents. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param queryDto The required query object. (required) + * @return APIcontentsGetContentsPostRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIcontentsGetContentsPostRequest getContentsPost(String schema, QueryDto queryDto) { + return new APIcontentsGetContentsPostRequest(schema, queryDto); + } + private okhttp3.Call getReferencesCall(String schema, String id, String q, String fields, Boolean flatten, String languages, Boolean unpublished, Boolean noSlowTotal, Boolean noTotal, 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 = "/api/content/$app$/{schema}/{id}/references" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (q != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("q", q)); + } + + if (fields != null) { + localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + } + + if (flatten != null) { + localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (noSlowTotal != null) { + localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + } + + if (noTotal != null) { + localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getReferencesValidateBeforeCall(String schema, String id, String q, String fields, Boolean flatten, String languages, Boolean unpublished, Boolean noSlowTotal, Boolean noTotal, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return getReferencesCall(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal, _callback); + + } + + + private ApiResponse getReferencesWithHttpInfo(String schema, String id, String q, String fields, Boolean flatten, String languages, Boolean unpublished, Boolean noSlowTotal, Boolean noTotal) throws ApiException { + okhttp3.Call localVarCall = getReferencesValidateBeforeCall(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getReferencesAsync(String schema, String id, String q, String fields, Boolean flatten, String languages, Boolean unpublished, Boolean noSlowTotal, Boolean noTotal, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getReferencesValidateBeforeCall(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsGetReferencesRequest { + private final String schema; + private final String id; + private String q; + private String fields; + private Boolean flatten; + private String languages; + private Boolean unpublished; + private Boolean noSlowTotal; + private Boolean noTotal; + + private APIcontentsGetReferencesRequest(String schema, String id) { + this.schema = schema; + this.id = id; + } + + /** + * Set q + * @param q The optional json query. (optional) + * @return APIcontentsGetReferencesRequest + */ + public APIcontentsGetReferencesRequest q(String q) { + this.q = q; + return this; + } + + /** + * Set fields + * @param fields The list of content fields (comma-separated). (optional) + * @return APIcontentsGetReferencesRequest + */ + public APIcontentsGetReferencesRequest fields(String fields) { + this.fields = fields; + return this; + } + + /** + * Set flatten + * @param flatten Provide the data as flat object. (optional) + * @return APIcontentsGetReferencesRequest + */ + public APIcontentsGetReferencesRequest flatten(Boolean flatten) { + this.flatten = flatten; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsGetReferencesRequest + */ + public APIcontentsGetReferencesRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsGetReferencesRequest + */ + public APIcontentsGetReferencesRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set noSlowTotal + * @param noSlowTotal Do not return the total amount, if it would be slow. (optional) + * @return APIcontentsGetReferencesRequest + */ + public APIcontentsGetReferencesRequest noSlowTotal(Boolean noSlowTotal) { + this.noSlowTotal = noSlowTotal; + return this; + } + + /** + * Set noTotal + * @param noTotal Do not return the total amount. (optional) + * @return APIcontentsGetReferencesRequest + */ + public APIcontentsGetReferencesRequest noTotal(Boolean noTotal) { + this.noTotal = noTotal; + return this; + } + + /** + * Build call for getReferences + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getReferencesCall(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal, _callback); + } + + /** + * Execute getReferences request + * @return ContentsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ContentsDto execute() throws ApiException { + ApiResponse localVarResp = getReferencesWithHttpInfo(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal); + return localVarResp.getData(); + } + + /** + * Execute getReferences request with HTTP info returned + * @return ApiResponse<ContentsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getReferencesWithHttpInfo(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal); + } + + /** + * Execute getReferences request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getReferencesAsync(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal, _callback); + } + } + + /** + * Get all references of a content. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content to fetch. (required) + * @return APIcontentsGetReferencesRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsGetReferencesRequest getReferences(String schema, String id) { + return new APIcontentsGetReferencesRequest(schema, id); + } + private okhttp3.Call getReferencingCall(String schema, String id, String q, String fields, Boolean flatten, String languages, Boolean unpublished, Boolean noSlowTotal, Boolean noTotal, 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 = "/api/content/$app$/{schema}/{id}/referencing" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (q != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("q", q)); + } + + if (fields != null) { + localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + } + + if (flatten != null) { + localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (noSlowTotal != null) { + localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + } + + if (noTotal != null) { + localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getReferencingValidateBeforeCall(String schema, String id, String q, String fields, Boolean flatten, String languages, Boolean unpublished, Boolean noSlowTotal, Boolean noTotal, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return getReferencingCall(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal, _callback); + + } + + + private ApiResponse getReferencingWithHttpInfo(String schema, String id, String q, String fields, Boolean flatten, String languages, Boolean unpublished, Boolean noSlowTotal, Boolean noTotal) throws ApiException { + okhttp3.Call localVarCall = getReferencingValidateBeforeCall(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getReferencingAsync(String schema, String id, String q, String fields, Boolean flatten, String languages, Boolean unpublished, Boolean noSlowTotal, Boolean noTotal, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getReferencingValidateBeforeCall(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsGetReferencingRequest { + private final String schema; + private final String id; + private String q; + private String fields; + private Boolean flatten; + private String languages; + private Boolean unpublished; + private Boolean noSlowTotal; + private Boolean noTotal; + + private APIcontentsGetReferencingRequest(String schema, String id) { + this.schema = schema; + this.id = id; + } + + /** + * Set q + * @param q The optional json query. (optional) + * @return APIcontentsGetReferencingRequest + */ + public APIcontentsGetReferencingRequest q(String q) { + this.q = q; + return this; + } + + /** + * Set fields + * @param fields The list of content fields (comma-separated). (optional) + * @return APIcontentsGetReferencingRequest + */ + public APIcontentsGetReferencingRequest fields(String fields) { + this.fields = fields; + return this; + } + + /** + * Set flatten + * @param flatten Provide the data as flat object. (optional) + * @return APIcontentsGetReferencingRequest + */ + public APIcontentsGetReferencingRequest flatten(Boolean flatten) { + this.flatten = flatten; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsGetReferencingRequest + */ + public APIcontentsGetReferencingRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsGetReferencingRequest + */ + public APIcontentsGetReferencingRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set noSlowTotal + * @param noSlowTotal Do not return the total amount, if it would be slow. (optional) + * @return APIcontentsGetReferencingRequest + */ + public APIcontentsGetReferencingRequest noSlowTotal(Boolean noSlowTotal) { + this.noSlowTotal = noSlowTotal; + return this; + } + + /** + * Set noTotal + * @param noTotal Do not return the total amount. (optional) + * @return APIcontentsGetReferencingRequest + */ + public APIcontentsGetReferencingRequest noTotal(Boolean noTotal) { + this.noTotal = noTotal; + return this; + } + + /** + * Build call for getReferencing + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getReferencingCall(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal, _callback); + } + + /** + * Execute getReferencing request + * @return ContentsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ContentsDto execute() throws ApiException { + ApiResponse localVarResp = getReferencingWithHttpInfo(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal); + return localVarResp.getData(); + } + + /** + * Execute getReferencing request with HTTP info returned + * @return ApiResponse<ContentsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getReferencingWithHttpInfo(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal); + } + + /** + * Execute getReferencing request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Content returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getReferencingAsync(schema, id, q, fields, flatten, languages, unpublished, noSlowTotal, noTotal, _callback); + } + } + + /** + * Get a referencing contents of a content item. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content to fetch. (required) + * @return APIcontentsGetReferencingRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Content returned. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsGetReferencingRequest getReferencing(String schema, String id) { + return new APIcontentsGetReferencingRequest(schema, id); + } + private okhttp3.Call patchContentCall(String schema, String id, Map> requestBody, Boolean unpublished, String languages, 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 = requestBody; + + // create path and map variables + String localVarPath = "/api/content/$app$/{schema}/{id}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PATCH", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call patchContentValidateBeforeCall(String schema, String id, Map> requestBody, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling (Async)"); + } + + return patchContentCall(schema, id, requestBody, unpublished, languages, _callback); + + } + + + private ApiResponse patchContentWithHttpInfo(String schema, String id, Map> requestBody, Boolean unpublished, String languages) throws ApiException { + okhttp3.Call localVarCall = patchContentValidateBeforeCall(schema, id, requestBody, unpublished, languages, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call patchContentAsync(String schema, String id, Map> requestBody, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = patchContentValidateBeforeCall(schema, id, requestBody, unpublished, languages, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsPatchContentRequest { + private final String schema; + private final String id; + private final Map> requestBody; + private Boolean unpublished; + private String languages; + + private APIcontentsPatchContentRequest(String schema, String id, Map> requestBody) { + this.schema = schema; + this.id = id; + this.requestBody = requestBody; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsPatchContentRequest + */ + public APIcontentsPatchContentRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsPatchContentRequest + */ + public APIcontentsPatchContentRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Build call for patchContent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content patched. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return patchContentCall(schema, id, requestBody, unpublished, languages, _callback); + } + + /** + * Execute patchContent request + * @return ContentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content patched. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ContentDto execute() throws ApiException { + ApiResponse localVarResp = patchContentWithHttpInfo(schema, id, requestBody, unpublished, languages); + return localVarResp.getData(); + } + + /** + * Execute patchContent request with HTTP info returned + * @return ApiResponse<ContentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content patched. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return patchContentWithHttpInfo(schema, id, requestBody, unpublished, languages); + } + + /** + * Execute patchContent request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Content patched. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return patchContentAsync(schema, id, requestBody, unpublished, languages, _callback); + } + } + + /** + * Patchs a content item. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content item to patch. (required) + * @param requestBody The patch for the content item. (required) + * @return APIcontentsPatchContentRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content patched. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsPatchContentRequest patchContent(String schema, String id, Map> requestBody) { + return new APIcontentsPatchContentRequest(schema, id, requestBody); + } + private okhttp3.Call postContentCall(String schema, Map> requestBody, String status, String id, Boolean publish, Boolean unpublished, String languages, 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 = requestBody; + + // create path and map variables + String localVarPath = "/api/content/$app$/{schema}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (status != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("status", status)); + } + + if (id != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("id", id)); + } + + if (publish != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("publish", publish)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postContentValidateBeforeCall(String schema, Map> requestBody, String status, String id, Boolean publish, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling (Async)"); + } + + return postContentCall(schema, requestBody, status, id, publish, unpublished, languages, _callback); + + } + + + private ApiResponse postContentWithHttpInfo(String schema, Map> requestBody, String status, String id, Boolean publish, Boolean unpublished, String languages) throws ApiException { + okhttp3.Call localVarCall = postContentValidateBeforeCall(schema, requestBody, status, id, publish, unpublished, languages, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postContentAsync(String schema, Map> requestBody, String status, String id, Boolean publish, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postContentValidateBeforeCall(schema, requestBody, status, id, publish, unpublished, languages, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsPostContentRequest { + private final String schema; + private final Map> requestBody; + private String status; + private String id; + private Boolean publish; + private Boolean unpublished; + private String languages; + + private APIcontentsPostContentRequest(String schema, Map> requestBody) { + this.schema = schema; + this.requestBody = requestBody; + } + + /** + * Set status + * @param status The initial status. (optional) + * @return APIcontentsPostContentRequest + */ + public APIcontentsPostContentRequest status(String status) { + this.status = status; + return this; + } + + /** + * Set id + * @param id The optional custom content id. (optional) + * @return APIcontentsPostContentRequest + */ + public APIcontentsPostContentRequest id(String id) { + this.id = id; + return this; + } + + /** + * Set publish + * @param publish True to automatically publish the content. (optional) + * @return APIcontentsPostContentRequest + */ + public APIcontentsPostContentRequest publish(Boolean publish) { + this.publish = publish; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsPostContentRequest + */ + public APIcontentsPostContentRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsPostContentRequest + */ + public APIcontentsPostContentRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Build call for postContent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Content created. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postContentCall(schema, requestBody, status, id, publish, unpublished, languages, _callback); + } + + /** + * Execute postContent request + * @return ContentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Content created. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ContentDto execute() throws ApiException { + ApiResponse localVarResp = postContentWithHttpInfo(schema, requestBody, status, id, publish, unpublished, languages); + return localVarResp.getData(); + } + + /** + * Execute postContent request with HTTP info returned + * @return ApiResponse<ContentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Content created. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postContentWithHttpInfo(schema, requestBody, status, id, publish, unpublished, languages); + } + + /** + * Execute postContent request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
201 Content created. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postContentAsync(schema, requestBody, status, id, publish, unpublished, languages, _callback); + } + } + + /** + * Create a content item. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param requestBody The full data for the content item. (required) + * @return APIcontentsPostContentRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Content created. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsPostContentRequest postContent(String schema, Map> requestBody) { + return new APIcontentsPostContentRequest(schema, requestBody); + } + private okhttp3.Call postContentsCall(String schema, ImportContentsDto importContentsDto, 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 = importContentsDto; + + // create path and map variables + String localVarPath = "/api/content/$app$/{schema}/import" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @Deprecated + @SuppressWarnings("rawtypes") + private okhttp3.Call postContentsValidateBeforeCall(String schema, ImportContentsDto importContentsDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'importContentsDto' is set + if (importContentsDto == null) { + throw new ApiException("Missing the required parameter 'importContentsDto' when calling (Async)"); + } + + return postContentsCall(schema, importContentsDto, _callback); + + } + + + private ApiResponse> postContentsWithHttpInfo(String schema, ImportContentsDto importContentsDto) throws ApiException { + okhttp3.Call localVarCall = postContentsValidateBeforeCall(schema, importContentsDto, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postContentsAsync(String schema, ImportContentsDto importContentsDto, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = postContentsValidateBeforeCall(schema, importContentsDto, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsPostContentsRequest { + private final String schema; + private final ImportContentsDto importContentsDto; + + private APIcontentsPostContentsRequest(String schema, ImportContentsDto importContentsDto) { + this.schema = schema; + this.importContentsDto = importContentsDto; + } + + /** + * Build call for postContents + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents created. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postContentsCall(schema, importContentsDto, _callback); + } + + /** + * Execute postContents request + * @return List<BulkResultDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents created. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public List execute() throws ApiException { + ApiResponse> localVarResp = postContentsWithHttpInfo(schema, importContentsDto); + return localVarResp.getData(); + } + + /** + * Execute postContents request with HTTP info returned + * @return ApiResponse<List<BulkResultDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents created. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public ApiResponse> executeWithHttpInfo() throws ApiException { + return postContentsWithHttpInfo(schema, importContentsDto); + } + + /** + * Execute postContents request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Contents created. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return postContentsAsync(schema, importContentsDto, _callback); + } + } + + /** + * Import content items. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param importContentsDto The import request. (required) + * @return APIcontentsPostContentsRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents created. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ * @deprecated + */ + @Deprecated + public APIcontentsPostContentsRequest postContents(String schema, ImportContentsDto importContentsDto) { + return new APIcontentsPostContentsRequest(schema, importContentsDto); + } + private okhttp3.Call postUpsertContentCall(String schema, String id, Map> requestBody, String status, Boolean patch, Boolean enrichDefaults, Boolean publish, Boolean unpublished, String languages, 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 = requestBody; + + // create path and map variables + String localVarPath = "/api/content/$app$/{schema}/{id}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (status != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("status", status)); + } + + if (patch != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("patch", patch)); + } + + if (enrichDefaults != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enrichDefaults", enrichDefaults)); + } + + if (publish != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("publish", publish)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postUpsertContentValidateBeforeCall(String schema, String id, Map> requestBody, String status, Boolean patch, Boolean enrichDefaults, Boolean publish, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling (Async)"); + } + + return postUpsertContentCall(schema, id, requestBody, status, patch, enrichDefaults, publish, unpublished, languages, _callback); + + } + + + private ApiResponse postUpsertContentWithHttpInfo(String schema, String id, Map> requestBody, String status, Boolean patch, Boolean enrichDefaults, Boolean publish, Boolean unpublished, String languages) throws ApiException { + okhttp3.Call localVarCall = postUpsertContentValidateBeforeCall(schema, id, requestBody, status, patch, enrichDefaults, publish, unpublished, languages, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postUpsertContentAsync(String schema, String id, Map> requestBody, String status, Boolean patch, Boolean enrichDefaults, Boolean publish, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postUpsertContentValidateBeforeCall(schema, id, requestBody, status, patch, enrichDefaults, publish, unpublished, languages, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsPostUpsertContentRequest { + private final String schema; + private final String id; + private final Map> requestBody; + private String status; + private Boolean patch; + private Boolean enrichDefaults; + private Boolean publish; + private Boolean unpublished; + private String languages; + + private APIcontentsPostUpsertContentRequest(String schema, String id, Map> requestBody) { + this.schema = schema; + this.id = id; + this.requestBody = requestBody; + } + + /** + * Set status + * @param status The initial status. (optional) + * @return APIcontentsPostUpsertContentRequest + */ + public APIcontentsPostUpsertContentRequest status(String status) { + this.status = status; + return this; + } + + /** + * Set patch + * @param patch Makes the update as patch. (optional) + * @return APIcontentsPostUpsertContentRequest + */ + public APIcontentsPostUpsertContentRequest patch(Boolean patch) { + this.patch = patch; + return this; + } + + /** + * Set enrichDefaults + * @param enrichDefaults Enrich the content with defaults. (optional) + * @return APIcontentsPostUpsertContentRequest + */ + public APIcontentsPostUpsertContentRequest enrichDefaults(Boolean enrichDefaults) { + this.enrichDefaults = enrichDefaults; + return this; + } + + /** + * Set publish + * @param publish True to automatically publish the content. (optional) + * @return APIcontentsPostUpsertContentRequest + */ + public APIcontentsPostUpsertContentRequest publish(Boolean publish) { + this.publish = publish; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsPostUpsertContentRequest + */ + public APIcontentsPostUpsertContentRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsPostUpsertContentRequest + */ + public APIcontentsPostUpsertContentRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Build call for postUpsertContent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content created or updated. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postUpsertContentCall(schema, id, requestBody, status, patch, enrichDefaults, publish, unpublished, languages, _callback); + } + + /** + * Execute postUpsertContent request + * @return ContentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content created or updated. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ */ + public ContentDto execute() throws ApiException { + ApiResponse localVarResp = postUpsertContentWithHttpInfo(schema, id, requestBody, status, patch, enrichDefaults, publish, unpublished, languages); + return localVarResp.getData(); + } + + /** + * Execute postUpsertContent request with HTTP info returned + * @return ApiResponse<ContentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content created or updated. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postUpsertContentWithHttpInfo(schema, id, requestBody, status, patch, enrichDefaults, publish, unpublished, languages); + } + + /** + * Execute postUpsertContent request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Content created or updated. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postUpsertContentAsync(schema, id, requestBody, status, patch, enrichDefaults, publish, unpublished, languages, _callback); + } + } + + /** + * Upsert a content item. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content item to update. (required) + * @param requestBody The full data for the content item. (required) + * @return APIcontentsPostUpsertContentRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content created or updated. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsPostUpsertContentRequest postUpsertContent(String schema, String id, Map> requestBody) { + return new APIcontentsPostUpsertContentRequest(schema, id, requestBody); + } + private okhttp3.Call putContentCall(String schema, String id, Map> requestBody, Boolean enrichDefaults, Boolean unpublished, String languages, 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 = requestBody; + + // create path and map variables + String localVarPath = "/api/content/$app$/{schema}/{id}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (enrichDefaults != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enrichDefaults", enrichDefaults)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putContentValidateBeforeCall(String schema, String id, Map> requestBody, Boolean enrichDefaults, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling (Async)"); + } + + return putContentCall(schema, id, requestBody, enrichDefaults, unpublished, languages, _callback); + + } + + + private ApiResponse putContentWithHttpInfo(String schema, String id, Map> requestBody, Boolean enrichDefaults, Boolean unpublished, String languages) throws ApiException { + okhttp3.Call localVarCall = putContentValidateBeforeCall(schema, id, requestBody, enrichDefaults, unpublished, languages, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putContentAsync(String schema, String id, Map> requestBody, Boolean enrichDefaults, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putContentValidateBeforeCall(schema, id, requestBody, enrichDefaults, unpublished, languages, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsPutContentRequest { + private final String schema; + private final String id; + private final Map> requestBody; + private Boolean enrichDefaults; + private Boolean unpublished; + private String languages; + + private APIcontentsPutContentRequest(String schema, String id, Map> requestBody) { + this.schema = schema; + this.id = id; + this.requestBody = requestBody; + } + + /** + * Set enrichDefaults + * @param enrichDefaults Enrich the content with defaults. (optional) + * @return APIcontentsPutContentRequest + */ + public APIcontentsPutContentRequest enrichDefaults(Boolean enrichDefaults) { + this.enrichDefaults = enrichDefaults; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsPutContentRequest + */ + public APIcontentsPutContentRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsPutContentRequest + */ + public APIcontentsPutContentRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Build call for putContent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content updated. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putContentCall(schema, id, requestBody, enrichDefaults, unpublished, languages, _callback); + } + + /** + * Execute putContent request + * @return ContentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content updated. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ */ + public ContentDto execute() throws ApiException { + ApiResponse localVarResp = putContentWithHttpInfo(schema, id, requestBody, enrichDefaults, unpublished, languages); + return localVarResp.getData(); + } + + /** + * Execute putContent request with HTTP info returned + * @return ApiResponse<ContentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content updated. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putContentWithHttpInfo(schema, id, requestBody, enrichDefaults, unpublished, languages); + } + + /** + * Execute putContent request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Content updated. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putContentAsync(schema, id, requestBody, enrichDefaults, unpublished, languages, _callback); + } + } + + /** + * Update a content item. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content item to update. (required) + * @param requestBody The full data for the content item. (required) + * @return APIcontentsPutContentRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content updated. -
400 Content request not valid. -
404 Content references, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsPutContentRequest putContent(String schema, String id, Map> requestBody) { + return new APIcontentsPutContentRequest(schema, id, requestBody); + } + private okhttp3.Call putContentDefaultsCall(String schema, String id, Boolean enrichRequiredFields, Boolean unpublished, String languages, 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 = "/api/content/$app$/{schema}/{id}/defaults" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (enrichRequiredFields != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("enrichRequiredFields", enrichRequiredFields)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putContentDefaultsValidateBeforeCall(String schema, String id, Boolean enrichRequiredFields, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return putContentDefaultsCall(schema, id, enrichRequiredFields, unpublished, languages, _callback); + + } + + + private ApiResponse putContentDefaultsWithHttpInfo(String schema, String id, Boolean enrichRequiredFields, Boolean unpublished, String languages) throws ApiException { + okhttp3.Call localVarCall = putContentDefaultsValidateBeforeCall(schema, id, enrichRequiredFields, unpublished, languages, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putContentDefaultsAsync(String schema, String id, Boolean enrichRequiredFields, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putContentDefaultsValidateBeforeCall(schema, id, enrichRequiredFields, unpublished, languages, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsPutContentDefaultsRequest { + private final String schema; + private final String id; + private Boolean enrichRequiredFields; + private Boolean unpublished; + private String languages; + + private APIcontentsPutContentDefaultsRequest(String schema, String id) { + this.schema = schema; + this.id = id; + } + + /** + * Set enrichRequiredFields + * @param enrichRequiredFields True, to also enrich required fields. Default: false. (optional) + * @return APIcontentsPutContentDefaultsRequest + */ + public APIcontentsPutContentDefaultsRequest enrichRequiredFields(Boolean enrichRequiredFields) { + this.enrichRequiredFields = enrichRequiredFields; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsPutContentDefaultsRequest + */ + public APIcontentsPutContentDefaultsRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsPutContentDefaultsRequest + */ + public APIcontentsPutContentDefaultsRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Build call for putContentDefaults + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content updated. -
404 Content references, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putContentDefaultsCall(schema, id, enrichRequiredFields, unpublished, languages, _callback); + } + + /** + * Execute putContentDefaults request + * @return ContentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content updated. -
404 Content references, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ContentDto execute() throws ApiException { + ApiResponse localVarResp = putContentDefaultsWithHttpInfo(schema, id, enrichRequiredFields, unpublished, languages); + return localVarResp.getData(); + } + + /** + * Execute putContentDefaults request with HTTP info returned + * @return ApiResponse<ContentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content updated. -
404 Content references, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putContentDefaultsWithHttpInfo(schema, id, enrichRequiredFields, unpublished, languages); + } + + /** + * Execute putContentDefaults request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Content updated. -
404 Content references, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putContentDefaultsAsync(schema, id, enrichRequiredFields, unpublished, languages, _callback); + } + } + + /** + * Enrich a content item with defaults. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content item to update. (required) + * @return APIcontentsPutContentDefaultsRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content updated. -
404 Content references, schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIcontentsPutContentDefaultsRequest putContentDefaults(String schema, String id) { + return new APIcontentsPutContentDefaultsRequest(schema, id); + } + private okhttp3.Call putContentStatusCall(String schema, String id, ChangeStatusDto changeStatusDto, Boolean unpublished, String languages, 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 = changeStatusDto; + + // create path and map variables + String localVarPath = "/api/content/$app$/{schema}/{id}/status" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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 (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putContentStatusValidateBeforeCall(String schema, String id, ChangeStatusDto changeStatusDto, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + // verify the required parameter 'changeStatusDto' is set + if (changeStatusDto == null) { + throw new ApiException("Missing the required parameter 'changeStatusDto' when calling (Async)"); + } + + return putContentStatusCall(schema, id, changeStatusDto, unpublished, languages, _callback); + + } + + + private ApiResponse putContentStatusWithHttpInfo(String schema, String id, ChangeStatusDto changeStatusDto, Boolean unpublished, String languages) throws ApiException { + okhttp3.Call localVarCall = putContentStatusValidateBeforeCall(schema, id, changeStatusDto, unpublished, languages, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putContentStatusAsync(String schema, String id, ChangeStatusDto changeStatusDto, Boolean unpublished, String languages, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putContentStatusValidateBeforeCall(schema, id, changeStatusDto, unpublished, languages, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsPutContentStatusRequest { + private final String schema; + private final String id; + private final ChangeStatusDto changeStatusDto; + private Boolean unpublished; + private String languages; + + private APIcontentsPutContentStatusRequest(String schema, String id, ChangeStatusDto changeStatusDto) { + this.schema = schema; + this.id = id; + this.changeStatusDto = changeStatusDto; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsPutContentStatusRequest + */ + public APIcontentsPutContentStatusRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsPutContentStatusRequest + */ + public APIcontentsPutContentStatusRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Build call for putContentStatus + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content status changed. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putContentStatusCall(schema, id, changeStatusDto, unpublished, languages, _callback); + } + + /** + * Execute putContentStatus request + * @return ContentDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content status changed. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ContentDto execute() throws ApiException { + ApiResponse localVarResp = putContentStatusWithHttpInfo(schema, id, changeStatusDto, unpublished, languages); + return localVarResp.getData(); + } + + /** + * Execute putContentStatus request with HTTP info returned + * @return ApiResponse<ContentDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content status changed. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putContentStatusWithHttpInfo(schema, id, changeStatusDto, unpublished, languages); + } + + /** + * Execute putContentStatus request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Content status changed. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putContentStatusAsync(schema, id, changeStatusDto, unpublished, languages, _callback); + } + } + + /** + * Change status of a content item. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param schema The name of the schema. (required) + * @param id The ID of the content item to change. (required) + * @param changeStatusDto The status request. (required) + * @return APIcontentsPutContentStatusRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Content status changed. -
400 Content request not valid. -
404 Content, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsPutContentStatusRequest putContentStatus(String schema, String id, ChangeStatusDto changeStatusDto) { + return new APIcontentsPutContentStatusRequest(schema, id, changeStatusDto); + } + private okhttp3.Call bulkUpdateAllContentsCall(BulkUpdateContentsDto bulkUpdateContentsDto, String schema, 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 = bulkUpdateContentsDto; + + // create path and map variables + String localVarPath = "/api/content/$app$/bulk"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (schema != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("schema", schema)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call bulkUpdateAllContentsValidateBeforeCall(BulkUpdateContentsDto bulkUpdateContentsDto, String schema, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'bulkUpdateContentsDto' is set + if (bulkUpdateContentsDto == null) { + throw new ApiException("Missing the required parameter 'bulkUpdateContentsDto' when calling (Async)"); + } + + return bulkUpdateAllContentsCall(bulkUpdateContentsDto, schema, _callback); + + } + + + private ApiResponse> bulkUpdateAllContentsWithHttpInfo(BulkUpdateContentsDto bulkUpdateContentsDto, String schema) throws ApiException { + okhttp3.Call localVarCall = bulkUpdateAllContentsValidateBeforeCall(bulkUpdateContentsDto, schema, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call bulkUpdateAllContentsAsync(BulkUpdateContentsDto bulkUpdateContentsDto, String schema, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = bulkUpdateAllContentsValidateBeforeCall(bulkUpdateContentsDto, schema, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsSharedBulkUpdateAllContentsRequest { + private final BulkUpdateContentsDto bulkUpdateContentsDto; + private String schema; + + private APIcontentsSharedBulkUpdateAllContentsRequest(BulkUpdateContentsDto bulkUpdateContentsDto) { + this.bulkUpdateContentsDto = bulkUpdateContentsDto; + } + + /** + * Set schema + * @param schema The name of the schema. (optional) + * @return APIcontentsSharedBulkUpdateAllContentsRequest + */ + public APIcontentsSharedBulkUpdateAllContentsRequest schema(String schema) { + this.schema = schema; + return this; + } + + /** + * Build call for bulkUpdateAllContents + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 -
400 Contents request not valid. -
404 Contents references, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return bulkUpdateAllContentsCall(bulkUpdateContentsDto, schema, _callback); + } + + /** + * Execute bulkUpdateAllContents request + * @return List<BulkResultDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 -
400 Contents request not valid. -
404 Contents references, schema or app not found. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = bulkUpdateAllContentsWithHttpInfo(bulkUpdateContentsDto, schema); + return localVarResp.getData(); + } + + /** + * Execute bulkUpdateAllContents request with HTTP info returned + * @return ApiResponse<List<BulkResultDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 -
400 Contents request not valid. -
404 Contents references, schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return bulkUpdateAllContentsWithHttpInfo(bulkUpdateContentsDto, schema); + } + + /** + * Execute bulkUpdateAllContents request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 -
400 Contents request not valid. -
404 Contents references, schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return bulkUpdateAllContentsAsync(bulkUpdateContentsDto, schema, _callback); + } + } + + /** + * Bulk update content items. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param bulkUpdateContentsDto The bulk update request. (required) + * @return APIcontentsSharedBulkUpdateAllContentsRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 -
400 Contents request not valid. -
404 Contents references, schema or app not found. -
500 Operation failed. -
+ */ + public APIcontentsSharedBulkUpdateAllContentsRequest bulkUpdateAllContents(BulkUpdateContentsDto bulkUpdateContentsDto) { + return new APIcontentsSharedBulkUpdateAllContentsRequest(bulkUpdateContentsDto); + } + private okhttp3.Call getAllContentsCall(String ids, OffsetDateTime scheduleFrom, OffsetDateTime scheduleTo, String referencing, String references, String q, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, 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 = "/api/content/$app$"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (ids != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("ids", ids)); + } + + if (scheduleFrom != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("scheduleFrom", scheduleFrom)); + } + + if (scheduleTo != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("scheduleTo", scheduleTo)); + } + + if (referencing != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("referencing", referencing)); + } + + if (references != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("references", references)); + } + + if (q != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("q", q)); + } + + if (fields != null) { + localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + } + + if (flatten != null) { + localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + if (noSlowTotal != null) { + localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + } + + if (noTotal != null) { + localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAllContentsValidateBeforeCall(String ids, OffsetDateTime scheduleFrom, OffsetDateTime scheduleTo, String referencing, String references, String q, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, final ApiCallback _callback) throws ApiException { + return getAllContentsCall(ids, scheduleFrom, scheduleTo, referencing, references, q, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + + } + + + private ApiResponse getAllContentsWithHttpInfo(String ids, OffsetDateTime scheduleFrom, OffsetDateTime scheduleTo, String referencing, String references, String q, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished) throws ApiException { + okhttp3.Call localVarCall = getAllContentsValidateBeforeCall(ids, scheduleFrom, scheduleTo, referencing, references, q, fields, flatten, languages, noSlowTotal, noTotal, unpublished, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAllContentsAsync(String ids, OffsetDateTime scheduleFrom, OffsetDateTime scheduleTo, String referencing, String references, String q, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAllContentsValidateBeforeCall(ids, scheduleFrom, scheduleTo, referencing, references, q, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsSharedGetAllContentsRequest { + private String ids; + private OffsetDateTime scheduleFrom; + private OffsetDateTime scheduleTo; + private String referencing; + private String references; + private String q; + private String fields; + private Boolean flatten; + private String languages; + private Boolean noSlowTotal; + private Boolean noTotal; + private Boolean unpublished; + + private APIcontentsSharedGetAllContentsRequest() { + } + + /** + * Set ids + * @param ids The list of ids to query. (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest ids(String ids) { + this.ids = ids; + return this; + } + + /** + * Set scheduleFrom + * @param scheduleFrom The start of the schedule. (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest scheduleFrom(OffsetDateTime scheduleFrom) { + this.scheduleFrom = scheduleFrom; + return this; + } + + /** + * Set scheduleTo + * @param scheduleTo The end of the schedule. (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest scheduleTo(OffsetDateTime scheduleTo) { + this.scheduleTo = scheduleTo; + return this; + } + + /** + * Set referencing + * @param referencing The ID of the referencing content item. (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest referencing(String referencing) { + this.referencing = referencing; + return this; + } + + /** + * Set references + * @param references The ID of the reference content item. (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest references(String references) { + this.references = references; + return this; + } + + /** + * Set q + * @param q The optional json query. (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest q(String q) { + this.q = q; + return this; + } + + /** + * Set fields + * @param fields The list of content fields (comma-separated). (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest fields(String fields) { + this.fields = fields; + return this; + } + + /** + * Set flatten + * @param flatten Provide the data as flat object. (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest flatten(Boolean flatten) { + this.flatten = flatten; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Set noSlowTotal + * @param noSlowTotal Do not return the total amount, if it would be slow. (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest noSlowTotal(Boolean noSlowTotal) { + this.noSlowTotal = noSlowTotal; + return this; + } + + /** + * Set noTotal + * @param noTotal Do not return the total amount. (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest noTotal(Boolean noTotal) { + this.noTotal = noTotal; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsSharedGetAllContentsRequest + */ + public APIcontentsSharedGetAllContentsRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Build call for getAllContents + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAllContentsCall(ids, scheduleFrom, scheduleTo, referencing, references, q, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + } + + /** + * Execute getAllContents request + * @return ContentsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ContentsDto execute() throws ApiException { + ApiResponse localVarResp = getAllContentsWithHttpInfo(ids, scheduleFrom, scheduleTo, referencing, references, q, fields, flatten, languages, noSlowTotal, noTotal, unpublished); + return localVarResp.getData(); + } + + /** + * Execute getAllContents request with HTTP info returned + * @return ApiResponse<ContentsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAllContentsWithHttpInfo(ids, scheduleFrom, scheduleTo, referencing, references, q, fields, flatten, languages, noSlowTotal, noTotal, unpublished); + } + + /** + * Execute getAllContents request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAllContentsAsync(ids, scheduleFrom, scheduleTo, referencing, references, q, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + } + } + + /** + * Queries contents. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @return APIcontentsSharedGetAllContentsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIcontentsSharedGetAllContentsRequest getAllContents() { + return new APIcontentsSharedGetAllContentsRequest(); + } + private okhttp3.Call getAllContentsPostCall(AllContentsByPostDto allContentsByPostDto, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, 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 = allContentsByPostDto; + + // create path and map variables + String localVarPath = "/api/content/$app$"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (fields != null) { + localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + } + + if (flatten != null) { + localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + } + + if (languages != null) { + localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + } + + if (noSlowTotal != null) { + localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + } + + if (noTotal != null) { + localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAllContentsPostValidateBeforeCall(AllContentsByPostDto allContentsByPostDto, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'allContentsByPostDto' is set + if (allContentsByPostDto == null) { + throw new ApiException("Missing the required parameter 'allContentsByPostDto' when calling (Async)"); + } + + return getAllContentsPostCall(allContentsByPostDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + + } + + + private ApiResponse getAllContentsPostWithHttpInfo(AllContentsByPostDto allContentsByPostDto, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished) throws ApiException { + okhttp3.Call localVarCall = getAllContentsPostValidateBeforeCall(allContentsByPostDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAllContentsPostAsync(AllContentsByPostDto allContentsByPostDto, String fields, Boolean flatten, String languages, Boolean noSlowTotal, Boolean noTotal, Boolean unpublished, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAllContentsPostValidateBeforeCall(allContentsByPostDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsSharedGetAllContentsPostRequest { + private final AllContentsByPostDto allContentsByPostDto; + private String fields; + private Boolean flatten; + private String languages; + private Boolean noSlowTotal; + private Boolean noTotal; + private Boolean unpublished; + + private APIcontentsSharedGetAllContentsPostRequest(AllContentsByPostDto allContentsByPostDto) { + this.allContentsByPostDto = allContentsByPostDto; + } + + /** + * Set fields + * @param fields The list of content fields (comma-separated). (optional) + * @return APIcontentsSharedGetAllContentsPostRequest + */ + public APIcontentsSharedGetAllContentsPostRequest fields(String fields) { + this.fields = fields; + return this; + } + + /** + * Set flatten + * @param flatten Provide the data as flat object. (optional) + * @return APIcontentsSharedGetAllContentsPostRequest + */ + public APIcontentsSharedGetAllContentsPostRequest flatten(Boolean flatten) { + this.flatten = flatten; + return this; + } + + /** + * Set languages + * @param languages The list of languages to resolve (comma-separated). (optional) + * @return APIcontentsSharedGetAllContentsPostRequest + */ + public APIcontentsSharedGetAllContentsPostRequest languages(String languages) { + this.languages = languages; + return this; + } + + /** + * Set noSlowTotal + * @param noSlowTotal Do not return the total amount, if it would be slow. (optional) + * @return APIcontentsSharedGetAllContentsPostRequest + */ + public APIcontentsSharedGetAllContentsPostRequest noSlowTotal(Boolean noSlowTotal) { + this.noSlowTotal = noSlowTotal; + return this; + } + + /** + * Set noTotal + * @param noTotal Do not return the total amount. (optional) + * @return APIcontentsSharedGetAllContentsPostRequest + */ + public APIcontentsSharedGetAllContentsPostRequest noTotal(Boolean noTotal) { + this.noTotal = noTotal; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsSharedGetAllContentsPostRequest + */ + public APIcontentsSharedGetAllContentsPostRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Build call for getAllContentsPost + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAllContentsPostCall(allContentsByPostDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + } + + /** + * Execute getAllContentsPost request + * @return ContentsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ContentsDto execute() throws ApiException { + ApiResponse localVarResp = getAllContentsPostWithHttpInfo(allContentsByPostDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished); + return localVarResp.getData(); + } + + /** + * Execute getAllContentsPost request with HTTP info returned + * @return ApiResponse<ContentsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAllContentsPostWithHttpInfo(allContentsByPostDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished); + } + + /** + * Execute getAllContentsPost request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAllContentsPostAsync(allContentsByPostDto, fields, flatten, languages, noSlowTotal, noTotal, unpublished, _callback); + } + } + + /** + * Queries contents. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @param allContentsByPostDto The required query object. (required) + * @return APIcontentsSharedGetAllContentsPostRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIcontentsSharedGetAllContentsPostRequest getAllContentsPost(AllContentsByPostDto allContentsByPostDto) { + return new APIcontentsSharedGetAllContentsPostRequest(allContentsByPostDto); + } + private okhttp3.Call getGraphQLCall(String theQueryString, String variables, String operationName, Boolean unpublished, 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 = "/api/content/$app$/graphql"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (theQueryString != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("The query string", theQueryString)); + } + + if (variables != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("variables", variables)); + } + + if (operationName != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("operationName", operationName)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGraphQLValidateBeforeCall(String theQueryString, String variables, String operationName, Boolean unpublished, final ApiCallback _callback) throws ApiException { + return getGraphQLCall(theQueryString, variables, operationName, unpublished, _callback); + + } + + + private ApiResponse getGraphQLWithHttpInfo(String theQueryString, String variables, String operationName, Boolean unpublished) throws ApiException { + okhttp3.Call localVarCall = getGraphQLValidateBeforeCall(theQueryString, variables, operationName, unpublished, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getGraphQLAsync(String theQueryString, String variables, String operationName, Boolean unpublished, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGraphQLValidateBeforeCall(theQueryString, variables, operationName, unpublished, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsSharedGetGraphQLRequest { + private String theQueryString; + private String variables; + private String operationName; + private Boolean unpublished; + + private APIcontentsSharedGetGraphQLRequest() { + } + + /** + * Set theQueryString + * @param theQueryString The optional version of the asset. (optional) + * @return APIcontentsSharedGetGraphQLRequest + */ + public APIcontentsSharedGetGraphQLRequest theQueryString(String theQueryString) { + this.theQueryString = theQueryString; + return this; + } + + /** + * Set variables + * @param variables The optional operation variables. (optional) + * @return APIcontentsSharedGetGraphQLRequest + */ + public APIcontentsSharedGetGraphQLRequest variables(String variables) { + this.variables = variables; + return this; + } + + /** + * Set operationName + * @param operationName The optional operation name. (optional) + * @return APIcontentsSharedGetGraphQLRequest + */ + public APIcontentsSharedGetGraphQLRequest operationName(String operationName) { + this.operationName = operationName; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsSharedGetGraphQLRequest + */ + public APIcontentsSharedGetGraphQLRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Build call for getGraphQL + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getGraphQLCall(theQueryString, variables, operationName, unpublished, _callback); + } + + /** + * Execute getGraphQL request + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
500 Operation failed. -
+ */ + public Object execute() throws ApiException { + ApiResponse localVarResp = getGraphQLWithHttpInfo(theQueryString, variables, operationName, unpublished); + return localVarResp.getData(); + } + + /** + * Execute getGraphQL request with HTTP info returned + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getGraphQLWithHttpInfo(theQueryString, variables, operationName, unpublished); + } + + /** + * Execute getGraphQL request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getGraphQLAsync(theQueryString, variables, operationName, unpublished, _callback); + } + } + + /** + * GraphQL endpoint. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @return APIcontentsSharedGetGraphQLRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
500 Operation failed. -
+ */ + public APIcontentsSharedGetGraphQLRequest getGraphQL() { + return new APIcontentsSharedGetGraphQLRequest(); + } + private okhttp3.Call getGraphQLBatchCall(String theQueryString, String variables, String operationName, Boolean unpublished, 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 = "/api/content/$app$/graphql/batch"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (theQueryString != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("The query string", theQueryString)); + } + + if (variables != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("variables", variables)); + } + + if (operationName != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("operationName", operationName)); + } + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGraphQLBatchValidateBeforeCall(String theQueryString, String variables, String operationName, Boolean unpublished, final ApiCallback _callback) throws ApiException { + return getGraphQLBatchCall(theQueryString, variables, operationName, unpublished, _callback); + + } + + + private ApiResponse getGraphQLBatchWithHttpInfo(String theQueryString, String variables, String operationName, Boolean unpublished) throws ApiException { + okhttp3.Call localVarCall = getGraphQLBatchValidateBeforeCall(theQueryString, variables, operationName, unpublished, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getGraphQLBatchAsync(String theQueryString, String variables, String operationName, Boolean unpublished, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGraphQLBatchValidateBeforeCall(theQueryString, variables, operationName, unpublished, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsSharedGetGraphQLBatchRequest { + private String theQueryString; + private String variables; + private String operationName; + private Boolean unpublished; + + private APIcontentsSharedGetGraphQLBatchRequest() { + } + + /** + * Set theQueryString + * @param theQueryString The optional version of the asset. (optional) + * @return APIcontentsSharedGetGraphQLBatchRequest + */ + public APIcontentsSharedGetGraphQLBatchRequest theQueryString(String theQueryString) { + this.theQueryString = theQueryString; + return this; + } + + /** + * Set variables + * @param variables The optional operation variables. (optional) + * @return APIcontentsSharedGetGraphQLBatchRequest + */ + public APIcontentsSharedGetGraphQLBatchRequest variables(String variables) { + this.variables = variables; + return this; + } + + /** + * Set operationName + * @param operationName The optional operation name. (optional) + * @return APIcontentsSharedGetGraphQLBatchRequest + */ + public APIcontentsSharedGetGraphQLBatchRequest operationName(String operationName) { + this.operationName = operationName; + return this; + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsSharedGetGraphQLBatchRequest + */ + public APIcontentsSharedGetGraphQLBatchRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Build call for getGraphQLBatch + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getGraphQLBatchCall(theQueryString, variables, operationName, unpublished, _callback); + } + + /** + * Execute getGraphQLBatch request + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
500 Operation failed. -
+ */ + public Object execute() throws ApiException { + ApiResponse localVarResp = getGraphQLBatchWithHttpInfo(theQueryString, variables, operationName, unpublished); + return localVarResp.getData(); + } + + /** + * Execute getGraphQLBatch request with HTTP info returned + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getGraphQLBatchWithHttpInfo(theQueryString, variables, operationName, unpublished); + } + + /** + * Execute getGraphQLBatch request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getGraphQLBatchAsync(theQueryString, variables, operationName, unpublished, _callback); + } + } + + /** + * GraphQL batch endpoint. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @return APIcontentsSharedGetGraphQLBatchRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
500 Operation failed. -
+ */ + public APIcontentsSharedGetGraphQLBatchRequest getGraphQLBatch() { + return new APIcontentsSharedGetGraphQLBatchRequest(); + } + private okhttp3.Call postGraphQLCall(Boolean unpublished, Object body, 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 = body; + + // create path and map variables + String localVarPath = "/api/content/$app$/graphql"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postGraphQLValidateBeforeCall(Boolean unpublished, Object body, final ApiCallback _callback) throws ApiException { + return postGraphQLCall(unpublished, body, _callback); + + } + + + private ApiResponse postGraphQLWithHttpInfo(Boolean unpublished, Object body) throws ApiException { + okhttp3.Call localVarCall = postGraphQLValidateBeforeCall(unpublished, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postGraphQLAsync(Boolean unpublished, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postGraphQLValidateBeforeCall(unpublished, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsSharedPostGraphQLRequest { + private Boolean unpublished; + private Object body; + + private APIcontentsSharedPostGraphQLRequest() { + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsSharedPostGraphQLRequest + */ + public APIcontentsSharedPostGraphQLRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set body + * @param body The graphql request. (optional) + * @return APIcontentsSharedPostGraphQLRequest + */ + public APIcontentsSharedPostGraphQLRequest body(Object body) { + this.body = body; + return this; + } + + /** + * Build call for postGraphQL + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postGraphQLCall(unpublished, body, _callback); + } + + /** + * Execute postGraphQL request + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public Object execute() throws ApiException { + ApiResponse localVarResp = postGraphQLWithHttpInfo(unpublished, body); + return localVarResp.getData(); + } + + /** + * Execute postGraphQL request with HTTP info returned + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postGraphQLWithHttpInfo(unpublished, body); + } + + /** + * Execute postGraphQL request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postGraphQLAsync(unpublished, body, _callback); + } + } + + /** + * GraphQL endpoint. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @return APIcontentsSharedPostGraphQLRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIcontentsSharedPostGraphQLRequest postGraphQL() { + return new APIcontentsSharedPostGraphQLRequest(); + } + private okhttp3.Call postGraphQLBatchCall(Boolean unpublished, Object body, 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 = body; + + // create path and map variables + String localVarPath = "/api/content/$app$/graphql/batch"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (unpublished != null) { + localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + } + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postGraphQLBatchValidateBeforeCall(Boolean unpublished, Object body, final ApiCallback _callback) throws ApiException { + return postGraphQLBatchCall(unpublished, body, _callback); + + } + + + private ApiResponse postGraphQLBatchWithHttpInfo(Boolean unpublished, Object body) throws ApiException { + okhttp3.Call localVarCall = postGraphQLBatchValidateBeforeCall(unpublished, body, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postGraphQLBatchAsync(Boolean unpublished, Object body, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postGraphQLBatchValidateBeforeCall(unpublished, body, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIcontentsSharedPostGraphQLBatchRequest { + private Boolean unpublished; + private Object body; + + private APIcontentsSharedPostGraphQLBatchRequest() { + } + + /** + * Set unpublished + * @param unpublished Return unpublished content items. (optional) + * @return APIcontentsSharedPostGraphQLBatchRequest + */ + public APIcontentsSharedPostGraphQLBatchRequest unpublished(Boolean unpublished) { + this.unpublished = unpublished; + return this; + } + + /** + * Set body + * @param body The graphql request. (optional) + * @return APIcontentsSharedPostGraphQLBatchRequest + */ + public APIcontentsSharedPostGraphQLBatchRequest body(Object body) { + this.body = body; + return this; + } + + /** + * Build call for postGraphQLBatch + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postGraphQLBatchCall(unpublished, body, _callback); + } + + /** + * Execute postGraphQLBatch request + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public Object execute() throws ApiException { + ApiResponse localVarResp = postGraphQLBatchWithHttpInfo(unpublished, body); + return localVarResp.getData(); + } + + /** + * Execute postGraphQLBatch request with HTTP info returned + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postGraphQLBatchWithHttpInfo(unpublished, body); + } + + /** + * Execute postGraphQLBatch request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postGraphQLBatchAsync(unpublished, body, _callback); + } + } + + /** + * GraphQL batch endpoint. + * You can read the generated documentation for your app at /api/content/{appName}/docs. + * @return APIcontentsSharedPostGraphQLBatchRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contents returned or mutated. -
404 App not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIcontentsSharedPostGraphQLBatchRequest postGraphQLBatch() { + return new APIcontentsSharedPostGraphQLBatchRequest(); + } +} diff --git a/src/main/java/com/squidex/api/core/api/DiagnosticsApi.java b/src/main/java/com/squidex/api/core/api/DiagnosticsApi.java new file mode 100644 index 0000000..6c03ea8 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/DiagnosticsApi.java @@ -0,0 +1,375 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class DiagnosticsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public DiagnosticsApi() { + this(Configuration.getDefaultApiClient()); + } + + public DiagnosticsApi(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; + } + + private okhttp3.Call getDumpCall(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 = "/api/diagnostics/dump"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getDumpValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getDumpCall(_callback); + + } + + + private ApiResponse getDumpWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getDumpValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call getDumpAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getDumpValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIdiagnosticsGetDumpRequest { + + private APIdiagnosticsGetDumpRequest() { + } + + /** + * Build call for getDump + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Dump created successful. -
501 Not configured. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getDumpCall(_callback); + } + + /** + * Execute getDump request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Dump created successful. -
501 Not configured. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + getDumpWithHttpInfo(); + } + + /** + * Execute getDump request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Dump created successful. -
501 Not configured. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getDumpWithHttpInfo(); + } + + /** + * Execute getDump request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
204 Dump created successful. -
501 Not configured. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getDumpAsync(_callback); + } + } + + /** + * Creates a dump and writes it into storage.. + * + * @return APIdiagnosticsGetDumpRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Dump created successful. -
501 Not configured. -
500 Operation failed. -
+ */ + public APIdiagnosticsGetDumpRequest getDump() { + return new APIdiagnosticsGetDumpRequest(); + } + private okhttp3.Call getGCDumpCall(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 = "/api/diagnostics/gcdump"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getGCDumpValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getGCDumpCall(_callback); + + } + + + private ApiResponse getGCDumpWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getGCDumpValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call getGCDumpAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getGCDumpValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIdiagnosticsGetGCDumpRequest { + + private APIdiagnosticsGetGCDumpRequest() { + } + + /** + * Build call for getGCDump + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Dump created successful. -
501 Not configured. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getGCDumpCall(_callback); + } + + /** + * Execute getGCDump request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Dump created successful. -
501 Not configured. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + getGCDumpWithHttpInfo(); + } + + /** + * Execute getGCDump request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Dump created successful. -
501 Not configured. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getGCDumpWithHttpInfo(); + } + + /** + * Execute getGCDump request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
204 Dump created successful. -
501 Not configured. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getGCDumpAsync(_callback); + } + } + + /** + * Creates a gc dump and writes it into storage. + * + * @return APIdiagnosticsGetGCDumpRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Dump created successful. -
501 Not configured. -
500 Operation failed. -
+ */ + public APIdiagnosticsGetGCDumpRequest getGCDump() { + return new APIdiagnosticsGetGCDumpRequest(); + } +} diff --git a/src/main/java/com/squidex/api/core/api/EventConsumersApi.java b/src/main/java/com/squidex/api/core/api/EventConsumersApi.java new file mode 100644 index 0000000..a008421 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/EventConsumersApi.java @@ -0,0 +1,728 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.EventConsumerDto; +import com.squidex.api.types.EventConsumersDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class EventConsumersApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public EventConsumersApi() { + this(Configuration.getDefaultApiClient()); + } + + public EventConsumersApi(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; + } + + private okhttp3.Call getEventConsumersCall(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 = "/api/event-consumers"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getEventConsumersValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getEventConsumersCall(_callback); + + } + + + private ApiResponse getEventConsumersWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getEventConsumersValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getEventConsumersAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getEventConsumersValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIeventConsumersGetEventConsumersRequest { + + private APIeventConsumersGetEventConsumersRequest() { + } + + /** + * Build call for getEventConsumers + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Event consumers returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getEventConsumersCall(_callback); + } + + /** + * Execute getEventConsumers request + * @return EventConsumersDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Event consumers returned. -
500 Operation failed. -
+ */ + public EventConsumersDto execute() throws ApiException { + ApiResponse localVarResp = getEventConsumersWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getEventConsumers request with HTTP info returned + * @return ApiResponse<EventConsumersDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Event consumers returned. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getEventConsumersWithHttpInfo(); + } + + /** + * Execute getEventConsumers request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Event consumers returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getEventConsumersAsync(_callback); + } + } + + /** + * Get event consumers. + * + * @return APIeventConsumersGetEventConsumersRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Event consumers returned. -
500 Operation failed. -
+ */ + public APIeventConsumersGetEventConsumersRequest getEventConsumers() { + return new APIeventConsumersGetEventConsumersRequest(); + } + private okhttp3.Call resetEventConsumerCall(String consumerName, 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 = "/api/event-consumers/{consumerName}/reset" + .replace("{" + "consumerName" + "}", localVarApiClient.escapeString(consumerName.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call resetEventConsumerValidateBeforeCall(String consumerName, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'consumerName' is set + if (consumerName == null) { + throw new ApiException("Missing the required parameter 'consumerName' when calling (Async)"); + } + + return resetEventConsumerCall(consumerName, _callback); + + } + + + private ApiResponse resetEventConsumerWithHttpInfo(String consumerName) throws ApiException { + okhttp3.Call localVarCall = resetEventConsumerValidateBeforeCall(consumerName, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call resetEventConsumerAsync(String consumerName, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = resetEventConsumerValidateBeforeCall(consumerName, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIeventConsumersResetEventConsumerRequest { + private final String consumerName; + + private APIeventConsumersResetEventConsumerRequest(String consumerName) { + this.consumerName = consumerName; + } + + /** + * Build call for resetEventConsumer + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer resetted asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return resetEventConsumerCall(consumerName, _callback); + } + + /** + * Execute resetEventConsumer request + * @return EventConsumerDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer resetted asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public EventConsumerDto execute() throws ApiException { + ApiResponse localVarResp = resetEventConsumerWithHttpInfo(consumerName); + return localVarResp.getData(); + } + + /** + * Execute resetEventConsumer request with HTTP info returned + * @return ApiResponse<EventConsumerDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer resetted asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return resetEventConsumerWithHttpInfo(consumerName); + } + + /** + * Execute resetEventConsumer request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Event consumer resetted asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return resetEventConsumerAsync(consumerName, _callback); + } + } + + /** + * Reset an event consumer. + * + * @param consumerName The name of the event consumer. (required) + * @return APIeventConsumersResetEventConsumerRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer resetted asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIeventConsumersResetEventConsumerRequest resetEventConsumer(String consumerName) { + return new APIeventConsumersResetEventConsumerRequest(consumerName); + } + private okhttp3.Call startEventConsumerCall(String consumerName, 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 = "/api/event-consumers/{consumerName}/start" + .replace("{" + "consumerName" + "}", localVarApiClient.escapeString(consumerName.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call startEventConsumerValidateBeforeCall(String consumerName, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'consumerName' is set + if (consumerName == null) { + throw new ApiException("Missing the required parameter 'consumerName' when calling (Async)"); + } + + return startEventConsumerCall(consumerName, _callback); + + } + + + private ApiResponse startEventConsumerWithHttpInfo(String consumerName) throws ApiException { + okhttp3.Call localVarCall = startEventConsumerValidateBeforeCall(consumerName, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call startEventConsumerAsync(String consumerName, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = startEventConsumerValidateBeforeCall(consumerName, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIeventConsumersStartEventConsumerRequest { + private final String consumerName; + + private APIeventConsumersStartEventConsumerRequest(String consumerName) { + this.consumerName = consumerName; + } + + /** + * Build call for startEventConsumer + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer started asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return startEventConsumerCall(consumerName, _callback); + } + + /** + * Execute startEventConsumer request + * @return EventConsumerDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer started asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public EventConsumerDto execute() throws ApiException { + ApiResponse localVarResp = startEventConsumerWithHttpInfo(consumerName); + return localVarResp.getData(); + } + + /** + * Execute startEventConsumer request with HTTP info returned + * @return ApiResponse<EventConsumerDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer started asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return startEventConsumerWithHttpInfo(consumerName); + } + + /** + * Execute startEventConsumer request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Event consumer started asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return startEventConsumerAsync(consumerName, _callback); + } + } + + /** + * Start an event consumer. + * + * @param consumerName The name of the event consumer. (required) + * @return APIeventConsumersStartEventConsumerRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer started asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIeventConsumersStartEventConsumerRequest startEventConsumer(String consumerName) { + return new APIeventConsumersStartEventConsumerRequest(consumerName); + } + private okhttp3.Call stopEventConsumerCall(String consumerName, 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 = "/api/event-consumers/{consumerName}/stop" + .replace("{" + "consumerName" + "}", localVarApiClient.escapeString(consumerName.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call stopEventConsumerValidateBeforeCall(String consumerName, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'consumerName' is set + if (consumerName == null) { + throw new ApiException("Missing the required parameter 'consumerName' when calling (Async)"); + } + + return stopEventConsumerCall(consumerName, _callback); + + } + + + private ApiResponse stopEventConsumerWithHttpInfo(String consumerName) throws ApiException { + okhttp3.Call localVarCall = stopEventConsumerValidateBeforeCall(consumerName, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call stopEventConsumerAsync(String consumerName, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = stopEventConsumerValidateBeforeCall(consumerName, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIeventConsumersStopEventConsumerRequest { + private final String consumerName; + + private APIeventConsumersStopEventConsumerRequest(String consumerName) { + this.consumerName = consumerName; + } + + /** + * Build call for stopEventConsumer + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer stopped asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return stopEventConsumerCall(consumerName, _callback); + } + + /** + * Execute stopEventConsumer request + * @return EventConsumerDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer stopped asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public EventConsumerDto execute() throws ApiException { + ApiResponse localVarResp = stopEventConsumerWithHttpInfo(consumerName); + return localVarResp.getData(); + } + + /** + * Execute stopEventConsumer request with HTTP info returned + * @return ApiResponse<EventConsumerDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer stopped asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return stopEventConsumerWithHttpInfo(consumerName); + } + + /** + * Execute stopEventConsumer request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Event consumer stopped asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return stopEventConsumerAsync(consumerName, _callback); + } + } + + /** + * Stop an event consumer. + * + * @param consumerName The name of the event consumer. (required) + * @return APIeventConsumersStopEventConsumerRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Event consumer stopped asynchronously. -
404 Event consumer not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIeventConsumersStopEventConsumerRequest stopEventConsumer(String consumerName) { + return new APIeventConsumersStopEventConsumerRequest(consumerName); + } +} diff --git a/src/main/java/com/squidex/api/core/api/HistoryApi.java b/src/main/java/com/squidex/api/core/api/HistoryApi.java new file mode 100644 index 0000000..5096b2d --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/HistoryApi.java @@ -0,0 +1,423 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.HistoryEventDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class HistoryApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public HistoryApi() { + this(Configuration.getDefaultApiClient()); + } + + public HistoryApi(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; + } + + private okhttp3.Call getAppHistoryCall(String channel, 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 = "/api/apps/$app$/history"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (channel != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("channel", channel)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAppHistoryValidateBeforeCall(String channel, final ApiCallback _callback) throws ApiException { + return getAppHistoryCall(channel, _callback); + + } + + + private ApiResponse> getAppHistoryWithHttpInfo(String channel) throws ApiException { + okhttp3.Call localVarCall = getAppHistoryValidateBeforeCall(channel, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getAppHistoryAsync(String channel, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getAppHistoryValidateBeforeCall(channel, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIhistoryGetAppHistoryRequest { + private String channel; + + private APIhistoryGetAppHistoryRequest() { + } + + /** + * Set channel + * @param channel The name of the channel. (optional) + * @return APIhistoryGetAppHistoryRequest + */ + public APIhistoryGetAppHistoryRequest channel(String channel) { + this.channel = channel; + return this; + } + + /** + * Build call for getAppHistory + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Events returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAppHistoryCall(channel, _callback); + } + + /** + * Execute getAppHistory request + * @return List<HistoryEventDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Events returned. -
404 App not found. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getAppHistoryWithHttpInfo(channel); + return localVarResp.getData(); + } + + /** + * Execute getAppHistory request with HTTP info returned + * @return ApiResponse<List<HistoryEventDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Events returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getAppHistoryWithHttpInfo(channel); + } + + /** + * Execute getAppHistory request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Events returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getAppHistoryAsync(channel, _callback); + } + } + + /** + * Get the app history. + * + * @return APIhistoryGetAppHistoryRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Events returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIhistoryGetAppHistoryRequest getAppHistory() { + return new APIhistoryGetAppHistoryRequest(); + } + private okhttp3.Call getTeamHistoryCall(String team, String channel, 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 = "/api/teams/{team}/history" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (channel != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("channel", channel)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTeamHistoryValidateBeforeCall(String team, String channel, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + return getTeamHistoryCall(team, channel, _callback); + + } + + + private ApiResponse> getTeamHistoryWithHttpInfo(String team, String channel) throws ApiException { + okhttp3.Call localVarCall = getTeamHistoryValidateBeforeCall(team, channel, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getTeamHistoryAsync(String team, String channel, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getTeamHistoryValidateBeforeCall(team, channel, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIhistoryGetTeamHistoryRequest { + private final String team; + private String channel; + + private APIhistoryGetTeamHistoryRequest(String team) { + this.team = team; + } + + /** + * Set channel + * @param channel The name of the channel. (optional) + * @return APIhistoryGetTeamHistoryRequest + */ + public APIhistoryGetTeamHistoryRequest channel(String channel) { + this.channel = channel; + return this; + } + + /** + * Build call for getTeamHistory + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Events returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getTeamHistoryCall(team, channel, _callback); + } + + /** + * Execute getTeamHistory request + * @return List<HistoryEventDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Events returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getTeamHistoryWithHttpInfo(team, channel); + return localVarResp.getData(); + } + + /** + * Execute getTeamHistory request with HTTP info returned + * @return ApiResponse<List<HistoryEventDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Events returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getTeamHistoryWithHttpInfo(team, channel); + } + + /** + * Execute getTeamHistory request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Events returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getTeamHistoryAsync(team, channel, _callback); + } + } + + /** + * Get the team history. + * + * @param team The ID of the team. (required) + * @return APIhistoryGetTeamHistoryRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Events returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIhistoryGetTeamHistoryRequest getTeamHistory(String team) { + return new APIhistoryGetTeamHistoryRequest(team); + } +} diff --git a/src/main/java/com/squidex/api/core/api/JobsApi.java b/src/main/java/com/squidex/api/core/api/JobsApi.java new file mode 100644 index 0000000..2b5d96d --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/JobsApi.java @@ -0,0 +1,573 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; +import java.io.File; +import com.squidex.api.types.JobsDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class JobsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public JobsApi() { + this(Configuration.getDefaultApiClient()); + } + + public JobsApi(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; + } + + private okhttp3.Call getJobContentCall(String id, String appId, 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 = "/api/apps/jobs/{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(); + + if (appId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("appId", appId)); + } + + final String[] localVarAccepts = { + "application/octet-stream", + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getJobContentValidateBeforeCall(String id, String appId, 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 (Async)"); + } + + return getJobContentCall(id, appId, _callback); + + } + + + private ApiResponse getJobContentWithHttpInfo(String id, String appId) throws ApiException { + okhttp3.Call localVarCall = getJobContentValidateBeforeCall(id, appId, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getJobContentAsync(String id, String appId, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getJobContentValidateBeforeCall(id, appId, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIjobsContentGetJobContentRequest { + private final String id; + private String appId; + + private APIjobsContentGetJobContentRequest(String id) { + this.id = id; + } + + /** + * Set appId + * @param appId The ID of the app. (optional) + * @return APIjobsContentGetJobContentRequest + */ + public APIjobsContentGetJobContentRequest appId(String appId) { + this.appId = appId; + return this; + } + + /** + * Build call for getJobContent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Job found and content returned. -
404 Job or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getJobContentCall(id, appId, _callback); + } + + /** + * Execute getJobContent request + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Job found and content returned. -
404 Job or app not found. -
500 Operation failed. -
+ */ + public File execute() throws ApiException { + ApiResponse localVarResp = getJobContentWithHttpInfo(id, appId); + return localVarResp.getData(); + } + + /** + * Execute getJobContent request with HTTP info returned + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Job found and content returned. -
404 Job or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getJobContentWithHttpInfo(id, appId); + } + + /** + * Execute getJobContent request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Job found and content returned. -
404 Job or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getJobContentAsync(id, appId, _callback); + } + } + + /** + * Get the job content. + * + * @param id The ID of the job. (required) + * @return APIjobsContentGetJobContentRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Job found and content returned. -
404 Job or app not found. -
500 Operation failed. -
+ */ + public APIjobsContentGetJobContentRequest getJobContent(String id) { + return new APIjobsContentGetJobContentRequest(id); + } + private okhttp3.Call deleteJobCall(String 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 = "/api/apps/$app$/jobs/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteJobValidateBeforeCall(String 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 (Async)"); + } + + return deleteJobCall(id, _callback); + + } + + + private ApiResponse deleteJobWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteJobValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteJobAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteJobValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIjobsDeleteJobRequest { + private final String id; + + private APIjobsDeleteJobRequest(String id) { + this.id = id; + } + + /** + * Build call for deleteJob + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Job deleted. -
404 Job or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteJobCall(id, _callback); + } + + /** + * Execute deleteJob request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Job deleted. -
404 Job or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteJobWithHttpInfo(id); + } + + /** + * Execute deleteJob request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Job deleted. -
404 Job or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteJobWithHttpInfo(id); + } + + /** + * Execute deleteJob request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Job deleted. -
404 Job or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteJobAsync(id, _callback); + } + } + + /** + * Delete a job. + * + * @param id The ID of the jobs to delete. (required) + * @return APIjobsDeleteJobRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Job deleted. -
404 Job or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIjobsDeleteJobRequest deleteJob(String id) { + return new APIjobsDeleteJobRequest(id); + } + private okhttp3.Call getJobsCall(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 = "/api/apps/$app$/jobs"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getJobsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getJobsCall(_callback); + + } + + + private ApiResponse getJobsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getJobsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getJobsAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getJobsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIjobsGetJobsRequest { + + private APIjobsGetJobsRequest() { + } + + /** + * Build call for getJobs + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Jobs returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getJobsCall(_callback); + } + + /** + * Execute getJobs request + * @return JobsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Jobs returned. -
404 App not found. -
500 Operation failed. -
+ */ + public JobsDto execute() throws ApiException { + ApiResponse localVarResp = getJobsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getJobs request with HTTP info returned + * @return ApiResponse<JobsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Jobs returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getJobsWithHttpInfo(); + } + + /** + * Execute getJobs request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Jobs returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getJobsAsync(_callback); + } + } + + /** + * Get all jobs. + * + * @return APIjobsGetJobsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Jobs returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIjobsGetJobsRequest getJobs() { + return new APIjobsGetJobsRequest(); + } +} diff --git a/src/main/java/com/squidex/api/core/api/LanguagesApi.java b/src/main/java/com/squidex/api/core/api/LanguagesApi.java new file mode 100644 index 0000000..ca493c8 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/LanguagesApi.java @@ -0,0 +1,226 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.LanguageDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class LanguagesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public LanguagesApi() { + this(Configuration.getDefaultApiClient()); + } + + public LanguagesApi(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; + } + + private okhttp3.Call getLanguagesCall(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 = "/api/languages"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getLanguagesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getLanguagesCall(_callback); + + } + + + private ApiResponse> getLanguagesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getLanguagesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getLanguagesAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getLanguagesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIlanguagesGetLanguagesRequest { + + private APIlanguagesGetLanguagesRequest() { + } + + /** + * Build call for getLanguages + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Supported language codes returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getLanguagesCall(_callback); + } + + /** + * Execute getLanguages request + * @return List<LanguageDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Supported language codes returned. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getLanguagesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getLanguages request with HTTP info returned + * @return ApiResponse<List<LanguageDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Supported language codes returned. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getLanguagesWithHttpInfo(); + } + + /** + * Execute getLanguages request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Supported language codes returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getLanguagesAsync(_callback); + } + } + + /** + * Get supported languages. + * Provide a list of supported language codes, following the ISO2Code standard. + * @return APIlanguagesGetLanguagesRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Supported language codes returned. -
500 Operation failed. -
+ */ + public APIlanguagesGetLanguagesRequest getLanguages() { + return new APIlanguagesGetLanguagesRequest(); + } +} diff --git a/src/main/java/com/squidex/api/core/api/NewsApi.java b/src/main/java/com/squidex/api/core/api/NewsApi.java new file mode 100644 index 0000000..bb0068c --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/NewsApi.java @@ -0,0 +1,241 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.FeaturesDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class NewsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public NewsApi() { + this(Configuration.getDefaultApiClient()); + } + + public NewsApi(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; + } + + private okhttp3.Call getNewsCall(Integer version, 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 = "/api/news/features"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (version != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("version", version)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getNewsValidateBeforeCall(Integer version, final ApiCallback _callback) throws ApiException { + return getNewsCall(version, _callback); + + } + + + private ApiResponse getNewsWithHttpInfo(Integer version) throws ApiException { + okhttp3.Call localVarCall = getNewsValidateBeforeCall(version, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getNewsAsync(Integer version, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getNewsValidateBeforeCall(version, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APInewsGetNewsRequest { + private Integer version; + + private APInewsGetNewsRequest() { + } + + /** + * Set version + * @param version The latest received version. (optional, default to 0) + * @return APInewsGetNewsRequest + */ + public APInewsGetNewsRequest version(Integer version) { + this.version = version; + return this; + } + + /** + * Build call for getNews + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Latest features returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getNewsCall(version, _callback); + } + + /** + * Execute getNews request + * @return FeaturesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Latest features returned. -
500 Operation failed. -
+ */ + public FeaturesDto execute() throws ApiException { + ApiResponse localVarResp = getNewsWithHttpInfo(version); + return localVarResp.getData(); + } + + /** + * Execute getNews request with HTTP info returned + * @return ApiResponse<FeaturesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Latest features returned. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getNewsWithHttpInfo(version); + } + + /** + * Execute getNews request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Latest features returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getNewsAsync(version, _callback); + } + } + + /** + * Get features since version. + * + * @return APInewsGetNewsRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Latest features returned. -
500 Operation failed. -
+ */ + public APInewsGetNewsRequest getNews() { + return new APInewsGetNewsRequest(); + } +} diff --git a/src/main/java/com/squidex/api/core/api/PingApi.java b/src/main/java/com/squidex/api/core/api/PingApi.java new file mode 100644 index 0000000..5aa1429 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/PingApi.java @@ -0,0 +1,513 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class PingApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PingApi() { + this(Configuration.getDefaultApiClient()); + } + + public PingApi(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; + } + + private okhttp3.Call getAppPingCall(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 = "/api/ping/$app$"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getAppPingValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getAppPingCall(_callback); + + } + + + private ApiResponse getAppPingWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getAppPingValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call getAppPingAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getAppPingValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIpingGetAppPingRequest { + + private APIpingGetAppPingRequest() { + } + + /** + * Build call for getAppPing + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
204 Service ping successful. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getAppPingCall(_callback); + } + + /** + * Execute getAppPing request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
204 Service ping successful. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + getAppPingWithHttpInfo(); + } + + /** + * Execute getAppPing request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
204 Service ping successful. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getAppPingWithHttpInfo(); + } + + /** + * Execute getAppPing request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
204 Service ping successful. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getAppPingAsync(_callback); + } + } + + /** + * Get ping status. + * Can be used to test, if the Squidex API is alive and responding. + * @return APIpingGetAppPingRequest + * @http.response.details + + + + +
Status Code Description Response Headers
204 Service ping successful. -
500 Operation failed. -
+ */ + public APIpingGetAppPingRequest getAppPing() { + return new APIpingGetAppPingRequest(); + } + private okhttp3.Call getInfoCall(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 = "/api/info"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getInfoValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getInfoCall(_callback); + + } + + + private ApiResponse> getInfoWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getInfoValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getInfoAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getInfoValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIpingGetInfoRequest { + + private APIpingGetInfoRequest() { + } + + /** + * Build call for getInfo + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Infos returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getInfoCall(_callback); + } + + /** + * Execute getInfo request + * @return Map<String, String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Infos returned. -
500 Operation failed. -
+ */ + public Map execute() throws ApiException { + ApiResponse> localVarResp = getInfoWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getInfo request with HTTP info returned + * @return ApiResponse<Map<String, String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Infos returned. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getInfoWithHttpInfo(); + } + + /** + * Execute getInfo request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Infos returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getInfoAsync(_callback); + } + } + + /** + * Get API information. + * + * @return APIpingGetInfoRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Infos returned. -
500 Operation failed. -
+ */ + public APIpingGetInfoRequest getInfo() { + return new APIpingGetInfoRequest(); + } + private okhttp3.Call getPingCall(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 = "/api/ping"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPingValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getPingCall(_callback); + + } + + + private ApiResponse getPingWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getPingValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call getPingAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPingValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIpingGetPingRequest { + + private APIpingGetPingRequest() { + } + + /** + * Build call for getPing + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
204 Service ping successful. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getPingCall(_callback); + } + + /** + * Execute getPing request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
204 Service ping successful. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + getPingWithHttpInfo(); + } + + /** + * Execute getPing request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
204 Service ping successful. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getPingWithHttpInfo(); + } + + /** + * Execute getPing request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
204 Service ping successful. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getPingAsync(_callback); + } + } + + /** + * Get ping status of the API. + * Can be used to test, if the Squidex API is alive and responding. + * @return APIpingGetPingRequest + * @http.response.details + + + + +
Status Code Description Response Headers
204 Service ping successful. -
500 Operation failed. -
+ */ + public APIpingGetPingRequest getPing() { + return new APIpingGetPingRequest(); + } +} diff --git a/src/main/java/com/squidex/api/core/api/PlansApi.java b/src/main/java/com/squidex/api/core/api/PlansApi.java new file mode 100644 index 0000000..9f6f3c3 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/PlansApi.java @@ -0,0 +1,738 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ChangePlanDto; +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.PlanChangedDto; +import com.squidex.api.types.PlansDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class PlansApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public PlansApi() { + this(Configuration.getDefaultApiClient()); + } + + public PlansApi(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; + } + + private okhttp3.Call getPlansCall(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 = "/api/apps/$app$/plans"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getPlansValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getPlansCall(_callback); + + } + + + private ApiResponse getPlansWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getPlansValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getPlansAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getPlansValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappPlansGetPlansRequest { + + private APIappPlansGetPlansRequest() { + } + + /** + * Build call for getPlans + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App plan information returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getPlansCall(_callback); + } + + /** + * Execute getPlans request + * @return PlansDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App plan information returned. -
404 App not found. -
500 Operation failed. -
+ */ + public PlansDto execute() throws ApiException { + ApiResponse localVarResp = getPlansWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getPlans request with HTTP info returned + * @return ApiResponse<PlansDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App plan information returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getPlansWithHttpInfo(); + } + + /** + * Execute getPlans request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 App plan information returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getPlansAsync(_callback); + } + } + + /** + * Get app plan information. + * + * @return APIappPlansGetPlansRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 App plan information returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappPlansGetPlansRequest getPlans() { + return new APIappPlansGetPlansRequest(); + } + private okhttp3.Call putPlanCall(ChangePlanDto changePlanDto, 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 = changePlanDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/plan"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putPlanValidateBeforeCall(ChangePlanDto changePlanDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'changePlanDto' is set + if (changePlanDto == null) { + throw new ApiException("Missing the required parameter 'changePlanDto' when calling (Async)"); + } + + return putPlanCall(changePlanDto, _callback); + + } + + + private ApiResponse putPlanWithHttpInfo(ChangePlanDto changePlanDto) throws ApiException { + okhttp3.Call localVarCall = putPlanValidateBeforeCall(changePlanDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putPlanAsync(ChangePlanDto changePlanDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putPlanValidateBeforeCall(changePlanDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIappPlansPutPlanRequest { + private final ChangePlanDto changePlanDto; + + private APIappPlansPutPlanRequest(ChangePlanDto changePlanDto) { + this.changePlanDto = changePlanDto; + } + + /** + * Build call for putPlan + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Plan changed or redirect url returned. -
400 Plan not owned by user. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putPlanCall(changePlanDto, _callback); + } + + /** + * Execute putPlan request + * @return PlanChangedDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Plan changed or redirect url returned. -
400 Plan not owned by user. -
404 App not found. -
500 Operation failed. -
+ */ + public PlanChangedDto execute() throws ApiException { + ApiResponse localVarResp = putPlanWithHttpInfo(changePlanDto); + return localVarResp.getData(); + } + + /** + * Execute putPlan request with HTTP info returned + * @return ApiResponse<PlanChangedDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Plan changed or redirect url returned. -
400 Plan not owned by user. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putPlanWithHttpInfo(changePlanDto); + } + + /** + * Execute putPlan request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Plan changed or redirect url returned. -
400 Plan not owned by user. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putPlanAsync(changePlanDto, _callback); + } + } + + /** + * Change the app plan. + * + * @param changePlanDto Plan object that needs to be changed. (required) + * @return APIappPlansPutPlanRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Plan changed or redirect url returned. -
400 Plan not owned by user. -
404 App not found. -
500 Operation failed. -
+ */ + public APIappPlansPutPlanRequest putPlan(ChangePlanDto changePlanDto) { + return new APIappPlansPutPlanRequest(changePlanDto); + } + private okhttp3.Call getTeamPlansCall(String team, 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 = "/api/teams/{team}/plans" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTeamPlansValidateBeforeCall(String team, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + return getTeamPlansCall(team, _callback); + + } + + + private ApiResponse getTeamPlansWithHttpInfo(String team) throws ApiException { + okhttp3.Call localVarCall = getTeamPlansValidateBeforeCall(team, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getTeamPlansAsync(String team, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTeamPlansValidateBeforeCall(team, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamPlansGetTeamPlansRequest { + private final String team; + + private APIteamPlansGetTeamPlansRequest(String team) { + this.team = team; + } + + /** + * Build call for getTeamPlans + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Team plan information returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getTeamPlansCall(team, _callback); + } + + /** + * Execute getTeamPlans request + * @return PlansDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Team plan information returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public PlansDto execute() throws ApiException { + ApiResponse localVarResp = getTeamPlansWithHttpInfo(team); + return localVarResp.getData(); + } + + /** + * Execute getTeamPlans request with HTTP info returned + * @return ApiResponse<PlansDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Team plan information returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getTeamPlansWithHttpInfo(team); + } + + /** + * Execute getTeamPlans request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Team plan information returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getTeamPlansAsync(team, _callback); + } + } + + /** + * Get team plan information. + * + * @param team The name of the team. (required) + * @return APIteamPlansGetTeamPlansRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Team plan information returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIteamPlansGetTeamPlansRequest getTeamPlans(String team) { + return new APIteamPlansGetTeamPlansRequest(team); + } + private okhttp3.Call putTeamPlanCall(String team, ChangePlanDto changePlanDto, 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 = changePlanDto; + + // create path and map variables + String localVarPath = "/api/teams/{team}/plan" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putTeamPlanValidateBeforeCall(String team, ChangePlanDto changePlanDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + // verify the required parameter 'changePlanDto' is set + if (changePlanDto == null) { + throw new ApiException("Missing the required parameter 'changePlanDto' when calling (Async)"); + } + + return putTeamPlanCall(team, changePlanDto, _callback); + + } + + + private ApiResponse putTeamPlanWithHttpInfo(String team, ChangePlanDto changePlanDto) throws ApiException { + okhttp3.Call localVarCall = putTeamPlanValidateBeforeCall(team, changePlanDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putTeamPlanAsync(String team, ChangePlanDto changePlanDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putTeamPlanValidateBeforeCall(team, changePlanDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamPlansPutTeamPlanRequest { + private final String team; + private final ChangePlanDto changePlanDto; + + private APIteamPlansPutTeamPlanRequest(String team, ChangePlanDto changePlanDto) { + this.team = team; + this.changePlanDto = changePlanDto; + } + + /** + * Build call for putTeamPlan + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Plan changed or redirect url returned. -
404 Team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putTeamPlanCall(team, changePlanDto, _callback); + } + + /** + * Execute putTeamPlan request + * @return PlanChangedDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Plan changed or redirect url returned. -
404 Team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public PlanChangedDto execute() throws ApiException { + ApiResponse localVarResp = putTeamPlanWithHttpInfo(team, changePlanDto); + return localVarResp.getData(); + } + + /** + * Execute putTeamPlan request with HTTP info returned + * @return ApiResponse<PlanChangedDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Plan changed or redirect url returned. -
404 Team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putTeamPlanWithHttpInfo(team, changePlanDto); + } + + /** + * Execute putTeamPlan request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Plan changed or redirect url returned. -
404 Team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putTeamPlanAsync(team, changePlanDto, _callback); + } + } + + /** + * Change the team plan. + * + * @param team The name of the team. (required) + * @param changePlanDto Plan object that needs to be changed. (required) + * @return APIteamPlansPutTeamPlanRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Plan changed or redirect url returned. -
404 Team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIteamPlansPutTeamPlanRequest putTeamPlan(String team, ChangePlanDto changePlanDto) { + return new APIteamPlansPutTeamPlanRequest(team, changePlanDto); + } +} diff --git a/src/main/java/com/squidex/api/core/api/RulesApi.java b/src/main/java/com/squidex/api/core/api/RulesApi.java new file mode 100644 index 0000000..80fe863 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/RulesApi.java @@ -0,0 +1,3180 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.CreateRuleDto; +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.RuleDto; +import com.squidex.api.types.RuleElementDto; +import com.squidex.api.types.RuleEventsDto; +import com.squidex.api.types.RulesDto; +import com.squidex.api.types.SimulatedRuleEventsDto; +import com.squidex.api.types.UpdateRuleDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class RulesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public RulesApi() { + this(Configuration.getDefaultApiClient()); + } + + public RulesApi(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; + } + + private okhttp3.Call deleteEventCall(String 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 = "/api/apps/$app$/rules/events/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteEventValidateBeforeCall(String 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 (Async)"); + } + + return deleteEventCall(id, _callback); + + } + + + private ApiResponse deleteEventWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteEventValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteEventAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteEventValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIrulesDeleteEventRequest { + private final String id; + + private APIrulesDeleteEventRequest(String id) { + this.id = id; + } + + /** + * Build call for deleteEvent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule event cancelled. -
404 App or rule event not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteEventCall(id, _callback); + } + + /** + * Execute deleteEvent request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule event cancelled. -
404 App or rule event not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteEventWithHttpInfo(id); + } + + /** + * Execute deleteEvent request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule event cancelled. -
404 App or rule event not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteEventWithHttpInfo(id); + } + + /** + * Execute deleteEvent request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Rule event cancelled. -
404 App or rule event not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteEventAsync(id, _callback); + } + } + + /** + * Cancels an event. + * + * @param id The event to cancel. (required) + * @return APIrulesDeleteEventRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule event cancelled. -
404 App or rule event not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesDeleteEventRequest deleteEvent(String id) { + return new APIrulesDeleteEventRequest(id); + } + private okhttp3.Call deleteEventsCall(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 = "/api/apps/$app$/rules/events"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteEventsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return deleteEventsCall(_callback); + + } + + + private ApiResponse deleteEventsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = deleteEventsValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteEventsAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteEventsValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIrulesDeleteEventsRequest { + + private APIrulesDeleteEventsRequest() { + } + + /** + * Build call for deleteEvents + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Events cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteEventsCall(_callback); + } + + /** + * Execute deleteEvents request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Events cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteEventsWithHttpInfo(); + } + + /** + * Execute deleteEvents request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Events cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteEventsWithHttpInfo(); + } + + /** + * Execute deleteEvents request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
204 Events cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteEventsAsync(_callback); + } + } + + /** + * Cancels all events. + * + * @return APIrulesDeleteEventsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Events cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesDeleteEventsRequest deleteEvents() { + return new APIrulesDeleteEventsRequest(); + } + private okhttp3.Call deleteRuleCall(String 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 = "/api/apps/$app$/rules/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteRuleValidateBeforeCall(String 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 (Async)"); + } + + return deleteRuleCall(id, _callback); + + } + + + private ApiResponse deleteRuleWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteRuleValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteRuleAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteRuleValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIrulesDeleteRuleRequest { + private final String id; + + private APIrulesDeleteRuleRequest(String id) { + this.id = id; + } + + /** + * Build call for deleteRule + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule deleted. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteRuleCall(id, _callback); + } + + /** + * Execute deleteRule request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule deleted. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteRuleWithHttpInfo(id); + } + + /** + * Execute deleteRule request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule deleted. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteRuleWithHttpInfo(id); + } + + /** + * Execute deleteRule request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Rule deleted. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteRuleAsync(id, _callback); + } + } + + /** + * Delete a rule. + * + * @param id The ID of the rule to delete. (required) + * @return APIrulesDeleteRuleRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule deleted. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesDeleteRuleRequest deleteRule(String id) { + return new APIrulesDeleteRuleRequest(id); + } + private okhttp3.Call deleteRuleEventsCall(String 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 = "/api/apps/$app$/rules/{id}/events" + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteRuleEventsValidateBeforeCall(String 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 (Async)"); + } + + return deleteRuleEventsCall(id, _callback); + + } + + + private ApiResponse deleteRuleEventsWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteRuleEventsValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteRuleEventsAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteRuleEventsValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIrulesDeleteRuleEventsRequest { + private final String id; + + private APIrulesDeleteRuleEventsRequest(String id) { + this.id = id; + } + + /** + * Build call for deleteRuleEvents + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule events cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteRuleEventsCall(id, _callback); + } + + /** + * Execute deleteRuleEvents request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule events cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteRuleEventsWithHttpInfo(id); + } + + /** + * Execute deleteRuleEvents request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule events cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteRuleEventsWithHttpInfo(id); + } + + /** + * Execute deleteRuleEvents request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
204 Rule events cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteRuleEventsAsync(id, _callback); + } + } + + /** + * Cancels all rule events. + * + * @param id The ID of the rule to cancel. (required) + * @return APIrulesDeleteRuleEventsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule events cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesDeleteRuleEventsRequest deleteRuleEvents(String id) { + return new APIrulesDeleteRuleEventsRequest(id); + } + private okhttp3.Call deleteRuleRunCall(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 = "/api/apps/$app$/rules/run"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteRuleRunValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return deleteRuleRunCall(_callback); + + } + + + private ApiResponse deleteRuleRunWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = deleteRuleRunValidateBeforeCall(null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteRuleRunAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteRuleRunValidateBeforeCall(_callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIrulesDeleteRuleRunRequest { + + private APIrulesDeleteRuleRunRequest() { + } + + /** + * Build call for deleteRuleRun + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule run cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteRuleRunCall(_callback); + } + + /** + * Execute deleteRuleRun request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule run cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteRuleRunWithHttpInfo(); + } + + /** + * Execute deleteRuleRun request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule run cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteRuleRunWithHttpInfo(); + } + + /** + * Execute deleteRuleRun request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
204 Rule run cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteRuleRunAsync(_callback); + } + } + + /** + * Cancel the current run. + * + * @return APIrulesDeleteRuleRunRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule run cancelled. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesDeleteRuleRunRequest deleteRuleRun() { + return new APIrulesDeleteRuleRunRequest(); + } + private okhttp3.Call disableRuleCall(String 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 = "/api/apps/$app$/rules/{id}/disable" + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call disableRuleValidateBeforeCall(String 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 (Async)"); + } + + return disableRuleCall(id, _callback); + + } + + + private ApiResponse disableRuleWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = disableRuleValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call disableRuleAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = disableRuleValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesDisableRuleRequest { + private final String id; + + private APIrulesDisableRuleRequest(String id) { + this.id = id; + } + + /** + * Build call for disableRule + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule disabled. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return disableRuleCall(id, _callback); + } + + /** + * Execute disableRule request + * @return RuleDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule disabled. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public RuleDto execute() throws ApiException { + ApiResponse localVarResp = disableRuleWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute disableRule request with HTTP info returned + * @return ApiResponse<RuleDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule disabled. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return disableRuleWithHttpInfo(id); + } + + /** + * Execute disableRule request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Rule disabled. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return disableRuleAsync(id, _callback); + } + } + + /** + * Disable a rule. + * + * @param id The ID of the rule to disable. (required) + * @return APIrulesDisableRuleRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule disabled. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesDisableRuleRequest disableRule(String id) { + return new APIrulesDisableRuleRequest(id); + } + private okhttp3.Call enableRuleCall(String 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 = "/api/apps/$app$/rules/{id}/enable" + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call enableRuleValidateBeforeCall(String 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 (Async)"); + } + + return enableRuleCall(id, _callback); + + } + + + private ApiResponse enableRuleWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = enableRuleValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call enableRuleAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = enableRuleValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesEnableRuleRequest { + private final String id; + + private APIrulesEnableRuleRequest(String id) { + this.id = id; + } + + /** + * Build call for enableRule + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule enabled. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return enableRuleCall(id, _callback); + } + + /** + * Execute enableRule request + * @return RuleDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule enabled. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public RuleDto execute() throws ApiException { + ApiResponse localVarResp = enableRuleWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute enableRule request with HTTP info returned + * @return ApiResponse<RuleDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule enabled. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return enableRuleWithHttpInfo(id); + } + + /** + * Execute enableRule request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Rule enabled. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return enableRuleAsync(id, _callback); + } + } + + /** + * Enable a rule. + * + * @param id The ID of the rule to enable. (required) + * @return APIrulesEnableRuleRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule enabled. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesEnableRuleRequest enableRule(String id) { + return new APIrulesEnableRuleRequest(id); + } + private okhttp3.Call getActionsCall(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 = "/api/rules/actions"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getActionsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getActionsCall(_callback); + + } + + + private ApiResponse> getActionsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getActionsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getActionsAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getActionsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesGetActionsRequest { + + private APIrulesGetActionsRequest() { + } + + /** + * Build call for getActions + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Rule actions returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getActionsCall(_callback); + } + + /** + * Execute getActions request + * @return Map<String, RuleElementDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Rule actions returned. -
500 Operation failed. -
+ */ + public Map execute() throws ApiException { + ApiResponse> localVarResp = getActionsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getActions request with HTTP info returned + * @return ApiResponse<Map<String, RuleElementDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Rule actions returned. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getActionsWithHttpInfo(); + } + + /** + * Execute getActions request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Rule actions returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getActionsAsync(_callback); + } + } + + /** + * Get supported rule actions. + * + * @return APIrulesGetActionsRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Rule actions returned. -
500 Operation failed. -
+ */ + public APIrulesGetActionsRequest getActions() { + return new APIrulesGetActionsRequest(); + } + private okhttp3.Call getEventSchemaCall(String type, 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 = "/api/rules/eventtypes/{type}" + .replace("{" + "type" + "}", localVarApiClient.escapeString(type.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getEventSchemaValidateBeforeCall(String type, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'type' is set + if (type == null) { + throw new ApiException("Missing the required parameter 'type' when calling (Async)"); + } + + return getEventSchemaCall(type, _callback); + + } + + + private ApiResponse getEventSchemaWithHttpInfo(String type) throws ApiException { + okhttp3.Call localVarCall = getEventSchemaValidateBeforeCall(type, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getEventSchemaAsync(String type, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getEventSchemaValidateBeforeCall(type, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesGetEventSchemaRequest { + private final String type; + + private APIrulesGetEventSchemaRequest(String type) { + this.type = type; + } + + /** + * Build call for getEventSchema + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule event type found. -
404 Rule event not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getEventSchemaCall(type, _callback); + } + + /** + * Execute getEventSchema request + * @return Object + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule event type found. -
404 Rule event not found. -
500 Operation failed. -
+ */ + public Object execute() throws ApiException { + ApiResponse localVarResp = getEventSchemaWithHttpInfo(type); + return localVarResp.getData(); + } + + /** + * Execute getEventSchema request with HTTP info returned + * @return ApiResponse<Object> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule event type found. -
404 Rule event not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getEventSchemaWithHttpInfo(type); + } + + /** + * Execute getEventSchema request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Rule event type found. -
404 Rule event not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getEventSchemaAsync(type, _callback); + } + } + + /** + * Provide the json schema for the event with the specified name. + * + * @param type The type name of the event. (required) + * @return APIrulesGetEventSchemaRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule event type found. -
404 Rule event not found. -
500 Operation failed. -
+ */ + public APIrulesGetEventSchemaRequest getEventSchema(String type) { + return new APIrulesGetEventSchemaRequest(type); + } + private okhttp3.Call getEventTypesCall(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 = "/api/rules/eventtypes"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getEventTypesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getEventTypesCall(_callback); + + } + + + private ApiResponse> getEventTypesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getEventTypesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getEventTypesAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getEventTypesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesGetEventTypesRequest { + + private APIrulesGetEventTypesRequest() { + } + + /** + * Build call for getEventTypes + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Rule events returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getEventTypesCall(_callback); + } + + /** + * Execute getEventTypes request + * @return List<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Rule events returned. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getEventTypesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getEventTypes request with HTTP info returned + * @return ApiResponse<List<String>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Rule events returned. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getEventTypesWithHttpInfo(); + } + + /** + * Execute getEventTypes request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Rule events returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getEventTypesAsync(_callback); + } + } + + /** + * Provide a list of all event types that are used in rules. + * + * @return APIrulesGetEventTypesRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Rule events returned. -
500 Operation failed. -
+ */ + public APIrulesGetEventTypesRequest getEventTypes() { + return new APIrulesGetEventTypesRequest(); + } + private okhttp3.Call getEventsCall(String ruleId, Integer skip, Integer take, 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 = "/api/apps/$app$/rules/events"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (ruleId != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("ruleId", ruleId)); + } + + if (skip != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("skip", skip)); + } + + if (take != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("take", take)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getEventsValidateBeforeCall(String ruleId, Integer skip, Integer take, final ApiCallback _callback) throws ApiException { + return getEventsCall(ruleId, skip, take, _callback); + + } + + + private ApiResponse getEventsWithHttpInfo(String ruleId, Integer skip, Integer take) throws ApiException { + okhttp3.Call localVarCall = getEventsValidateBeforeCall(ruleId, skip, take, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getEventsAsync(String ruleId, Integer skip, Integer take, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getEventsValidateBeforeCall(ruleId, skip, take, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesGetEventsRequest { + private String ruleId; + private Integer skip; + private Integer take; + + private APIrulesGetEventsRequest() { + } + + /** + * Set ruleId + * @param ruleId The optional rule id to filter to events. (optional) + * @return APIrulesGetEventsRequest + */ + public APIrulesGetEventsRequest ruleId(String ruleId) { + this.ruleId = ruleId; + return this; + } + + /** + * Set skip + * @param skip The number of events to skip. (optional, default to 0) + * @return APIrulesGetEventsRequest + */ + public APIrulesGetEventsRequest skip(Integer skip) { + this.skip = skip; + return this; + } + + /** + * Set take + * @param take The number of events to take. (optional, default to 20) + * @return APIrulesGetEventsRequest + */ + public APIrulesGetEventsRequest take(Integer take) { + this.take = take; + return this; + } + + /** + * Build call for getEvents + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule events returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getEventsCall(ruleId, skip, take, _callback); + } + + /** + * Execute getEvents request + * @return RuleEventsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule events returned. -
404 App not found. -
500 Operation failed. -
+ */ + public RuleEventsDto execute() throws ApiException { + ApiResponse localVarResp = getEventsWithHttpInfo(ruleId, skip, take); + return localVarResp.getData(); + } + + /** + * Execute getEvents request with HTTP info returned + * @return ApiResponse<RuleEventsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule events returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getEventsWithHttpInfo(ruleId, skip, take); + } + + /** + * Execute getEvents request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Rule events returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getEventsAsync(ruleId, skip, take, _callback); + } + } + + /** + * Get rule events. + * + * @return APIrulesGetEventsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule events returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIrulesGetEventsRequest getEvents() { + return new APIrulesGetEventsRequest(); + } + private okhttp3.Call getRulesCall(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 = "/api/apps/$app$/rules"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getRulesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getRulesCall(_callback); + + } + + + private ApiResponse getRulesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getRulesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getRulesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getRulesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesGetRulesRequest { + + private APIrulesGetRulesRequest() { + } + + /** + * Build call for getRules + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rules returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getRulesCall(_callback); + } + + /** + * Execute getRules request + * @return RulesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rules returned. -
404 App not found. -
500 Operation failed. -
+ */ + public RulesDto execute() throws ApiException { + ApiResponse localVarResp = getRulesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getRules request with HTTP info returned + * @return ApiResponse<RulesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rules returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getRulesWithHttpInfo(); + } + + /** + * Execute getRules request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Rules returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getRulesAsync(_callback); + } + } + + /** + * Get rules. + * + * @return APIrulesGetRulesRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rules returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIrulesGetRulesRequest getRules() { + return new APIrulesGetRulesRequest(); + } + private okhttp3.Call postRuleCall(CreateRuleDto createRuleDto, 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 = createRuleDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/rules"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postRuleValidateBeforeCall(CreateRuleDto createRuleDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createRuleDto' is set + if (createRuleDto == null) { + throw new ApiException("Missing the required parameter 'createRuleDto' when calling (Async)"); + } + + return postRuleCall(createRuleDto, _callback); + + } + + + private ApiResponse postRuleWithHttpInfo(CreateRuleDto createRuleDto) throws ApiException { + okhttp3.Call localVarCall = postRuleValidateBeforeCall(createRuleDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postRuleAsync(CreateRuleDto createRuleDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postRuleValidateBeforeCall(createRuleDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesPostRuleRequest { + private final CreateRuleDto createRuleDto; + + private APIrulesPostRuleRequest(CreateRuleDto createRuleDto) { + this.createRuleDto = createRuleDto; + } + + /** + * Build call for postRule + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Rule created. -
400 Rule request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postRuleCall(createRuleDto, _callback); + } + + /** + * Execute postRule request + * @return RuleDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Rule created. -
400 Rule request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public RuleDto execute() throws ApiException { + ApiResponse localVarResp = postRuleWithHttpInfo(createRuleDto); + return localVarResp.getData(); + } + + /** + * Execute postRule request with HTTP info returned + * @return ApiResponse<RuleDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Rule created. -
400 Rule request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postRuleWithHttpInfo(createRuleDto); + } + + /** + * Execute postRule request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
201 Rule created. -
400 Rule request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postRuleAsync(createRuleDto, _callback); + } + } + + /** + * Create a new rule. + * + * @param createRuleDto The rule object that needs to be added to the app. (required) + * @return APIrulesPostRuleRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Rule created. -
400 Rule request not valid. -
404 App not found. -
500 Operation failed. -
+ */ + public APIrulesPostRuleRequest postRule(CreateRuleDto createRuleDto) { + return new APIrulesPostRuleRequest(createRuleDto); + } + private okhttp3.Call putEventCall(String 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 = "/api/apps/$app$/rules/events/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putEventValidateBeforeCall(String 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 (Async)"); + } + + return putEventCall(id, _callback); + + } + + + private ApiResponse putEventWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = putEventValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call putEventAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putEventValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIrulesPutEventRequest { + private final String id; + + private APIrulesPutEventRequest(String id) { + this.id = id; + } + + /** + * Build call for putEvent + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule enqueued. -
404 App or rule event not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putEventCall(id, _callback); + } + + /** + * Execute putEvent request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule enqueued. -
404 App or rule event not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + putEventWithHttpInfo(id); + } + + /** + * Execute putEvent request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule enqueued. -
404 App or rule event not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putEventWithHttpInfo(id); + } + + /** + * Execute putEvent request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Rule enqueued. -
404 App or rule event not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putEventAsync(id, _callback); + } + } + + /** + * Retry the event immediately. + * + * @param id The event to enqueue. (required) + * @return APIrulesPutEventRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule enqueued. -
404 App or rule event not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesPutEventRequest putEvent(String id) { + return new APIrulesPutEventRequest(id); + } + private okhttp3.Call putRuleCall(String id, UpdateRuleDto updateRuleDto, 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 = updateRuleDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/rules/{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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putRuleValidateBeforeCall(String id, UpdateRuleDto updateRuleDto, 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 (Async)"); + } + + // verify the required parameter 'updateRuleDto' is set + if (updateRuleDto == null) { + throw new ApiException("Missing the required parameter 'updateRuleDto' when calling (Async)"); + } + + return putRuleCall(id, updateRuleDto, _callback); + + } + + + private ApiResponse putRuleWithHttpInfo(String id, UpdateRuleDto updateRuleDto) throws ApiException { + okhttp3.Call localVarCall = putRuleValidateBeforeCall(id, updateRuleDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putRuleAsync(String id, UpdateRuleDto updateRuleDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putRuleValidateBeforeCall(id, updateRuleDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesPutRuleRequest { + private final String id; + private final UpdateRuleDto updateRuleDto; + + private APIrulesPutRuleRequest(String id, UpdateRuleDto updateRuleDto) { + this.id = id; + this.updateRuleDto = updateRuleDto; + } + + /** + * Build call for putRule + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule updated. -
400 Rule request not valid. -
404 Rule or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putRuleCall(id, updateRuleDto, _callback); + } + + /** + * Execute putRule request + * @return RuleDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule updated. -
400 Rule request not valid. -
404 Rule or app not found. -
500 Operation failed. -
+ */ + public RuleDto execute() throws ApiException { + ApiResponse localVarResp = putRuleWithHttpInfo(id, updateRuleDto); + return localVarResp.getData(); + } + + /** + * Execute putRule request with HTTP info returned + * @return ApiResponse<RuleDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule updated. -
400 Rule request not valid. -
404 Rule or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putRuleWithHttpInfo(id, updateRuleDto); + } + + /** + * Execute putRule request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Rule updated. -
400 Rule request not valid. -
404 Rule or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putRuleAsync(id, updateRuleDto, _callback); + } + } + + /** + * Update a rule. + * + * @param id The ID of the rule to update. (required) + * @param updateRuleDto The rule object that needs to be added to the app. (required) + * @return APIrulesPutRuleRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule updated. -
400 Rule request not valid. -
404 Rule or app not found. -
500 Operation failed. -
+ */ + public APIrulesPutRuleRequest putRule(String id, UpdateRuleDto updateRuleDto) { + return new APIrulesPutRuleRequest(id, updateRuleDto); + } + private okhttp3.Call putRuleRunCall(String id, Boolean fromSnapshots, 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 = "/api/apps/$app$/rules/{id}/run" + .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 (fromSnapshots != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("fromSnapshots", fromSnapshots)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putRuleRunValidateBeforeCall(String id, Boolean fromSnapshots, 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 (Async)"); + } + + return putRuleRunCall(id, fromSnapshots, _callback); + + } + + + private ApiResponse putRuleRunWithHttpInfo(String id, Boolean fromSnapshots) throws ApiException { + okhttp3.Call localVarCall = putRuleRunValidateBeforeCall(id, fromSnapshots, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call putRuleRunAsync(String id, Boolean fromSnapshots, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putRuleRunValidateBeforeCall(id, fromSnapshots, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIrulesPutRuleRunRequest { + private final String id; + private Boolean fromSnapshots; + + private APIrulesPutRuleRunRequest(String id) { + this.id = id; + } + + /** + * Set fromSnapshots + * @param fromSnapshots Runs the rule from snapeshots if possible. (optional, default to false) + * @return APIrulesPutRuleRunRequest + */ + public APIrulesPutRuleRunRequest fromSnapshots(Boolean fromSnapshots) { + this.fromSnapshots = fromSnapshots; + return this; + } + + /** + * Build call for putRuleRun + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule started. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putRuleRunCall(id, fromSnapshots, _callback); + } + + /** + * Execute putRuleRun request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule started. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + putRuleRunWithHttpInfo(id, fromSnapshots); + } + + /** + * Execute putRuleRun request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule started. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putRuleRunWithHttpInfo(id, fromSnapshots); + } + + /** + * Execute putRuleRun request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
204 Rule started. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putRuleRunAsync(id, fromSnapshots, _callback); + } + } + + /** + * Run a rule. + * + * @param id The ID of the rule to run. (required) + * @return APIrulesPutRuleRunRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
204 Rule started. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesPutRuleRunRequest putRuleRun(String id) { + return new APIrulesPutRuleRunRequest(id); + } + private okhttp3.Call simulateGETCall(String 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 = "/api/apps/$app$/rules/{id}/simulate" + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call simulateGETValidateBeforeCall(String 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 (Async)"); + } + + return simulateGETCall(id, _callback); + + } + + + private ApiResponse simulateGETWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = simulateGETValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call simulateGETAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = simulateGETValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesSimulateGETRequest { + private final String id; + + private APIrulesSimulateGETRequest(String id) { + this.id = id; + } + + /** + * Build call for simulateGET + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule simulated. -
404 Rule or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return simulateGETCall(id, _callback); + } + + /** + * Execute simulateGET request + * @return SimulatedRuleEventsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule simulated. -
404 Rule or app not found. -
500 Operation failed. -
+ */ + public SimulatedRuleEventsDto execute() throws ApiException { + ApiResponse localVarResp = simulateGETWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute simulateGET request with HTTP info returned + * @return ApiResponse<SimulatedRuleEventsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule simulated. -
404 Rule or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return simulateGETWithHttpInfo(id); + } + + /** + * Execute simulateGET request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Rule simulated. -
404 Rule or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return simulateGETAsync(id, _callback); + } + } + + /** + * Simulate a rule. + * + * @param id The ID of the rule to simulate. (required) + * @return APIrulesSimulateGETRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Rule simulated. -
404 Rule or app not found. -
500 Operation failed. -
+ */ + public APIrulesSimulateGETRequest simulateGET(String id) { + return new APIrulesSimulateGETRequest(id); + } + private okhttp3.Call simulatePOSTCall(CreateRuleDto createRuleDto, 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 = createRuleDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/rules/simulate"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call simulatePOSTValidateBeforeCall(CreateRuleDto createRuleDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createRuleDto' is set + if (createRuleDto == null) { + throw new ApiException("Missing the required parameter 'createRuleDto' when calling (Async)"); + } + + return simulatePOSTCall(createRuleDto, _callback); + + } + + + private ApiResponse simulatePOSTWithHttpInfo(CreateRuleDto createRuleDto) throws ApiException { + okhttp3.Call localVarCall = simulatePOSTValidateBeforeCall(createRuleDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call simulatePOSTAsync(CreateRuleDto createRuleDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = simulatePOSTValidateBeforeCall(createRuleDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIrulesSimulatePOSTRequest { + private final CreateRuleDto createRuleDto; + + private APIrulesSimulatePOSTRequest(CreateRuleDto createRuleDto) { + this.createRuleDto = createRuleDto; + } + + /** + * Build call for simulatePOST + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule simulated. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return simulatePOSTCall(createRuleDto, _callback); + } + + /** + * Execute simulatePOST request + * @return SimulatedRuleEventsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule simulated. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public SimulatedRuleEventsDto execute() throws ApiException { + ApiResponse localVarResp = simulatePOSTWithHttpInfo(createRuleDto); + return localVarResp.getData(); + } + + /** + * Execute simulatePOST request with HTTP info returned + * @return ApiResponse<SimulatedRuleEventsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule simulated. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return simulatePOSTWithHttpInfo(createRuleDto); + } + + /** + * Execute simulatePOST request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Rule simulated. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return simulatePOSTAsync(createRuleDto, _callback); + } + } + + /** + * Simulate a rule. + * + * @param createRuleDto The rule to simulate. (required) + * @return APIrulesSimulatePOSTRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Rule simulated. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesSimulatePOSTRequest simulatePOST(CreateRuleDto createRuleDto) { + return new APIrulesSimulatePOSTRequest(createRuleDto); + } + private okhttp3.Call triggerRuleCall(String 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 = "/api/apps/$app$/rules/{id}/trigger" + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call triggerRuleValidateBeforeCall(String 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 (Async)"); + } + + return triggerRuleCall(id, _callback); + + } + + + private ApiResponse triggerRuleWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = triggerRuleValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call triggerRuleAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = triggerRuleValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIrulesTriggerRuleRequest { + private final String id; + + private APIrulesTriggerRuleRequest(String id) { + this.id = id; + } + + /** + * Build call for triggerRule + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule triggered. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return triggerRuleCall(id, _callback); + } + + /** + * Execute triggerRule request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule triggered. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + triggerRuleWithHttpInfo(id); + } + + /** + * Execute triggerRule request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule triggered. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return triggerRuleWithHttpInfo(id); + } + + /** + * Execute triggerRule request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Rule triggered. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return triggerRuleAsync(id, _callback); + } + } + + /** + * Trigger a rule. + * + * @param id The ID of the rule to disable. (required) + * @return APIrulesTriggerRuleRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Rule triggered. -
404 Rule or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIrulesTriggerRuleRequest triggerRule(String id) { + return new APIrulesTriggerRuleRequest(id); + } +} diff --git a/src/main/java/com/squidex/api/core/api/SchemasApi.java b/src/main/java/com/squidex/api/core/api/SchemasApi.java new file mode 100644 index 0000000..c1f9d61 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/SchemasApi.java @@ -0,0 +1,5577 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.AddFieldDto; +import com.squidex.api.types.ChangeCategoryDto; +import com.squidex.api.types.ConfigureFieldRulesDto; +import com.squidex.api.types.ConfigureUIFieldsDto; +import com.squidex.api.types.CreateSchemaDto; +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.ReorderFieldsDto; +import com.squidex.api.types.SchemaDto; +import com.squidex.api.types.SchemaScriptsDto; +import com.squidex.api.types.SchemasDto; +import com.squidex.api.types.SynchronizeSchemaDto; +import com.squidex.api.types.UpdateFieldDto; +import com.squidex.api.types.UpdateSchemaDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class SchemasApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public SchemasApi() { + this(Configuration.getDefaultApiClient()); + } + + public SchemasApi(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; + } + + private okhttp3.Call deleteFieldCall(String schema, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{id}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteFieldValidateBeforeCall(String schema, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return deleteFieldCall(schema, id, _callback); + + } + + + private ApiResponse deleteFieldWithHttpInfo(String schema, Long id) throws ApiException { + okhttp3.Call localVarCall = deleteFieldValidateBeforeCall(schema, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteFieldAsync(String schema, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteFieldValidateBeforeCall(schema, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsDeleteFieldRequest { + private final String schema; + private final Long id; + + private APIschemaFieldsDeleteFieldRequest(String schema, Long id) { + this.schema = schema; + this.id = id; + } + + /** + * Build call for deleteField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field deleted. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteFieldCall(schema, id, _callback); + } + + /** + * Execute deleteField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field deleted. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = deleteFieldWithHttpInfo(schema, id); + return localVarResp.getData(); + } + + /** + * Execute deleteField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field deleted. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteFieldWithHttpInfo(schema, id); + } + + /** + * Execute deleteField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field deleted. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteFieldAsync(schema, id, _callback); + } + } + + /** + * Delete a schema field. + * + * @param schema The name of the schema. (required) + * @param id The ID of the field to disable. (required) + * @return APIschemaFieldsDeleteFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field deleted. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsDeleteFieldRequest deleteField(String schema, Long id) { + return new APIschemaFieldsDeleteFieldRequest(schema, id); + } + private okhttp3.Call deleteNestedFieldCall(String schema, Long parentId, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .replace("{" + "parentId" + "}", localVarApiClient.escapeString(parentId.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteNestedFieldValidateBeforeCall(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'parentId' is set + if (parentId == null) { + throw new ApiException("Missing the required parameter 'parentId' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return deleteNestedFieldCall(schema, parentId, id, _callback); + + } + + + private ApiResponse deleteNestedFieldWithHttpInfo(String schema, Long parentId, Long id) throws ApiException { + okhttp3.Call localVarCall = deleteNestedFieldValidateBeforeCall(schema, parentId, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteNestedFieldAsync(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteNestedFieldValidateBeforeCall(schema, parentId, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsDeleteNestedFieldRequest { + private final String schema; + private final Long parentId; + private final Long id; + + private APIschemaFieldsDeleteNestedFieldRequest(String schema, Long parentId, Long id) { + this.schema = schema; + this.parentId = parentId; + this.id = id; + } + + /** + * Build call for deleteNestedField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field deleted. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteNestedFieldCall(schema, parentId, id, _callback); + } + + /** + * Execute deleteNestedField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field deleted. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = deleteNestedFieldWithHttpInfo(schema, parentId, id); + return localVarResp.getData(); + } + + /** + * Execute deleteNestedField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field deleted. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteNestedFieldWithHttpInfo(schema, parentId, id); + } + + /** + * Execute deleteNestedField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field deleted. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteNestedFieldAsync(schema, parentId, id, _callback); + } + } + + /** + * Delete a nested field. + * + * @param schema The name of the schema. (required) + * @param parentId The parent field id. (required) + * @param id The ID of the field to disable. (required) + * @return APIschemaFieldsDeleteNestedFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field deleted. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsDeleteNestedFieldRequest deleteNestedField(String schema, Long parentId, Long id) { + return new APIschemaFieldsDeleteNestedFieldRequest(schema, parentId, id); + } + private okhttp3.Call disableFieldCall(String schema, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{id}/disable" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call disableFieldValidateBeforeCall(String schema, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return disableFieldCall(schema, id, _callback); + + } + + + private ApiResponse disableFieldWithHttpInfo(String schema, Long id) throws ApiException { + okhttp3.Call localVarCall = disableFieldValidateBeforeCall(schema, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call disableFieldAsync(String schema, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = disableFieldValidateBeforeCall(schema, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsDisableFieldRequest { + private final String schema; + private final Long id; + + private APIschemaFieldsDisableFieldRequest(String schema, Long id) { + this.schema = schema; + this.id = id; + } + + /** + * Build call for disableField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field disabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return disableFieldCall(schema, id, _callback); + } + + /** + * Execute disableField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field disabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = disableFieldWithHttpInfo(schema, id); + return localVarResp.getData(); + } + + /** + * Execute disableField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field disabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return disableFieldWithHttpInfo(schema, id); + } + + /** + * Execute disableField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field disabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return disableFieldAsync(schema, id, _callback); + } + } + + /** + * Disable a schema field. + * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. + * @param schema The name of the schema. (required) + * @param id The ID of the field to disable. (required) + * @return APIschemaFieldsDisableFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field disabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsDisableFieldRequest disableField(String schema, Long id) { + return new APIschemaFieldsDisableFieldRequest(schema, id); + } + private okhttp3.Call disableNestedFieldCall(String schema, Long parentId, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}/disable" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .replace("{" + "parentId" + "}", localVarApiClient.escapeString(parentId.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call disableNestedFieldValidateBeforeCall(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'parentId' is set + if (parentId == null) { + throw new ApiException("Missing the required parameter 'parentId' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return disableNestedFieldCall(schema, parentId, id, _callback); + + } + + + private ApiResponse disableNestedFieldWithHttpInfo(String schema, Long parentId, Long id) throws ApiException { + okhttp3.Call localVarCall = disableNestedFieldValidateBeforeCall(schema, parentId, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call disableNestedFieldAsync(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = disableNestedFieldValidateBeforeCall(schema, parentId, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsDisableNestedFieldRequest { + private final String schema; + private final Long parentId; + private final Long id; + + private APIschemaFieldsDisableNestedFieldRequest(String schema, Long parentId, Long id) { + this.schema = schema; + this.parentId = parentId; + this.id = id; + } + + /** + * Build call for disableNestedField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field disabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return disableNestedFieldCall(schema, parentId, id, _callback); + } + + /** + * Execute disableNestedField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field disabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = disableNestedFieldWithHttpInfo(schema, parentId, id); + return localVarResp.getData(); + } + + /** + * Execute disableNestedField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field disabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return disableNestedFieldWithHttpInfo(schema, parentId, id); + } + + /** + * Execute disableNestedField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field disabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return disableNestedFieldAsync(schema, parentId, id, _callback); + } + } + + /** + * Disable a nested field. + * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. + * @param schema The name of the schema. (required) + * @param parentId The parent field id. (required) + * @param id The ID of the field to disable. (required) + * @return APIschemaFieldsDisableNestedFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field disabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsDisableNestedFieldRequest disableNestedField(String schema, Long parentId, Long id) { + return new APIschemaFieldsDisableNestedFieldRequest(schema, parentId, id); + } + private okhttp3.Call enableFieldCall(String schema, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{id}/enable" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call enableFieldValidateBeforeCall(String schema, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return enableFieldCall(schema, id, _callback); + + } + + + private ApiResponse enableFieldWithHttpInfo(String schema, Long id) throws ApiException { + okhttp3.Call localVarCall = enableFieldValidateBeforeCall(schema, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call enableFieldAsync(String schema, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = enableFieldValidateBeforeCall(schema, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsEnableFieldRequest { + private final String schema; + private final Long id; + + private APIschemaFieldsEnableFieldRequest(String schema, Long id) { + this.schema = schema; + this.id = id; + } + + /** + * Build call for enableField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field enabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return enableFieldCall(schema, id, _callback); + } + + /** + * Execute enableField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field enabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = enableFieldWithHttpInfo(schema, id); + return localVarResp.getData(); + } + + /** + * Execute enableField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field enabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return enableFieldWithHttpInfo(schema, id); + } + + /** + * Execute enableField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field enabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return enableFieldAsync(schema, id, _callback); + } + } + + /** + * Enable a schema field. + * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. + * @param schema The name of the schema. (required) + * @param id The ID of the field to enable. (required) + * @return APIschemaFieldsEnableFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field enabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsEnableFieldRequest enableField(String schema, Long id) { + return new APIschemaFieldsEnableFieldRequest(schema, id); + } + private okhttp3.Call enableNestedFieldCall(String schema, Long parentId, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}/enable" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .replace("{" + "parentId" + "}", localVarApiClient.escapeString(parentId.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call enableNestedFieldValidateBeforeCall(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'parentId' is set + if (parentId == null) { + throw new ApiException("Missing the required parameter 'parentId' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return enableNestedFieldCall(schema, parentId, id, _callback); + + } + + + private ApiResponse enableNestedFieldWithHttpInfo(String schema, Long parentId, Long id) throws ApiException { + okhttp3.Call localVarCall = enableNestedFieldValidateBeforeCall(schema, parentId, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call enableNestedFieldAsync(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = enableNestedFieldValidateBeforeCall(schema, parentId, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsEnableNestedFieldRequest { + private final String schema; + private final Long parentId; + private final Long id; + + private APIschemaFieldsEnableNestedFieldRequest(String schema, Long parentId, Long id) { + this.schema = schema; + this.parentId = parentId; + this.id = id; + } + + /** + * Build call for enableNestedField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field enabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return enableNestedFieldCall(schema, parentId, id, _callback); + } + + /** + * Execute enableNestedField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field enabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = enableNestedFieldWithHttpInfo(schema, parentId, id); + return localVarResp.getData(); + } + + /** + * Execute enableNestedField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field enabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return enableNestedFieldWithHttpInfo(schema, parentId, id); + } + + /** + * Execute enableNestedField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field enabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return enableNestedFieldAsync(schema, parentId, id, _callback); + } + } + + /** + * Enable a nested field. + * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. + * @param schema The name of the schema. (required) + * @param parentId The parent field id. (required) + * @param id The ID of the field to enable. (required) + * @return APIschemaFieldsEnableNestedFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field enabled. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsEnableNestedFieldRequest enableNestedField(String schema, Long parentId, Long id) { + return new APIschemaFieldsEnableNestedFieldRequest(schema, parentId, id); + } + private okhttp3.Call hideFieldCall(String schema, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{id}/hide" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call hideFieldValidateBeforeCall(String schema, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return hideFieldCall(schema, id, _callback); + + } + + + private ApiResponse hideFieldWithHttpInfo(String schema, Long id) throws ApiException { + okhttp3.Call localVarCall = hideFieldValidateBeforeCall(schema, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call hideFieldAsync(String schema, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = hideFieldValidateBeforeCall(schema, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsHideFieldRequest { + private final String schema; + private final Long id; + + private APIschemaFieldsHideFieldRequest(String schema, Long id) { + this.schema = schema; + this.id = id; + } + + /** + * Build call for hideField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return hideFieldCall(schema, id, _callback); + } + + /** + * Execute hideField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = hideFieldWithHttpInfo(schema, id); + return localVarResp.getData(); + } + + /** + * Execute hideField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return hideFieldWithHttpInfo(schema, id); + } + + /** + * Execute hideField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return hideFieldAsync(schema, id, _callback); + } + } + + /** + * Hide a schema field. + * A hidden field is not part of the API response, but can still be edited in the portal. + * @param schema The name of the schema. (required) + * @param id The ID of the field to hide. (required) + * @return APIschemaFieldsHideFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsHideFieldRequest hideField(String schema, Long id) { + return new APIschemaFieldsHideFieldRequest(schema, id); + } + private okhttp3.Call hideNestedFieldCall(String schema, Long parentId, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}/hide" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .replace("{" + "parentId" + "}", localVarApiClient.escapeString(parentId.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call hideNestedFieldValidateBeforeCall(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'parentId' is set + if (parentId == null) { + throw new ApiException("Missing the required parameter 'parentId' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return hideNestedFieldCall(schema, parentId, id, _callback); + + } + + + private ApiResponse hideNestedFieldWithHttpInfo(String schema, Long parentId, Long id) throws ApiException { + okhttp3.Call localVarCall = hideNestedFieldValidateBeforeCall(schema, parentId, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call hideNestedFieldAsync(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = hideNestedFieldValidateBeforeCall(schema, parentId, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsHideNestedFieldRequest { + private final String schema; + private final Long parentId; + private final Long id; + + private APIschemaFieldsHideNestedFieldRequest(String schema, Long parentId, Long id) { + this.schema = schema; + this.parentId = parentId; + this.id = id; + } + + /** + * Build call for hideNestedField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Field, schema, or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return hideNestedFieldCall(schema, parentId, id, _callback); + } + + /** + * Execute hideNestedField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Field, schema, or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = hideNestedFieldWithHttpInfo(schema, parentId, id); + return localVarResp.getData(); + } + + /** + * Execute hideNestedField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Field, schema, or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return hideNestedFieldWithHttpInfo(schema, parentId, id); + } + + /** + * Execute hideNestedField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Field, schema, or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return hideNestedFieldAsync(schema, parentId, id, _callback); + } + } + + /** + * Hide a nested field. + * A hidden field is not part of the API response, but can still be edited in the portal. + * @param schema The name of the schema. (required) + * @param parentId The parent field id. (required) + * @param id The ID of the field to hide. (required) + * @return APIschemaFieldsHideNestedFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Field, schema, or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsHideNestedFieldRequest hideNestedField(String schema, Long parentId, Long id) { + return new APIschemaFieldsHideNestedFieldRequest(schema, parentId, id); + } + private okhttp3.Call lockFieldCall(String schema, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{id}/lock" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call lockFieldValidateBeforeCall(String schema, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return lockFieldCall(schema, id, _callback); + + } + + + private ApiResponse lockFieldWithHttpInfo(String schema, Long id) throws ApiException { + okhttp3.Call localVarCall = lockFieldValidateBeforeCall(schema, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call lockFieldAsync(String schema, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = lockFieldValidateBeforeCall(schema, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsLockFieldRequest { + private final String schema; + private final Long id; + + private APIschemaFieldsLockFieldRequest(String schema, Long id) { + this.schema = schema; + this.id = id; + } + + /** + * Build call for lockField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return lockFieldCall(schema, id, _callback); + } + + /** + * Execute lockField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = lockFieldWithHttpInfo(schema, id); + return localVarResp.getData(); + } + + /** + * Execute lockField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return lockFieldWithHttpInfo(schema, id); + } + + /** + * Execute lockField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return lockFieldAsync(schema, id, _callback); + } + } + + /** + * Lock a schema field. + * A locked field cannot be updated or deleted. + * @param schema The name of the schema. (required) + * @param id The ID of the field to lock. (required) + * @return APIschemaFieldsLockFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsLockFieldRequest lockField(String schema, Long id) { + return new APIschemaFieldsLockFieldRequest(schema, id); + } + private okhttp3.Call lockNestedFieldCall(String schema, Long parentId, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}/lock" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .replace("{" + "parentId" + "}", localVarApiClient.escapeString(parentId.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call lockNestedFieldValidateBeforeCall(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'parentId' is set + if (parentId == null) { + throw new ApiException("Missing the required parameter 'parentId' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return lockNestedFieldCall(schema, parentId, id, _callback); + + } + + + private ApiResponse lockNestedFieldWithHttpInfo(String schema, Long parentId, Long id) throws ApiException { + okhttp3.Call localVarCall = lockNestedFieldValidateBeforeCall(schema, parentId, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call lockNestedFieldAsync(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = lockNestedFieldValidateBeforeCall(schema, parentId, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsLockNestedFieldRequest { + private final String schema; + private final Long parentId; + private final Long id; + + private APIschemaFieldsLockNestedFieldRequest(String schema, Long parentId, Long id) { + this.schema = schema; + this.parentId = parentId; + this.id = id; + } + + /** + * Build call for lockNestedField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Field, schema, or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return lockNestedFieldCall(schema, parentId, id, _callback); + } + + /** + * Execute lockNestedField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Field, schema, or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = lockNestedFieldWithHttpInfo(schema, parentId, id); + return localVarResp.getData(); + } + + /** + * Execute lockNestedField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Field, schema, or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return lockNestedFieldWithHttpInfo(schema, parentId, id); + } + + /** + * Execute lockNestedField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Field, schema, or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return lockNestedFieldAsync(schema, parentId, id, _callback); + } + } + + /** + * Lock a nested field. + * A locked field cannot be edited or deleted. + * @param schema The name of the schema. (required) + * @param parentId The parent field id. (required) + * @param id The ID of the field to lock. (required) + * @return APIschemaFieldsLockNestedFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field hidden. -
400 Schema field request not valid or field locked. -
404 Field, schema, or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsLockNestedFieldRequest lockNestedField(String schema, Long parentId, Long id) { + return new APIschemaFieldsLockNestedFieldRequest(schema, parentId, id); + } + private okhttp3.Call postFieldCall(String schema, AddFieldDto addFieldDto, 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 = addFieldDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/fields" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postFieldValidateBeforeCall(String schema, AddFieldDto addFieldDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'addFieldDto' is set + if (addFieldDto == null) { + throw new ApiException("Missing the required parameter 'addFieldDto' when calling (Async)"); + } + + return postFieldCall(schema, addFieldDto, _callback); + + } + + + private ApiResponse postFieldWithHttpInfo(String schema, AddFieldDto addFieldDto) throws ApiException { + okhttp3.Call localVarCall = postFieldValidateBeforeCall(schema, addFieldDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postFieldAsync(String schema, AddFieldDto addFieldDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postFieldValidateBeforeCall(schema, addFieldDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsPostFieldRequest { + private final String schema; + private final AddFieldDto addFieldDto; + + private APIschemaFieldsPostFieldRequest(String schema, AddFieldDto addFieldDto) { + this.schema = schema; + this.addFieldDto = addFieldDto; + } + + /** + * Build call for postField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Schema field created. -
400 Schema request not valid. -
404 Schema or app not found. -
409 Schema field name already in use. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postFieldCall(schema, addFieldDto, _callback); + } + + /** + * Execute postField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Schema field created. -
400 Schema request not valid. -
404 Schema or app not found. -
409 Schema field name already in use. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = postFieldWithHttpInfo(schema, addFieldDto); + return localVarResp.getData(); + } + + /** + * Execute postField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Schema field created. -
400 Schema request not valid. -
404 Schema or app not found. -
409 Schema field name already in use. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postFieldWithHttpInfo(schema, addFieldDto); + } + + /** + * Execute postField request (asynchronously) + * @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 + + + + + + + +
Status Code Description Response Headers
201 Schema field created. -
400 Schema request not valid. -
404 Schema or app not found. -
409 Schema field name already in use. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postFieldAsync(schema, addFieldDto, _callback); + } + } + + /** + * Add a schema field. + * + * @param schema The name of the schema. (required) + * @param addFieldDto The field object that needs to be added to the schema. (required) + * @return APIschemaFieldsPostFieldRequest + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Schema field created. -
400 Schema request not valid. -
404 Schema or app not found. -
409 Schema field name already in use. -
500 Operation failed. -
+ */ + public APIschemaFieldsPostFieldRequest postField(String schema, AddFieldDto addFieldDto) { + return new APIschemaFieldsPostFieldRequest(schema, addFieldDto); + } + private okhttp3.Call postNestedFieldCall(String schema, Long parentId, AddFieldDto addFieldDto, 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 = addFieldDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .replace("{" + "parentId" + "}", localVarApiClient.escapeString(parentId.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postNestedFieldValidateBeforeCall(String schema, Long parentId, AddFieldDto addFieldDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'parentId' is set + if (parentId == null) { + throw new ApiException("Missing the required parameter 'parentId' when calling (Async)"); + } + + // verify the required parameter 'addFieldDto' is set + if (addFieldDto == null) { + throw new ApiException("Missing the required parameter 'addFieldDto' when calling (Async)"); + } + + return postNestedFieldCall(schema, parentId, addFieldDto, _callback); + + } + + + private ApiResponse postNestedFieldWithHttpInfo(String schema, Long parentId, AddFieldDto addFieldDto) throws ApiException { + okhttp3.Call localVarCall = postNestedFieldValidateBeforeCall(schema, parentId, addFieldDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postNestedFieldAsync(String schema, Long parentId, AddFieldDto addFieldDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postNestedFieldValidateBeforeCall(schema, parentId, addFieldDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsPostNestedFieldRequest { + private final String schema; + private final Long parentId; + private final AddFieldDto addFieldDto; + + private APIschemaFieldsPostNestedFieldRequest(String schema, Long parentId, AddFieldDto addFieldDto) { + this.schema = schema; + this.parentId = parentId; + this.addFieldDto = addFieldDto; + } + + /** + * Build call for postNestedField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Schema field created. -
400 Schema request not valid. -
409 Schema field name already in use. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postNestedFieldCall(schema, parentId, addFieldDto, _callback); + } + + /** + * Execute postNestedField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Schema field created. -
400 Schema request not valid. -
409 Schema field name already in use. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = postNestedFieldWithHttpInfo(schema, parentId, addFieldDto); + return localVarResp.getData(); + } + + /** + * Execute postNestedField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Schema field created. -
400 Schema request not valid. -
409 Schema field name already in use. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postNestedFieldWithHttpInfo(schema, parentId, addFieldDto); + } + + /** + * Execute postNestedField request (asynchronously) + * @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 + + + + + + + +
Status Code Description Response Headers
201 Schema field created. -
400 Schema request not valid. -
409 Schema field name already in use. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postNestedFieldAsync(schema, parentId, addFieldDto, _callback); + } + } + + /** + * Add a nested field. + * + * @param schema The name of the schema. (required) + * @param parentId The parent field id. (required) + * @param addFieldDto The field object that needs to be added to the schema. (required) + * @return APIschemaFieldsPostNestedFieldRequest + * @http.response.details + + + + + + + +
Status Code Description Response Headers
201 Schema field created. -
400 Schema request not valid. -
409 Schema field name already in use. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsPostNestedFieldRequest postNestedField(String schema, Long parentId, AddFieldDto addFieldDto) { + return new APIschemaFieldsPostNestedFieldRequest(schema, parentId, addFieldDto); + } + private okhttp3.Call putFieldCall(String schema, Long id, UpdateFieldDto updateFieldDto, 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 = updateFieldDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/fields/{id}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putFieldValidateBeforeCall(String schema, Long id, UpdateFieldDto updateFieldDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + // verify the required parameter 'updateFieldDto' is set + if (updateFieldDto == null) { + throw new ApiException("Missing the required parameter 'updateFieldDto' when calling (Async)"); + } + + return putFieldCall(schema, id, updateFieldDto, _callback); + + } + + + private ApiResponse putFieldWithHttpInfo(String schema, Long id, UpdateFieldDto updateFieldDto) throws ApiException { + okhttp3.Call localVarCall = putFieldValidateBeforeCall(schema, id, updateFieldDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putFieldAsync(String schema, Long id, UpdateFieldDto updateFieldDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putFieldValidateBeforeCall(schema, id, updateFieldDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsPutFieldRequest { + private final String schema; + private final Long id; + private final UpdateFieldDto updateFieldDto; + + private APIschemaFieldsPutFieldRequest(String schema, Long id, UpdateFieldDto updateFieldDto) { + this.schema = schema; + this.id = id; + this.updateFieldDto = updateFieldDto; + } + + /** + * Build call for putField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field updated. -
400 Schema field request not valid. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putFieldCall(schema, id, updateFieldDto, _callback); + } + + /** + * Execute putField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field updated. -
400 Schema field request not valid. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putFieldWithHttpInfo(schema, id, updateFieldDto); + return localVarResp.getData(); + } + + /** + * Execute putField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field updated. -
400 Schema field request not valid. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putFieldWithHttpInfo(schema, id, updateFieldDto); + } + + /** + * Execute putField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field updated. -
400 Schema field request not valid. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putFieldAsync(schema, id, updateFieldDto, _callback); + } + } + + /** + * Update a schema field. + * + * @param schema The name of the schema. (required) + * @param id The ID of the field to update. (required) + * @param updateFieldDto The field object that needs to be added to the schema. (required) + * @return APIschemaFieldsPutFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field updated. -
400 Schema field request not valid. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsPutFieldRequest putField(String schema, Long id, UpdateFieldDto updateFieldDto) { + return new APIschemaFieldsPutFieldRequest(schema, id, updateFieldDto); + } + private okhttp3.Call putNestedFieldCall(String schema, Long parentId, Long id, UpdateFieldDto updateFieldDto, 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 = updateFieldDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .replace("{" + "parentId" + "}", localVarApiClient.escapeString(parentId.toString())) + .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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putNestedFieldValidateBeforeCall(String schema, Long parentId, Long id, UpdateFieldDto updateFieldDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'parentId' is set + if (parentId == null) { + throw new ApiException("Missing the required parameter 'parentId' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + // verify the required parameter 'updateFieldDto' is set + if (updateFieldDto == null) { + throw new ApiException("Missing the required parameter 'updateFieldDto' when calling (Async)"); + } + + return putNestedFieldCall(schema, parentId, id, updateFieldDto, _callback); + + } + + + private ApiResponse putNestedFieldWithHttpInfo(String schema, Long parentId, Long id, UpdateFieldDto updateFieldDto) throws ApiException { + okhttp3.Call localVarCall = putNestedFieldValidateBeforeCall(schema, parentId, id, updateFieldDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putNestedFieldAsync(String schema, Long parentId, Long id, UpdateFieldDto updateFieldDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putNestedFieldValidateBeforeCall(schema, parentId, id, updateFieldDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsPutNestedFieldRequest { + private final String schema; + private final Long parentId; + private final Long id; + private final UpdateFieldDto updateFieldDto; + + private APIschemaFieldsPutNestedFieldRequest(String schema, Long parentId, Long id, UpdateFieldDto updateFieldDto) { + this.schema = schema; + this.parentId = parentId; + this.id = id; + this.updateFieldDto = updateFieldDto; + } + + /** + * Build call for putNestedField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field updated. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putNestedFieldCall(schema, parentId, id, updateFieldDto, _callback); + } + + /** + * Execute putNestedField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field updated. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putNestedFieldWithHttpInfo(schema, parentId, id, updateFieldDto); + return localVarResp.getData(); + } + + /** + * Execute putNestedField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field updated. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putNestedFieldWithHttpInfo(schema, parentId, id, updateFieldDto); + } + + /** + * Execute putNestedField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field updated. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putNestedFieldAsync(schema, parentId, id, updateFieldDto, _callback); + } + } + + /** + * Update a nested field. + * + * @param schema The name of the schema. (required) + * @param parentId The parent field id. (required) + * @param id The ID of the field to update. (required) + * @param updateFieldDto The field object that needs to be added to the schema. (required) + * @return APIschemaFieldsPutNestedFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field updated. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsPutNestedFieldRequest putNestedField(String schema, Long parentId, Long id, UpdateFieldDto updateFieldDto) { + return new APIschemaFieldsPutNestedFieldRequest(schema, parentId, id, updateFieldDto); + } + private okhttp3.Call putNestedFieldOrderingCall(String schema, Long parentId, ReorderFieldsDto reorderFieldsDto, 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 = reorderFieldsDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/ordering" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .replace("{" + "parentId" + "}", localVarApiClient.escapeString(parentId.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putNestedFieldOrderingValidateBeforeCall(String schema, Long parentId, ReorderFieldsDto reorderFieldsDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'parentId' is set + if (parentId == null) { + throw new ApiException("Missing the required parameter 'parentId' when calling (Async)"); + } + + // verify the required parameter 'reorderFieldsDto' is set + if (reorderFieldsDto == null) { + throw new ApiException("Missing the required parameter 'reorderFieldsDto' when calling (Async)"); + } + + return putNestedFieldOrderingCall(schema, parentId, reorderFieldsDto, _callback); + + } + + + private ApiResponse putNestedFieldOrderingWithHttpInfo(String schema, Long parentId, ReorderFieldsDto reorderFieldsDto) throws ApiException { + okhttp3.Call localVarCall = putNestedFieldOrderingValidateBeforeCall(schema, parentId, reorderFieldsDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putNestedFieldOrderingAsync(String schema, Long parentId, ReorderFieldsDto reorderFieldsDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putNestedFieldOrderingValidateBeforeCall(schema, parentId, reorderFieldsDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsPutNestedFieldOrderingRequest { + private final String schema; + private final Long parentId; + private final ReorderFieldsDto reorderFieldsDto; + + private APIschemaFieldsPutNestedFieldOrderingRequest(String schema, Long parentId, ReorderFieldsDto reorderFieldsDto) { + this.schema = schema; + this.parentId = parentId; + this.reorderFieldsDto = reorderFieldsDto; + } + + /** + * Build call for putNestedFieldOrdering + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema fields reordered. -
400 Schema field request not valid. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putNestedFieldOrderingCall(schema, parentId, reorderFieldsDto, _callback); + } + + /** + * Execute putNestedFieldOrdering request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema fields reordered. -
400 Schema field request not valid. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putNestedFieldOrderingWithHttpInfo(schema, parentId, reorderFieldsDto); + return localVarResp.getData(); + } + + /** + * Execute putNestedFieldOrdering request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema fields reordered. -
400 Schema field request not valid. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putNestedFieldOrderingWithHttpInfo(schema, parentId, reorderFieldsDto); + } + + /** + * Execute putNestedFieldOrdering request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema fields reordered. -
400 Schema field request not valid. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putNestedFieldOrderingAsync(schema, parentId, reorderFieldsDto, _callback); + } + } + + /** + * Reorder all nested fields. + * + * @param schema The name of the schema. (required) + * @param parentId The parent field id. (required) + * @param reorderFieldsDto The request that contains the field ids. (required) + * @return APIschemaFieldsPutNestedFieldOrderingRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema fields reordered. -
400 Schema field request not valid. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsPutNestedFieldOrderingRequest putNestedFieldOrdering(String schema, Long parentId, ReorderFieldsDto reorderFieldsDto) { + return new APIschemaFieldsPutNestedFieldOrderingRequest(schema, parentId, reorderFieldsDto); + } + private okhttp3.Call putSchemaFieldOrderingCall(String schema, ReorderFieldsDto reorderFieldsDto, 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 = reorderFieldsDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/fields/ordering" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putSchemaFieldOrderingValidateBeforeCall(String schema, ReorderFieldsDto reorderFieldsDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'reorderFieldsDto' is set + if (reorderFieldsDto == null) { + throw new ApiException("Missing the required parameter 'reorderFieldsDto' when calling (Async)"); + } + + return putSchemaFieldOrderingCall(schema, reorderFieldsDto, _callback); + + } + + + private ApiResponse putSchemaFieldOrderingWithHttpInfo(String schema, ReorderFieldsDto reorderFieldsDto) throws ApiException { + okhttp3.Call localVarCall = putSchemaFieldOrderingValidateBeforeCall(schema, reorderFieldsDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putSchemaFieldOrderingAsync(String schema, ReorderFieldsDto reorderFieldsDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putSchemaFieldOrderingValidateBeforeCall(schema, reorderFieldsDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsPutSchemaFieldOrderingRequest { + private final String schema; + private final ReorderFieldsDto reorderFieldsDto; + + private APIschemaFieldsPutSchemaFieldOrderingRequest(String schema, ReorderFieldsDto reorderFieldsDto) { + this.schema = schema; + this.reorderFieldsDto = reorderFieldsDto; + } + + /** + * Build call for putSchemaFieldOrdering + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema fields reordered. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putSchemaFieldOrderingCall(schema, reorderFieldsDto, _callback); + } + + /** + * Execute putSchemaFieldOrdering request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema fields reordered. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putSchemaFieldOrderingWithHttpInfo(schema, reorderFieldsDto); + return localVarResp.getData(); + } + + /** + * Execute putSchemaFieldOrdering request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema fields reordered. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putSchemaFieldOrderingWithHttpInfo(schema, reorderFieldsDto); + } + + /** + * Execute putSchemaFieldOrdering request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema fields reordered. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putSchemaFieldOrderingAsync(schema, reorderFieldsDto, _callback); + } + } + + /** + * Reorder all fields. + * + * @param schema The name of the schema. (required) + * @param reorderFieldsDto The request that contains the field ids. (required) + * @return APIschemaFieldsPutSchemaFieldOrderingRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema fields reordered. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsPutSchemaFieldOrderingRequest putSchemaFieldOrdering(String schema, ReorderFieldsDto reorderFieldsDto) { + return new APIschemaFieldsPutSchemaFieldOrderingRequest(schema, reorderFieldsDto); + } + private okhttp3.Call putSchemaUIFieldsCall(String schema, ConfigureUIFieldsDto configureUIFieldsDto, 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 = configureUIFieldsDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/fields/ui" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putSchemaUIFieldsValidateBeforeCall(String schema, ConfigureUIFieldsDto configureUIFieldsDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'configureUIFieldsDto' is set + if (configureUIFieldsDto == null) { + throw new ApiException("Missing the required parameter 'configureUIFieldsDto' when calling (Async)"); + } + + return putSchemaUIFieldsCall(schema, configureUIFieldsDto, _callback); + + } + + + private ApiResponse putSchemaUIFieldsWithHttpInfo(String schema, ConfigureUIFieldsDto configureUIFieldsDto) throws ApiException { + okhttp3.Call localVarCall = putSchemaUIFieldsValidateBeforeCall(schema, configureUIFieldsDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putSchemaUIFieldsAsync(String schema, ConfigureUIFieldsDto configureUIFieldsDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putSchemaUIFieldsValidateBeforeCall(schema, configureUIFieldsDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsPutSchemaUIFieldsRequest { + private final String schema; + private final ConfigureUIFieldsDto configureUIFieldsDto; + + private APIschemaFieldsPutSchemaUIFieldsRequest(String schema, ConfigureUIFieldsDto configureUIFieldsDto) { + this.schema = schema; + this.configureUIFieldsDto = configureUIFieldsDto; + } + + /** + * Build call for putSchemaUIFields + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema UI fields defined. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putSchemaUIFieldsCall(schema, configureUIFieldsDto, _callback); + } + + /** + * Execute putSchemaUIFields request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema UI fields defined. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putSchemaUIFieldsWithHttpInfo(schema, configureUIFieldsDto); + return localVarResp.getData(); + } + + /** + * Execute putSchemaUIFields request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema UI fields defined. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putSchemaUIFieldsWithHttpInfo(schema, configureUIFieldsDto); + } + + /** + * Execute putSchemaUIFields request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema UI fields defined. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putSchemaUIFieldsAsync(schema, configureUIFieldsDto, _callback); + } + } + + /** + * Configure UI fields. + * + * @param schema The name of the schema. (required) + * @param configureUIFieldsDto The request that contains the field names. (required) + * @return APIschemaFieldsPutSchemaUIFieldsRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema UI fields defined. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsPutSchemaUIFieldsRequest putSchemaUIFields(String schema, ConfigureUIFieldsDto configureUIFieldsDto) { + return new APIschemaFieldsPutSchemaUIFieldsRequest(schema, configureUIFieldsDto); + } + private okhttp3.Call showFieldCall(String schema, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{id}/show" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call showFieldValidateBeforeCall(String schema, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return showFieldCall(schema, id, _callback); + + } + + + private ApiResponse showFieldWithHttpInfo(String schema, Long id) throws ApiException { + okhttp3.Call localVarCall = showFieldValidateBeforeCall(schema, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call showFieldAsync(String schema, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = showFieldValidateBeforeCall(schema, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsShowFieldRequest { + private final String schema; + private final Long id; + + private APIschemaFieldsShowFieldRequest(String schema, Long id) { + this.schema = schema; + this.id = id; + } + + /** + * Build call for showField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return showFieldCall(schema, id, _callback); + } + + /** + * Execute showField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = showFieldWithHttpInfo(schema, id); + return localVarResp.getData(); + } + + /** + * Execute showField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return showFieldWithHttpInfo(schema, id); + } + + /** + * Execute showField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return showFieldAsync(schema, id, _callback); + } + } + + /** + * Show a schema field. + * A hidden field is not part of the API response, but can still be edited in the portal. + * @param schema The name of the schema. (required) + * @param id The ID of the field to show. (required) + * @return APIschemaFieldsShowFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsShowFieldRequest showField(String schema, Long id) { + return new APIschemaFieldsShowFieldRequest(schema, id); + } + private okhttp3.Call showNestedFieldCall(String schema, Long parentId, Long 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 = "/api/apps/$app$/schemas/{schema}/fields/{parentId}/nested/{id}/show" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.toString())) + .replace("{" + "parentId" + "}", localVarApiClient.escapeString(parentId.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call showNestedFieldValidateBeforeCall(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'parentId' is set + if (parentId == null) { + throw new ApiException("Missing the required parameter 'parentId' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return showNestedFieldCall(schema, parentId, id, _callback); + + } + + + private ApiResponse showNestedFieldWithHttpInfo(String schema, Long parentId, Long id) throws ApiException { + okhttp3.Call localVarCall = showNestedFieldValidateBeforeCall(schema, parentId, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call showNestedFieldAsync(String schema, Long parentId, Long id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = showNestedFieldValidateBeforeCall(schema, parentId, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemaFieldsShowNestedFieldRequest { + private final String schema; + private final Long parentId; + private final Long id; + + private APIschemaFieldsShowNestedFieldRequest(String schema, Long parentId, Long id) { + this.schema = schema; + this.parentId = parentId; + this.id = id; + } + + /** + * Build call for showNestedField + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return showNestedFieldCall(schema, parentId, id, _callback); + } + + /** + * Execute showNestedField request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = showNestedFieldWithHttpInfo(schema, parentId, id); + return localVarResp.getData(); + } + + /** + * Execute showNestedField request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return showNestedFieldWithHttpInfo(schema, parentId, id); + } + + /** + * Execute showNestedField request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return showNestedFieldAsync(schema, parentId, id, _callback); + } + } + + /** + * Show a nested field. + * A hidden field is not part of the API response, but can still be edited in the portal. + * @param schema The name of the schema. (required) + * @param parentId The parent field id. (required) + * @param id The ID of the field to show. (required) + * @return APIschemaFieldsShowNestedFieldRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema field shown. -
400 Schema field request not valid or field locked. -
404 Schema, field or app not found. -
500 Operation failed. -
+ */ + public APIschemaFieldsShowNestedFieldRequest showNestedField(String schema, Long parentId, Long id) { + return new APIschemaFieldsShowNestedFieldRequest(schema, parentId, id); + } + private okhttp3.Call deleteSchemaCall(String schema, 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 = "/api/apps/$app$/schemas/{schema}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteSchemaValidateBeforeCall(String schema, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + return deleteSchemaCall(schema, _callback); + + } + + + private ApiResponse deleteSchemaWithHttpInfo(String schema) throws ApiException { + okhttp3.Call localVarCall = deleteSchemaValidateBeforeCall(schema, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteSchemaAsync(String schema, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteSchemaValidateBeforeCall(schema, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIschemasDeleteSchemaRequest { + private final String schema; + + private APIschemasDeleteSchemaRequest(String schema) { + this.schema = schema; + } + + /** + * Build call for deleteSchema + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Schema deleted. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteSchemaCall(schema, _callback); + } + + /** + * Execute deleteSchema request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Schema deleted. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteSchemaWithHttpInfo(schema); + } + + /** + * Execute deleteSchema request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Schema deleted. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteSchemaWithHttpInfo(schema); + } + + /** + * Execute deleteSchema request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Schema deleted. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteSchemaAsync(schema, _callback); + } + } + + /** + * Delete a schema. + * + * @param schema The name of the schema to delete. (required) + * @return APIschemasDeleteSchemaRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Schema deleted. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIschemasDeleteSchemaRequest deleteSchema(String schema) { + return new APIschemasDeleteSchemaRequest(schema); + } + private okhttp3.Call getSchemaCall(String schema, 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 = "/api/apps/$app$/schemas/{schema}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSchemaValidateBeforeCall(String schema, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + return getSchemaCall(schema, _callback); + + } + + + private ApiResponse getSchemaWithHttpInfo(String schema) throws ApiException { + okhttp3.Call localVarCall = getSchemaValidateBeforeCall(schema, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getSchemaAsync(String schema, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSchemaValidateBeforeCall(schema, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasGetSchemaRequest { + private final String schema; + + private APIschemasGetSchemaRequest(String schema) { + this.schema = schema; + } + + /** + * Build call for getSchema + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Schema found. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getSchemaCall(schema, _callback); + } + + /** + * Execute getSchema request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Schema found. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = getSchemaWithHttpInfo(schema); + return localVarResp.getData(); + } + + /** + * Execute getSchema request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Schema found. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getSchemaWithHttpInfo(schema); + } + + /** + * Execute getSchema request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Schema found. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getSchemaAsync(schema, _callback); + } + } + + /** + * Get a schema by name. + * + * @param schema The name of the schema to retrieve. (required) + * @return APIschemasGetSchemaRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Schema found. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public APIschemasGetSchemaRequest getSchema(String schema) { + return new APIschemasGetSchemaRequest(schema); + } + private okhttp3.Call getSchemasCall(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 = "/api/apps/$app$/schemas"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSchemasValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getSchemasCall(_callback); + + } + + + private ApiResponse getSchemasWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getSchemasValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getSchemasAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getSchemasValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasGetSchemasRequest { + + private APIschemasGetSchemasRequest() { + } + + /** + * Build call for getSchemas + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Schemas returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getSchemasCall(_callback); + } + + /** + * Execute getSchemas request + * @return SchemasDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Schemas returned. -
404 App not found. -
500 Operation failed. -
+ */ + public SchemasDto execute() throws ApiException { + ApiResponse localVarResp = getSchemasWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getSchemas request with HTTP info returned + * @return ApiResponse<SchemasDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Schemas returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getSchemasWithHttpInfo(); + } + + /** + * Execute getSchemas request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Schemas returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getSchemasAsync(_callback); + } + } + + /** + * Get schemas. + * + * @return APIschemasGetSchemasRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Schemas returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIschemasGetSchemasRequest getSchemas() { + return new APIschemasGetSchemasRequest(); + } + private okhttp3.Call postSchemaCall(CreateSchemaDto createSchemaDto, 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 = createSchemaDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postSchemaValidateBeforeCall(CreateSchemaDto createSchemaDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createSchemaDto' is set + if (createSchemaDto == null) { + throw new ApiException("Missing the required parameter 'createSchemaDto' when calling (Async)"); + } + + return postSchemaCall(createSchemaDto, _callback); + + } + + + private ApiResponse postSchemaWithHttpInfo(CreateSchemaDto createSchemaDto) throws ApiException { + okhttp3.Call localVarCall = postSchemaValidateBeforeCall(createSchemaDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postSchemaAsync(CreateSchemaDto createSchemaDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postSchemaValidateBeforeCall(createSchemaDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasPostSchemaRequest { + private final CreateSchemaDto createSchemaDto; + + private APIschemasPostSchemaRequest(CreateSchemaDto createSchemaDto) { + this.createSchemaDto = createSchemaDto; + } + + /** + * Build call for postSchema + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Schema created. -
400 Schema request not valid. -
409 Schema name already in use. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postSchemaCall(createSchemaDto, _callback); + } + + /** + * Execute postSchema request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Schema created. -
400 Schema request not valid. -
409 Schema name already in use. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = postSchemaWithHttpInfo(createSchemaDto); + return localVarResp.getData(); + } + + /** + * Execute postSchema request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Schema created. -
400 Schema request not valid. -
409 Schema name already in use. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postSchemaWithHttpInfo(createSchemaDto); + } + + /** + * Execute postSchema request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
201 Schema created. -
400 Schema request not valid. -
409 Schema name already in use. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postSchemaAsync(createSchemaDto, _callback); + } + } + + /** + * Create a new schema. + * + * @param createSchemaDto The schema object that needs to be added to the app. (required) + * @return APIschemasPostSchemaRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Schema created. -
400 Schema request not valid. -
409 Schema name already in use. -
500 Operation failed. -
+ */ + public APIschemasPostSchemaRequest postSchema(CreateSchemaDto createSchemaDto) { + return new APIschemasPostSchemaRequest(createSchemaDto); + } + private okhttp3.Call publishSchemaCall(String schema, 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 = "/api/apps/$app$/schemas/{schema}/publish" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call publishSchemaValidateBeforeCall(String schema, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + return publishSchemaCall(schema, _callback); + + } + + + private ApiResponse publishSchemaWithHttpInfo(String schema) throws ApiException { + okhttp3.Call localVarCall = publishSchemaValidateBeforeCall(schema, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call publishSchemaAsync(String schema, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = publishSchemaValidateBeforeCall(schema, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasPublishSchemaRequest { + private final String schema; + + private APIschemasPublishSchemaRequest(String schema) { + this.schema = schema; + } + + /** + * Build call for publishSchema + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema published. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return publishSchemaCall(schema, _callback); + } + + /** + * Execute publishSchema request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema published. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = publishSchemaWithHttpInfo(schema); + return localVarResp.getData(); + } + + /** + * Execute publishSchema request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema published. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return publishSchemaWithHttpInfo(schema); + } + + /** + * Execute publishSchema request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema published. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return publishSchemaAsync(schema, _callback); + } + } + + /** + * Publish a schema. + * + * @param schema The name of the schema to publish. (required) + * @return APIschemasPublishSchemaRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema published. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIschemasPublishSchemaRequest publishSchema(String schema) { + return new APIschemasPublishSchemaRequest(schema); + } + private okhttp3.Call putCategoryCall(String schema, ChangeCategoryDto changeCategoryDto, 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 = changeCategoryDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/category" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putCategoryValidateBeforeCall(String schema, ChangeCategoryDto changeCategoryDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'changeCategoryDto' is set + if (changeCategoryDto == null) { + throw new ApiException("Missing the required parameter 'changeCategoryDto' when calling (Async)"); + } + + return putCategoryCall(schema, changeCategoryDto, _callback); + + } + + + private ApiResponse putCategoryWithHttpInfo(String schema, ChangeCategoryDto changeCategoryDto) throws ApiException { + okhttp3.Call localVarCall = putCategoryValidateBeforeCall(schema, changeCategoryDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putCategoryAsync(String schema, ChangeCategoryDto changeCategoryDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putCategoryValidateBeforeCall(schema, changeCategoryDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasPutCategoryRequest { + private final String schema; + private final ChangeCategoryDto changeCategoryDto; + + private APIschemasPutCategoryRequest(String schema, ChangeCategoryDto changeCategoryDto) { + this.schema = schema; + this.changeCategoryDto = changeCategoryDto; + } + + /** + * Build call for putCategory + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putCategoryCall(schema, changeCategoryDto, _callback); + } + + /** + * Execute putCategory request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putCategoryWithHttpInfo(schema, changeCategoryDto); + return localVarResp.getData(); + } + + /** + * Execute putCategory request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putCategoryWithHttpInfo(schema, changeCategoryDto); + } + + /** + * Execute putCategory request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putCategoryAsync(schema, changeCategoryDto, _callback); + } + } + + /** + * Update a schema category. + * + * @param schema The name of the schema. (required) + * @param changeCategoryDto The schema object that needs to updated. (required) + * @return APIschemasPutCategoryRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public APIschemasPutCategoryRequest putCategory(String schema, ChangeCategoryDto changeCategoryDto) { + return new APIschemasPutCategoryRequest(schema, changeCategoryDto); + } + private okhttp3.Call putPreviewUrlsCall(String schema, Map requestBody, 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 = requestBody; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/preview-urls" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putPreviewUrlsValidateBeforeCall(String schema, Map requestBody, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'requestBody' is set + if (requestBody == null) { + throw new ApiException("Missing the required parameter 'requestBody' when calling (Async)"); + } + + return putPreviewUrlsCall(schema, requestBody, _callback); + + } + + + private ApiResponse putPreviewUrlsWithHttpInfo(String schema, Map requestBody) throws ApiException { + okhttp3.Call localVarCall = putPreviewUrlsValidateBeforeCall(schema, requestBody, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putPreviewUrlsAsync(String schema, Map requestBody, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putPreviewUrlsValidateBeforeCall(schema, requestBody, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasPutPreviewUrlsRequest { + private final String schema; + private final Map requestBody; + + private APIschemasPutPreviewUrlsRequest(String schema, Map requestBody) { + this.schema = schema; + this.requestBody = requestBody; + } + + /** + * Build call for putPreviewUrls + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putPreviewUrlsCall(schema, requestBody, _callback); + } + + /** + * Execute putPreviewUrls request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putPreviewUrlsWithHttpInfo(schema, requestBody); + return localVarResp.getData(); + } + + /** + * Execute putPreviewUrls request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putPreviewUrlsWithHttpInfo(schema, requestBody); + } + + /** + * Execute putPreviewUrls request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putPreviewUrlsAsync(schema, requestBody, _callback); + } + } + + /** + * Update the preview urls. + * + * @param schema The name of the schema. (required) + * @param requestBody The preview urls for the schema. (required) + * @return APIschemasPutPreviewUrlsRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public APIschemasPutPreviewUrlsRequest putPreviewUrls(String schema, Map requestBody) { + return new APIschemasPutPreviewUrlsRequest(schema, requestBody); + } + private okhttp3.Call putRulesCall(String schema, ConfigureFieldRulesDto configureFieldRulesDto, 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 = configureFieldRulesDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/rules" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putRulesValidateBeforeCall(String schema, ConfigureFieldRulesDto configureFieldRulesDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'configureFieldRulesDto' is set + if (configureFieldRulesDto == null) { + throw new ApiException("Missing the required parameter 'configureFieldRulesDto' when calling (Async)"); + } + + return putRulesCall(schema, configureFieldRulesDto, _callback); + + } + + + private ApiResponse putRulesWithHttpInfo(String schema, ConfigureFieldRulesDto configureFieldRulesDto) throws ApiException { + okhttp3.Call localVarCall = putRulesValidateBeforeCall(schema, configureFieldRulesDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putRulesAsync(String schema, ConfigureFieldRulesDto configureFieldRulesDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putRulesValidateBeforeCall(schema, configureFieldRulesDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasPutRulesRequest { + private final String schema; + private final ConfigureFieldRulesDto configureFieldRulesDto; + + private APIschemasPutRulesRequest(String schema, ConfigureFieldRulesDto configureFieldRulesDto) { + this.schema = schema; + this.configureFieldRulesDto = configureFieldRulesDto; + } + + /** + * Build call for putRules + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putRulesCall(schema, configureFieldRulesDto, _callback); + } + + /** + * Execute putRules request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putRulesWithHttpInfo(schema, configureFieldRulesDto); + return localVarResp.getData(); + } + + /** + * Execute putRules request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putRulesWithHttpInfo(schema, configureFieldRulesDto); + } + + /** + * Execute putRules request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putRulesAsync(schema, configureFieldRulesDto, _callback); + } + } + + /** + * Update the rules. + * + * @param schema The name of the schema. (required) + * @param configureFieldRulesDto The schema rules object that needs to updated. (required) + * @return APIschemasPutRulesRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public APIschemasPutRulesRequest putRules(String schema, ConfigureFieldRulesDto configureFieldRulesDto) { + return new APIschemasPutRulesRequest(schema, configureFieldRulesDto); + } + private okhttp3.Call putSchemaCall(String schema, UpdateSchemaDto updateSchemaDto, 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 = updateSchemaDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putSchemaValidateBeforeCall(String schema, UpdateSchemaDto updateSchemaDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'updateSchemaDto' is set + if (updateSchemaDto == null) { + throw new ApiException("Missing the required parameter 'updateSchemaDto' when calling (Async)"); + } + + return putSchemaCall(schema, updateSchemaDto, _callback); + + } + + + private ApiResponse putSchemaWithHttpInfo(String schema, UpdateSchemaDto updateSchemaDto) throws ApiException { + okhttp3.Call localVarCall = putSchemaValidateBeforeCall(schema, updateSchemaDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putSchemaAsync(String schema, UpdateSchemaDto updateSchemaDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putSchemaValidateBeforeCall(schema, updateSchemaDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasPutSchemaRequest { + private final String schema; + private final UpdateSchemaDto updateSchemaDto; + + private APIschemasPutSchemaRequest(String schema, UpdateSchemaDto updateSchemaDto) { + this.schema = schema; + this.updateSchemaDto = updateSchemaDto; + } + + /** + * Build call for putSchema + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putSchemaCall(schema, updateSchemaDto, _callback); + } + + /** + * Execute putSchema request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putSchemaWithHttpInfo(schema, updateSchemaDto); + return localVarResp.getData(); + } + + /** + * Execute putSchema request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putSchemaWithHttpInfo(schema, updateSchemaDto); + } + + /** + * Execute putSchema request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putSchemaAsync(schema, updateSchemaDto, _callback); + } + } + + /** + * Update a schema. + * + * @param schema The name of the schema. (required) + * @param updateSchemaDto The schema object that needs to updated. (required) + * @return APIschemasPutSchemaRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public APIschemasPutSchemaRequest putSchema(String schema, UpdateSchemaDto updateSchemaDto) { + return new APIschemasPutSchemaRequest(schema, updateSchemaDto); + } + private okhttp3.Call putSchemaSyncCall(String schema, SynchronizeSchemaDto synchronizeSchemaDto, 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 = synchronizeSchemaDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/sync" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putSchemaSyncValidateBeforeCall(String schema, SynchronizeSchemaDto synchronizeSchemaDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'synchronizeSchemaDto' is set + if (synchronizeSchemaDto == null) { + throw new ApiException("Missing the required parameter 'synchronizeSchemaDto' when calling (Async)"); + } + + return putSchemaSyncCall(schema, synchronizeSchemaDto, _callback); + + } + + + private ApiResponse putSchemaSyncWithHttpInfo(String schema, SynchronizeSchemaDto synchronizeSchemaDto) throws ApiException { + okhttp3.Call localVarCall = putSchemaSyncValidateBeforeCall(schema, synchronizeSchemaDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putSchemaSyncAsync(String schema, SynchronizeSchemaDto synchronizeSchemaDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putSchemaSyncValidateBeforeCall(schema, synchronizeSchemaDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasPutSchemaSyncRequest { + private final String schema; + private final SynchronizeSchemaDto synchronizeSchemaDto; + + private APIschemasPutSchemaSyncRequest(String schema, SynchronizeSchemaDto synchronizeSchemaDto) { + this.schema = schema; + this.synchronizeSchemaDto = synchronizeSchemaDto; + } + + /** + * Build call for putSchemaSync + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putSchemaSyncCall(schema, synchronizeSchemaDto, _callback); + } + + /** + * Execute putSchemaSync request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putSchemaSyncWithHttpInfo(schema, synchronizeSchemaDto); + return localVarResp.getData(); + } + + /** + * Execute putSchemaSync request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putSchemaSyncWithHttpInfo(schema, synchronizeSchemaDto); + } + + /** + * Execute putSchemaSync request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putSchemaSyncAsync(schema, synchronizeSchemaDto, _callback); + } + } + + /** + * Synchronize a schema. + * + * @param schema The name of the schema. (required) + * @param synchronizeSchemaDto The schema object that needs to updated. (required) + * @return APIschemasPutSchemaSyncRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public APIschemasPutSchemaSyncRequest putSchemaSync(String schema, SynchronizeSchemaDto synchronizeSchemaDto) { + return new APIschemasPutSchemaSyncRequest(schema, synchronizeSchemaDto); + } + private okhttp3.Call putScriptsCall(String schema, SchemaScriptsDto schemaScriptsDto, 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 = schemaScriptsDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/schemas/{schema}/scripts" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putScriptsValidateBeforeCall(String schema, SchemaScriptsDto schemaScriptsDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + // verify the required parameter 'schemaScriptsDto' is set + if (schemaScriptsDto == null) { + throw new ApiException("Missing the required parameter 'schemaScriptsDto' when calling (Async)"); + } + + return putScriptsCall(schema, schemaScriptsDto, _callback); + + } + + + private ApiResponse putScriptsWithHttpInfo(String schema, SchemaScriptsDto schemaScriptsDto) throws ApiException { + okhttp3.Call localVarCall = putScriptsValidateBeforeCall(schema, schemaScriptsDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putScriptsAsync(String schema, SchemaScriptsDto schemaScriptsDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putScriptsValidateBeforeCall(schema, schemaScriptsDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasPutScriptsRequest { + private final String schema; + private final SchemaScriptsDto schemaScriptsDto; + + private APIschemasPutScriptsRequest(String schema, SchemaScriptsDto schemaScriptsDto) { + this.schema = schema; + this.schemaScriptsDto = schemaScriptsDto; + } + + /** + * Build call for putScripts + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putScriptsCall(schema, schemaScriptsDto, _callback); + } + + /** + * Execute putScripts request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = putScriptsWithHttpInfo(schema, schemaScriptsDto); + return localVarResp.getData(); + } + + /** + * Execute putScripts request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putScriptsWithHttpInfo(schema, schemaScriptsDto); + } + + /** + * Execute putScripts request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putScriptsAsync(schema, schemaScriptsDto, _callback); + } + } + + /** + * Update the scripts. + * + * @param schema The name of the schema. (required) + * @param schemaScriptsDto The schema scripts object that needs to updated. (required) + * @return APIschemasPutScriptsRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema updated. -
400 Schema request not valid. -
404 Schema or app not found. -
500 Operation failed. -
+ */ + public APIschemasPutScriptsRequest putScripts(String schema, SchemaScriptsDto schemaScriptsDto) { + return new APIschemasPutScriptsRequest(schema, schemaScriptsDto); + } + private okhttp3.Call unpublishSchemaCall(String schema, 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 = "/api/apps/$app$/schemas/{schema}/unpublish" + .replace("{" + "schema" + "}", localVarApiClient.escapeString(schema.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call unpublishSchemaValidateBeforeCall(String schema, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'schema' is set + if (schema == null) { + throw new ApiException("Missing the required parameter 'schema' when calling (Async)"); + } + + return unpublishSchemaCall(schema, _callback); + + } + + + private ApiResponse unpublishSchemaWithHttpInfo(String schema) throws ApiException { + okhttp3.Call localVarCall = unpublishSchemaValidateBeforeCall(schema, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call unpublishSchemaAsync(String schema, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = unpublishSchemaValidateBeforeCall(schema, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIschemasUnpublishSchemaRequest { + private final String schema; + + private APIschemasUnpublishSchemaRequest(String schema) { + this.schema = schema; + } + + /** + * Build call for unpublishSchema + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema unpublished. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return unpublishSchemaCall(schema, _callback); + } + + /** + * Execute unpublishSchema request + * @return SchemaDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema unpublished. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public SchemaDto execute() throws ApiException { + ApiResponse localVarResp = unpublishSchemaWithHttpInfo(schema); + return localVarResp.getData(); + } + + /** + * Execute unpublishSchema request with HTTP info returned + * @return ApiResponse<SchemaDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema unpublished. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return unpublishSchemaWithHttpInfo(schema); + } + + /** + * Execute unpublishSchema request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Schema unpublished. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return unpublishSchemaAsync(schema, _callback); + } + } + + /** + * Unpublish a schema. + * + * @param schema The name of the schema to unpublish. (required) + * @return APIschemasUnpublishSchemaRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Schema unpublished. -
404 Schema or app not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIschemasUnpublishSchemaRequest unpublishSchema(String schema) { + return new APIschemasUnpublishSchemaRequest(schema); + } +} diff --git a/src/main/java/com/squidex/api/core/api/SearchApi.java b/src/main/java/com/squidex/api/core/api/SearchApi.java new file mode 100644 index 0000000..ab9412d --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/SearchApi.java @@ -0,0 +1,246 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.SearchResultDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class SearchApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public SearchApi() { + this(Configuration.getDefaultApiClient()); + } + + public SearchApi(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; + } + + private okhttp3.Call getSearchResultsCall(String query, 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 = "/api/apps/$app$/search"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getSearchResultsValidateBeforeCall(String query, final ApiCallback _callback) throws ApiException { + return getSearchResultsCall(query, _callback); + + } + + + private ApiResponse> getSearchResultsWithHttpInfo(String query) throws ApiException { + okhttp3.Call localVarCall = getSearchResultsValidateBeforeCall(query, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getSearchResultsAsync(String query, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getSearchResultsValidateBeforeCall(query, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIsearchGetSearchResultsRequest { + private String query; + + private APIsearchGetSearchResultsRequest() { + } + + /** + * Set query + * @param query The search query. (optional) + * @return APIsearchGetSearchResultsRequest + */ + public APIsearchGetSearchResultsRequest query(String query) { + this.query = query; + return this; + } + + /** + * Build call for getSearchResults + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Search results returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getSearchResultsCall(query, _callback); + } + + /** + * Execute getSearchResults request + * @return List<SearchResultDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Search results returned. -
404 App not found. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getSearchResultsWithHttpInfo(query); + return localVarResp.getData(); + } + + /** + * Execute getSearchResults request with HTTP info returned + * @return ApiResponse<List<SearchResultDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Search results returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getSearchResultsWithHttpInfo(query); + } + + /** + * Execute getSearchResults request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Search results returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getSearchResultsAsync(query, _callback); + } + } + + /** + * Get search results. + * + * @return APIsearchGetSearchResultsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Search results returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIsearchGetSearchResultsRequest getSearchResults() { + return new APIsearchGetSearchResultsRequest(); + } +} diff --git a/src/main/java/com/squidex/api/core/api/StatisticsApi.java b/src/main/java/com/squidex/api/core/api/StatisticsApi.java new file mode 100644 index 0000000..de0778c --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/StatisticsApi.java @@ -0,0 +1,1252 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.CallsUsageDtoDto; +import com.squidex.api.types.CurrentStorageDto; +import com.squidex.api.types.ErrorDto; +import java.time.LocalDate; +import com.squidex.api.types.LogDownloadDto; +import com.squidex.api.types.StorageUsagePerDateDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class StatisticsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public StatisticsApi() { + this(Configuration.getDefaultApiClient()); + } + + public StatisticsApi(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; + } + + private okhttp3.Call getCurrentStorageSizeCall(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 = "/api/apps/$app$/usages/storage/today"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getCurrentStorageSizeValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getCurrentStorageSizeCall(_callback); + + } + + + private ApiResponse getCurrentStorageSizeWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getCurrentStorageSizeValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getCurrentStorageSizeAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getCurrentStorageSizeValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusagesGetCurrentStorageSizeRequest { + + private APIusagesGetCurrentStorageSizeRequest() { + } + + /** + * Build call for getCurrentStorageSize + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getCurrentStorageSizeCall(_callback); + } + + /** + * Execute getCurrentStorageSize request + * @return CurrentStorageDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 App not found. -
500 Operation failed. -
+ */ + public CurrentStorageDto execute() throws ApiException { + ApiResponse localVarResp = getCurrentStorageSizeWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getCurrentStorageSize request with HTTP info returned + * @return ApiResponse<CurrentStorageDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getCurrentStorageSizeWithHttpInfo(); + } + + /** + * Execute getCurrentStorageSize request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getCurrentStorageSizeAsync(_callback); + } + } + + /** + * Get total asset size for app. + * + * @return APIusagesGetCurrentStorageSizeRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIusagesGetCurrentStorageSizeRequest getCurrentStorageSize() { + return new APIusagesGetCurrentStorageSizeRequest(); + } + private okhttp3.Call getLogCall(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 = "/api/apps/$app$/usages/log"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getLogValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getLogCall(_callback); + + } + + + private ApiResponse getLogWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getLogValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getLogAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getLogValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusagesGetLogRequest { + + private APIusagesGetLogRequest() { + } + + /** + * Build call for getLog + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Usage tracking results returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getLogCall(_callback); + } + + /** + * Execute getLog request + * @return LogDownloadDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Usage tracking results returned. -
404 App not found. -
500 Operation failed. -
+ */ + public LogDownloadDto execute() throws ApiException { + ApiResponse localVarResp = getLogWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getLog request with HTTP info returned + * @return ApiResponse<LogDownloadDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Usage tracking results returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getLogWithHttpInfo(); + } + + /** + * Execute getLog request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Usage tracking results returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getLogAsync(_callback); + } + } + + /** + * Get api calls as log file. + * + * @return APIusagesGetLogRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Usage tracking results returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIusagesGetLogRequest getLog() { + return new APIusagesGetLogRequest(); + } + private okhttp3.Call getStorageSizesCall(LocalDate fromDate, LocalDate toDate, 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 = "/api/apps/$app$/usages/storage/{fromDate}/{toDate}" + .replace("{" + "fromDate" + "}", localVarApiClient.escapeString(fromDate.toString())) + .replace("{" + "toDate" + "}", localVarApiClient.escapeString(toDate.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getStorageSizesValidateBeforeCall(LocalDate fromDate, LocalDate toDate, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'fromDate' is set + if (fromDate == null) { + throw new ApiException("Missing the required parameter 'fromDate' when calling (Async)"); + } + + // verify the required parameter 'toDate' is set + if (toDate == null) { + throw new ApiException("Missing the required parameter 'toDate' when calling (Async)"); + } + + return getStorageSizesCall(fromDate, toDate, _callback); + + } + + + private ApiResponse> getStorageSizesWithHttpInfo(LocalDate fromDate, LocalDate toDate) throws ApiException { + okhttp3.Call localVarCall = getStorageSizesValidateBeforeCall(fromDate, toDate, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getStorageSizesAsync(LocalDate fromDate, LocalDate toDate, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getStorageSizesValidateBeforeCall(fromDate, toDate, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusagesGetStorageSizesRequest { + private final LocalDate fromDate; + private final LocalDate toDate; + + private APIusagesGetStorageSizesRequest(LocalDate fromDate, LocalDate toDate) { + this.fromDate = fromDate; + this.toDate = toDate; + } + + /** + * Build call for getStorageSizes + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getStorageSizesCall(fromDate, toDate, _callback); + } + + /** + * Execute getStorageSizes request + * @return List<StorageUsagePerDateDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 App not found. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getStorageSizesWithHttpInfo(fromDate, toDate); + return localVarResp.getData(); + } + + /** + * Execute getStorageSizes request with HTTP info returned + * @return ApiResponse<List<StorageUsagePerDateDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getStorageSizesWithHttpInfo(fromDate, toDate); + } + + /** + * Execute getStorageSizes request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getStorageSizesAsync(fromDate, toDate, _callback); + } + } + + /** + * Get asset usage by date for app. + * + * @param fromDate The from date. (required) + * @param toDate The to date. (required) + * @return APIusagesGetStorageSizesRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIusagesGetStorageSizesRequest getStorageSizes(LocalDate fromDate, LocalDate toDate) { + return new APIusagesGetStorageSizesRequest(fromDate, toDate); + } + private okhttp3.Call getStorageSizesForTeamCall(String team, LocalDate fromDate, LocalDate toDate, 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 = "/api/teams/{team}/usages/storage/{fromDate}/{toDate}" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.toString())) + .replace("{" + "fromDate" + "}", localVarApiClient.escapeString(fromDate.toString())) + .replace("{" + "toDate" + "}", localVarApiClient.escapeString(toDate.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getStorageSizesForTeamValidateBeforeCall(String team, LocalDate fromDate, LocalDate toDate, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + // verify the required parameter 'fromDate' is set + if (fromDate == null) { + throw new ApiException("Missing the required parameter 'fromDate' when calling (Async)"); + } + + // verify the required parameter 'toDate' is set + if (toDate == null) { + throw new ApiException("Missing the required parameter 'toDate' when calling (Async)"); + } + + return getStorageSizesForTeamCall(team, fromDate, toDate, _callback); + + } + + + private ApiResponse> getStorageSizesForTeamWithHttpInfo(String team, LocalDate fromDate, LocalDate toDate) throws ApiException { + okhttp3.Call localVarCall = getStorageSizesForTeamValidateBeforeCall(team, fromDate, toDate, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getStorageSizesForTeamAsync(String team, LocalDate fromDate, LocalDate toDate, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getStorageSizesForTeamValidateBeforeCall(team, fromDate, toDate, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusagesGetStorageSizesForTeamRequest { + private final String team; + private final LocalDate fromDate; + private final LocalDate toDate; + + private APIusagesGetStorageSizesForTeamRequest(String team, LocalDate fromDate, LocalDate toDate) { + this.team = team; + this.fromDate = fromDate; + this.toDate = toDate; + } + + /** + * Build call for getStorageSizesForTeam + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getStorageSizesForTeamCall(team, fromDate, toDate, _callback); + } + + /** + * Execute getStorageSizesForTeam request + * @return List<StorageUsagePerDateDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getStorageSizesForTeamWithHttpInfo(team, fromDate, toDate); + return localVarResp.getData(); + } + + /** + * Execute getStorageSizesForTeam request with HTTP info returned + * @return ApiResponse<List<StorageUsagePerDateDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getStorageSizesForTeamWithHttpInfo(team, fromDate, toDate); + } + + /** + * Execute getStorageSizesForTeam request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getStorageSizesForTeamAsync(team, fromDate, toDate, _callback); + } + } + + /** + * Get asset usage by date for team. + * + * @param team The ID of the team. (required) + * @param fromDate The from date. (required) + * @param toDate The to date. (required) + * @return APIusagesGetStorageSizesForTeamRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIusagesGetStorageSizesForTeamRequest getStorageSizesForTeam(String team, LocalDate fromDate, LocalDate toDate) { + return new APIusagesGetStorageSizesForTeamRequest(team, fromDate, toDate); + } + private okhttp3.Call getTeamCurrentStorageSizeForTeamCall(String team, 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 = "/api/teams/{team}/usages/storage/today" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTeamCurrentStorageSizeForTeamValidateBeforeCall(String team, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + return getTeamCurrentStorageSizeForTeamCall(team, _callback); + + } + + + private ApiResponse getTeamCurrentStorageSizeForTeamWithHttpInfo(String team) throws ApiException { + okhttp3.Call localVarCall = getTeamCurrentStorageSizeForTeamValidateBeforeCall(team, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getTeamCurrentStorageSizeForTeamAsync(String team, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTeamCurrentStorageSizeForTeamValidateBeforeCall(team, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusagesGetTeamCurrentStorageSizeForTeamRequest { + private final String team; + + private APIusagesGetTeamCurrentStorageSizeForTeamRequest(String team) { + this.team = team; + } + + /** + * Build call for getTeamCurrentStorageSizeForTeam + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getTeamCurrentStorageSizeForTeamCall(team, _callback); + } + + /** + * Execute getTeamCurrentStorageSizeForTeam request + * @return CurrentStorageDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public CurrentStorageDto execute() throws ApiException { + ApiResponse localVarResp = getTeamCurrentStorageSizeForTeamWithHttpInfo(team); + return localVarResp.getData(); + } + + /** + * Execute getTeamCurrentStorageSizeForTeam request with HTTP info returned + * @return ApiResponse<CurrentStorageDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getTeamCurrentStorageSizeForTeamWithHttpInfo(team); + } + + /** + * Execute getTeamCurrentStorageSizeForTeam request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getTeamCurrentStorageSizeForTeamAsync(team, _callback); + } + } + + /** + * Get total asset size for team. + * + * @param team The ID of the team. (required) + * @return APIusagesGetTeamCurrentStorageSizeForTeamRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Storage usage returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIusagesGetTeamCurrentStorageSizeForTeamRequest getTeamCurrentStorageSizeForTeam(String team) { + return new APIusagesGetTeamCurrentStorageSizeForTeamRequest(team); + } + private okhttp3.Call getUsagesCall(LocalDate fromDate, LocalDate toDate, 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 = "/api/apps/$app$/usages/calls/{fromDate}/{toDate}" + .replace("{" + "fromDate" + "}", localVarApiClient.escapeString(fromDate.toString())) + .replace("{" + "toDate" + "}", localVarApiClient.escapeString(toDate.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUsagesValidateBeforeCall(LocalDate fromDate, LocalDate toDate, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'fromDate' is set + if (fromDate == null) { + throw new ApiException("Missing the required parameter 'fromDate' when calling (Async)"); + } + + // verify the required parameter 'toDate' is set + if (toDate == null) { + throw new ApiException("Missing the required parameter 'toDate' when calling (Async)"); + } + + return getUsagesCall(fromDate, toDate, _callback); + + } + + + private ApiResponse getUsagesWithHttpInfo(LocalDate fromDate, LocalDate toDate) throws ApiException { + okhttp3.Call localVarCall = getUsagesValidateBeforeCall(fromDate, toDate, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUsagesAsync(LocalDate fromDate, LocalDate toDate, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUsagesValidateBeforeCall(fromDate, toDate, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusagesGetUsagesRequest { + private final LocalDate fromDate; + private final LocalDate toDate; + + private APIusagesGetUsagesRequest(LocalDate fromDate, LocalDate toDate) { + this.fromDate = fromDate; + this.toDate = toDate; + } + + /** + * Build call for getUsages + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 API call returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUsagesCall(fromDate, toDate, _callback); + } + + /** + * Execute getUsages request + * @return CallsUsageDtoDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 API call returned. -
404 App not found. -
500 Operation failed. -
+ */ + public CallsUsageDtoDto execute() throws ApiException { + ApiResponse localVarResp = getUsagesWithHttpInfo(fromDate, toDate); + return localVarResp.getData(); + } + + /** + * Execute getUsages request with HTTP info returned + * @return ApiResponse<CallsUsageDtoDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 API call returned. -
404 App not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getUsagesWithHttpInfo(fromDate, toDate); + } + + /** + * Execute getUsages request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 API call returned. -
404 App not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getUsagesAsync(fromDate, toDate, _callback); + } + } + + /** + * Get api calls in date range for app. + * + * @param fromDate The from date. (required) + * @param toDate The to date. (required) + * @return APIusagesGetUsagesRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 API call returned. -
404 App not found. -
500 Operation failed. -
+ */ + public APIusagesGetUsagesRequest getUsages(LocalDate fromDate, LocalDate toDate) { + return new APIusagesGetUsagesRequest(fromDate, toDate); + } + private okhttp3.Call getUsagesForTeamCall(String team, LocalDate fromDate, LocalDate toDate, 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 = "/api/teams/{team}/usages/calls/{fromDate}/{toDate}" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.toString())) + .replace("{" + "fromDate" + "}", localVarApiClient.escapeString(fromDate.toString())) + .replace("{" + "toDate" + "}", localVarApiClient.escapeString(toDate.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUsagesForTeamValidateBeforeCall(String team, LocalDate fromDate, LocalDate toDate, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + // verify the required parameter 'fromDate' is set + if (fromDate == null) { + throw new ApiException("Missing the required parameter 'fromDate' when calling (Async)"); + } + + // verify the required parameter 'toDate' is set + if (toDate == null) { + throw new ApiException("Missing the required parameter 'toDate' when calling (Async)"); + } + + return getUsagesForTeamCall(team, fromDate, toDate, _callback); + + } + + + private ApiResponse getUsagesForTeamWithHttpInfo(String team, LocalDate fromDate, LocalDate toDate) throws ApiException { + okhttp3.Call localVarCall = getUsagesForTeamValidateBeforeCall(team, fromDate, toDate, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUsagesForTeamAsync(String team, LocalDate fromDate, LocalDate toDate, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUsagesForTeamValidateBeforeCall(team, fromDate, toDate, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusagesGetUsagesForTeamRequest { + private final String team; + private final LocalDate fromDate; + private final LocalDate toDate; + + private APIusagesGetUsagesForTeamRequest(String team, LocalDate fromDate, LocalDate toDate) { + this.team = team; + this.fromDate = fromDate; + this.toDate = toDate; + } + + /** + * Build call for getUsagesForTeam + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 API call returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUsagesForTeamCall(team, fromDate, toDate, _callback); + } + + /** + * Execute getUsagesForTeam request + * @return CallsUsageDtoDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 API call returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public CallsUsageDtoDto execute() throws ApiException { + ApiResponse localVarResp = getUsagesForTeamWithHttpInfo(team, fromDate, toDate); + return localVarResp.getData(); + } + + /** + * Execute getUsagesForTeam request with HTTP info returned + * @return ApiResponse<CallsUsageDtoDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 API call returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getUsagesForTeamWithHttpInfo(team, fromDate, toDate); + } + + /** + * Execute getUsagesForTeam request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 API call returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getUsagesForTeamAsync(team, fromDate, toDate, _callback); + } + } + + /** + * Get api calls in date range for team. + * + * @param team The name of the team. (required) + * @param fromDate The from date. (required) + * @param toDate The to date. (required) + * @return APIusagesGetUsagesForTeamRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 API call returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIusagesGetUsagesForTeamRequest getUsagesForTeam(String team, LocalDate fromDate, LocalDate toDate) { + return new APIusagesGetUsagesForTeamRequest(team, fromDate, toDate); + } +} diff --git a/src/main/java/com/squidex/api/core/api/TeamsApi.java b/src/main/java/com/squidex/api/core/api/TeamsApi.java new file mode 100644 index 0000000..66bb139 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/TeamsApi.java @@ -0,0 +1,1914 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.AssignContributorDto; +import com.squidex.api.types.AuthSchemeResponseDto; +import com.squidex.api.types.AuthSchemeValueDto; +import com.squidex.api.types.ContributorsDto; +import com.squidex.api.types.CreateTeamDto; +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.TeamDto; +import com.squidex.api.types.UpdateTeamDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class TeamsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TeamsApi() { + this(Configuration.getDefaultApiClient()); + } + + public TeamsApi(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; + } + + private okhttp3.Call deleteContributorCall(String team, String 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 = "/api/teams/{team}/contributors/{id}" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.toString())) + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteContributorValidateBeforeCall(String team, String id, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + // verify the required parameter 'id' is set + if (id == null) { + throw new ApiException("Missing the required parameter 'id' when calling (Async)"); + } + + return deleteContributorCall(team, id, _callback); + + } + + + private ApiResponse deleteContributorWithHttpInfo(String team, String id) throws ApiException { + okhttp3.Call localVarCall = deleteContributorValidateBeforeCall(team, id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteContributorAsync(String team, String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteContributorValidateBeforeCall(team, id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamContributorsDeleteContributorRequest { + private final String team; + private final String id; + + private APIteamContributorsDeleteContributorRequest(String team, String id) { + this.team = team; + this.id = id; + } + + /** + * Build call for deleteContributor + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteContributorCall(team, id, _callback); + } + + /** + * Execute deleteContributor request + * @return ContributorsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ContributorsDto execute() throws ApiException { + ApiResponse localVarResp = deleteContributorWithHttpInfo(team, id); + return localVarResp.getData(); + } + + /** + * Execute deleteContributor request with HTTP info returned + * @return ApiResponse<ContributorsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteContributorWithHttpInfo(team, id); + } + + /** + * Execute deleteContributor request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteContributorAsync(team, id, _callback); + } + } + + /** + * Remove contributor. + * + * @param team The ID of the team. (required) + * @param id The ID of the contributor. (required) + * @return APIteamContributorsDeleteContributorRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIteamContributorsDeleteContributorRequest deleteContributor(String team, String id) { + return new APIteamContributorsDeleteContributorRequest(team, id); + } + private okhttp3.Call deleteMyselfCall(String team, 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 = "/api/teams/{team}/contributors/me" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteMyselfValidateBeforeCall(String team, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + return deleteMyselfCall(team, _callback); + + } + + + private ApiResponse deleteMyselfWithHttpInfo(String team) throws ApiException { + okhttp3.Call localVarCall = deleteMyselfValidateBeforeCall(team, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call deleteMyselfAsync(String team, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteMyselfValidateBeforeCall(team, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamContributorsDeleteMyselfRequest { + private final String team; + + private APIteamContributorsDeleteMyselfRequest(String team) { + this.team = team; + } + + /** + * Build call for deleteMyself + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteMyselfCall(team, _callback); + } + + /** + * Execute deleteMyself request + * @return ContributorsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ContributorsDto execute() throws ApiException { + ApiResponse localVarResp = deleteMyselfWithHttpInfo(team); + return localVarResp.getData(); + } + + /** + * Execute deleteMyself request with HTTP info returned + * @return ApiResponse<ContributorsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteMyselfWithHttpInfo(team); + } + + /** + * Execute deleteMyself request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteMyselfAsync(team, _callback); + } + } + + /** + * Remove yourself. + * + * @param team The ID of the team. (required) + * @return APIteamContributorsDeleteMyselfRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Contributor removed. -
404 Contributor or team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIteamContributorsDeleteMyselfRequest deleteMyself(String team) { + return new APIteamContributorsDeleteMyselfRequest(team); + } + private okhttp3.Call getContributorsCall(String team, 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 = "/api/teams/{team}/contributors" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getContributorsValidateBeforeCall(String team, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + return getContributorsCall(team, _callback); + + } + + + private ApiResponse getContributorsWithHttpInfo(String team) throws ApiException { + okhttp3.Call localVarCall = getContributorsValidateBeforeCall(team, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getContributorsAsync(String team, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getContributorsValidateBeforeCall(team, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamContributorsGetContributorsRequest { + private final String team; + + private APIteamContributorsGetContributorsRequest(String team) { + this.team = team; + } + + /** + * Build call for getContributors + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contributors returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getContributorsCall(team, _callback); + } + + /** + * Execute getContributors request + * @return ContributorsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contributors returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public ContributorsDto execute() throws ApiException { + ApiResponse localVarResp = getContributorsWithHttpInfo(team); + return localVarResp.getData(); + } + + /** + * Execute getContributors request with HTTP info returned + * @return ApiResponse<ContributorsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contributors returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getContributorsWithHttpInfo(team); + } + + /** + * Execute getContributors request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Contributors returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getContributorsAsync(team, _callback); + } + } + + /** + * Get team contributors. + * + * @param team The ID of the team. (required) + * @return APIteamContributorsGetContributorsRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Contributors returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIteamContributorsGetContributorsRequest getContributors(String team) { + return new APIteamContributorsGetContributorsRequest(team); + } + private okhttp3.Call postContributorCall(String team, AssignContributorDto assignContributorDto, 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 = assignContributorDto; + + // create path and map variables + String localVarPath = "/api/teams/{team}/contributors" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postContributorValidateBeforeCall(String team, AssignContributorDto assignContributorDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + // verify the required parameter 'assignContributorDto' is set + if (assignContributorDto == null) { + throw new ApiException("Missing the required parameter 'assignContributorDto' when calling (Async)"); + } + + return postContributorCall(team, assignContributorDto, _callback); + + } + + + private ApiResponse postContributorWithHttpInfo(String team, AssignContributorDto assignContributorDto) throws ApiException { + okhttp3.Call localVarCall = postContributorValidateBeforeCall(team, assignContributorDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postContributorAsync(String team, AssignContributorDto assignContributorDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postContributorValidateBeforeCall(team, assignContributorDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamContributorsPostContributorRequest { + private final String team; + private final AssignContributorDto assignContributorDto; + + private APIteamContributorsPostContributorRequest(String team, AssignContributorDto assignContributorDto) { + this.team = team; + this.assignContributorDto = assignContributorDto; + } + + /** + * Build call for postContributor + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Contributor assigned to team. -
400 Contributor request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postContributorCall(team, assignContributorDto, _callback); + } + + /** + * Execute postContributor request + * @return ContributorsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Contributor assigned to team. -
400 Contributor request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public ContributorsDto execute() throws ApiException { + ApiResponse localVarResp = postContributorWithHttpInfo(team, assignContributorDto); + return localVarResp.getData(); + } + + /** + * Execute postContributor request with HTTP info returned + * @return ApiResponse<ContributorsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Contributor assigned to team. -
400 Contributor request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postContributorWithHttpInfo(team, assignContributorDto); + } + + /** + * Execute postContributor request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
201 Contributor assigned to team. -
400 Contributor request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postContributorAsync(team, assignContributorDto, _callback); + } + } + + /** + * Assign contributor to team. + * + * @param team The ID of the team. (required) + * @param assignContributorDto Contributor object that needs to be added to the team. (required) + * @return APIteamContributorsPostContributorRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
201 Contributor assigned to team. -
400 Contributor request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIteamContributorsPostContributorRequest postContributor(String team, AssignContributorDto assignContributorDto) { + return new APIteamContributorsPostContributorRequest(team, assignContributorDto); + } + private okhttp3.Call deleteTeamCall(String team, 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 = "/api/teams/{team}" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteTeamValidateBeforeCall(String team, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + return deleteTeamCall(team, _callback); + + } + + + private ApiResponse deleteTeamWithHttpInfo(String team) throws ApiException { + okhttp3.Call localVarCall = deleteTeamValidateBeforeCall(team, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteTeamAsync(String team, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteTeamValidateBeforeCall(team, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIteamsDeleteTeamRequest { + private final String team; + + private APIteamsDeleteTeamRequest(String team) { + this.team = team; + } + + /** + * Build call for deleteTeam + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Team deleted. -
404 Team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteTeamCall(team, _callback); + } + + /** + * Execute deleteTeam request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Team deleted. -
404 Team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteTeamWithHttpInfo(team); + } + + /** + * Execute deleteTeam request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Team deleted. -
404 Team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteTeamWithHttpInfo(team); + } + + /** + * Execute deleteTeam request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
204 Team deleted. -
404 Team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteTeamAsync(team, _callback); + } + } + + /** + * Delete the team. + * + * @param team The ID of the team to delete. (required) + * @return APIteamsDeleteTeamRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
204 Team deleted. -
404 Team not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIteamsDeleteTeamRequest deleteTeam(String team) { + return new APIteamsDeleteTeamRequest(team); + } + private okhttp3.Call getTeamCall(String team, 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 = "/api/teams/{team}" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTeamValidateBeforeCall(String team, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + return getTeamCall(team, _callback); + + } + + + private ApiResponse getTeamWithHttpInfo(String team) throws ApiException { + okhttp3.Call localVarCall = getTeamValidateBeforeCall(team, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getTeamAsync(String team, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTeamValidateBeforeCall(team, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamsGetTeamRequest { + private final String team; + + private APIteamsGetTeamRequest(String team) { + this.team = team; + } + + /** + * Build call for getTeam + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Teams returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getTeamCall(team, _callback); + } + + /** + * Execute getTeam request + * @return TeamDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Teams returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public TeamDto execute() throws ApiException { + ApiResponse localVarResp = getTeamWithHttpInfo(team); + return localVarResp.getData(); + } + + /** + * Execute getTeam request with HTTP info returned + * @return ApiResponse<TeamDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Teams returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getTeamWithHttpInfo(team); + } + + /** + * Execute getTeam request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Teams returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getTeamAsync(team, _callback); + } + } + + /** + * Get an team by ID. + * + * @param team The ID of the team. (required) + * @return APIteamsGetTeamRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Teams returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIteamsGetTeamRequest getTeam(String team) { + return new APIteamsGetTeamRequest(team); + } + private okhttp3.Call getTeamAuthCall(String team, 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 = "/api/teams/{team}/auth" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTeamAuthValidateBeforeCall(String team, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + return getTeamAuthCall(team, _callback); + + } + + + private ApiResponse getTeamAuthWithHttpInfo(String team) throws ApiException { + okhttp3.Call localVarCall = getTeamAuthValidateBeforeCall(team, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getTeamAuthAsync(String team, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTeamAuthValidateBeforeCall(team, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamsGetTeamAuthRequest { + private final String team; + + private APIteamsGetTeamAuthRequest(String team) { + this.team = team; + } + + /** + * Build call for getTeamAuth + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Teams returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getTeamAuthCall(team, _callback); + } + + /** + * Execute getTeamAuth request + * @return AuthSchemeResponseDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Teams returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public AuthSchemeResponseDto execute() throws ApiException { + ApiResponse localVarResp = getTeamAuthWithHttpInfo(team); + return localVarResp.getData(); + } + + /** + * Execute getTeamAuth request with HTTP info returned + * @return ApiResponse<AuthSchemeResponseDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Teams returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getTeamAuthWithHttpInfo(team); + } + + /** + * Execute getTeamAuth request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Teams returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getTeamAuthAsync(team, _callback); + } + } + + /** + * Get the team auth settings. + * + * @param team The ID of the team. (required) + * @return APIteamsGetTeamAuthRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Teams returned. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIteamsGetTeamAuthRequest getTeamAuth(String team) { + return new APIteamsGetTeamAuthRequest(team); + } + private okhttp3.Call getTeamsCall(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 = "/api/teams"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTeamsValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getTeamsCall(_callback); + + } + + + private ApiResponse> getTeamsWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getTeamsValidateBeforeCall(null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getTeamsAsync(final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getTeamsValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamsGetTeamsRequest { + + private APIteamsGetTeamsRequest() { + } + + /** + * Build call for getTeams + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Teams returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getTeamsCall(_callback); + } + + /** + * Execute getTeams request + * @return List<TeamDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Teams returned. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getTeamsWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getTeams request with HTTP info returned + * @return ApiResponse<List<TeamDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Teams returned. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getTeamsWithHttpInfo(); + } + + /** + * Execute getTeams request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Teams returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getTeamsAsync(_callback); + } + } + + /** + * Get your teams. + * You can only retrieve the list of teams when you are authenticated as a user (OpenID implicit flow). You will retrieve all teams, where you are assigned as a contributor. + * @return APIteamsGetTeamsRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Teams returned. -
500 Operation failed. -
+ */ + public APIteamsGetTeamsRequest getTeams() { + return new APIteamsGetTeamsRequest(); + } + private okhttp3.Call postTeamCall(CreateTeamDto createTeamDto, 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 = createTeamDto; + + // create path and map variables + String localVarPath = "/api/teams"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postTeamValidateBeforeCall(CreateTeamDto createTeamDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createTeamDto' is set + if (createTeamDto == null) { + throw new ApiException("Missing the required parameter 'createTeamDto' when calling (Async)"); + } + + return postTeamCall(createTeamDto, _callback); + + } + + + private ApiResponse postTeamWithHttpInfo(CreateTeamDto createTeamDto) throws ApiException { + okhttp3.Call localVarCall = postTeamValidateBeforeCall(createTeamDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postTeamAsync(CreateTeamDto createTeamDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postTeamValidateBeforeCall(createTeamDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamsPostTeamRequest { + private final CreateTeamDto createTeamDto; + + private APIteamsPostTeamRequest(CreateTeamDto createTeamDto) { + this.createTeamDto = createTeamDto; + } + + /** + * Build call for postTeam + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Team created. -
400 Team request not valid. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postTeamCall(createTeamDto, _callback); + } + + /** + * Execute postTeam request + * @return TeamDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Team created. -
400 Team request not valid. -
500 Operation failed. -
+ */ + public TeamDto execute() throws ApiException { + ApiResponse localVarResp = postTeamWithHttpInfo(createTeamDto); + return localVarResp.getData(); + } + + /** + * Execute postTeam request with HTTP info returned + * @return ApiResponse<TeamDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Team created. -
400 Team request not valid. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postTeamWithHttpInfo(createTeamDto); + } + + /** + * Execute postTeam request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
201 Team created. -
400 Team request not valid. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postTeamAsync(createTeamDto, _callback); + } + } + + /** + * Create a new team. + * You can only create an team when you are authenticated as a user (OpenID implicit flow). You will be assigned as owner of the new team automatically. + * @param createTeamDto The team object that needs to be added to Squidex. (required) + * @return APIteamsPostTeamRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
201 Team created. -
400 Team request not valid. -
500 Operation failed. -
+ */ + public APIteamsPostTeamRequest postTeam(CreateTeamDto createTeamDto) { + return new APIteamsPostTeamRequest(createTeamDto); + } + private okhttp3.Call putTeamCall(String team, UpdateTeamDto updateTeamDto, 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 = updateTeamDto; + + // create path and map variables + String localVarPath = "/api/teams/{team}" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putTeamValidateBeforeCall(String team, UpdateTeamDto updateTeamDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + // verify the required parameter 'updateTeamDto' is set + if (updateTeamDto == null) { + throw new ApiException("Missing the required parameter 'updateTeamDto' when calling (Async)"); + } + + return putTeamCall(team, updateTeamDto, _callback); + + } + + + private ApiResponse putTeamWithHttpInfo(String team, UpdateTeamDto updateTeamDto) throws ApiException { + okhttp3.Call localVarCall = putTeamValidateBeforeCall(team, updateTeamDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putTeamAsync(String team, UpdateTeamDto updateTeamDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putTeamValidateBeforeCall(team, updateTeamDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamsPutTeamRequest { + private final String team; + private final UpdateTeamDto updateTeamDto; + + private APIteamsPutTeamRequest(String team, UpdateTeamDto updateTeamDto) { + this.team = team; + this.updateTeamDto = updateTeamDto; + } + + /** + * Build call for putTeam + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team updated. -
400 Team request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putTeamCall(team, updateTeamDto, _callback); + } + + /** + * Execute putTeam request + * @return TeamDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team updated. -
400 Team request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public TeamDto execute() throws ApiException { + ApiResponse localVarResp = putTeamWithHttpInfo(team, updateTeamDto); + return localVarResp.getData(); + } + + /** + * Execute putTeam request with HTTP info returned + * @return ApiResponse<TeamDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team updated. -
400 Team request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putTeamWithHttpInfo(team, updateTeamDto); + } + + /** + * Execute putTeam request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Team updated. -
400 Team request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putTeamAsync(team, updateTeamDto, _callback); + } + } + + /** + * Update the team. + * + * @param team The ID of the team to update. (required) + * @param updateTeamDto The values to update. (required) + * @return APIteamsPutTeamRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team updated. -
400 Team request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIteamsPutTeamRequest putTeam(String team, UpdateTeamDto updateTeamDto) { + return new APIteamsPutTeamRequest(team, updateTeamDto); + } + private okhttp3.Call putTeamAuthCall(String team, AuthSchemeValueDto authSchemeValueDto, 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 = authSchemeValueDto; + + // create path and map variables + String localVarPath = "/api/teams/{team}/auth" + .replace("{" + "team" + "}", localVarApiClient.escapeString(team.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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putTeamAuthValidateBeforeCall(String team, AuthSchemeValueDto authSchemeValueDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'team' is set + if (team == null) { + throw new ApiException("Missing the required parameter 'team' when calling (Async)"); + } + + // verify the required parameter 'authSchemeValueDto' is set + if (authSchemeValueDto == null) { + throw new ApiException("Missing the required parameter 'authSchemeValueDto' when calling (Async)"); + } + + return putTeamAuthCall(team, authSchemeValueDto, _callback); + + } + + + private ApiResponse putTeamAuthWithHttpInfo(String team, AuthSchemeValueDto authSchemeValueDto) throws ApiException { + okhttp3.Call localVarCall = putTeamAuthValidateBeforeCall(team, authSchemeValueDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putTeamAuthAsync(String team, AuthSchemeValueDto authSchemeValueDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putTeamAuthValidateBeforeCall(team, authSchemeValueDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIteamsPutTeamAuthRequest { + private final String team; + private final AuthSchemeValueDto authSchemeValueDto; + + private APIteamsPutTeamAuthRequest(String team, AuthSchemeValueDto authSchemeValueDto) { + this.team = team; + this.authSchemeValueDto = authSchemeValueDto; + } + + /** + * Build call for putTeamAuth + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team updated. -
400 Team request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putTeamAuthCall(team, authSchemeValueDto, _callback); + } + + /** + * Execute putTeamAuth request + * @return AuthSchemeResponseDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team updated. -
400 Team request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public AuthSchemeResponseDto execute() throws ApiException { + ApiResponse localVarResp = putTeamAuthWithHttpInfo(team, authSchemeValueDto); + return localVarResp.getData(); + } + + /** + * Execute putTeamAuth request with HTTP info returned + * @return ApiResponse<AuthSchemeResponseDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team updated. -
400 Team request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putTeamAuthWithHttpInfo(team, authSchemeValueDto); + } + + /** + * Execute putTeamAuth request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 Team updated. -
400 Team request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putTeamAuthAsync(team, authSchemeValueDto, _callback); + } + } + + /** + * Update the team auth. + * + * @param team The ID of the team to update. (required) + * @param authSchemeValueDto The values to update. (required) + * @return APIteamsPutTeamAuthRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 Team updated. -
400 Team request not valid. -
404 Team not found. -
500 Operation failed. -
+ */ + public APIteamsPutTeamAuthRequest putTeamAuth(String team, AuthSchemeValueDto authSchemeValueDto) { + return new APIteamsPutTeamAuthRequest(team, authSchemeValueDto); + } +} diff --git a/src/main/java/com/squidex/api/core/api/TemplatesApi.java b/src/main/java/com/squidex/api/core/api/TemplatesApi.java new file mode 100644 index 0000000..d4f5e22 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/TemplatesApi.java @@ -0,0 +1,389 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.TemplateDetailsDto; +import com.squidex.api.types.TemplatesDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class TemplatesApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TemplatesApi() { + this(Configuration.getDefaultApiClient()); + } + + public TemplatesApi(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; + } + + private okhttp3.Call getTemplateCall(String name, 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 = "/api/templates/{name}" + .replace("{" + "name" + "}", localVarApiClient.escapeString(name.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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTemplateValidateBeforeCall(String name, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'name' is set + if (name == null) { + throw new ApiException("Missing the required parameter 'name' when calling (Async)"); + } + + return getTemplateCall(name, _callback); + + } + + + private ApiResponse getTemplateWithHttpInfo(String name) throws ApiException { + okhttp3.Call localVarCall = getTemplateValidateBeforeCall(name, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getTemplateAsync(String name, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTemplateValidateBeforeCall(name, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APItemplatesGetTemplateRequest { + private final String name; + + private APItemplatesGetTemplateRequest(String name) { + this.name = name; + } + + /** + * Build call for getTemplate + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Template returned. -
404 Template not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getTemplateCall(name, _callback); + } + + /** + * Execute getTemplate request + * @return TemplateDetailsDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Template returned. -
404 Template not found. -
500 Operation failed. -
+ */ + public TemplateDetailsDto execute() throws ApiException { + ApiResponse localVarResp = getTemplateWithHttpInfo(name); + return localVarResp.getData(); + } + + /** + * Execute getTemplate request with HTTP info returned + * @return ApiResponse<TemplateDetailsDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Template returned. -
404 Template not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getTemplateWithHttpInfo(name); + } + + /** + * Execute getTemplate request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Template returned. -
404 Template not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getTemplateAsync(name, _callback); + } + } + + /** + * Get template details. + * + * @param name The name of the template. (required) + * @return APItemplatesGetTemplateRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Template returned. -
404 Template not found. -
500 Operation failed. -
+ */ + public APItemplatesGetTemplateRequest getTemplate(String name) { + return new APItemplatesGetTemplateRequest(name); + } + private okhttp3.Call getTemplatesCall(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 = "/api/templates"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getTemplatesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getTemplatesCall(_callback); + + } + + + private ApiResponse getTemplatesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getTemplatesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getTemplatesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getTemplatesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APItemplatesGetTemplatesRequest { + + private APItemplatesGetTemplatesRequest() { + } + + /** + * Build call for getTemplates + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Templates returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getTemplatesCall(_callback); + } + + /** + * Execute getTemplates request + * @return TemplatesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Templates returned. -
500 Operation failed. -
+ */ + public TemplatesDto execute() throws ApiException { + ApiResponse localVarResp = getTemplatesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getTemplates request with HTTP info returned + * @return ApiResponse<TemplatesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Templates returned. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getTemplatesWithHttpInfo(); + } + + /** + * Execute getTemplates request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Templates returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getTemplatesAsync(_callback); + } + } + + /** + * Get all templates. + * + * @return APItemplatesGetTemplatesRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Templates returned. -
500 Operation failed. -
+ */ + public APItemplatesGetTemplatesRequest getTemplates() { + return new APItemplatesGetTemplatesRequest(); + } +} diff --git a/src/main/java/com/squidex/api/core/api/TranslationsApi.java b/src/main/java/com/squidex/api/core/api/TranslationsApi.java new file mode 100644 index 0000000..57121ac --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/TranslationsApi.java @@ -0,0 +1,241 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.TranslateDto; +import com.squidex.api.types.TranslationDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class TranslationsApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public TranslationsApi() { + this(Configuration.getDefaultApiClient()); + } + + public TranslationsApi(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; + } + + private okhttp3.Call postTranslationCall(TranslateDto translateDto, 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 = translateDto; + + // create path and map variables + String localVarPath = "/api/apps/$app$/translations"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postTranslationValidateBeforeCall(TranslateDto translateDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'translateDto' is set + if (translateDto == null) { + throw new ApiException("Missing the required parameter 'translateDto' when calling (Async)"); + } + + return postTranslationCall(translateDto, _callback); + + } + + + private ApiResponse postTranslationWithHttpInfo(TranslateDto translateDto) throws ApiException { + okhttp3.Call localVarCall = postTranslationValidateBeforeCall(translateDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postTranslationAsync(TranslateDto translateDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postTranslationValidateBeforeCall(translateDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APItranslationsPostTranslationRequest { + private final TranslateDto translateDto; + + private APItranslationsPostTranslationRequest(TranslateDto translateDto) { + this.translateDto = translateDto; + } + + /** + * Build call for postTranslation + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Text translated. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postTranslationCall(translateDto, _callback); + } + + /** + * Execute postTranslation request + * @return TranslationDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Text translated. -
400 Validation error. -
500 Operation failed. -
+ */ + public TranslationDto execute() throws ApiException { + ApiResponse localVarResp = postTranslationWithHttpInfo(translateDto); + return localVarResp.getData(); + } + + /** + * Execute postTranslation request with HTTP info returned + * @return ApiResponse<TranslationDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Text translated. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postTranslationWithHttpInfo(translateDto); + } + + /** + * Execute postTranslation request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 Text translated. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postTranslationAsync(translateDto, _callback); + } + } + + /** + * Translate a text. + * + * @param translateDto The translation request. (required) + * @return APItranslationsPostTranslationRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 Text translated. -
400 Validation error. -
500 Operation failed. -
+ */ + public APItranslationsPostTranslationRequest postTranslation(TranslateDto translateDto) { + return new APItranslationsPostTranslationRequest(translateDto); + } +} diff --git a/src/main/java/com/squidex/api/core/api/UserManagementApi.java b/src/main/java/com/squidex/api/core/api/UserManagementApi.java new file mode 100644 index 0000000..4a4e7ef --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/UserManagementApi.java @@ -0,0 +1,1286 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.CreateUserDto; +import com.squidex.api.types.ErrorDto; +import com.squidex.api.types.UpdateUserDto; +import com.squidex.api.types.UserDto; +import com.squidex.api.types.UsersDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class UserManagementApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UserManagementApi() { + this(Configuration.getDefaultApiClient()); + } + + public UserManagementApi(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; + } + + private okhttp3.Call deleteUserCall(String 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 = "/api/user-management/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "DELETE", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call deleteUserValidateBeforeCall(String 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 (Async)"); + } + + return deleteUserCall(id, _callback); + + } + + + private ApiResponse deleteUserWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(id, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call deleteUserAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = deleteUserValidateBeforeCall(id, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIuserManagementDeleteUserRequest { + private final String id; + + private APIuserManagementDeleteUserRequest(String id) { + this.id = id; + } + + /** + * Build call for deleteUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 User deleted. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return deleteUserCall(id, _callback); + } + + /** + * Execute deleteUser request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 User deleted. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + deleteUserWithHttpInfo(id); + } + + /** + * Execute deleteUser request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 User deleted. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return deleteUserWithHttpInfo(id); + } + + /** + * Execute deleteUser request (asynchronously) + * @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 + + + + + + + +
Status Code Description Response Headers
204 User deleted. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return deleteUserAsync(id, _callback); + } + } + + /** + * Delete a User. + * + * @param id The ID of the user to delete. (required) + * @return APIuserManagementDeleteUserRequest + * @http.response.details + + + + + + + +
Status Code Description Response Headers
204 User deleted. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIuserManagementDeleteUserRequest deleteUser(String id) { + return new APIuserManagementDeleteUserRequest(id); + } + private okhttp3.Call getUserCall(String 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 = "/api/user-management/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserValidateBeforeCall(String 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 (Async)"); + } + + return getUserCall(id, _callback); + + } + + + private ApiResponse getUserWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getUserValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUserAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIuserManagementGetUserRequest { + private final String id; + + private APIuserManagementGetUserRequest(String id) { + this.id = id; + } + + /** + * Build call for getUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User returned. -
404 User not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUserCall(id, _callback); + } + + /** + * Execute getUser request + * @return UserDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User returned. -
404 User not found. -
500 Operation failed. -
+ */ + public UserDto execute() throws ApiException { + ApiResponse localVarResp = getUserWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute getUser request with HTTP info returned + * @return ApiResponse<UserDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User returned. -
404 User not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getUserWithHttpInfo(id); + } + + /** + * Execute getUser request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 User returned. -
404 User not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getUserAsync(id, _callback); + } + } + + /** + * Get a user by ID. + * + * @param id The ID of the user. (required) + * @return APIuserManagementGetUserRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User returned. -
404 User not found. -
500 Operation failed. -
+ */ + public APIuserManagementGetUserRequest getUser(String id) { + return new APIuserManagementGetUserRequest(id); + } + private okhttp3.Call getUsersCall(String query, Integer skip, Integer take, 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 = "/api/user-management"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + if (skip != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("skip", skip)); + } + + if (take != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("take", take)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUsersValidateBeforeCall(String query, Integer skip, Integer take, final ApiCallback _callback) throws ApiException { + return getUsersCall(query, skip, take, _callback); + + } + + + private ApiResponse getUsersWithHttpInfo(String query, Integer skip, Integer take) throws ApiException { + okhttp3.Call localVarCall = getUsersValidateBeforeCall(query, skip, take, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUsersAsync(String query, Integer skip, Integer take, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUsersValidateBeforeCall(query, skip, take, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIuserManagementGetUsersRequest { + private String query; + private Integer skip; + private Integer take; + + private APIuserManagementGetUsersRequest() { + } + + /** + * Set query + * @param query Optional query to search by email address or username. (optional) + * @return APIuserManagementGetUsersRequest + */ + public APIuserManagementGetUsersRequest query(String query) { + this.query = query; + return this; + } + + /** + * Set skip + * @param skip The number of users to skip. (optional, default to 0) + * @return APIuserManagementGetUsersRequest + */ + public APIuserManagementGetUsersRequest skip(Integer skip) { + this.skip = skip; + return this; + } + + /** + * Set take + * @param take The number of users to return. (optional, default to 10) + * @return APIuserManagementGetUsersRequest + */ + public APIuserManagementGetUsersRequest take(Integer take) { + this.take = take; + return this; + } + + /** + * Build call for getUsers + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Users returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUsersCall(query, skip, take, _callback); + } + + /** + * Execute getUsers request + * @return UsersDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Users returned. -
500 Operation failed. -
+ */ + public UsersDto execute() throws ApiException { + ApiResponse localVarResp = getUsersWithHttpInfo(query, skip, take); + return localVarResp.getData(); + } + + /** + * Execute getUsers request with HTTP info returned + * @return ApiResponse<UsersDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Users returned. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getUsersWithHttpInfo(query, skip, take); + } + + /** + * Execute getUsers request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Users returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getUsersAsync(query, skip, take, _callback); + } + } + + /** + * Get users by query. + * + * @return APIuserManagementGetUsersRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Users returned. -
500 Operation failed. -
+ */ + public APIuserManagementGetUsersRequest getUsers() { + return new APIuserManagementGetUsersRequest(); + } + private okhttp3.Call lockUserCall(String 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 = "/api/user-management/{id}/lock" + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call lockUserValidateBeforeCall(String 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 (Async)"); + } + + return lockUserCall(id, _callback); + + } + + + private ApiResponse lockUserWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = lockUserValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call lockUserAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = lockUserValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIuserManagementLockUserRequest { + private final String id; + + private APIuserManagementLockUserRequest(String id) { + this.id = id; + } + + /** + * Build call for lockUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 User locked. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return lockUserCall(id, _callback); + } + + /** + * Execute lockUser request + * @return UserDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 User locked. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public UserDto execute() throws ApiException { + ApiResponse localVarResp = lockUserWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute lockUser request with HTTP info returned + * @return ApiResponse<UserDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 User locked. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return lockUserWithHttpInfo(id); + } + + /** + * Execute lockUser request (asynchronously) + * @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 + + + + + + + +
Status Code Description Response Headers
200 User locked. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return lockUserAsync(id, _callback); + } + } + + /** + * Lock a user. + * + * @param id The ID of the user to lock. (required) + * @return APIuserManagementLockUserRequest + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 User locked. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIuserManagementLockUserRequest lockUser(String id) { + return new APIuserManagementLockUserRequest(id); + } + private okhttp3.Call postUserCall(CreateUserDto createUserDto, 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 = createUserDto; + + // create path and map variables + String localVarPath = "/api/user-management"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postUserValidateBeforeCall(CreateUserDto createUserDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'createUserDto' is set + if (createUserDto == null) { + throw new ApiException("Missing the required parameter 'createUserDto' when calling (Async)"); + } + + return postUserCall(createUserDto, _callback); + + } + + + private ApiResponse postUserWithHttpInfo(CreateUserDto createUserDto) throws ApiException { + okhttp3.Call localVarCall = postUserValidateBeforeCall(createUserDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call postUserAsync(CreateUserDto createUserDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postUserValidateBeforeCall(createUserDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIuserManagementPostUserRequest { + private final CreateUserDto createUserDto; + + private APIuserManagementPostUserRequest(CreateUserDto createUserDto) { + this.createUserDto = createUserDto; + } + + /** + * Build call for postUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
201 User created. -
400 User request not valid. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postUserCall(createUserDto, _callback); + } + + /** + * Execute postUser request + * @return UserDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
201 User created. -
400 User request not valid. -
500 Operation failed. -
+ */ + public UserDto execute() throws ApiException { + ApiResponse localVarResp = postUserWithHttpInfo(createUserDto); + return localVarResp.getData(); + } + + /** + * Execute postUser request with HTTP info returned + * @return ApiResponse<UserDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
201 User created. -
400 User request not valid. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postUserWithHttpInfo(createUserDto); + } + + /** + * Execute postUser request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
201 User created. -
400 User request not valid. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postUserAsync(createUserDto, _callback); + } + } + + /** + * Create a new user. + * + * @param createUserDto The user object that needs to be added. (required) + * @return APIuserManagementPostUserRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
201 User created. -
400 User request not valid. -
500 Operation failed. -
+ */ + public APIuserManagementPostUserRequest postUser(CreateUserDto createUserDto) { + return new APIuserManagementPostUserRequest(createUserDto); + } + private okhttp3.Call putUserCall(String id, UpdateUserDto updateUserDto, 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 = updateUserDto; + + // create path and map variables + String localVarPath = "/api/user-management/{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/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call putUserValidateBeforeCall(String id, UpdateUserDto updateUserDto, 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 (Async)"); + } + + // verify the required parameter 'updateUserDto' is set + if (updateUserDto == null) { + throw new ApiException("Missing the required parameter 'updateUserDto' when calling (Async)"); + } + + return putUserCall(id, updateUserDto, _callback); + + } + + + private ApiResponse putUserWithHttpInfo(String id, UpdateUserDto updateUserDto) throws ApiException { + okhttp3.Call localVarCall = putUserValidateBeforeCall(id, updateUserDto, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call putUserAsync(String id, UpdateUserDto updateUserDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = putUserValidateBeforeCall(id, updateUserDto, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIuserManagementPutUserRequest { + private final String id; + private final UpdateUserDto updateUserDto; + + private APIuserManagementPutUserRequest(String id, UpdateUserDto updateUserDto) { + this.id = id; + this.updateUserDto = updateUserDto; + } + + /** + * Build call for putUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 User created. -
400 User request not valid. -
404 User not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return putUserCall(id, updateUserDto, _callback); + } + + /** + * Execute putUser request + * @return UserDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 User created. -
400 User request not valid. -
404 User not found. -
500 Operation failed. -
+ */ + public UserDto execute() throws ApiException { + ApiResponse localVarResp = putUserWithHttpInfo(id, updateUserDto); + return localVarResp.getData(); + } + + /** + * Execute putUser request with HTTP info returned + * @return ApiResponse<UserDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 User created. -
400 User request not valid. -
404 User not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return putUserWithHttpInfo(id, updateUserDto); + } + + /** + * Execute putUser request (asynchronously) + * @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 + + + + + + +
Status Code Description Response Headers
200 User created. -
400 User request not valid. -
404 User not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return putUserAsync(id, updateUserDto, _callback); + } + } + + /** + * Update a user. + * + * @param id The ID of the user. (required) + * @param updateUserDto The user object that needs to be updated. (required) + * @return APIuserManagementPutUserRequest + * @http.response.details + + + + + + +
Status Code Description Response Headers
200 User created. -
400 User request not valid. -
404 User not found. -
500 Operation failed. -
+ */ + public APIuserManagementPutUserRequest putUser(String id, UpdateUserDto updateUserDto) { + return new APIuserManagementPutUserRequest(id, updateUserDto); + } + private okhttp3.Call unlockUserCall(String 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 = "/api/user-management/{id}/unlock" + .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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "PUT", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call unlockUserValidateBeforeCall(String 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 (Async)"); + } + + return unlockUserCall(id, _callback); + + } + + + private ApiResponse unlockUserWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = unlockUserValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call unlockUserAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = unlockUserValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIuserManagementUnlockUserRequest { + private final String id; + + private APIuserManagementUnlockUserRequest(String id) { + this.id = id; + } + + /** + * Build call for unlockUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 User unlocked. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return unlockUserCall(id, _callback); + } + + /** + * Execute unlockUser request + * @return UserDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 User unlocked. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public UserDto execute() throws ApiException { + ApiResponse localVarResp = unlockUserWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute unlockUser request with HTTP info returned + * @return ApiResponse<UserDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 User unlocked. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return unlockUserWithHttpInfo(id); + } + + /** + * Execute unlockUser request (asynchronously) + * @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 + + + + + + + +
Status Code Description Response Headers
200 User unlocked. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return unlockUserAsync(id, _callback); + } + } + + /** + * Unlock a user. + * + * @param id The ID of the user to unlock. (required) + * @return APIuserManagementUnlockUserRequest + * @http.response.details + + + + + + + +
Status Code Description Response Headers
200 User unlocked. -
403 User is the current user. -
404 User not found. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIuserManagementUnlockUserRequest unlockUser(String id) { + return new APIuserManagementUnlockUserRequest(id); + } +} diff --git a/src/main/java/com/squidex/api/core/api/UsersApi.java b/src/main/java/com/squidex/api/core/api/UsersApi.java new file mode 100644 index 0000000..533d832 --- /dev/null +++ b/src/main/java/com/squidex/api/core/api/UsersApi.java @@ -0,0 +1,875 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.api; + +import com.squidex.api.core.ApiCallback; +import com.squidex.api.core.ApiClient; +import com.squidex.api.core.ApiException; +import com.squidex.api.core.ApiResponse; +import com.squidex.api.core.Configuration; +import com.squidex.api.core.Pair; +import com.squidex.api.core.ProgressRequestBody; +import com.squidex.api.core.ProgressResponseBody; + +import com.google.gson.reflect.TypeToken; + +import java.io.IOException; + + +import com.squidex.api.types.ErrorDto; +import java.io.File; +import com.squidex.api.types.ResourcesDto; +import com.squidex.api.types.UpdateProfileDto; +import com.squidex.api.types.UserDto; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +@SuppressWarnings("ALL") +public class UsersApi { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public UsersApi() { + this(Configuration.getDefaultApiClient()); + } + + public UsersApi(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; + } + + private okhttp3.Call getUserCall(String 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 = "/api/users/{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/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserValidateBeforeCall(String 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 (Async)"); + } + + return getUserCall(id, _callback); + + } + + + private ApiResponse getUserWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getUserValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUserAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusersGetUserRequest { + private final String id; + + private APIusersGetUserRequest(String id) { + this.id = id; + } + + /** + * Build call for getUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User found. -
404 User not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUserCall(id, _callback); + } + + /** + * Execute getUser request + * @return UserDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User found. -
404 User not found. -
500 Operation failed. -
+ */ + public UserDto execute() throws ApiException { + ApiResponse localVarResp = getUserWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute getUser request with HTTP info returned + * @return ApiResponse<UserDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User found. -
404 User not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getUserWithHttpInfo(id); + } + + /** + * Execute getUser request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 User found. -
404 User not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getUserAsync(id, _callback); + } + } + + /** + * Get user by id. + * + * @param id The ID of the user (GUID). (required) + * @return APIusersGetUserRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User found. -
404 User not found. -
500 Operation failed. -
+ */ + public APIusersGetUserRequest getUser(String id) { + return new APIusersGetUserRequest(id); + } + private okhttp3.Call getUserPictureCall(String 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 = "/api/users/{id}/picture" + .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/octet-stream", + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserPictureValidateBeforeCall(String 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 (Async)"); + } + + return getUserPictureCall(id, _callback); + + } + + + private ApiResponse getUserPictureWithHttpInfo(String id) throws ApiException { + okhttp3.Call localVarCall = getUserPictureValidateBeforeCall(id, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUserPictureAsync(String id, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserPictureValidateBeforeCall(id, _callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusersGetUserPictureRequest { + private final String id; + + private APIusersGetUserPictureRequest(String id) { + this.id = id; + } + + /** + * Build call for getUserPicture + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User found and image or fallback returned. -
404 User not found. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUserPictureCall(id, _callback); + } + + /** + * Execute getUserPicture request + * @return File + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User found and image or fallback returned. -
404 User not found. -
500 Operation failed. -
+ */ + public File execute() throws ApiException { + ApiResponse localVarResp = getUserPictureWithHttpInfo(id); + return localVarResp.getData(); + } + + /** + * Execute getUserPicture request with HTTP info returned + * @return ApiResponse<File> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User found and image or fallback returned. -
404 User not found. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getUserPictureWithHttpInfo(id); + } + + /** + * Execute getUserPicture request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
200 User found and image or fallback returned. -
404 User not found. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getUserPictureAsync(id, _callback); + } + } + + /** + * Get user picture by id. + * + * @param id The ID of the user (GUID). (required) + * @return APIusersGetUserPictureRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
200 User found and image or fallback returned. -
404 User not found. -
500 Operation failed. -
+ */ + public APIusersGetUserPictureRequest getUserPicture(String id) { + return new APIusersGetUserPictureRequest(id); + } + private okhttp3.Call getUserResourcesCall(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 = "/api"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUserResourcesValidateBeforeCall(final ApiCallback _callback) throws ApiException { + return getUserResourcesCall(_callback); + + } + + + private ApiResponse getUserResourcesWithHttpInfo() throws ApiException { + okhttp3.Call localVarCall = getUserResourcesValidateBeforeCall(null); + Type localVarReturnType = new TypeToken(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUserResourcesAsync(final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = getUserResourcesValidateBeforeCall(_callback); + Type localVarReturnType = new TypeToken(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusersGetUserResourcesRequest { + + private APIusersGetUserResourcesRequest() { + } + + /** + * Build call for getUserResources + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 User resources returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUserResourcesCall(_callback); + } + + /** + * Execute getUserResources request + * @return ResourcesDto + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 User resources returned. -
500 Operation failed. -
+ */ + public ResourcesDto execute() throws ApiException { + ApiResponse localVarResp = getUserResourcesWithHttpInfo(); + return localVarResp.getData(); + } + + /** + * Execute getUserResources request with HTTP info returned + * @return ApiResponse<ResourcesDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 User resources returned. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return getUserResourcesWithHttpInfo(); + } + + /** + * Execute getUserResources request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 User resources returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return getUserResourcesAsync(_callback); + } + } + + /** + * Get the user resources. + * + * @return APIusersGetUserResourcesRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 User resources returned. -
500 Operation failed. -
+ */ + public APIusersGetUserResourcesRequest getUserResources() { + return new APIusersGetUserResourcesRequest(); + } + private okhttp3.Call getUsersCall(String query, 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 = "/api/users"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + if (query != null) { + localVarQueryParams.addAll(localVarApiClient.parameterToPair("query", query)); + } + + final String[] localVarAccepts = { + "application/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[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call getUsersValidateBeforeCall(String query, final ApiCallback _callback) throws ApiException { + return getUsersCall(query, _callback); + + } + + + private ApiResponse> getUsersWithHttpInfo(String query) throws ApiException { + okhttp3.Call localVarCall = getUsersValidateBeforeCall(query, null); + Type localVarReturnType = new TypeToken>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } + + private okhttp3.Call getUsersAsync(String query, final ApiCallback> _callback) throws ApiException { + + okhttp3.Call localVarCall = getUsersValidateBeforeCall(query, _callback); + Type localVarReturnType = new TypeToken>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); + return localVarCall; + } + + public class APIusersGetUsersRequest { + private String query; + + private APIusersGetUsersRequest() { + } + + /** + * Set query + * @param query The query to search the user by email address. Case invariant. (optional) + * @return APIusersGetUsersRequest + */ + public APIusersGetUsersRequest query(String query) { + this.query = query; + return this; + } + + /** + * Build call for getUsers + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + +
Status Code Description Response Headers
200 Users returned. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return getUsersCall(query, _callback); + } + + /** + * Execute getUsers request + * @return List<UserDto> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Users returned. -
500 Operation failed. -
+ */ + public List execute() throws ApiException { + ApiResponse> localVarResp = getUsersWithHttpInfo(query); + return localVarResp.getData(); + } + + /** + * Execute getUsers request with HTTP info returned + * @return ApiResponse<List<UserDto>> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + +
Status Code Description Response Headers
200 Users returned. -
500 Operation failed. -
+ */ + public ApiResponse> executeWithHttpInfo() throws ApiException { + return getUsersWithHttpInfo(query); + } + + /** + * Execute getUsers request (asynchronously) + * @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 + + + + +
Status Code Description Response Headers
200 Users returned. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback> _callback) throws ApiException { + return getUsersAsync(query, _callback); + } + } + + /** + * Get users by query. + * Search the user by query that contains the email address or the part of the email address. + * @return APIusersGetUsersRequest + * @http.response.details + + + + +
Status Code Description Response Headers
200 Users returned. -
500 Operation failed. -
+ */ + public APIusersGetUsersRequest getUsers() { + return new APIusersGetUsersRequest(); + } + private okhttp3.Call postUserCall(UpdateProfileDto updateProfileDto, 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 = updateProfileDto; + + // create path and map variables + String localVarPath = "/api/user"; + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + "application/json" + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { }; + return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + @SuppressWarnings("rawtypes") + private okhttp3.Call postUserValidateBeforeCall(UpdateProfileDto updateProfileDto, final ApiCallback _callback) throws ApiException { + // verify the required parameter 'updateProfileDto' is set + if (updateProfileDto == null) { + throw new ApiException("Missing the required parameter 'updateProfileDto' when calling (Async)"); + } + + return postUserCall(updateProfileDto, _callback); + + } + + + private ApiResponse postUserWithHttpInfo(UpdateProfileDto updateProfileDto) throws ApiException { + okhttp3.Call localVarCall = postUserValidateBeforeCall(updateProfileDto, null); + return localVarApiClient.execute(localVarCall); + } + + private okhttp3.Call postUserAsync(UpdateProfileDto updateProfileDto, final ApiCallback _callback) throws ApiException { + + okhttp3.Call localVarCall = postUserValidateBeforeCall(updateProfileDto, _callback); + localVarApiClient.executeAsync(localVarCall, _callback); + return localVarCall; + } + + public class APIusersPostUserRequest { + private final UpdateProfileDto updateProfileDto; + + private APIusersPostUserRequest(UpdateProfileDto updateProfileDto) { + this.updateProfileDto = updateProfileDto; + } + + /** + * Build call for postUser + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + * @http.response.details + + + + + +
Status Code Description Response Headers
204 User updated. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return postUserCall(updateProfileDto, _callback); + } + + /** + * Execute postUser request + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 User updated. -
400 Validation error. -
500 Operation failed. -
+ */ + public void execute() throws ApiException { + postUserWithHttpInfo(updateProfileDto); + } + + /** + * Execute postUser request with HTTP info returned + * @return ApiResponse<Void> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + * @http.response.details + + + + + +
Status Code Description Response Headers
204 User updated. -
400 Validation error. -
500 Operation failed. -
+ */ + public ApiResponse executeWithHttpInfo() throws ApiException { + return postUserWithHttpInfo(updateProfileDto); + } + + /** + * Execute postUser request (asynchronously) + * @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 + + + + + +
Status Code Description Response Headers
204 User updated. -
400 Validation error. -
500 Operation failed. -
+ */ + public okhttp3.Call executeAsync(final ApiCallback _callback) throws ApiException { + return postUserAsync(updateProfileDto, _callback); + } + } + + /** + * Update the user profile. + * + * @param updateProfileDto The values to update. (required) + * @return APIusersPostUserRequest + * @http.response.details + + + + + +
Status Code Description Response Headers
204 User updated. -
400 Validation error. -
500 Operation failed. -
+ */ + public APIusersPostUserRequest postUser(UpdateProfileDto updateProfileDto) { + return new APIusersPostUserRequest(updateProfileDto); + } +} diff --git a/src/main/java/com/squidex/api/core/auth/ApiKeyAuth.java b/src/main/java/com/squidex/api/core/auth/ApiKeyAuth.java new file mode 100644 index 0000000..fec71b9 --- /dev/null +++ b/src/main/java/com/squidex/api/core/auth/ApiKeyAuth.java @@ -0,0 +1,80 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.auth; + +import com.squidex.api.core.ApiException; +import com.squidex.api.core.Pair; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } else if ("cookie".equals(location)) { + cookieParams.put(paramName, value); + } + } +} diff --git a/src/main/java/com/squidex/api/core/auth/Authentication.java b/src/main/java/com/squidex/api/core/auth/Authentication.java new file mode 100644 index 0000000..099e6aa --- /dev/null +++ b/src/main/java/com/squidex/api/core/auth/Authentication.java @@ -0,0 +1,36 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.auth; + +import com.squidex.api.core.Pair; +import com.squidex.api.core.ApiException; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + * @param cookieParams Map of cookie parameters + * @param payload HTTP request body + * @param method HTTP method + * @param uri URI + * @throws ApiException if failed to update the parameters + */ + void applyToParams(List queryParams, Map headerParams, Map cookieParams, String payload, String method, URI uri) throws ApiException; +} diff --git a/src/main/java/com/squidex/api/core/auth/HttpBasicAuth.java b/src/main/java/com/squidex/api/core/auth/HttpBasicAuth.java new file mode 100644 index 0000000..d39a181 --- /dev/null +++ b/src/main/java/com/squidex/api/core/auth/HttpBasicAuth.java @@ -0,0 +1,55 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.auth; + +import com.squidex.api.core.Pair; +import com.squidex.api.core.ApiException; + +import okhttp3.Credentials; + +import java.net.URI; +import java.util.Map; +import java.util.List; + +public class HttpBasicAuth implements Authentication { + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @Override + public void applyToParams(List queryParams, Map headerParams, Map cookieParams, + String payload, String method, URI uri) throws ApiException { + if (username == null && password == null) { + return; + } + headerParams.put("Authorization", Credentials.basic( + username == null ? "" : username, + password == null ? "" : password)); + } +} diff --git a/src/main/java/com/squidex/api/core/auth/HttpBearerAuth.java b/src/main/java/com/squidex/api/core/auth/HttpBearerAuth.java new file mode 100644 index 0000000..2afc9b3 --- /dev/null +++ b/src/main/java/com/squidex/api/core/auth/HttpBearerAuth.java @@ -0,0 +1,75 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.core.auth; + +import com.squidex.api.core.ApiException; +import com.squidex.api.core.Pair; + +import java.net.URI; +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", comments = "Generator version: 7.9.0-SNAPSHOT") +public class HttpBearerAuth implements Authentication { + private final String scheme; + private Supplier tokenSupplier; + + public HttpBearerAuth(String scheme) { + this.scheme = scheme; + } + + /** + * Gets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @return The bearer token + */ + public String getBearerToken() { + return tokenSupplier.get(); + } + + /** + * Sets the token, which together with the scheme, will be sent as the value of the Authorization header. + * + * @param bearerToken The bearer token to send in the Authorization header + */ + public void setBearerToken(String 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; + } + + headerParams.put("Authorization", (scheme != null ? upperCaseBearer(scheme) + " " : "") + bearerToken); + } + + private static String upperCaseBearer(String scheme) { + return ("bearer".equalsIgnoreCase(scheme)) ? "Bearer" : scheme; + } +} diff --git a/src/main/java/com/squidex/api/resources/apps/AppsClient.java b/src/main/java/com/squidex/api/resources/apps/AppsClient.java deleted file mode 100644 index 7ee29b9..0000000 --- a/src/main/java/com/squidex/api/resources/apps/AppsClient.java +++ /dev/null @@ -1,1320 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.apps.requests.AddLanguageDto; -import com.squidex.api.resources.apps.requests.AddRoleDto; -import com.squidex.api.resources.apps.requests.AddWorkflowDto; -import com.squidex.api.resources.apps.requests.AppsUploadImageRequest; -import com.squidex.api.resources.apps.requests.CreateAppDto; -import com.squidex.api.resources.apps.requests.CreateClientDto; -import com.squidex.api.resources.apps.requests.TransferToTeamDto; -import com.squidex.api.resources.apps.requests.UpdateAppDto; -import com.squidex.api.resources.apps.requests.UpdateAppSettingsDto; -import com.squidex.api.resources.apps.requests.UpdateAssetScriptsDto; -import com.squidex.api.resources.apps.requests.UpdateClientDto; -import com.squidex.api.resources.apps.requests.UpdateLanguageDto; -import com.squidex.api.resources.apps.requests.UpdateRoleDto; -import com.squidex.api.resources.apps.requests.UpdateWorkflowDto; -import com.squidex.api.types.AppDto; -import com.squidex.api.types.AppLanguagesDto; -import com.squidex.api.types.AppSettingsDto; -import com.squidex.api.types.AssetScriptsDto; -import com.squidex.api.types.AssignContributorDto; -import com.squidex.api.types.ClientsDto; -import com.squidex.api.types.ContributorsDto; -import com.squidex.api.types.RolesDto; -import com.squidex.api.types.WorkflowsDto; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.MultipartBody; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class AppsClient { - protected final ClientOptions clientOptions; - - public AppsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public AssetScriptsDto getAssetScripts(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/scripts") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetScriptsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetScriptsDto getAssetScripts() { - return getAssetScripts(null); - } - - public AssetScriptsDto putAssetScripts() { - return putAssetScripts(UpdateAssetScriptsDto.builder().build()); - } - - public AssetScriptsDto putAssetScripts(UpdateAssetScriptsDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/scripts") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetScriptsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetScriptsDto putAssetScripts(UpdateAssetScriptsDto request) { - return putAssetScripts(request, null); - } - - /** - * Gets all configured clients for the app with the specified name. - */ - public ClientsDto getClients(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("clients") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ClientsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Gets all configured clients for the app with the specified name. - */ - public ClientsDto getClients() { - return getClients(null); - } - - /** - * Create a new client for the app with the specified name. - * The client secret is auto generated on the server and returned. The client does not expire, the access token is valid for 30 days. - */ - public ClientsDto postClient(CreateClientDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("clients") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ClientsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Create a new client for the app with the specified name. - * The client secret is auto generated on the server and returned. The client does not expire, the access token is valid for 30 days. - */ - public ClientsDto postClient(CreateClientDto request) { - return postClient(request, null); - } - - /** - * Only the display name can be changed, create a new client if necessary. - */ - public ClientsDto putClient(String id) { - return putClient(id, UpdateClientDto.builder().build()); - } - - /** - * Only the display name can be changed, create a new client if necessary. - */ - public ClientsDto putClient(String id, UpdateClientDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("clients") - .addPathSegment(id) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ClientsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Only the display name can be changed, create a new client if necessary. - */ - public ClientsDto putClient(String id, UpdateClientDto request) { - return putClient(id, request, null); - } - - /** - * The application that uses this client credentials cannot access the API after it has been revoked. - */ - public ClientsDto deleteClient(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("clients") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ClientsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * The application that uses this client credentials cannot access the API after it has been revoked. - */ - public ClientsDto deleteClient(String id) { - return deleteClient(id, null); - } - - public ContributorsDto getContributors(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("contributors") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContributorsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto getContributors() { - return getContributors(null); - } - - public ContributorsDto postContributor(AssignContributorDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("contributors") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContributorsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto postContributor(AssignContributorDto request) { - return postContributor(request, null); - } - - public ContributorsDto deleteMyself(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("contributors/me") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContributorsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto deleteMyself() { - return deleteMyself(null); - } - - public ContributorsDto deleteContributor(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("contributors") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContributorsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto deleteContributor(String id) { - return deleteContributor(id, null); - } - - public InputStream getImage(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("image") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return response.body().byteStream(); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getImage() { - return getImage(null); - } - - public AppDto uploadImage(File file, AppsUploadImageRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("image") - .build(); - MultipartBody.Builder body = new MultipartBody.Builder().setType(MultipartBody.FORM); - try { - String mimeType = Files.probeContentType(file.toPath()); - MediaType mediaType = mimeType != null ? MediaType.parse(mimeType) : null; - body.addFormDataPart("file", file.getName(), RequestBody.create(mediaType, file)); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("POST", body.build()) - .headers(Headers.of(clientOptions.headers(requestOptions))); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto uploadImage(File file, AppsUploadImageRequest request) { - return uploadImage(file, request, null); - } - - public AppDto deleteImage(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("image") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto deleteImage() { - return deleteImage(null); - } - - public AppLanguagesDto getLanguages(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("languages") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppLanguagesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppLanguagesDto getLanguages() { - return getLanguages(null); - } - - public AppLanguagesDto postLanguage(AddLanguageDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("languages") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppLanguagesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppLanguagesDto postLanguage(AddLanguageDto request) { - return postLanguage(request, null); - } - - public AppLanguagesDto putLanguage(String language) { - return putLanguage(language, UpdateLanguageDto.builder().build()); - } - - public AppLanguagesDto putLanguage(String language, UpdateLanguageDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("languages") - .addPathSegment(language) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppLanguagesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppLanguagesDto putLanguage(String language, UpdateLanguageDto request) { - return putLanguage(language, request, null); - } - - public AppLanguagesDto deleteLanguage(String language, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("languages") - .addPathSegment(language) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppLanguagesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppLanguagesDto deleteLanguage(String language) { - return deleteLanguage(language, null); - } - - public RolesDto getRoles(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("roles") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RolesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RolesDto getRoles() { - return getRoles(null); - } - - public RolesDto postRole(AddRoleDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("roles") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RolesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RolesDto postRole(AddRoleDto request) { - return postRole(request, null); - } - - public List getPermissions(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("roles/permissions") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getPermissions() { - return getPermissions(null); - } - - public RolesDto putRole(String roleName, UpdateRoleDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("roles") - .addPathSegment(roleName) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RolesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RolesDto putRole(String roleName, UpdateRoleDto request) { - return putRole(roleName, request, null); - } - - public RolesDto deleteRole(String roleName, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("roles") - .addPathSegment(roleName) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RolesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RolesDto deleteRole(String roleName) { - return deleteRole(roleName, null); - } - - /** - * You can only retrieve the list of apps when you are authenticated as a user (OpenID implicit flow). - * You will retrieve all apps, where you are assigned as a contributor. - */ - public List getApps(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can only retrieve the list of apps when you are authenticated as a user (OpenID implicit flow). - * You will retrieve all apps, where you are assigned as a contributor. - */ - public List getApps() { - return getApps(null); - } - - /** - * You can only create an app when you are authenticated as a user (OpenID implicit flow). - * You will be assigned as owner of the new app automatically. - */ - public AppDto postApp(CreateAppDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can only create an app when you are authenticated as a user (OpenID implicit flow). - * You will be assigned as owner of the new app automatically. - */ - public AppDto postApp(CreateAppDto request) { - return postApp(request, null); - } - - /** - * You can only retrieve the list of apps when you are authenticated as a user (OpenID implicit flow). - * You will retrieve all apps, where you are assigned as a contributor. - */ - public List getTeamApps(String team, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("apps") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can only retrieve the list of apps when you are authenticated as a user (OpenID implicit flow). - * You will retrieve all apps, where you are assigned as a contributor. - */ - public List getTeamApps(String team) { - return getTeamApps(team, null); - } - - public AppDto getApp(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto getApp() { - return getApp(null); - } - - public AppDto putApp() { - return putApp(UpdateAppDto.builder().build()); - } - - public AppDto putApp(UpdateAppDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto putApp(UpdateAppDto request) { - return putApp(request, null); - } - - public void deleteApp(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteApp() { - deleteApp(null); - } - - public AppDto putAppTeam() { - return putAppTeam(TransferToTeamDto.builder().build()); - } - - public AppDto putAppTeam(TransferToTeamDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("team") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppDto putAppTeam(TransferToTeamDto request) { - return putAppTeam(request, null); - } - - public AppSettingsDto getSettings(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("settings") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppSettingsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppSettingsDto getSettings() { - return getSettings(null); - } - - public AppSettingsDto putSettings(UpdateAppSettingsDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("settings") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AppSettingsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AppSettingsDto putSettings(UpdateAppSettingsDto request) { - return putSettings(request, null); - } - - public WorkflowsDto getWorkflows(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("workflows") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), WorkflowsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public WorkflowsDto getWorkflows() { - return getWorkflows(null); - } - - public WorkflowsDto postWorkflow(AddWorkflowDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("workflows") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), WorkflowsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public WorkflowsDto postWorkflow(AddWorkflowDto request) { - return postWorkflow(request, null); - } - - public WorkflowsDto putWorkflow(String id, UpdateWorkflowDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("workflows") - .addPathSegment(id) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), WorkflowsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public WorkflowsDto putWorkflow(String id, UpdateWorkflowDto request) { - return putWorkflow(id, request, null); - } - - public WorkflowsDto deleteWorkflow(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("workflows") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), WorkflowsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public WorkflowsDto deleteWorkflow(String id) { - return deleteWorkflow(id, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/AddLanguageDto.java b/src/main/java/com/squidex/api/resources/apps/requests/AddLanguageDto.java deleted file mode 100644 index 64072bf..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/AddLanguageDto.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AddLanguageDto.Builder.class) -public final class AddLanguageDto { - private final String language; - - private AddLanguageDto(String language) { - this.language = language; - } - - /** - * @return The language to add. - */ - @JsonProperty("language") - public String getLanguage() { - return language; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AddLanguageDto && equalTo((AddLanguageDto) other); - } - - private boolean equalTo(AddLanguageDto other) { - return language.equals(other.language); - } - - @Override - public int hashCode() { - return Objects.hash(this.language); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static LanguageStage builder() { - return new Builder(); - } - - public interface LanguageStage { - _FinalStage language(String language); - - Builder from(AddLanguageDto other); - } - - public interface _FinalStage { - AddLanguageDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements LanguageStage, _FinalStage { - private String language; - - private Builder() {} - - @Override - public Builder from(AddLanguageDto other) { - language(other.getLanguage()); - return this; - } - - /** - *

The language to add.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("language") - public _FinalStage language(String language) { - this.language = language; - return this; - } - - @Override - public AddLanguageDto build() { - return new AddLanguageDto(language); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/AddRoleDto.java b/src/main/java/com/squidex/api/resources/apps/requests/AddRoleDto.java deleted file mode 100644 index bb19995..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/AddRoleDto.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AddRoleDto.Builder.class) -public final class AddRoleDto { - private final String name; - - private AddRoleDto(String name) { - this.name = name; - } - - /** - * @return The role name. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AddRoleDto && equalTo((AddRoleDto) other); - } - - private boolean equalTo(AddRoleDto other) { - return name.equals(other.name); - } - - @Override - public int hashCode() { - return Objects.hash(this.name); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(AddRoleDto other); - } - - public interface _FinalStage { - AddRoleDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Builder() {} - - @Override - public Builder from(AddRoleDto other) { - name(other.getName()); - return this; - } - - /** - *

The role name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - @Override - public AddRoleDto build() { - return new AddRoleDto(name); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/AddWorkflowDto.java b/src/main/java/com/squidex/api/resources/apps/requests/AddWorkflowDto.java deleted file mode 100644 index ed30225..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/AddWorkflowDto.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AddWorkflowDto.Builder.class) -public final class AddWorkflowDto { - private final String name; - - private AddWorkflowDto(String name) { - this.name = name; - } - - /** - * @return The name of the workflow. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AddWorkflowDto && equalTo((AddWorkflowDto) other); - } - - private boolean equalTo(AddWorkflowDto other) { - return name.equals(other.name); - } - - @Override - public int hashCode() { - return Objects.hash(this.name); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(AddWorkflowDto other); - } - - public interface _FinalStage { - AddWorkflowDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Builder() {} - - @Override - public Builder from(AddWorkflowDto other) { - name(other.getName()); - return this; - } - - /** - *

The name of the workflow.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - @Override - public AddWorkflowDto build() { - return new AddWorkflowDto(name); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/AppsUploadImageRequest.java b/src/main/java/com/squidex/api/resources/apps/requests/AppsUploadImageRequest.java deleted file mode 100644 index 854ea12..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/AppsUploadImageRequest.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.squidex.api.core.ObjectMappers; - -public final class AppsUploadImageRequest { - private AppsUploadImageRequest() {} - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AppsUploadImageRequest; - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/CreateAppDto.java b/src/main/java/com/squidex/api/resources/apps/requests/CreateAppDto.java deleted file mode 100644 index 29d7102..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/CreateAppDto.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateAppDto.Builder.class) -public final class CreateAppDto { - private final String name; - - private final Optional template; - - private CreateAppDto(String name, Optional template) { - this.name = name; - this.template = template; - } - - /** - * @return The name of the app. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Initialize the app with the inbuilt template. - */ - @JsonProperty("template") - public Optional getTemplate() { - return template; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateAppDto && equalTo((CreateAppDto) other); - } - - private boolean equalTo(CreateAppDto other) { - return name.equals(other.name) && template.equals(other.template); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.template); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(CreateAppDto other); - } - - public interface _FinalStage { - CreateAppDto build(); - - _FinalStage template(Optional template); - - _FinalStage template(String template); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Optional template = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CreateAppDto other) { - name(other.getName()); - template(other.getTemplate()); - return this; - } - - /** - *

The name of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - /** - *

Initialize the app with the inbuilt template.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage template(String template) { - this.template = Optional.of(template); - return this; - } - - @Override - @JsonSetter(value = "template", nulls = Nulls.SKIP) - public _FinalStage template(Optional template) { - this.template = template; - return this; - } - - @Override - public CreateAppDto build() { - return new CreateAppDto(name, template); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/CreateClientDto.java b/src/main/java/com/squidex/api/resources/apps/requests/CreateClientDto.java deleted file mode 100644 index 0ba5f47..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/CreateClientDto.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateClientDto.Builder.class) -public final class CreateClientDto { - private final String id; - - private CreateClientDto(String id) { - this.id = id; - } - - /** - * @return The ID of the client. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateClientDto && equalTo((CreateClientDto) other); - } - - private boolean equalTo(CreateClientDto other) { - return id.equals(other.id); - } - - @Override - public int hashCode() { - return Objects.hash(this.id); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - _FinalStage id(String id); - - Builder from(CreateClientDto other); - } - - public interface _FinalStage { - CreateClientDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, _FinalStage { - private String id; - - private Builder() {} - - @Override - public Builder from(CreateClientDto other) { - id(other.getId()); - return this; - } - - /** - *

The ID of the client.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public _FinalStage id(String id) { - this.id = id; - return this; - } - - @Override - public CreateClientDto build() { - return new CreateClientDto(id); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/TransferToTeamDto.java b/src/main/java/com/squidex/api/resources/apps/requests/TransferToTeamDto.java deleted file mode 100644 index b3478ac..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/TransferToTeamDto.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TransferToTeamDto.Builder.class) -public final class TransferToTeamDto { - private final Optional teamId; - - private TransferToTeamDto(Optional teamId) { - this.teamId = teamId; - } - - /** - * @return The ID of the team. - */ - @JsonProperty("teamId") - public Optional getTeamId() { - return teamId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TransferToTeamDto && equalTo((TransferToTeamDto) other); - } - - private boolean equalTo(TransferToTeamDto other) { - return teamId.equals(other.teamId); - } - - @Override - public int hashCode() { - return Objects.hash(this.teamId); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional teamId = Optional.empty(); - - private Builder() {} - - public Builder from(TransferToTeamDto other) { - teamId(other.getTeamId()); - return this; - } - - @JsonSetter(value = "teamId", nulls = Nulls.SKIP) - public Builder teamId(Optional teamId) { - this.teamId = teamId; - return this; - } - - public Builder teamId(String teamId) { - this.teamId = Optional.of(teamId); - return this; - } - - public TransferToTeamDto build() { - return new TransferToTeamDto(teamId); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppDto.java deleted file mode 100644 index 1fe434c..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppDto.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateAppDto.Builder.class) -public final class UpdateAppDto { - private final Optional label; - - private final Optional description; - - private UpdateAppDto(Optional label, Optional description) { - this.label = label; - this.description = description; - } - - /** - * @return The optional label of your app. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; - } - - /** - * @return The optional description of your app. - */ - @JsonProperty("description") - public Optional getDescription() { - return description; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateAppDto && equalTo((UpdateAppDto) other); - } - - private boolean equalTo(UpdateAppDto other) { - return label.equals(other.label) && description.equals(other.description); - } - - @Override - public int hashCode() { - return Objects.hash(this.label, this.description); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional label = Optional.empty(); - - private Optional description = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateAppDto other) { - label(other.getLabel()); - description(other.getDescription()); - return this; - } - - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public Builder label(Optional label) { - this.label = label; - return this; - } - - public Builder label(String label) { - this.label = Optional.of(label); - return this; - } - - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public Builder description(Optional description) { - this.description = description; - return this; - } - - public Builder description(String description) { - this.description = Optional.of(description); - return this; - } - - public UpdateAppDto build() { - return new UpdateAppDto(label, description); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppSettingsDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppSettingsDto.java deleted file mode 100644 index 7c9faa8..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppSettingsDto.java +++ /dev/null @@ -1,181 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.EditorDto; -import com.squidex.api.types.PatternDto; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateAppSettingsDto.Builder.class) -public final class UpdateAppSettingsDto { - private final List patterns; - - private final List editors; - - private final Optional hideScheduler; - - private final Optional hideDateTimeModeButton; - - private UpdateAppSettingsDto( - List patterns, - List editors, - Optional hideScheduler, - Optional hideDateTimeModeButton) { - this.patterns = patterns; - this.editors = editors; - this.hideScheduler = hideScheduler; - this.hideDateTimeModeButton = hideDateTimeModeButton; - } - - /** - * @return The configured app patterns. - */ - @JsonProperty("patterns") - public List getPatterns() { - return patterns; - } - - /** - * @return The configured UI editors. - */ - @JsonProperty("editors") - public List getEditors() { - return editors; - } - - /** - * @return Hide the scheduler for content items. - */ - @JsonProperty("hideScheduler") - public Optional getHideScheduler() { - return hideScheduler; - } - - /** - * @return Hide the datetime mode button. - */ - @JsonProperty("hideDateTimeModeButton") - public Optional getHideDateTimeModeButton() { - return hideDateTimeModeButton; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateAppSettingsDto && equalTo((UpdateAppSettingsDto) other); - } - - private boolean equalTo(UpdateAppSettingsDto other) { - return patterns.equals(other.patterns) - && editors.equals(other.editors) - && hideScheduler.equals(other.hideScheduler) - && hideDateTimeModeButton.equals(other.hideDateTimeModeButton); - } - - @Override - public int hashCode() { - return Objects.hash(this.patterns, this.editors, this.hideScheduler, this.hideDateTimeModeButton); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private List patterns = new ArrayList<>(); - - private List editors = new ArrayList<>(); - - private Optional hideScheduler = Optional.empty(); - - private Optional hideDateTimeModeButton = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateAppSettingsDto other) { - patterns(other.getPatterns()); - editors(other.getEditors()); - hideScheduler(other.getHideScheduler()); - hideDateTimeModeButton(other.getHideDateTimeModeButton()); - return this; - } - - @JsonSetter(value = "patterns", nulls = Nulls.SKIP) - public Builder patterns(List patterns) { - this.patterns.clear(); - this.patterns.addAll(patterns); - return this; - } - - public Builder addPatterns(PatternDto patterns) { - this.patterns.add(patterns); - return this; - } - - public Builder addAllPatterns(List patterns) { - this.patterns.addAll(patterns); - return this; - } - - @JsonSetter(value = "editors", nulls = Nulls.SKIP) - public Builder editors(List editors) { - this.editors.clear(); - this.editors.addAll(editors); - return this; - } - - public Builder addEditors(EditorDto editors) { - this.editors.add(editors); - return this; - } - - public Builder addAllEditors(List editors) { - this.editors.addAll(editors); - return this; - } - - @JsonSetter(value = "hideScheduler", nulls = Nulls.SKIP) - public Builder hideScheduler(Optional hideScheduler) { - this.hideScheduler = hideScheduler; - return this; - } - - public Builder hideScheduler(Boolean hideScheduler) { - this.hideScheduler = Optional.of(hideScheduler); - return this; - } - - @JsonSetter(value = "hideDateTimeModeButton", nulls = Nulls.SKIP) - public Builder hideDateTimeModeButton(Optional hideDateTimeModeButton) { - this.hideDateTimeModeButton = hideDateTimeModeButton; - return this; - } - - public Builder hideDateTimeModeButton(Boolean hideDateTimeModeButton) { - this.hideDateTimeModeButton = Optional.of(hideDateTimeModeButton); - return this; - } - - public UpdateAppSettingsDto build() { - return new UpdateAppSettingsDto(patterns, editors, hideScheduler, hideDateTimeModeButton); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAssetScriptsDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateAssetScriptsDto.java deleted file mode 100644 index f8dd7d4..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateAssetScriptsDto.java +++ /dev/null @@ -1,246 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateAssetScriptsDto.Builder.class) -public final class UpdateAssetScriptsDto { - private final Optional query; - - private final Optional queryPre; - - private final Optional create; - - private final Optional update; - - private final Optional annotate; - - private final Optional move; - - private final Optional delete; - - private UpdateAssetScriptsDto( - Optional query, - Optional queryPre, - Optional create, - Optional update, - Optional annotate, - Optional move, - Optional delete) { - this.query = query; - this.queryPre = queryPre; - this.create = create; - this.update = update; - this.annotate = annotate; - this.move = move; - this.delete = delete; - } - - /** - * @return The script that is executed for each asset when querying assets. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return The script that is executed for all assets when querying assets. - */ - @JsonProperty("queryPre") - public Optional getQueryPre() { - return queryPre; - } - - /** - * @return The script that is executed when creating an asset. - */ - @JsonProperty("create") - public Optional getCreate() { - return create; - } - - /** - * @return The script that is executed when updating a content. - */ - @JsonProperty("update") - public Optional getUpdate() { - return update; - } - - /** - * @return The script that is executed when annotating a content. - */ - @JsonProperty("annotate") - public Optional getAnnotate() { - return annotate; - } - - /** - * @return The script that is executed when moving a content. - */ - @JsonProperty("move") - public Optional getMove() { - return move; - } - - /** - * @return The script that is executed when deleting a content. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateAssetScriptsDto && equalTo((UpdateAssetScriptsDto) other); - } - - private boolean equalTo(UpdateAssetScriptsDto other) { - return query.equals(other.query) - && queryPre.equals(other.queryPre) - && create.equals(other.create) - && update.equals(other.update) - && annotate.equals(other.annotate) - && move.equals(other.move) - && delete.equals(other.delete); - } - - @Override - public int hashCode() { - return Objects.hash(this.query, this.queryPre, this.create, this.update, this.annotate, this.move, this.delete); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Optional queryPre = Optional.empty(); - - private Optional create = Optional.empty(); - - private Optional update = Optional.empty(); - - private Optional annotate = Optional.empty(); - - private Optional move = Optional.empty(); - - private Optional delete = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateAssetScriptsDto other) { - query(other.getQuery()); - queryPre(other.getQueryPre()); - create(other.getCreate()); - update(other.getUpdate()); - annotate(other.getAnnotate()); - move(other.getMove()); - delete(other.getDelete()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "queryPre", nulls = Nulls.SKIP) - public Builder queryPre(Optional queryPre) { - this.queryPre = queryPre; - return this; - } - - public Builder queryPre(String queryPre) { - this.queryPre = Optional.of(queryPre); - return this; - } - - @JsonSetter(value = "create", nulls = Nulls.SKIP) - public Builder create(Optional create) { - this.create = create; - return this; - } - - public Builder create(String create) { - this.create = Optional.of(create); - return this; - } - - @JsonSetter(value = "update", nulls = Nulls.SKIP) - public Builder update(Optional update) { - this.update = update; - return this; - } - - public Builder update(String update) { - this.update = Optional.of(update); - return this; - } - - @JsonSetter(value = "annotate", nulls = Nulls.SKIP) - public Builder annotate(Optional annotate) { - this.annotate = annotate; - return this; - } - - public Builder annotate(String annotate) { - this.annotate = Optional.of(annotate); - return this; - } - - @JsonSetter(value = "move", nulls = Nulls.SKIP) - public Builder move(Optional move) { - this.move = move; - return this; - } - - public Builder move(String move) { - this.move = Optional.of(move); - return this; - } - - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public Builder delete(Optional delete) { - this.delete = delete; - return this; - } - - public Builder delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - public UpdateAssetScriptsDto build() { - return new UpdateAssetScriptsDto(query, queryPre, create, update, annotate, move, delete); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateClientDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateClientDto.java deleted file mode 100644 index 4af3e3c..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateClientDto.java +++ /dev/null @@ -1,192 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateClientDto.Builder.class) -public final class UpdateClientDto { - private final Optional name; - - private final Optional role; - - private final Optional allowAnonymous; - - private final Optional apiCallsLimit; - - private final Optional apiTrafficLimit; - - private UpdateClientDto( - Optional name, - Optional role, - Optional allowAnonymous, - Optional apiCallsLimit, - Optional apiTrafficLimit) { - this.name = name; - this.role = role; - this.allowAnonymous = allowAnonymous; - this.apiCallsLimit = apiCallsLimit; - this.apiTrafficLimit = apiTrafficLimit; - } - - /** - * @return The new display name of the client. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The role of the client. - */ - @JsonProperty("role") - public Optional getRole() { - return role; - } - - /** - * @return True to allow anonymous access without an access token for this client. - */ - @JsonProperty("allowAnonymous") - public Optional getAllowAnonymous() { - return allowAnonymous; - } - - /** - * @return The number of allowed api calls per month for this client. - */ - @JsonProperty("apiCallsLimit") - public Optional getApiCallsLimit() { - return apiCallsLimit; - } - - /** - * @return The number of allowed api traffic bytes per month for this client. - */ - @JsonProperty("apiTrafficLimit") - public Optional getApiTrafficLimit() { - return apiTrafficLimit; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateClientDto && equalTo((UpdateClientDto) other); - } - - private boolean equalTo(UpdateClientDto other) { - return name.equals(other.name) - && role.equals(other.role) - && allowAnonymous.equals(other.allowAnonymous) - && apiCallsLimit.equals(other.apiCallsLimit) - && apiTrafficLimit.equals(other.apiTrafficLimit); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.role, this.allowAnonymous, this.apiCallsLimit, this.apiTrafficLimit); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional name = Optional.empty(); - - private Optional role = Optional.empty(); - - private Optional allowAnonymous = Optional.empty(); - - private Optional apiCallsLimit = Optional.empty(); - - private Optional apiTrafficLimit = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateClientDto other) { - name(other.getName()); - role(other.getRole()); - allowAnonymous(other.getAllowAnonymous()); - apiCallsLimit(other.getApiCallsLimit()); - apiTrafficLimit(other.getApiTrafficLimit()); - return this; - } - - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.of(name); - return this; - } - - @JsonSetter(value = "role", nulls = Nulls.SKIP) - public Builder role(Optional role) { - this.role = role; - return this; - } - - public Builder role(String role) { - this.role = Optional.of(role); - return this; - } - - @JsonSetter(value = "allowAnonymous", nulls = Nulls.SKIP) - public Builder allowAnonymous(Optional allowAnonymous) { - this.allowAnonymous = allowAnonymous; - return this; - } - - public Builder allowAnonymous(Boolean allowAnonymous) { - this.allowAnonymous = Optional.of(allowAnonymous); - return this; - } - - @JsonSetter(value = "apiCallsLimit", nulls = Nulls.SKIP) - public Builder apiCallsLimit(Optional apiCallsLimit) { - this.apiCallsLimit = apiCallsLimit; - return this; - } - - public Builder apiCallsLimit(Integer apiCallsLimit) { - this.apiCallsLimit = Optional.of(apiCallsLimit); - return this; - } - - @JsonSetter(value = "apiTrafficLimit", nulls = Nulls.SKIP) - public Builder apiTrafficLimit(Optional apiTrafficLimit) { - this.apiTrafficLimit = apiTrafficLimit; - return this; - } - - public Builder apiTrafficLimit(Integer apiTrafficLimit) { - this.apiTrafficLimit = Optional.of(apiTrafficLimit); - return this; - } - - public UpdateClientDto build() { - return new UpdateClientDto(name, role, allowAnonymous, apiCallsLimit, apiTrafficLimit); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateLanguageDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateLanguageDto.java deleted file mode 100644 index 5fac321..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateLanguageDto.java +++ /dev/null @@ -1,137 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateLanguageDto.Builder.class) -public final class UpdateLanguageDto { - private final Optional isMaster; - - private final Optional isOptional; - - private final Optional> fallback; - - private UpdateLanguageDto( - Optional isMaster, Optional isOptional, Optional> fallback) { - this.isMaster = isMaster; - this.isOptional = isOptional; - this.fallback = fallback; - } - - /** - * @return Set the value to true to make the language the master. - */ - @JsonProperty("isMaster") - public Optional getIsMaster() { - return isMaster; - } - - /** - * @return Set the value to true to make the language optional. - */ - @JsonProperty("isOptional") - public Optional getIsOptional() { - return isOptional; - } - - /** - * @return Optional fallback languages. - */ - @JsonProperty("fallback") - public Optional> getFallback() { - return fallback; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateLanguageDto && equalTo((UpdateLanguageDto) other); - } - - private boolean equalTo(UpdateLanguageDto other) { - return isMaster.equals(other.isMaster) - && isOptional.equals(other.isOptional) - && fallback.equals(other.fallback); - } - - @Override - public int hashCode() { - return Objects.hash(this.isMaster, this.isOptional, this.fallback); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional isMaster = Optional.empty(); - - private Optional isOptional = Optional.empty(); - - private Optional> fallback = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateLanguageDto other) { - isMaster(other.getIsMaster()); - isOptional(other.getIsOptional()); - fallback(other.getFallback()); - return this; - } - - @JsonSetter(value = "isMaster", nulls = Nulls.SKIP) - public Builder isMaster(Optional isMaster) { - this.isMaster = isMaster; - return this; - } - - public Builder isMaster(Boolean isMaster) { - this.isMaster = Optional.of(isMaster); - return this; - } - - @JsonSetter(value = "isOptional", nulls = Nulls.SKIP) - public Builder isOptional(Optional isOptional) { - this.isOptional = isOptional; - return this; - } - - public Builder isOptional(Boolean isOptional) { - this.isOptional = Optional.of(isOptional); - return this; - } - - @JsonSetter(value = "fallback", nulls = Nulls.SKIP) - public Builder fallback(Optional> fallback) { - this.fallback = fallback; - return this; - } - - public Builder fallback(List fallback) { - this.fallback = Optional.of(fallback); - return this; - } - - public UpdateLanguageDto build() { - return new UpdateLanguageDto(isMaster, isOptional, fallback); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateRoleDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateRoleDto.java deleted file mode 100644 index f821642..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateRoleDto.java +++ /dev/null @@ -1,117 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateRoleDto.Builder.class) -public final class UpdateRoleDto { - private final List permissions; - - private final Optional> properties; - - private UpdateRoleDto(List permissions, Optional> properties) { - this.permissions = permissions; - this.properties = properties; - } - - /** - * @return Associated list of permissions. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - /** - * @return Associated list of UI properties. - */ - @JsonProperty("properties") - public Optional> getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateRoleDto && equalTo((UpdateRoleDto) other); - } - - private boolean equalTo(UpdateRoleDto other) { - return permissions.equals(other.permissions) && properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash(this.permissions, this.properties); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private List permissions = new ArrayList<>(); - - private Optional> properties = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateRoleDto other) { - permissions(other.getPermissions()); - properties(other.getProperties()); - return this; - } - - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public Builder permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - public Builder addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - public Builder addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public Builder properties(Optional> properties) { - this.properties = properties; - return this; - } - - public Builder properties(Map properties) { - this.properties = Optional.of(properties); - return this; - } - - public UpdateRoleDto build() { - return new UpdateRoleDto(permissions, properties); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/apps/requests/UpdateWorkflowDto.java b/src/main/java/com/squidex/api/resources/apps/requests/UpdateWorkflowDto.java deleted file mode 100644 index 7e8702a..0000000 --- a/src/main/java/com/squidex/api/resources/apps/requests/UpdateWorkflowDto.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.apps.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.WorkflowStepDto; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateWorkflowDto.Builder.class) -public final class UpdateWorkflowDto { - private final Optional name; - - private final Map steps; - - private final Optional> schemaIds; - - private final String initial; - - private UpdateWorkflowDto( - Optional name, - Map steps, - Optional> schemaIds, - String initial) { - this.name = name; - this.steps = steps; - this.schemaIds = schemaIds; - this.initial = initial; - } - - /** - * @return The name of the workflow. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The workflow steps. - */ - @JsonProperty("steps") - public Map getSteps() { - return steps; - } - - /** - * @return The schema ids. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; - } - - /** - * @return The initial step. - */ - @JsonProperty("initial") - public String getInitial() { - return initial; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateWorkflowDto && equalTo((UpdateWorkflowDto) other); - } - - private boolean equalTo(UpdateWorkflowDto other) { - return name.equals(other.name) - && steps.equals(other.steps) - && schemaIds.equals(other.schemaIds) - && initial.equals(other.initial); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.steps, this.schemaIds, this.initial); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static InitialStage builder() { - return new Builder(); - } - - public interface InitialStage { - _FinalStage initial(String initial); - - Builder from(UpdateWorkflowDto other); - } - - public interface _FinalStage { - UpdateWorkflowDto build(); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage steps(Map steps); - - _FinalStage putAllSteps(Map steps); - - _FinalStage steps(String key, WorkflowStepDto value); - - _FinalStage schemaIds(Optional> schemaIds); - - _FinalStage schemaIds(List schemaIds); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements InitialStage, _FinalStage { - private String initial; - - private Optional> schemaIds = Optional.empty(); - - private Map steps = new LinkedHashMap<>(); - - private Optional name = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UpdateWorkflowDto other) { - name(other.getName()); - steps(other.getSteps()); - schemaIds(other.getSchemaIds()); - initial(other.getInitial()); - return this; - } - - /** - *

The initial step.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("initial") - public _FinalStage initial(String initial) { - this.initial = initial; - return this; - } - - /** - *

The schema ids.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - @Override - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public _FinalStage schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - /** - *

The workflow steps.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage steps(String key, WorkflowStepDto value) { - this.steps.put(key, value); - return this; - } - - /** - *

The workflow steps.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllSteps(Map steps) { - this.steps.putAll(steps); - return this; - } - - @Override - @JsonSetter(value = "steps", nulls = Nulls.SKIP) - public _FinalStage steps(Map steps) { - this.steps.clear(); - this.steps.putAll(steps); - return this; - } - - /** - *

The name of the workflow.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage name(String name) { - this.name = Optional.of(name); - return this; - } - - @Override - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @Override - public UpdateWorkflowDto build() { - return new UpdateWorkflowDto(name, steps, schemaIds, initial); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/AssetsClient.java b/src/main/java/com/squidex/api/resources/assets/AssetsClient.java deleted file mode 100644 index 2fa726b..0000000 --- a/src/main/java/com/squidex/api/resources/assets/AssetsClient.java +++ /dev/null @@ -1,967 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.assets.requests.AnnotateAssetDto; -import com.squidex.api.resources.assets.requests.AssetsDeleteAssetRequest; -import com.squidex.api.resources.assets.requests.AssetsGetAssetContentBySlugRequest; -import com.squidex.api.resources.assets.requests.AssetsGetAssetContentRequest; -import com.squidex.api.resources.assets.requests.AssetsGetAssetFoldersRequest; -import com.squidex.api.resources.assets.requests.AssetsGetAssetsPostRequest; -import com.squidex.api.resources.assets.requests.AssetsGetAssetsRequest; -import com.squidex.api.resources.assets.requests.AssetsPostAssetRequest; -import com.squidex.api.resources.assets.requests.AssetsPostUpsertAssetRequest; -import com.squidex.api.resources.assets.requests.AssetsPutAssetContentRequest; -import com.squidex.api.resources.assets.requests.BulkUpdateAssetsDto; -import com.squidex.api.resources.assets.requests.CreateAssetFolderDto; -import com.squidex.api.resources.assets.requests.MoveAssetDto; -import com.squidex.api.resources.assets.requests.MoveAssetFolderDto; -import com.squidex.api.resources.assets.requests.RenameAssetFolderDto; -import com.squidex.api.resources.assets.requests.RenameTagDto; -import com.squidex.api.types.AssetDto; -import com.squidex.api.types.AssetFolderDto; -import com.squidex.api.types.AssetFoldersDto; -import com.squidex.api.types.AssetsDto; -import com.squidex.api.types.BulkResultDto; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Files; -import java.util.List; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.MultipartBody; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class AssetsClient { - protected final ClientOptions clientOptions; - - public AssetsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public InputStream getAssetContentBySlug(String idOrSlug, String more) { - return getAssetContentBySlug( - idOrSlug, more, AssetsGetAssetContentBySlugRequest.builder().build()); - } - - public InputStream getAssetContentBySlug( - String idOrSlug, String more, AssetsGetAssetContentBySlugRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/assets") - .addPathSegment(clientOptions.appName()) - .addPathSegment(idOrSlug) - .addPathSegment(more); - if (request.getVersion().isPresent()) { - httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - if (request.getCache().isPresent()) { - httpUrl.addQueryParameter("cache", request.getCache().get().toString()); - } - if (request.getDownload().isPresent()) { - httpUrl.addQueryParameter("download", request.getDownload().get().toString()); - } - if (request.getWidth().isPresent()) { - httpUrl.addQueryParameter("width", request.getWidth().get().toString()); - } - if (request.getHeight().isPresent()) { - httpUrl.addQueryParameter("height", request.getHeight().get().toString()); - } - if (request.getQuality().isPresent()) { - httpUrl.addQueryParameter("quality", request.getQuality().get().toString()); - } - if (request.getMode().isPresent()) { - httpUrl.addQueryParameter("mode", request.getMode().get().toString()); - } - if (request.getBg().isPresent()) { - httpUrl.addQueryParameter("bg", request.getBg().get()); - } - if (request.getFocusX().isPresent()) { - httpUrl.addQueryParameter("focusX", request.getFocusX().get().toString()); - } - if (request.getFocusY().isPresent()) { - httpUrl.addQueryParameter("focusY", request.getFocusY().get().toString()); - } - if (request.getNofocus().isPresent()) { - httpUrl.addQueryParameter("nofocus", request.getNofocus().get().toString()); - } - if (request.getAuto().isPresent()) { - httpUrl.addQueryParameter("auto", request.getAuto().get().toString()); - } - if (request.getForce().isPresent()) { - httpUrl.addQueryParameter("force", request.getForce().get().toString()); - } - if (request.getDeleted().isPresent()) { - httpUrl.addQueryParameter("deleted", request.getDeleted().get().toString()); - } - if (request.getFormat().isPresent()) { - httpUrl.addQueryParameter("format", request.getFormat().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return response.body().byteStream(); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getAssetContentBySlug(String idOrSlug, String more, AssetsGetAssetContentBySlugRequest request) { - return getAssetContentBySlug(idOrSlug, more, request, null); - } - - public InputStream getAssetContent(String id) { - return getAssetContent(id, AssetsGetAssetContentRequest.builder().build()); - } - - public InputStream getAssetContent(String id, AssetsGetAssetContentRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/assets") - .addPathSegment(id); - if (request.getVersion().isPresent()) { - httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - if (request.getCache().isPresent()) { - httpUrl.addQueryParameter("cache", request.getCache().get().toString()); - } - if (request.getDownload().isPresent()) { - httpUrl.addQueryParameter("download", request.getDownload().get().toString()); - } - if (request.getWidth().isPresent()) { - httpUrl.addQueryParameter("width", request.getWidth().get().toString()); - } - if (request.getHeight().isPresent()) { - httpUrl.addQueryParameter("height", request.getHeight().get().toString()); - } - if (request.getQuality().isPresent()) { - httpUrl.addQueryParameter("quality", request.getQuality().get().toString()); - } - if (request.getMode().isPresent()) { - httpUrl.addQueryParameter("mode", request.getMode().get().toString()); - } - if (request.getBg().isPresent()) { - httpUrl.addQueryParameter("bg", request.getBg().get()); - } - if (request.getFocusX().isPresent()) { - httpUrl.addQueryParameter("focusX", request.getFocusX().get().toString()); - } - if (request.getFocusY().isPresent()) { - httpUrl.addQueryParameter("focusY", request.getFocusY().get().toString()); - } - if (request.getNofocus().isPresent()) { - httpUrl.addQueryParameter("nofocus", request.getNofocus().get().toString()); - } - if (request.getAuto().isPresent()) { - httpUrl.addQueryParameter("auto", request.getAuto().get().toString()); - } - if (request.getForce().isPresent()) { - httpUrl.addQueryParameter("force", request.getForce().get().toString()); - } - if (request.getDeleted().isPresent()) { - httpUrl.addQueryParameter("deleted", request.getDeleted().get().toString()); - } - if (request.getFormat().isPresent()) { - httpUrl.addQueryParameter("format", request.getFormat().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return response.body().byteStream(); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getAssetContent(String id, AssetsGetAssetContentRequest request) { - return getAssetContent(id, request, null); - } - - /** - * Get all asset folders for the app. - */ - public AssetFoldersDto getAssetFolders() { - return getAssetFolders(AssetsGetAssetFoldersRequest.builder().build()); - } - - /** - * Get all asset folders for the app. - */ - public AssetFoldersDto getAssetFolders(AssetsGetAssetFoldersRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/folders"); - if (request.getParentId().isPresent()) { - httpUrl.addQueryParameter("parentId", request.getParentId().get()); - } - if (request.getScope().isPresent()) { - httpUrl.addQueryParameter("scope", request.getScope().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetFoldersDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Get all asset folders for the app. - */ - public AssetFoldersDto getAssetFolders(AssetsGetAssetFoldersRequest request) { - return getAssetFolders(request, null); - } - - public AssetFolderDto postAssetFolder(CreateAssetFolderDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/folders") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetFolderDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetFolderDto postAssetFolder(CreateAssetFolderDto request) { - return postAssetFolder(request, null); - } - - public AssetFolderDto putAssetFolder(String id, RenameAssetFolderDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/folders") - .addPathSegment(id) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetFolderDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetFolderDto putAssetFolder(String id, RenameAssetFolderDto request) { - return putAssetFolder(id, request, null); - } - - public void deleteAssetFolder(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/folders") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteAssetFolder(String id) { - deleteAssetFolder(id, null); - } - - public AssetFolderDto putAssetFolderParent(String id) { - return putAssetFolderParent(id, MoveAssetFolderDto.builder().build()); - } - - public AssetFolderDto putAssetFolderParent(String id, MoveAssetFolderDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/folders") - .addPathSegment(id) - .addPathSegments("parent") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetFolderDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetFolderDto putAssetFolderParent(String id, MoveAssetFolderDto request) { - return putAssetFolderParent(id, request, null); - } - - /** - * Get all tags for assets. - */ - public Map getTags(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/tags") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Get all tags for assets. - */ - public Map getTags() { - return getTags(null); - } - - public Map putTag(String name, RenameTagDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/tags") - .addPathSegment(name) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Map putTag(String name, RenameTagDto request) { - return putTag(name, request, null); - } - - /** - * Get all assets for the app. - */ - public AssetsDto getAssets() { - return getAssets(AssetsGetAssetsRequest.builder().build()); - } - - /** - * Get all assets for the app. - */ - public AssetsDto getAssets(AssetsGetAssetsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets"); - if (request.getParentId().isPresent()) { - httpUrl.addQueryParameter("parentId", request.getParentId().get()); - } - if (request.getIds().isPresent()) { - httpUrl.addQueryParameter("ids", request.getIds().get()); - } - if (request.getQ().isPresent()) { - httpUrl.addQueryParameter("q", request.getQ().get()); - } - if (request.getTop().isPresent()) { - httpUrl.addQueryParameter("$top", request.getTop().get().toString()); - } - if (request.getSkip().isPresent()) { - httpUrl.addQueryParameter("$skip", request.getSkip().get().toString()); - } - if (request.getOrderby().isPresent()) { - httpUrl.addQueryParameter("$orderby", request.getOrderby().get()); - } - if (request.getFilter().isPresent()) { - httpUrl.addQueryParameter("$filter", request.getFilter().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Get all assets for the app. - */ - public AssetsDto getAssets(AssetsGetAssetsRequest request) { - return getAssets(request, null); - } - - /** - * You can only upload one file at a time. The mime type of the file is not calculated by Squidex and is required correctly. - */ - public AssetDto postAsset(File file, AssetsPostAssetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets"); - if (request.getParentId().isPresent()) { - httpUrl.addQueryParameter("parentId", request.getParentId().get()); - } - if (request.getId().isPresent()) { - httpUrl.addQueryParameter("id", request.getId().get()); - } - if (request.getDuplicate().isPresent()) { - httpUrl.addQueryParameter("duplicate", request.getDuplicate().get().toString()); - } - MultipartBody.Builder body = new MultipartBody.Builder().setType(MultipartBody.FORM); - try { - String mimeType = Files.probeContentType(file.toPath()); - MediaType mediaType = mimeType != null ? MediaType.parse(mimeType) : null; - body.addFormDataPart("file", file.getName(), RequestBody.create(mediaType, file)); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("POST", body.build()) - .headers(Headers.of(clientOptions.headers(requestOptions))); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can only upload one file at a time. The mime type of the file is not calculated by Squidex and is required correctly. - */ - public AssetDto postAsset(File file, AssetsPostAssetRequest request) { - return postAsset(file, request, null); - } - - /** - * Get all assets for the app. - */ - public AssetsDto getAssetsPost(AssetsGetAssetsPostRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/query") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Get all assets for the app. - */ - public AssetsDto getAssetsPost(AssetsGetAssetsPostRequest request) { - return getAssetsPost(request, null); - } - - public AssetDto getAsset(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetDto getAsset(String id) { - return getAsset(id, null); - } - - /** - * You can only upload one file at a time. The mime type of the file is not calculated by Squidex and is required correctly. - */ - public AssetDto postUpsertAsset( - String id, File file, AssetsPostUpsertAssetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id); - if (request.getParentId().isPresent()) { - httpUrl.addQueryParameter("parentId", request.getParentId().get()); - } - if (request.getDuplicate().isPresent()) { - httpUrl.addQueryParameter("duplicate", request.getDuplicate().get().toString()); - } - MultipartBody.Builder body = new MultipartBody.Builder().setType(MultipartBody.FORM); - try { - String mimeType = Files.probeContentType(file.toPath()); - MediaType mediaType = mimeType != null ? MediaType.parse(mimeType) : null; - body.addFormDataPart("file", file.getName(), RequestBody.create(mediaType, file)); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("POST", body.build()) - .headers(Headers.of(clientOptions.headers(requestOptions))); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can only upload one file at a time. The mime type of the file is not calculated by Squidex and is required correctly. - */ - public AssetDto postUpsertAsset(String id, File file, AssetsPostUpsertAssetRequest request) { - return postUpsertAsset(id, file, request, null); - } - - public AssetDto putAsset(String id) { - return putAsset(id, AnnotateAssetDto.builder().build()); - } - - public AssetDto putAsset(String id, AnnotateAssetDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetDto putAsset(String id, AnnotateAssetDto request) { - return putAsset(id, request, null); - } - - public void deleteAsset(String id) { - deleteAsset(id, AssetsDeleteAssetRequest.builder().build()); - } - - public void deleteAsset(String id, AssetsDeleteAssetRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id); - if (request.getCheckReferrers().isPresent()) { - httpUrl.addQueryParameter( - "checkReferrers", request.getCheckReferrers().get().toString()); - } - if (request.getPermanent().isPresent()) { - httpUrl.addQueryParameter("permanent", request.getPermanent().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteAsset(String id, AssetsDeleteAssetRequest request) { - deleteAsset(id, request, null); - } - - public List bulkUpdateAssets() { - return bulkUpdateAssets(BulkUpdateAssetsDto.builder().build()); - } - - public List bulkUpdateAssets(BulkUpdateAssetsDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets/bulk") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List bulkUpdateAssets(BulkUpdateAssetsDto request) { - return bulkUpdateAssets(request, null); - } - - /** - * Use multipart request to upload an asset. - */ - public AssetDto putAssetContent( - String id, File file, AssetsPutAssetContentRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id) - .addPathSegments("content") - .build(); - MultipartBody.Builder body = new MultipartBody.Builder().setType(MultipartBody.FORM); - try { - String mimeType = Files.probeContentType(file.toPath()); - MediaType mediaType = mimeType != null ? MediaType.parse(mimeType) : null; - body.addFormDataPart("file", file.getName(), RequestBody.create(mediaType, file)); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("PUT", body.build()) - .headers(Headers.of(clientOptions.headers(requestOptions))); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Use multipart request to upload an asset. - */ - public AssetDto putAssetContent(String id, File file, AssetsPutAssetContentRequest request) { - return putAssetContent(id, file, request, null); - } - - public AssetDto putAssetParent(String id) { - return putAssetParent(id, MoveAssetDto.builder().build()); - } - - public AssetDto putAssetParent(String id, MoveAssetDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("assets") - .addPathSegment(id) - .addPathSegments("parent") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), AssetDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public AssetDto putAssetParent(String id, MoveAssetDto request) { - return putAssetParent(id, request, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AnnotateAssetDto.java b/src/main/java/com/squidex/api/resources/assets/requests/AnnotateAssetDto.java deleted file mode 100644 index 6cfe947..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AnnotateAssetDto.java +++ /dev/null @@ -1,194 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AnnotateAssetDto.Builder.class) -public final class AnnotateAssetDto { - private final Optional fileName; - - private final Optional slug; - - private final Optional isProtected; - - private final Optional> tags; - - private final Optional> metadata; - - private AnnotateAssetDto( - Optional fileName, - Optional slug, - Optional isProtected, - Optional> tags, - Optional> metadata) { - this.fileName = fileName; - this.slug = slug; - this.isProtected = isProtected; - this.tags = tags; - this.metadata = metadata; - } - - /** - * @return The new name of the asset. - */ - @JsonProperty("fileName") - public Optional getFileName() { - return fileName; - } - - /** - * @return The new slug of the asset. - */ - @JsonProperty("slug") - public Optional getSlug() { - return slug; - } - - /** - * @return True, when the asset is not public. - */ - @JsonProperty("isProtected") - public Optional getIsProtected() { - return isProtected; - } - - /** - * @return The new asset tags. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return The asset metadata. - */ - @JsonProperty("metadata") - public Optional> getMetadata() { - return metadata; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AnnotateAssetDto && equalTo((AnnotateAssetDto) other); - } - - private boolean equalTo(AnnotateAssetDto other) { - return fileName.equals(other.fileName) - && slug.equals(other.slug) - && isProtected.equals(other.isProtected) - && tags.equals(other.tags) - && metadata.equals(other.metadata); - } - - @Override - public int hashCode() { - return Objects.hash(this.fileName, this.slug, this.isProtected, this.tags, this.metadata); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional fileName = Optional.empty(); - - private Optional slug = Optional.empty(); - - private Optional isProtected = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional> metadata = Optional.empty(); - - private Builder() {} - - public Builder from(AnnotateAssetDto other) { - fileName(other.getFileName()); - slug(other.getSlug()); - isProtected(other.getIsProtected()); - tags(other.getTags()); - metadata(other.getMetadata()); - return this; - } - - @JsonSetter(value = "fileName", nulls = Nulls.SKIP) - public Builder fileName(Optional fileName) { - this.fileName = fileName; - return this; - } - - public Builder fileName(String fileName) { - this.fileName = Optional.of(fileName); - return this; - } - - @JsonSetter(value = "slug", nulls = Nulls.SKIP) - public Builder slug(Optional slug) { - this.slug = slug; - return this; - } - - public Builder slug(String slug) { - this.slug = Optional.of(slug); - return this; - } - - @JsonSetter(value = "isProtected", nulls = Nulls.SKIP) - public Builder isProtected(Optional isProtected) { - this.isProtected = isProtected; - return this; - } - - public Builder isProtected(Boolean isProtected) { - this.isProtected = Optional.of(isProtected); - return this; - } - - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.of(tags); - return this; - } - - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public Builder metadata(Optional> metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(Map metadata) { - this.metadata = Optional.of(metadata); - return this; - } - - public AnnotateAssetDto build() { - return new AnnotateAssetDto(fileName, slug, isProtected, tags, metadata); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsDeleteAssetRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsDeleteAssetRequest.java deleted file mode 100644 index fec7952..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsDeleteAssetRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsDeleteAssetRequest.Builder.class) -public final class AssetsDeleteAssetRequest { - private final Optional checkReferrers; - - private final Optional permanent; - - private AssetsDeleteAssetRequest(Optional checkReferrers, Optional permanent) { - this.checkReferrers = checkReferrers; - this.permanent = permanent; - } - - /** - * @return True to check referrers of this asset. - */ - @JsonProperty("checkReferrers") - public Optional getCheckReferrers() { - return checkReferrers; - } - - /** - * @return True to delete the asset permanently. - */ - @JsonProperty("permanent") - public Optional getPermanent() { - return permanent; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsDeleteAssetRequest && equalTo((AssetsDeleteAssetRequest) other); - } - - private boolean equalTo(AssetsDeleteAssetRequest other) { - return checkReferrers.equals(other.checkReferrers) && permanent.equals(other.permanent); - } - - @Override - public int hashCode() { - return Objects.hash(this.checkReferrers, this.permanent); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional checkReferrers = Optional.empty(); - - private Optional permanent = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsDeleteAssetRequest other) { - checkReferrers(other.getCheckReferrers()); - permanent(other.getPermanent()); - return this; - } - - @JsonSetter(value = "checkReferrers", nulls = Nulls.SKIP) - public Builder checkReferrers(Optional checkReferrers) { - this.checkReferrers = checkReferrers; - return this; - } - - public Builder checkReferrers(Boolean checkReferrers) { - this.checkReferrers = Optional.of(checkReferrers); - return this; - } - - @JsonSetter(value = "permanent", nulls = Nulls.SKIP) - public Builder permanent(Optional permanent) { - this.permanent = permanent; - return this; - } - - public Builder permanent(Boolean permanent) { - this.permanent = Optional.of(permanent); - return this; - } - - public AssetsDeleteAssetRequest build() { - return new AssetsDeleteAssetRequest(checkReferrers, permanent); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentBySlugRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentBySlugRequest.java deleted file mode 100644 index f5bd54e..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentBySlugRequest.java +++ /dev/null @@ -1,482 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.ImageFormat; -import com.squidex.api.types.ResizeMode; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsGetAssetContentBySlugRequest.Builder.class) -public final class AssetsGetAssetContentBySlugRequest { - private final Optional version; - - private final Optional cache; - - private final Optional download; - - private final Optional width; - - private final Optional height; - - private final Optional quality; - - private final Optional mode; - - private final Optional bg; - - private final Optional focusX; - - private final Optional focusY; - - private final Optional nofocus; - - private final Optional auto; - - private final Optional force; - - private final Optional deleted; - - private final Optional format; - - private AssetsGetAssetContentBySlugRequest( - Optional version, - Optional cache, - Optional download, - Optional width, - Optional height, - Optional quality, - Optional mode, - Optional bg, - Optional focusX, - Optional focusY, - Optional nofocus, - Optional auto, - Optional force, - Optional deleted, - Optional format) { - this.version = version; - this.cache = cache; - this.download = download; - this.width = width; - this.height = height; - this.quality = quality; - this.mode = mode; - this.bg = bg; - this.focusX = focusX; - this.focusY = focusY; - this.nofocus = nofocus; - this.auto = auto; - this.force = force; - this.deleted = deleted; - this.format = format; - } - - /** - * @return The optional version of the asset. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return The cache duration in seconds. - */ - @JsonProperty("cache") - public Optional getCache() { - return cache; - } - - /** - * @return Set it to 0 to prevent download. - */ - @JsonProperty("download") - public Optional getDownload() { - return download; - } - - /** - * @return The target width of the asset, if it is an image. - */ - @JsonProperty("width") - public Optional getWidth() { - return width; - } - - /** - * @return The target height of the asset, if it is an image. - */ - @JsonProperty("height") - public Optional getHeight() { - return height; - } - - /** - * @return Optional image quality, it is is an jpeg image. - */ - @JsonProperty("quality") - public Optional getQuality() { - return quality; - } - - /** - * @return The resize mode when the width and height is defined. - */ - @JsonProperty("mode") - public Optional getMode() { - return mode; - } - - /** - * @return Optional background color. - */ - @JsonProperty("bg") - public Optional getBg() { - return bg; - } - - /** - * @return Override the y focus point. - */ - @JsonProperty("focusX") - public Optional getFocusX() { - return focusX; - } - - /** - * @return Override the x focus point. - */ - @JsonProperty("focusY") - public Optional getFocusY() { - return focusY; - } - - /** - * @return True to ignore the asset focus point if any. - */ - @JsonProperty("nofocus") - public Optional getNofocus() { - return nofocus; - } - - /** - * @return True to use auto format. - */ - @JsonProperty("auto") - public Optional getAuto() { - return auto; - } - - /** - * @return True to force a new resize even if it already stored. - */ - @JsonProperty("force") - public Optional getForce() { - return force; - } - - /** - * @return Also return deleted content items. - */ - @JsonProperty("deleted") - public Optional getDeleted() { - return deleted; - } - - /** - * @return True to force a new resize even if it already stored. - */ - @JsonProperty("format") - public Optional getFormat() { - return format; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsGetAssetContentBySlugRequest - && equalTo((AssetsGetAssetContentBySlugRequest) other); - } - - private boolean equalTo(AssetsGetAssetContentBySlugRequest other) { - return version.equals(other.version) - && cache.equals(other.cache) - && download.equals(other.download) - && width.equals(other.width) - && height.equals(other.height) - && quality.equals(other.quality) - && mode.equals(other.mode) - && bg.equals(other.bg) - && focusX.equals(other.focusX) - && focusY.equals(other.focusY) - && nofocus.equals(other.nofocus) - && auto.equals(other.auto) - && force.equals(other.force) - && deleted.equals(other.deleted) - && format.equals(other.format); - } - - @Override - public int hashCode() { - return Objects.hash( - this.version, - this.cache, - this.download, - this.width, - this.height, - this.quality, - this.mode, - this.bg, - this.focusX, - this.focusY, - this.nofocus, - this.auto, - this.force, - this.deleted, - this.format); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional version = Optional.empty(); - - private Optional cache = Optional.empty(); - - private Optional download = Optional.empty(); - - private Optional width = Optional.empty(); - - private Optional height = Optional.empty(); - - private Optional quality = Optional.empty(); - - private Optional mode = Optional.empty(); - - private Optional bg = Optional.empty(); - - private Optional focusX = Optional.empty(); - - private Optional focusY = Optional.empty(); - - private Optional nofocus = Optional.empty(); - - private Optional auto = Optional.empty(); - - private Optional force = Optional.empty(); - - private Optional deleted = Optional.empty(); - - private Optional format = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsGetAssetContentBySlugRequest other) { - version(other.getVersion()); - cache(other.getCache()); - download(other.getDownload()); - width(other.getWidth()); - height(other.getHeight()); - quality(other.getQuality()); - mode(other.getMode()); - bg(other.getBg()); - focusX(other.getFocusX()); - focusY(other.getFocusY()); - nofocus(other.getNofocus()); - auto(other.getAuto()); - force(other.getForce()); - deleted(other.getDeleted()); - format(other.getFormat()); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - @JsonSetter(value = "cache", nulls = Nulls.SKIP) - public Builder cache(Optional cache) { - this.cache = cache; - return this; - } - - public Builder cache(Integer cache) { - this.cache = Optional.of(cache); - return this; - } - - @JsonSetter(value = "download", nulls = Nulls.SKIP) - public Builder download(Optional download) { - this.download = download; - return this; - } - - public Builder download(Integer download) { - this.download = Optional.of(download); - return this; - } - - @JsonSetter(value = "width", nulls = Nulls.SKIP) - public Builder width(Optional width) { - this.width = width; - return this; - } - - public Builder width(Integer width) { - this.width = Optional.of(width); - return this; - } - - @JsonSetter(value = "height", nulls = Nulls.SKIP) - public Builder height(Optional height) { - this.height = height; - return this; - } - - public Builder height(Integer height) { - this.height = Optional.of(height); - return this; - } - - @JsonSetter(value = "quality", nulls = Nulls.SKIP) - public Builder quality(Optional quality) { - this.quality = quality; - return this; - } - - public Builder quality(Integer quality) { - this.quality = Optional.of(quality); - return this; - } - - @JsonSetter(value = "mode", nulls = Nulls.SKIP) - public Builder mode(Optional mode) { - this.mode = mode; - return this; - } - - public Builder mode(ResizeMode mode) { - this.mode = Optional.of(mode); - return this; - } - - @JsonSetter(value = "bg", nulls = Nulls.SKIP) - public Builder bg(Optional bg) { - this.bg = bg; - return this; - } - - public Builder bg(String bg) { - this.bg = Optional.of(bg); - return this; - } - - @JsonSetter(value = "focusX", nulls = Nulls.SKIP) - public Builder focusX(Optional focusX) { - this.focusX = focusX; - return this; - } - - public Builder focusX(Double focusX) { - this.focusX = Optional.of(focusX); - return this; - } - - @JsonSetter(value = "focusY", nulls = Nulls.SKIP) - public Builder focusY(Optional focusY) { - this.focusY = focusY; - return this; - } - - public Builder focusY(Double focusY) { - this.focusY = Optional.of(focusY); - return this; - } - - @JsonSetter(value = "nofocus", nulls = Nulls.SKIP) - public Builder nofocus(Optional nofocus) { - this.nofocus = nofocus; - return this; - } - - public Builder nofocus(Boolean nofocus) { - this.nofocus = Optional.of(nofocus); - return this; - } - - @JsonSetter(value = "auto", nulls = Nulls.SKIP) - public Builder auto(Optional auto) { - this.auto = auto; - return this; - } - - public Builder auto(Boolean auto) { - this.auto = Optional.of(auto); - return this; - } - - @JsonSetter(value = "force", nulls = Nulls.SKIP) - public Builder force(Optional force) { - this.force = force; - return this; - } - - public Builder force(Boolean force) { - this.force = Optional.of(force); - return this; - } - - @JsonSetter(value = "deleted", nulls = Nulls.SKIP) - public Builder deleted(Optional deleted) { - this.deleted = deleted; - return this; - } - - public Builder deleted(Boolean deleted) { - this.deleted = Optional.of(deleted); - return this; - } - - @JsonSetter(value = "format", nulls = Nulls.SKIP) - public Builder format(Optional format) { - this.format = format; - return this; - } - - public Builder format(ImageFormat format) { - this.format = Optional.of(format); - return this; - } - - public AssetsGetAssetContentBySlugRequest build() { - return new AssetsGetAssetContentBySlugRequest( - version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, - deleted, format); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentRequest.java deleted file mode 100644 index c55a8e6..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentRequest.java +++ /dev/null @@ -1,481 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.ImageFormat; -import com.squidex.api.types.ResizeMode; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsGetAssetContentRequest.Builder.class) -public final class AssetsGetAssetContentRequest { - private final Optional version; - - private final Optional cache; - - private final Optional download; - - private final Optional width; - - private final Optional height; - - private final Optional quality; - - private final Optional mode; - - private final Optional bg; - - private final Optional focusX; - - private final Optional focusY; - - private final Optional nofocus; - - private final Optional auto; - - private final Optional force; - - private final Optional deleted; - - private final Optional format; - - private AssetsGetAssetContentRequest( - Optional version, - Optional cache, - Optional download, - Optional width, - Optional height, - Optional quality, - Optional mode, - Optional bg, - Optional focusX, - Optional focusY, - Optional nofocus, - Optional auto, - Optional force, - Optional deleted, - Optional format) { - this.version = version; - this.cache = cache; - this.download = download; - this.width = width; - this.height = height; - this.quality = quality; - this.mode = mode; - this.bg = bg; - this.focusX = focusX; - this.focusY = focusY; - this.nofocus = nofocus; - this.auto = auto; - this.force = force; - this.deleted = deleted; - this.format = format; - } - - /** - * @return The optional version of the asset. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return The cache duration in seconds. - */ - @JsonProperty("cache") - public Optional getCache() { - return cache; - } - - /** - * @return Set it to 0 to prevent download. - */ - @JsonProperty("download") - public Optional getDownload() { - return download; - } - - /** - * @return The target width of the asset, if it is an image. - */ - @JsonProperty("width") - public Optional getWidth() { - return width; - } - - /** - * @return The target height of the asset, if it is an image. - */ - @JsonProperty("height") - public Optional getHeight() { - return height; - } - - /** - * @return Optional image quality, it is is an jpeg image. - */ - @JsonProperty("quality") - public Optional getQuality() { - return quality; - } - - /** - * @return The resize mode when the width and height is defined. - */ - @JsonProperty("mode") - public Optional getMode() { - return mode; - } - - /** - * @return Optional background color. - */ - @JsonProperty("bg") - public Optional getBg() { - return bg; - } - - /** - * @return Override the y focus point. - */ - @JsonProperty("focusX") - public Optional getFocusX() { - return focusX; - } - - /** - * @return Override the x focus point. - */ - @JsonProperty("focusY") - public Optional getFocusY() { - return focusY; - } - - /** - * @return True to ignore the asset focus point if any. - */ - @JsonProperty("nofocus") - public Optional getNofocus() { - return nofocus; - } - - /** - * @return True to use auto format. - */ - @JsonProperty("auto") - public Optional getAuto() { - return auto; - } - - /** - * @return True to force a new resize even if it already stored. - */ - @JsonProperty("force") - public Optional getForce() { - return force; - } - - /** - * @return Also return deleted content items. - */ - @JsonProperty("deleted") - public Optional getDeleted() { - return deleted; - } - - /** - * @return True to force a new resize even if it already stored. - */ - @JsonProperty("format") - public Optional getFormat() { - return format; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsGetAssetContentRequest && equalTo((AssetsGetAssetContentRequest) other); - } - - private boolean equalTo(AssetsGetAssetContentRequest other) { - return version.equals(other.version) - && cache.equals(other.cache) - && download.equals(other.download) - && width.equals(other.width) - && height.equals(other.height) - && quality.equals(other.quality) - && mode.equals(other.mode) - && bg.equals(other.bg) - && focusX.equals(other.focusX) - && focusY.equals(other.focusY) - && nofocus.equals(other.nofocus) - && auto.equals(other.auto) - && force.equals(other.force) - && deleted.equals(other.deleted) - && format.equals(other.format); - } - - @Override - public int hashCode() { - return Objects.hash( - this.version, - this.cache, - this.download, - this.width, - this.height, - this.quality, - this.mode, - this.bg, - this.focusX, - this.focusY, - this.nofocus, - this.auto, - this.force, - this.deleted, - this.format); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional version = Optional.empty(); - - private Optional cache = Optional.empty(); - - private Optional download = Optional.empty(); - - private Optional width = Optional.empty(); - - private Optional height = Optional.empty(); - - private Optional quality = Optional.empty(); - - private Optional mode = Optional.empty(); - - private Optional bg = Optional.empty(); - - private Optional focusX = Optional.empty(); - - private Optional focusY = Optional.empty(); - - private Optional nofocus = Optional.empty(); - - private Optional auto = Optional.empty(); - - private Optional force = Optional.empty(); - - private Optional deleted = Optional.empty(); - - private Optional format = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsGetAssetContentRequest other) { - version(other.getVersion()); - cache(other.getCache()); - download(other.getDownload()); - width(other.getWidth()); - height(other.getHeight()); - quality(other.getQuality()); - mode(other.getMode()); - bg(other.getBg()); - focusX(other.getFocusX()); - focusY(other.getFocusY()); - nofocus(other.getNofocus()); - auto(other.getAuto()); - force(other.getForce()); - deleted(other.getDeleted()); - format(other.getFormat()); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - @JsonSetter(value = "cache", nulls = Nulls.SKIP) - public Builder cache(Optional cache) { - this.cache = cache; - return this; - } - - public Builder cache(Integer cache) { - this.cache = Optional.of(cache); - return this; - } - - @JsonSetter(value = "download", nulls = Nulls.SKIP) - public Builder download(Optional download) { - this.download = download; - return this; - } - - public Builder download(Integer download) { - this.download = Optional.of(download); - return this; - } - - @JsonSetter(value = "width", nulls = Nulls.SKIP) - public Builder width(Optional width) { - this.width = width; - return this; - } - - public Builder width(Integer width) { - this.width = Optional.of(width); - return this; - } - - @JsonSetter(value = "height", nulls = Nulls.SKIP) - public Builder height(Optional height) { - this.height = height; - return this; - } - - public Builder height(Integer height) { - this.height = Optional.of(height); - return this; - } - - @JsonSetter(value = "quality", nulls = Nulls.SKIP) - public Builder quality(Optional quality) { - this.quality = quality; - return this; - } - - public Builder quality(Integer quality) { - this.quality = Optional.of(quality); - return this; - } - - @JsonSetter(value = "mode", nulls = Nulls.SKIP) - public Builder mode(Optional mode) { - this.mode = mode; - return this; - } - - public Builder mode(ResizeMode mode) { - this.mode = Optional.of(mode); - return this; - } - - @JsonSetter(value = "bg", nulls = Nulls.SKIP) - public Builder bg(Optional bg) { - this.bg = bg; - return this; - } - - public Builder bg(String bg) { - this.bg = Optional.of(bg); - return this; - } - - @JsonSetter(value = "focusX", nulls = Nulls.SKIP) - public Builder focusX(Optional focusX) { - this.focusX = focusX; - return this; - } - - public Builder focusX(Double focusX) { - this.focusX = Optional.of(focusX); - return this; - } - - @JsonSetter(value = "focusY", nulls = Nulls.SKIP) - public Builder focusY(Optional focusY) { - this.focusY = focusY; - return this; - } - - public Builder focusY(Double focusY) { - this.focusY = Optional.of(focusY); - return this; - } - - @JsonSetter(value = "nofocus", nulls = Nulls.SKIP) - public Builder nofocus(Optional nofocus) { - this.nofocus = nofocus; - return this; - } - - public Builder nofocus(Boolean nofocus) { - this.nofocus = Optional.of(nofocus); - return this; - } - - @JsonSetter(value = "auto", nulls = Nulls.SKIP) - public Builder auto(Optional auto) { - this.auto = auto; - return this; - } - - public Builder auto(Boolean auto) { - this.auto = Optional.of(auto); - return this; - } - - @JsonSetter(value = "force", nulls = Nulls.SKIP) - public Builder force(Optional force) { - this.force = force; - return this; - } - - public Builder force(Boolean force) { - this.force = Optional.of(force); - return this; - } - - @JsonSetter(value = "deleted", nulls = Nulls.SKIP) - public Builder deleted(Optional deleted) { - this.deleted = deleted; - return this; - } - - public Builder deleted(Boolean deleted) { - this.deleted = Optional.of(deleted); - return this; - } - - @JsonSetter(value = "format", nulls = Nulls.SKIP) - public Builder format(Optional format) { - this.format = format; - return this; - } - - public Builder format(ImageFormat format) { - this.format = Optional.of(format); - return this; - } - - public AssetsGetAssetContentRequest build() { - return new AssetsGetAssetContentRequest( - version, cache, download, width, height, quality, mode, bg, focusX, focusY, nofocus, auto, force, - deleted, format); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetFoldersRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetFoldersRequest.java deleted file mode 100644 index cd11932..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetFoldersRequest.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.AssetFolderScope; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsGetAssetFoldersRequest.Builder.class) -public final class AssetsGetAssetFoldersRequest { - private final Optional parentId; - - private final Optional scope; - - private AssetsGetAssetFoldersRequest(Optional parentId, Optional scope) { - this.parentId = parentId; - this.scope = scope; - } - - /** - * @return The optional parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - /** - * @return The scope of the query. - */ - @JsonProperty("scope") - public Optional getScope() { - return scope; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsGetAssetFoldersRequest && equalTo((AssetsGetAssetFoldersRequest) other); - } - - private boolean equalTo(AssetsGetAssetFoldersRequest other) { - return parentId.equals(other.parentId) && scope.equals(other.scope); - } - - @Override - public int hashCode() { - return Objects.hash(this.parentId, this.scope); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional parentId = Optional.empty(); - - private Optional scope = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsGetAssetFoldersRequest other) { - parentId(other.getParentId()); - scope(other.getScope()); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @JsonSetter(value = "scope", nulls = Nulls.SKIP) - public Builder scope(Optional scope) { - this.scope = scope; - return this; - } - - public Builder scope(AssetFolderScope scope) { - this.scope = Optional.of(scope); - return this; - } - - public AssetsGetAssetFoldersRequest build() { - return new AssetsGetAssetFoldersRequest(parentId, scope); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsPostRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsPostRequest.java deleted file mode 100644 index 6145b44..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsPostRequest.java +++ /dev/null @@ -1,159 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.QueryDto; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsGetAssetsPostRequest.Builder.class) -public final class AssetsGetAssetsPostRequest { - private final Optional noTotal; - - private final Optional noSlowTotal; - - private final QueryDto body; - - private AssetsGetAssetsPostRequest(Optional noTotal, Optional noSlowTotal, QueryDto body) { - this.noTotal = noTotal; - this.noSlowTotal = noSlowTotal; - this.body = body; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - @JsonProperty("body") - public QueryDto getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsGetAssetsPostRequest && equalTo((AssetsGetAssetsPostRequest) other); - } - - private boolean equalTo(AssetsGetAssetsPostRequest other) { - return noTotal.equals(other.noTotal) && noSlowTotal.equals(other.noSlowTotal) && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.noTotal, this.noSlowTotal, this.body); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static BodyStage builder() { - return new Builder(); - } - - public interface BodyStage { - _FinalStage body(QueryDto body); - - Builder from(AssetsGetAssetsPostRequest other); - } - - public interface _FinalStage { - AssetsGetAssetsPostRequest build(); - - _FinalStage noTotal(Optional noTotal); - - _FinalStage noTotal(Boolean noTotal); - - _FinalStage noSlowTotal(Optional noSlowTotal); - - _FinalStage noSlowTotal(Boolean noSlowTotal); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements BodyStage, _FinalStage { - private QueryDto body; - - private Optional noSlowTotal = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(AssetsGetAssetsPostRequest other) { - noTotal(other.getNoTotal()); - noSlowTotal(other.getNoSlowTotal()); - body(other.getBody()); - return this; - } - - @Override - @JsonSetter("body") - public _FinalStage body(QueryDto body) { - this.body = body; - return this; - } - - /** - *

Do not return the total amount, if it would be slow.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @Override - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public _FinalStage noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - /** - *

Do not return the total amount.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @Override - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public _FinalStage noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - @Override - public AssetsGetAssetsPostRequest build() { - return new AssetsGetAssetsPostRequest(noTotal, noSlowTotal, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsRequest.java deleted file mode 100644 index 1127df3..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsRequest.java +++ /dev/null @@ -1,309 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsGetAssetsRequest.Builder.class) -public final class AssetsGetAssetsRequest { - private final Optional noTotal; - - private final Optional noSlowTotal; - - private final Optional parentId; - - private final Optional ids; - - private final Optional q; - - private final Optional top; - - private final Optional skip; - - private final Optional orderby; - - private final Optional filter; - - private AssetsGetAssetsRequest( - Optional noTotal, - Optional noSlowTotal, - Optional parentId, - Optional ids, - Optional q, - Optional top, - Optional skip, - Optional orderby, - Optional filter) { - this.noTotal = noTotal; - this.noSlowTotal = noSlowTotal; - this.parentId = parentId; - this.ids = ids; - this.q = q; - this.top = top; - this.skip = skip; - this.orderby = orderby; - this.filter = filter; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return The optional parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - /** - * @return The optional asset ids. - */ - @JsonProperty("ids") - public Optional getIds() { - return ids; - } - - /** - * @return The optional json query. - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - /** - * @return Optional number of items to take. - */ - @JsonProperty("$top") - public Optional getTop() { - return top; - } - - /** - * @return Optional number of items to skip. - */ - @JsonProperty("$skip") - public Optional getSkip() { - return skip; - } - - /** - * @return Optional OData order definition. - */ - @JsonProperty("$orderby") - public Optional getOrderby() { - return orderby; - } - - /** - * @return Optional OData filter. - */ - @JsonProperty("$filter") - public Optional getFilter() { - return filter; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsGetAssetsRequest && equalTo((AssetsGetAssetsRequest) other); - } - - private boolean equalTo(AssetsGetAssetsRequest other) { - return noTotal.equals(other.noTotal) - && noSlowTotal.equals(other.noSlowTotal) - && parentId.equals(other.parentId) - && ids.equals(other.ids) - && q.equals(other.q) - && top.equals(other.top) - && skip.equals(other.skip) - && orderby.equals(other.orderby) - && filter.equals(other.filter); - } - - @Override - public int hashCode() { - return Objects.hash( - this.noTotal, - this.noSlowTotal, - this.parentId, - this.ids, - this.q, - this.top, - this.skip, - this.orderby, - this.filter); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional noTotal = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional parentId = Optional.empty(); - - private Optional ids = Optional.empty(); - - private Optional q = Optional.empty(); - - private Optional top = Optional.empty(); - - private Optional skip = Optional.empty(); - - private Optional orderby = Optional.empty(); - - private Optional filter = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsGetAssetsRequest other) { - noTotal(other.getNoTotal()); - noSlowTotal(other.getNoSlowTotal()); - parentId(other.getParentId()); - ids(other.getIds()); - q(other.getQ()); - top(other.getTop()); - skip(other.getSkip()); - orderby(other.getOrderby()); - filter(other.getFilter()); - return this; - } - - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public Builder noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - public Builder noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public Builder noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - public Builder noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional ids) { - this.ids = ids; - return this; - } - - public Builder ids(String ids) { - this.ids = Optional.of(ids); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(String q) { - this.q = Optional.of(q); - return this; - } - - @JsonSetter(value = "$top", nulls = Nulls.SKIP) - public Builder top(Optional top) { - this.top = top; - return this; - } - - public Builder top(Double top) { - this.top = Optional.of(top); - return this; - } - - @JsonSetter(value = "$skip", nulls = Nulls.SKIP) - public Builder skip(Optional skip) { - this.skip = skip; - return this; - } - - public Builder skip(Double skip) { - this.skip = Optional.of(skip); - return this; - } - - @JsonSetter(value = "$orderby", nulls = Nulls.SKIP) - public Builder orderby(Optional orderby) { - this.orderby = orderby; - return this; - } - - public Builder orderby(String orderby) { - this.orderby = Optional.of(orderby); - return this; - } - - @JsonSetter(value = "$filter", nulls = Nulls.SKIP) - public Builder filter(Optional filter) { - this.filter = filter; - return this; - } - - public Builder filter(String filter) { - this.filter = Optional.of(filter); - return this; - } - - public AssetsGetAssetsRequest build() { - return new AssetsGetAssetsRequest(noTotal, noSlowTotal, parentId, ids, q, top, skip, orderby, filter); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostAssetRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostAssetRequest.java deleted file mode 100644 index d4e89b8..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostAssetRequest.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsPostAssetRequest.Builder.class) -public final class AssetsPostAssetRequest { - private final Optional parentId; - - private final Optional id; - - private final Optional duplicate; - - private AssetsPostAssetRequest(Optional parentId, Optional id, Optional duplicate) { - this.parentId = parentId; - this.id = id; - this.duplicate = duplicate; - } - - /** - * @return The optional parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - /** - * @return The optional custom asset id. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - /** - * @return True to duplicate the asset, event if the file has been uploaded. - */ - @JsonProperty("duplicate") - public Optional getDuplicate() { - return duplicate; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsPostAssetRequest && equalTo((AssetsPostAssetRequest) other); - } - - private boolean equalTo(AssetsPostAssetRequest other) { - return parentId.equals(other.parentId) && id.equals(other.id) && duplicate.equals(other.duplicate); - } - - @Override - public int hashCode() { - return Objects.hash(this.parentId, this.id, this.duplicate); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional parentId = Optional.empty(); - - private Optional id = Optional.empty(); - - private Optional duplicate = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsPostAssetRequest other) { - parentId(other.getParentId()); - id(other.getId()); - duplicate(other.getDuplicate()); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.of(id); - return this; - } - - @JsonSetter(value = "duplicate", nulls = Nulls.SKIP) - public Builder duplicate(Optional duplicate) { - this.duplicate = duplicate; - return this; - } - - public Builder duplicate(Boolean duplicate) { - this.duplicate = Optional.of(duplicate); - return this; - } - - public AssetsPostAssetRequest build() { - return new AssetsPostAssetRequest(parentId, id, duplicate); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostUpsertAssetRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostUpsertAssetRequest.java deleted file mode 100644 index 42f9e22..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostUpsertAssetRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsPostUpsertAssetRequest.Builder.class) -public final class AssetsPostUpsertAssetRequest { - private final Optional parentId; - - private final Optional duplicate; - - private AssetsPostUpsertAssetRequest(Optional parentId, Optional duplicate) { - this.parentId = parentId; - this.duplicate = duplicate; - } - - /** - * @return The optional parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - /** - * @return True to duplicate the asset, event if the file has been uploaded. - */ - @JsonProperty("duplicate") - public Optional getDuplicate() { - return duplicate; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsPostUpsertAssetRequest && equalTo((AssetsPostUpsertAssetRequest) other); - } - - private boolean equalTo(AssetsPostUpsertAssetRequest other) { - return parentId.equals(other.parentId) && duplicate.equals(other.duplicate); - } - - @Override - public int hashCode() { - return Objects.hash(this.parentId, this.duplicate); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional parentId = Optional.empty(); - - private Optional duplicate = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsPostUpsertAssetRequest other) { - parentId(other.getParentId()); - duplicate(other.getDuplicate()); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @JsonSetter(value = "duplicate", nulls = Nulls.SKIP) - public Builder duplicate(Optional duplicate) { - this.duplicate = duplicate; - return this; - } - - public Builder duplicate(Boolean duplicate) { - this.duplicate = Optional.of(duplicate); - return this; - } - - public AssetsPostUpsertAssetRequest build() { - return new AssetsPostUpsertAssetRequest(parentId, duplicate); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPutAssetContentRequest.java b/src/main/java/com/squidex/api/resources/assets/requests/AssetsPutAssetContentRequest.java deleted file mode 100644 index d31974f..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/AssetsPutAssetContentRequest.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.squidex.api.core.ObjectMappers; - -public final class AssetsPutAssetContentRequest { - private AssetsPutAssetContentRequest() {} - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsPutAssetContentRequest; - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/BulkUpdateAssetsDto.java b/src/main/java/com/squidex/api/resources/assets/requests/BulkUpdateAssetsDto.java deleted file mode 100644 index 5f12bd8..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/BulkUpdateAssetsDto.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.BulkUpdateAssetsJobDto; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BulkUpdateAssetsDto.Builder.class) -public final class BulkUpdateAssetsDto { - private final Optional> jobs; - - private final Optional checkReferrers; - - private final Optional optimizeValidation; - - private final Optional doNotScript; - - private BulkUpdateAssetsDto( - Optional> jobs, - Optional checkReferrers, - Optional optimizeValidation, - Optional doNotScript) { - this.jobs = jobs; - this.checkReferrers = checkReferrers; - this.optimizeValidation = optimizeValidation; - this.doNotScript = doNotScript; - } - - /** - * @return The contents to update or insert. - */ - @JsonProperty("jobs") - public Optional> getJobs() { - return jobs; - } - - /** - * @return True to check referrers of deleted assets. - */ - @JsonProperty("checkReferrers") - public Optional getCheckReferrers() { - return checkReferrers; - } - - /** - * @return True to turn off costly validation: Folder checks. Default: true. - */ - @JsonProperty("optimizeValidation") - public Optional getOptimizeValidation() { - return optimizeValidation; - } - - /** - * @return True to turn off scripting for faster inserts. Default: true. - */ - @JsonProperty("doNotScript") - public Optional getDoNotScript() { - return doNotScript; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BulkUpdateAssetsDto && equalTo((BulkUpdateAssetsDto) other); - } - - private boolean equalTo(BulkUpdateAssetsDto other) { - return jobs.equals(other.jobs) - && checkReferrers.equals(other.checkReferrers) - && optimizeValidation.equals(other.optimizeValidation) - && doNotScript.equals(other.doNotScript); - } - - @Override - public int hashCode() { - return Objects.hash(this.jobs, this.checkReferrers, this.optimizeValidation, this.doNotScript); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> jobs = Optional.empty(); - - private Optional checkReferrers = Optional.empty(); - - private Optional optimizeValidation = Optional.empty(); - - private Optional doNotScript = Optional.empty(); - - private Builder() {} - - public Builder from(BulkUpdateAssetsDto other) { - jobs(other.getJobs()); - checkReferrers(other.getCheckReferrers()); - optimizeValidation(other.getOptimizeValidation()); - doNotScript(other.getDoNotScript()); - return this; - } - - @JsonSetter(value = "jobs", nulls = Nulls.SKIP) - public Builder jobs(Optional> jobs) { - this.jobs = jobs; - return this; - } - - public Builder jobs(List jobs) { - this.jobs = Optional.of(jobs); - return this; - } - - @JsonSetter(value = "checkReferrers", nulls = Nulls.SKIP) - public Builder checkReferrers(Optional checkReferrers) { - this.checkReferrers = checkReferrers; - return this; - } - - public Builder checkReferrers(Boolean checkReferrers) { - this.checkReferrers = Optional.of(checkReferrers); - return this; - } - - @JsonSetter(value = "optimizeValidation", nulls = Nulls.SKIP) - public Builder optimizeValidation(Optional optimizeValidation) { - this.optimizeValidation = optimizeValidation; - return this; - } - - public Builder optimizeValidation(Boolean optimizeValidation) { - this.optimizeValidation = Optional.of(optimizeValidation); - return this; - } - - @JsonSetter(value = "doNotScript", nulls = Nulls.SKIP) - public Builder doNotScript(Optional doNotScript) { - this.doNotScript = doNotScript; - return this; - } - - public Builder doNotScript(Boolean doNotScript) { - this.doNotScript = Optional.of(doNotScript); - return this; - } - - public BulkUpdateAssetsDto build() { - return new BulkUpdateAssetsDto(jobs, checkReferrers, optimizeValidation, doNotScript); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/CreateAssetFolderDto.java b/src/main/java/com/squidex/api/resources/assets/requests/CreateAssetFolderDto.java deleted file mode 100644 index 85a9f06..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/CreateAssetFolderDto.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateAssetFolderDto.Builder.class) -public final class CreateAssetFolderDto { - private final String folderName; - - private final Optional parentId; - - private CreateAssetFolderDto(String folderName, Optional parentId) { - this.folderName = folderName; - this.parentId = parentId; - } - - /** - * @return The name of the folder. - */ - @JsonProperty("folderName") - public String getFolderName() { - return folderName; - } - - /** - * @return The ID of the parent folder. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateAssetFolderDto && equalTo((CreateAssetFolderDto) other); - } - - private boolean equalTo(CreateAssetFolderDto other) { - return folderName.equals(other.folderName) && parentId.equals(other.parentId); - } - - @Override - public int hashCode() { - return Objects.hash(this.folderName, this.parentId); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static FolderNameStage builder() { - return new Builder(); - } - - public interface FolderNameStage { - _FinalStage folderName(String folderName); - - Builder from(CreateAssetFolderDto other); - } - - public interface _FinalStage { - CreateAssetFolderDto build(); - - _FinalStage parentId(Optional parentId); - - _FinalStage parentId(String parentId); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements FolderNameStage, _FinalStage { - private String folderName; - - private Optional parentId = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CreateAssetFolderDto other) { - folderName(other.getFolderName()); - parentId(other.getParentId()); - return this; - } - - /** - *

The name of the folder.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("folderName") - public _FinalStage folderName(String folderName) { - this.folderName = folderName; - return this; - } - - /** - *

The ID of the parent folder.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @Override - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public _FinalStage parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - @Override - public CreateAssetFolderDto build() { - return new CreateAssetFolderDto(folderName, parentId); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetDto.java b/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetDto.java deleted file mode 100644 index a90f8d6..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetDto.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = MoveAssetDto.Builder.class) -public final class MoveAssetDto { - private final Optional parentId; - - private MoveAssetDto(Optional parentId) { - this.parentId = parentId; - } - - /** - * @return The parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MoveAssetDto && equalTo((MoveAssetDto) other); - } - - private boolean equalTo(MoveAssetDto other) { - return parentId.equals(other.parentId); - } - - @Override - public int hashCode() { - return Objects.hash(this.parentId); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional parentId = Optional.empty(); - - private Builder() {} - - public Builder from(MoveAssetDto other) { - parentId(other.getParentId()); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - public MoveAssetDto build() { - return new MoveAssetDto(parentId); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetFolderDto.java b/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetFolderDto.java deleted file mode 100644 index a06a82e..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetFolderDto.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = MoveAssetFolderDto.Builder.class) -public final class MoveAssetFolderDto { - private final Optional parentId; - - private MoveAssetFolderDto(Optional parentId) { - this.parentId = parentId; - } - - /** - * @return The parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MoveAssetFolderDto && equalTo((MoveAssetFolderDto) other); - } - - private boolean equalTo(MoveAssetFolderDto other) { - return parentId.equals(other.parentId); - } - - @Override - public int hashCode() { - return Objects.hash(this.parentId); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional parentId = Optional.empty(); - - private Builder() {} - - public Builder from(MoveAssetFolderDto other) { - parentId(other.getParentId()); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - public MoveAssetFolderDto build() { - return new MoveAssetFolderDto(parentId); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/RenameAssetFolderDto.java b/src/main/java/com/squidex/api/resources/assets/requests/RenameAssetFolderDto.java deleted file mode 100644 index 7913f16..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/RenameAssetFolderDto.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RenameAssetFolderDto.Builder.class) -public final class RenameAssetFolderDto { - private final String folderName; - - private RenameAssetFolderDto(String folderName) { - this.folderName = folderName; - } - - /** - * @return The name of the folder. - */ - @JsonProperty("folderName") - public String getFolderName() { - return folderName; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RenameAssetFolderDto && equalTo((RenameAssetFolderDto) other); - } - - private boolean equalTo(RenameAssetFolderDto other) { - return folderName.equals(other.folderName); - } - - @Override - public int hashCode() { - return Objects.hash(this.folderName); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static FolderNameStage builder() { - return new Builder(); - } - - public interface FolderNameStage { - _FinalStage folderName(String folderName); - - Builder from(RenameAssetFolderDto other); - } - - public interface _FinalStage { - RenameAssetFolderDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements FolderNameStage, _FinalStage { - private String folderName; - - private Builder() {} - - @Override - public Builder from(RenameAssetFolderDto other) { - folderName(other.getFolderName()); - return this; - } - - /** - *

The name of the folder.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("folderName") - public _FinalStage folderName(String folderName) { - this.folderName = folderName; - return this; - } - - @Override - public RenameAssetFolderDto build() { - return new RenameAssetFolderDto(folderName); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/assets/requests/RenameTagDto.java b/src/main/java/com/squidex/api/resources/assets/requests/RenameTagDto.java deleted file mode 100644 index e650a00..0000000 --- a/src/main/java/com/squidex/api/resources/assets/requests/RenameTagDto.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.assets.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RenameTagDto.Builder.class) -public final class RenameTagDto { - private final String tagName; - - private RenameTagDto(String tagName) { - this.tagName = tagName; - } - - /** - * @return The new name for the tag. - */ - @JsonProperty("tagName") - public String getTagName() { - return tagName; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RenameTagDto && equalTo((RenameTagDto) other); - } - - private boolean equalTo(RenameTagDto other) { - return tagName.equals(other.tagName); - } - - @Override - public int hashCode() { - return Objects.hash(this.tagName); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TagNameStage builder() { - return new Builder(); - } - - public interface TagNameStage { - _FinalStage tagName(String tagName); - - Builder from(RenameTagDto other); - } - - public interface _FinalStage { - RenameTagDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TagNameStage, _FinalStage { - private String tagName; - - private Builder() {} - - @Override - public Builder from(RenameTagDto other) { - tagName(other.getTagName()); - return this; - } - - /** - *

The new name for the tag.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("tagName") - public _FinalStage tagName(String tagName) { - this.tagName = tagName; - return this; - } - - @Override - public RenameTagDto build() { - return new RenameTagDto(tagName); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/backups/BackupsClient.java b/src/main/java/com/squidex/api/resources/backups/BackupsClient.java deleted file mode 100644 index aa08e29..0000000 --- a/src/main/java/com/squidex/api/resources/backups/BackupsClient.java +++ /dev/null @@ -1,258 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.backups; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.backups.requests.BackupsGetBackupContentV2Request; -import com.squidex.api.resources.backups.requests.RestoreRequestDto; -import com.squidex.api.types.BackupJobsDto; -import com.squidex.api.types.RestoreJobDto; -import java.io.IOException; -import java.io.InputStream; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class BackupsClient { - protected final ClientOptions clientOptions; - - public BackupsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public InputStream getBackupContent(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("backups") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return response.body().byteStream(); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getBackupContent(String id) { - return getBackupContent(id, null); - } - - public void deleteBackup(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("backups") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteBackup(String id) { - deleteBackup(id, null); - } - - public InputStream getBackupContentV2(String id) { - return getBackupContentV2(id, BackupsGetBackupContentV2Request.builder().build()); - } - - public InputStream getBackupContentV2( - String id, BackupsGetBackupContentV2Request request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps/backups") - .addPathSegment(id); - if (request.getAppId().isPresent()) { - httpUrl.addQueryParameter("appId", request.getAppId().get()); - } - if (request.getApp().isPresent()) { - httpUrl.addQueryParameter("app", request.getApp().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return response.body().byteStream(); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getBackupContentV2(String id, BackupsGetBackupContentV2Request request) { - return getBackupContentV2(id, request, null); - } - - public BackupJobsDto getBackups(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("backups") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), BackupJobsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public BackupJobsDto getBackups() { - return getBackups(null); - } - - public void postBackup(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("backups") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", RequestBody.create("", null)) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void postBackup() { - postBackup(null); - } - - public RestoreJobDto getRestoreJob(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps/restore") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RestoreJobDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RestoreJobDto getRestoreJob() { - return getRestoreJob(null); - } - - public void postRestoreJob(RestoreRequestDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps/restore") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void postRestoreJob(RestoreRequestDto request) { - postRestoreJob(request, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/backups/requests/BackupsGetBackupContentV2Request.java b/src/main/java/com/squidex/api/resources/backups/requests/BackupsGetBackupContentV2Request.java deleted file mode 100644 index f76ddf3..0000000 --- a/src/main/java/com/squidex/api/resources/backups/requests/BackupsGetBackupContentV2Request.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.backups.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BackupsGetBackupContentV2Request.Builder.class) -public final class BackupsGetBackupContentV2Request { - private final Optional appId; - - private final Optional app; - - private BackupsGetBackupContentV2Request(Optional appId, Optional app) { - this.appId = appId; - this.app = app; - } - - /** - * @return The ID of the app. - */ - @JsonProperty("appId") - public Optional getAppId() { - return appId; - } - - /** - * @return The name of the app. - */ - @JsonProperty("app") - public Optional getApp() { - return app; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BackupsGetBackupContentV2Request && equalTo((BackupsGetBackupContentV2Request) other); - } - - private boolean equalTo(BackupsGetBackupContentV2Request other) { - return appId.equals(other.appId) && app.equals(other.app); - } - - @Override - public int hashCode() { - return Objects.hash(this.appId, this.app); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional appId = Optional.empty(); - - private Optional app = Optional.empty(); - - private Builder() {} - - public Builder from(BackupsGetBackupContentV2Request other) { - appId(other.getAppId()); - app(other.getApp()); - return this; - } - - @JsonSetter(value = "appId", nulls = Nulls.SKIP) - public Builder appId(Optional appId) { - this.appId = appId; - return this; - } - - public Builder appId(String appId) { - this.appId = Optional.of(appId); - return this; - } - - @JsonSetter(value = "app", nulls = Nulls.SKIP) - public Builder app(Optional app) { - this.app = app; - return this; - } - - public Builder app(String app) { - this.app = Optional.of(app); - return this; - } - - public BackupsGetBackupContentV2Request build() { - return new BackupsGetBackupContentV2Request(appId, app); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/backups/requests/RestoreRequestDto.java b/src/main/java/com/squidex/api/resources/backups/requests/RestoreRequestDto.java deleted file mode 100644 index 1940a51..0000000 --- a/src/main/java/com/squidex/api/resources/backups/requests/RestoreRequestDto.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.backups.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RestoreRequestDto.Builder.class) -public final class RestoreRequestDto { - private final Optional name; - - private final String url; - - private RestoreRequestDto(Optional name, String url) { - this.name = name; - this.url = url; - } - - /** - * @return The name of the app. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The url to the restore file. - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RestoreRequestDto && equalTo((RestoreRequestDto) other); - } - - private boolean equalTo(RestoreRequestDto other) { - return name.equals(other.name) && url.equals(other.url); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.url); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static UrlStage builder() { - return new Builder(); - } - - public interface UrlStage { - _FinalStage url(String url); - - Builder from(RestoreRequestDto other); - } - - public interface _FinalStage { - RestoreRequestDto build(); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UrlStage, _FinalStage { - private String url; - - private Optional name = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(RestoreRequestDto other) { - name(other.getName()); - url(other.getUrl()); - return this; - } - - /** - *

The url to the restore file.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public _FinalStage url(String url) { - this.url = url; - return this; - } - - /** - *

The name of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage name(String name) { - this.name = Optional.of(name); - return this; - } - - @Override - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @Override - public RestoreRequestDto build() { - return new RestoreRequestDto(name, url); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/comments/CommentsClient.java b/src/main/java/com/squidex/api/resources/comments/CommentsClient.java deleted file mode 100644 index 69242b4..0000000 --- a/src/main/java/com/squidex/api/resources/comments/CommentsClient.java +++ /dev/null @@ -1,223 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.comments; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.comments.requests.CommentsGetCommentsRequest; -import com.squidex.api.types.CommentDto; -import com.squidex.api.types.CommentsDto; -import com.squidex.api.types.UpsertCommentDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class CommentsClient { - protected final ClientOptions clientOptions; - - public CommentsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public List getWatchingUsers(String resource, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("watching") - .addPathSegment(resource) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getWatchingUsers(String resource) { - return getWatchingUsers(resource, null); - } - - /** - * When passing in a version you can retrieve all updates since then. - */ - public CommentsDto getComments(String commentsId) { - return getComments(commentsId, CommentsGetCommentsRequest.builder().build()); - } - - /** - * When passing in a version you can retrieve all updates since then. - */ - public CommentsDto getComments( - String commentsId, CommentsGetCommentsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("comments") - .addPathSegment(commentsId); - if (request.getVersion().isPresent()) { - httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), CommentsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * When passing in a version you can retrieve all updates since then. - */ - public CommentsDto getComments(String commentsId, CommentsGetCommentsRequest request) { - return getComments(commentsId, request, null); - } - - public CommentDto postComment(String commentsId, UpsertCommentDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("comments") - .addPathSegment(commentsId) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), CommentDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CommentDto postComment(String commentsId, UpsertCommentDto request) { - return postComment(commentsId, request, null); - } - - public void putComment( - String commentsId, String commentId, UpsertCommentDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("comments") - .addPathSegment(commentsId) - .addPathSegment(commentId) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void putComment(String commentsId, String commentId, UpsertCommentDto request) { - putComment(commentsId, commentId, request, null); - } - - public void deleteComment(String commentsId, String commentId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("comments") - .addPathSegment(commentsId) - .addPathSegment(commentId) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteComment(String commentsId, String commentId) { - deleteComment(commentsId, commentId, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/comments/requests/CommentsGetCommentsRequest.java b/src/main/java/com/squidex/api/resources/comments/requests/CommentsGetCommentsRequest.java deleted file mode 100644 index 0d21f92..0000000 --- a/src/main/java/com/squidex/api/resources/comments/requests/CommentsGetCommentsRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.comments.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CommentsGetCommentsRequest.Builder.class) -public final class CommentsGetCommentsRequest { - private final Optional version; - - private CommentsGetCommentsRequest(Optional version) { - this.version = version; - } - - /** - * @return The current version. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentsGetCommentsRequest && equalTo((CommentsGetCommentsRequest) other); - } - - private boolean equalTo(CommentsGetCommentsRequest other) { - return version.equals(other.version); - } - - @Override - public int hashCode() { - return Objects.hash(this.version); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional version = Optional.empty(); - - private Builder() {} - - public Builder from(CommentsGetCommentsRequest other) { - version(other.getVersion()); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - public CommentsGetCommentsRequest build() { - return new CommentsGetCommentsRequest(version); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/ContentsClient.java b/src/main/java/com/squidex/api/resources/contents/ContentsClient.java deleted file mode 100644 index b7a5027..0000000 --- a/src/main/java/com/squidex/api/resources/contents/ContentsClient.java +++ /dev/null @@ -1,1539 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.contents.requests.AllContentsByPostDto; -import com.squidex.api.resources.contents.requests.ChangeStatusDto; -import com.squidex.api.resources.contents.requests.ContentsBulkUpdateAllContentsRequest; -import com.squidex.api.resources.contents.requests.ContentsCreateDraftRequest; -import com.squidex.api.resources.contents.requests.ContentsDeleteContentRequest; -import com.squidex.api.resources.contents.requests.ContentsDeleteContentStatusRequest; -import com.squidex.api.resources.contents.requests.ContentsDeleteVersionRequest; -import com.squidex.api.resources.contents.requests.ContentsGetAllContentsRequest; -import com.squidex.api.resources.contents.requests.ContentsGetContentRequest; -import com.squidex.api.resources.contents.requests.ContentsGetContentVersionRequest; -import com.squidex.api.resources.contents.requests.ContentsGetContentsPostRequest; -import com.squidex.api.resources.contents.requests.ContentsGetContentsRequest; -import com.squidex.api.resources.contents.requests.ContentsGetGraphQlBatchRequest; -import com.squidex.api.resources.contents.requests.ContentsGetGraphQlRequest; -import com.squidex.api.resources.contents.requests.ContentsGetReferencesRequest; -import com.squidex.api.resources.contents.requests.ContentsGetReferencingRequest; -import com.squidex.api.resources.contents.requests.ContentsPatchContentRequest; -import com.squidex.api.resources.contents.requests.ContentsPostContentRequest; -import com.squidex.api.resources.contents.requests.ContentsPostGraphQlBatchRequest; -import com.squidex.api.resources.contents.requests.ContentsPostGraphQlRequest; -import com.squidex.api.resources.contents.requests.ContentsPostUpsertContentRequest; -import com.squidex.api.resources.contents.requests.ContentsPutContentRequest; -import com.squidex.api.resources.contents.requests.ImportContentsDto; -import com.squidex.api.types.BulkResultDto; -import com.squidex.api.types.BulkUpdateContentsDto; -import com.squidex.api.types.ContentDto; -import com.squidex.api.types.ContentsDto; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class ContentsClient { - protected final ClientOptions clientOptions; - - public ContentsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getContents(String schema) { - return getContents(schema, ContentsGetContentsRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getContents(String schema, ContentsGetContentsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema); - if (request.getIds().isPresent()) { - httpUrl.addQueryParameter("ids", request.getIds().get()); - } - if (request.getQ().isPresent()) { - httpUrl.addQueryParameter("q", request.getQ().get()); - } - if (request.getSearch().isPresent()) { - httpUrl.addQueryParameter("$search", request.getSearch().get()); - } - if (request.getTop().isPresent()) { - httpUrl.addQueryParameter("$top", request.getTop().get().toString()); - } - if (request.getSkip().isPresent()) { - httpUrl.addQueryParameter("$skip", request.getSkip().get().toString()); - } - if (request.getOrderby().isPresent()) { - httpUrl.addQueryParameter("$orderby", request.getOrderby().get()); - } - if (request.getFilter().isPresent()) { - httpUrl.addQueryParameter("$filter", request.getFilter().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFields().isPresent()) { - _requestBuilder.addHeader("X-Fields", request.getFields().get()); - } - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getContents(String schema, ContentsGetContentsRequest request) { - return getContents(schema, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto postContent(String schema, ContentsPostContentRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema); - if (request.getStatus().isPresent()) { - httpUrl.addQueryParameter("status", request.getStatus().get()); - } - if (request.getId().isPresent()) { - httpUrl.addQueryParameter("id", request.getId().get()); - } - if (request.getPublish().isPresent()) { - httpUrl.addQueryParameter("publish", request.getPublish().get().toString()); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto postContent(String schema, ContentsPostContentRequest request) { - return postContent(schema, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getContentsPost( - String schema, ContentsGetContentsPostRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegments("query") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFields().isPresent()) { - _requestBuilder.addHeader("X-Fields", request.getFields().get()); - } - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getContentsPost(String schema, ContentsGetContentsPostRequest request) { - return getContentsPost(schema, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto getContent(String schema, String id) { - return getContent(schema, id, ContentsGetContentRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto getContent( - String schema, String id, ContentsGetContentRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id); - if (request.getVersion().isPresent()) { - httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFields().isPresent()) { - _requestBuilder.addHeader("X-Fields", request.getFields().get()); - } - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto getContent(String schema, String id, ContentsGetContentRequest request) { - return getContent(schema, id, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto postUpsertContent( - String schema, String id, ContentsPostUpsertContentRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id); - if (request.getStatus().isPresent()) { - httpUrl.addQueryParameter("status", request.getStatus().get()); - } - if (request.getPatch().isPresent()) { - httpUrl.addQueryParameter("patch", request.getPatch().get().toString()); - } - if (request.getPublish().isPresent()) { - httpUrl.addQueryParameter("publish", request.getPublish().get().toString()); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto postUpsertContent(String schema, String id, ContentsPostUpsertContentRequest request) { - return postUpsertContent(schema, id, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto putContent( - String schema, String id, ContentsPutContentRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto putContent(String schema, String id, ContentsPutContentRequest request) { - return putContent(schema, id, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto patchContent( - String schema, String id, ContentsPatchContentRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("PATCH", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto patchContent(String schema, String id, ContentsPatchContentRequest request) { - return patchContent(schema, id, request, null); - } - - /** - * You can create an generated documentation for your app at /api/content/{appName}/docs. - */ - public void deleteContent(String schema, String id) { - deleteContent(schema, id, ContentsDeleteContentRequest.builder().build()); - } - - /** - * You can create an generated documentation for your app at /api/content/{appName}/docs. - */ - public void deleteContent( - String schema, String id, ContentsDeleteContentRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id); - if (request.getCheckReferrers().isPresent()) { - httpUrl.addQueryParameter( - "checkReferrers", request.getCheckReferrers().get().toString()); - } - if (request.getPermanent().isPresent()) { - httpUrl.addQueryParameter("permanent", request.getPermanent().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can create an generated documentation for your app at /api/content/{appName}/docs. - */ - public void deleteContent(String schema, String id, ContentsDeleteContentRequest request) { - deleteContent(schema, id, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public void getContentValidity(String schema, String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("validity") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public void getContentValidity(String schema, String id) { - getContentValidity(schema, id, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getReferences(String schema, String id) { - return getReferences(schema, id, ContentsGetReferencesRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getReferences( - String schema, String id, ContentsGetReferencesRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("references"); - if (request.getQ().isPresent()) { - httpUrl.addQueryParameter("q", request.getQ().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFields().isPresent()) { - _requestBuilder.addHeader("X-Fields", request.getFields().get()); - } - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getReferences(String schema, String id, ContentsGetReferencesRequest request) { - return getReferences(schema, id, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getReferencing(String schema, String id) { - return getReferencing( - schema, id, ContentsGetReferencingRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getReferencing( - String schema, String id, ContentsGetReferencingRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("referencing"); - if (request.getQ().isPresent()) { - httpUrl.addQueryParameter("q", request.getQ().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFields().isPresent()) { - _requestBuilder.addHeader("X-Fields", request.getFields().get()); - } - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getReferencing(String schema, String id, ContentsGetReferencingRequest request) { - return getReferencing(schema, id, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public InputStream getContentVersion(String schema, String id, int version) { - return getContentVersion( - schema, id, version, ContentsGetContentVersionRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public InputStream getContentVersion( - String schema, - String id, - int version, - ContentsGetContentVersionRequest request, - RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegment(Integer.toString(version)) - .build(); - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return response.body().byteStream(); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public InputStream getContentVersion( - String schema, String id, int version, ContentsGetContentVersionRequest request) { - return getContentVersion(schema, id, version, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public List postContents(String schema, ImportContentsDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegments("import") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public List postContents(String schema, ImportContentsDto request) { - return postContents(schema, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public List bulkUpdateContents( - String schema, BulkUpdateContentsDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegments("bulk") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public List bulkUpdateContents(String schema, BulkUpdateContentsDto request) { - return bulkUpdateContents(schema, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto putContentStatus( - String schema, String id, ChangeStatusDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("status") - .build(); - Map properties = new HashMap<>(); - properties.put("status", request.getStatus()); - if (request.getDueTime().isPresent()) { - properties.put("dueTime", request.getDueTime()); - } - if (request.getCheckReferrers().isPresent()) { - properties.put("checkReferrers", request.getCheckReferrers()); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto putContentStatus(String schema, String id, ChangeStatusDto request) { - return putContentStatus(schema, id, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto deleteContentStatus(String schema, String id) { - return deleteContentStatus( - schema, id, ContentsDeleteContentStatusRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto deleteContentStatus( - String schema, String id, ContentsDeleteContentStatusRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("status") - .build(); - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto deleteContentStatus(String schema, String id, ContentsDeleteContentStatusRequest request) { - return deleteContentStatus(schema, id, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto createDraft(String schema, String id) { - return createDraft(schema, id, ContentsCreateDraftRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto createDraft( - String schema, String id, ContentsCreateDraftRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("draft") - .build(); - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("POST", RequestBody.create("", null)) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto createDraft(String schema, String id, ContentsCreateDraftRequest request) { - return createDraft(schema, id, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto deleteVersion(String schema, String id) { - return deleteVersion(schema, id, ContentsDeleteVersionRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto deleteVersion( - String schema, String id, ContentsDeleteVersionRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegment(schema) - .addPathSegment(id) - .addPathSegments("draft") - .build(); - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentDto deleteVersion(String schema, String id, ContentsDeleteVersionRequest request) { - return deleteVersion(schema, id, request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public Object getGraphQl() { - return getGraphQl(ContentsGetGraphQlRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public Object getGraphQl(ContentsGetGraphQlRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegments("graphql"); - if (request.getQuery().isPresent()) { - httpUrl.addQueryParameter("query", request.getQuery().get()); - } - if (request.getOperationName().isPresent()) { - httpUrl.addQueryParameter( - "operationName", request.getOperationName().get()); - } - if (request.getVariables().isPresent()) { - httpUrl.addQueryParameter("variables", request.getVariables().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public Object getGraphQl(ContentsGetGraphQlRequest request) { - return getGraphQl(request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public Object postGraphQl(ContentsPostGraphQlRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegments("graphql") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public Object postGraphQl(ContentsPostGraphQlRequest request) { - return postGraphQl(request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public Object getGraphQlBatch() { - return getGraphQlBatch(ContentsGetGraphQlBatchRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public Object getGraphQlBatch(ContentsGetGraphQlBatchRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegments("graphql/batch"); - if (request.getQuery().isPresent()) { - httpUrl.addQueryParameter("query", request.getQuery().get()); - } - if (request.getOperationName().isPresent()) { - httpUrl.addQueryParameter( - "operationName", request.getOperationName().get()); - } - if (request.getVariables().isPresent()) { - httpUrl.addQueryParameter("variables", request.getVariables().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public Object getGraphQlBatch(ContentsGetGraphQlBatchRequest request) { - return getGraphQlBatch(request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public Object postGraphQlBatch(ContentsPostGraphQlBatchRequest request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegments("graphql/batch") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public Object postGraphQlBatch(ContentsPostGraphQlBatchRequest request) { - return postGraphQlBatch(request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getAllContents() { - return getAllContents(ContentsGetAllContentsRequest.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getAllContents(ContentsGetAllContentsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()); - if (request.getIds().isPresent()) { - httpUrl.addQueryParameter("ids", request.getIds().get()); - } - if (request.getScheduleFrom().isPresent()) { - httpUrl.addQueryParameter( - "scheduleFrom", request.getScheduleFrom().get().toString()); - } - if (request.getScheduleTo().isPresent()) { - httpUrl.addQueryParameter( - "scheduleTo", request.getScheduleTo().get().toString()); - } - if (request.getReferencing().isPresent()) { - httpUrl.addQueryParameter("referencing", request.getReferencing().get()); - } - if (request.getReferences().isPresent()) { - httpUrl.addQueryParameter("references", request.getReferences().get()); - } - if (request.getQ().isPresent()) { - httpUrl.addQueryParameter("q", request.getQ().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFields().isPresent()) { - _requestBuilder.addHeader("X-Fields", request.getFields().get()); - } - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getAllContents(ContentsGetAllContentsRequest request) { - return getAllContents(request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getAllContentsPost() { - return getAllContentsPost(AllContentsByPostDto.builder().build()); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getAllContentsPost(AllContentsByPostDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .build(); - Map properties = new HashMap<>(); - if (request.getIds().isPresent()) { - properties.put("ids", request.getIds()); - } - if (request.getScheduledFrom().isPresent()) { - properties.put("scheduledFrom", request.getScheduledFrom()); - } - if (request.getScheduledTo().isPresent()) { - properties.put("scheduledTo", request.getScheduledTo()); - } - if (request.getReferencing().isPresent()) { - properties.put("referencing", request.getReferencing()); - } - if (request.getReferences().isPresent()) { - properties.put("references", request.getReferences()); - } - if (request.getOData().isPresent()) { - properties.put("oData", request.getOData()); - } - if (request.getQ().isPresent()) { - properties.put("q", request.getQ()); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - if (request.getFields().isPresent()) { - _requestBuilder.addHeader("X-Fields", request.getFields().get()); - } - if (request.getFlatten().isPresent()) { - _requestBuilder.addHeader("X-Flatten", request.getFlatten().get().toString()); - } - if (request.getLanguages().isPresent()) { - _requestBuilder.addHeader("X-Languages", request.getLanguages().get()); - } - if (request.getNoSlowTotal().isPresent()) { - _requestBuilder.addHeader( - "X-NoSlowTotal", request.getNoSlowTotal().get().toString()); - } - if (request.getNoTotal().isPresent()) { - _requestBuilder.addHeader("X-NoTotal", request.getNoTotal().get().toString()); - } - if (request.getUnpublished().isPresent()) { - _requestBuilder.addHeader( - "X-Unpublished", request.getUnpublished().get().toString()); - } - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContentsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public ContentsDto getAllContentsPost(AllContentsByPostDto request) { - return getAllContentsPost(request, null); - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public List bulkUpdateAllContents( - ContentsBulkUpdateAllContentsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/content") - .addPathSegment(clientOptions.appName()) - .addPathSegments("bulk"); - if (request.getSchema().isPresent()) { - httpUrl.addQueryParameter("schema", request.getSchema().get()); - } - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), - MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can read the generated documentation for your app at /api/content/{appName}/docs. - */ - public List bulkUpdateAllContents(ContentsBulkUpdateAllContentsRequest request) { - return bulkUpdateAllContents(request, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/AllContentsByPostDto.java b/src/main/java/com/squidex/api/resources/contents/requests/AllContentsByPostDto.java deleted file mode 100644 index 0255ee2..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/AllContentsByPostDto.java +++ /dev/null @@ -1,433 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AllContentsByPostDto.Builder.class) -public final class AllContentsByPostDto { - private final Optional fields; - - private final Optional flatten; - - private final Optional languages; - - private final Optional noSlowTotal; - - private final Optional noTotal; - - private final Optional unpublished; - - private final Optional> ids; - - private final Optional scheduledFrom; - - private final Optional scheduledTo; - - private final Optional referencing; - - private final Optional references; - - private final Optional oData; - - private final Optional q; - - private AllContentsByPostDto( - Optional fields, - Optional flatten, - Optional languages, - Optional noSlowTotal, - Optional noTotal, - Optional unpublished, - Optional> ids, - Optional scheduledFrom, - Optional scheduledTo, - Optional referencing, - Optional references, - Optional oData, - Optional q) { - this.fields = fields; - this.flatten = flatten; - this.languages = languages; - this.noSlowTotal = noSlowTotal; - this.noTotal = noTotal; - this.unpublished = unpublished; - this.ids = ids; - this.scheduledFrom = scheduledFrom; - this.scheduledTo = scheduledTo; - this.referencing = referencing; - this.references = references; - this.oData = oData; - this.q = q; - } - - /** - * @return The list of content fields (comma-separated). - */ - @JsonProperty("X-Fields") - public Optional getFields() { - return fields; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of ids to query. - */ - @JsonProperty("ids") - public Optional> getIds() { - return ids; - } - - /** - * @return The start of the schedule. - */ - @JsonProperty("scheduledFrom") - public Optional getScheduledFrom() { - return scheduledFrom; - } - - /** - * @return The end of the schedule. - */ - @JsonProperty("scheduledTo") - public Optional getScheduledTo() { - return scheduledTo; - } - - /** - * @return The ID of the referencing content item. - */ - @JsonProperty("referencing") - public Optional getReferencing() { - return referencing; - } - - /** - * @return The ID of the reference content item. - */ - @JsonProperty("references") - public Optional getReferences() { - return references; - } - - /** - * @return The optional odata query. - */ - @JsonProperty("oData") - public Optional getOData() { - return oData; - } - - @JsonProperty("q") - public Optional getQ() { - return q; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AllContentsByPostDto && equalTo((AllContentsByPostDto) other); - } - - private boolean equalTo(AllContentsByPostDto other) { - return fields.equals(other.fields) - && flatten.equals(other.flatten) - && languages.equals(other.languages) - && noSlowTotal.equals(other.noSlowTotal) - && noTotal.equals(other.noTotal) - && unpublished.equals(other.unpublished) - && ids.equals(other.ids) - && scheduledFrom.equals(other.scheduledFrom) - && scheduledTo.equals(other.scheduledTo) - && referencing.equals(other.referencing) - && references.equals(other.references) - && oData.equals(other.oData) - && q.equals(other.q); - } - - @Override - public int hashCode() { - return Objects.hash( - this.fields, - this.flatten, - this.languages, - this.noSlowTotal, - this.noTotal, - this.unpublished, - this.ids, - this.scheduledFrom, - this.scheduledTo, - this.referencing, - this.references, - this.oData, - this.q); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional fields = Optional.empty(); - - private Optional flatten = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Optional> ids = Optional.empty(); - - private Optional scheduledFrom = Optional.empty(); - - private Optional scheduledTo = Optional.empty(); - - private Optional referencing = Optional.empty(); - - private Optional references = Optional.empty(); - - private Optional oData = Optional.empty(); - - private Optional q = Optional.empty(); - - private Builder() {} - - public Builder from(AllContentsByPostDto other) { - fields(other.getFields()); - flatten(other.getFlatten()); - languages(other.getLanguages()); - noSlowTotal(other.getNoSlowTotal()); - noTotal(other.getNoTotal()); - unpublished(other.getUnpublished()); - ids(other.getIds()); - scheduledFrom(other.getScheduledFrom()); - scheduledTo(other.getScheduledTo()); - referencing(other.getReferencing()); - references(other.getReferences()); - oData(other.getOData()); - q(other.getQ()); - return this; - } - - @JsonSetter(value = "X-Fields", nulls = Nulls.SKIP) - public Builder fields(Optional fields) { - this.fields = fields; - return this; - } - - public Builder fields(String fields) { - this.fields = Optional.of(fields); - return this; - } - - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public Builder flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - public Builder flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public Builder noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - public Builder noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public Builder noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - public Builder noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional> ids) { - this.ids = ids; - return this; - } - - public Builder ids(List ids) { - this.ids = Optional.of(ids); - return this; - } - - @JsonSetter(value = "scheduledFrom", nulls = Nulls.SKIP) - public Builder scheduledFrom(Optional scheduledFrom) { - this.scheduledFrom = scheduledFrom; - return this; - } - - public Builder scheduledFrom(OffsetDateTime scheduledFrom) { - this.scheduledFrom = Optional.of(scheduledFrom); - return this; - } - - @JsonSetter(value = "scheduledTo", nulls = Nulls.SKIP) - public Builder scheduledTo(Optional scheduledTo) { - this.scheduledTo = scheduledTo; - return this; - } - - public Builder scheduledTo(OffsetDateTime scheduledTo) { - this.scheduledTo = Optional.of(scheduledTo); - return this; - } - - @JsonSetter(value = "referencing", nulls = Nulls.SKIP) - public Builder referencing(Optional referencing) { - this.referencing = referencing; - return this; - } - - public Builder referencing(String referencing) { - this.referencing = Optional.of(referencing); - return this; - } - - @JsonSetter(value = "references", nulls = Nulls.SKIP) - public Builder references(Optional references) { - this.references = references; - return this; - } - - public Builder references(String references) { - this.references = Optional.of(references); - return this; - } - - @JsonSetter(value = "oData", nulls = Nulls.SKIP) - public Builder oData(Optional oData) { - this.oData = oData; - return this; - } - - public Builder oData(String oData) { - this.oData = Optional.of(oData); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(Object q) { - this.q = Optional.of(q); - return this; - } - - public AllContentsByPostDto build() { - return new AllContentsByPostDto( - fields, - flatten, - languages, - noSlowTotal, - noTotal, - unpublished, - ids, - scheduledFrom, - scheduledTo, - referencing, - references, - oData, - q); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ChangeStatusDto.java b/src/main/java/com/squidex/api/resources/contents/requests/ChangeStatusDto.java deleted file mode 100644 index 432fd32..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ChangeStatusDto.java +++ /dev/null @@ -1,245 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.time.OffsetDateTime; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ChangeStatusDto.Builder.class) -public final class ChangeStatusDto { - private final Optional unpublished; - - private final Optional languages; - - private final String status; - - private final Optional dueTime; - - private final Optional checkReferrers; - - private ChangeStatusDto( - Optional unpublished, - Optional languages, - String status, - Optional dueTime, - Optional checkReferrers) { - this.unpublished = unpublished; - this.languages = languages; - this.status = status; - this.dueTime = dueTime; - this.checkReferrers = checkReferrers; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return The new status. - */ - @JsonProperty("status") - public String getStatus() { - return status; - } - - /** - * @return The due time. - */ - @JsonProperty("dueTime") - public Optional getDueTime() { - return dueTime; - } - - /** - * @return True to check referrers of this content. - */ - @JsonProperty("checkReferrers") - public Optional getCheckReferrers() { - return checkReferrers; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ChangeStatusDto && equalTo((ChangeStatusDto) other); - } - - private boolean equalTo(ChangeStatusDto other) { - return unpublished.equals(other.unpublished) - && languages.equals(other.languages) - && status.equals(other.status) - && dueTime.equals(other.dueTime) - && checkReferrers.equals(other.checkReferrers); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages, this.status, this.dueTime, this.checkReferrers); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static StatusStage builder() { - return new Builder(); - } - - public interface StatusStage { - _FinalStage status(String status); - - Builder from(ChangeStatusDto other); - } - - public interface _FinalStage { - ChangeStatusDto build(); - - _FinalStage unpublished(Optional unpublished); - - _FinalStage unpublished(Boolean unpublished); - - _FinalStage languages(Optional languages); - - _FinalStage languages(String languages); - - _FinalStage dueTime(Optional dueTime); - - _FinalStage dueTime(OffsetDateTime dueTime); - - _FinalStage checkReferrers(Optional checkReferrers); - - _FinalStage checkReferrers(Boolean checkReferrers); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements StatusStage, _FinalStage { - private String status; - - private Optional checkReferrers = Optional.empty(); - - private Optional dueTime = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ChangeStatusDto other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - status(other.getStatus()); - dueTime(other.getDueTime()); - checkReferrers(other.getCheckReferrers()); - return this; - } - - /** - *

The new status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public _FinalStage status(String status) { - this.status = status; - return this; - } - - /** - *

True to check referrers of this content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage checkReferrers(Boolean checkReferrers) { - this.checkReferrers = Optional.of(checkReferrers); - return this; - } - - @Override - @JsonSetter(value = "checkReferrers", nulls = Nulls.SKIP) - public _FinalStage checkReferrers(Optional checkReferrers) { - this.checkReferrers = checkReferrers; - return this; - } - - /** - *

The due time.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage dueTime(OffsetDateTime dueTime) { - this.dueTime = Optional.of(dueTime); - return this; - } - - @Override - @JsonSetter(value = "dueTime", nulls = Nulls.SKIP) - public _FinalStage dueTime(Optional dueTime) { - this.dueTime = dueTime; - return this; - } - - /** - *

The list of languages to resolve (comma-separated).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @Override - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public _FinalStage languages(Optional languages) { - this.languages = languages; - return this; - } - - /** - *

Return unpublished content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @Override - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public _FinalStage unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - @Override - public ChangeStatusDto build() { - return new ChangeStatusDto(unpublished, languages, status, dueTime, checkReferrers); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsBulkUpdateAllContentsRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsBulkUpdateAllContentsRequest.java deleted file mode 100644 index 00292e9..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsBulkUpdateAllContentsRequest.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.BulkUpdateContentsDto; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsBulkUpdateAllContentsRequest.Builder.class) -public final class ContentsBulkUpdateAllContentsRequest { - private final Optional schema; - - private final BulkUpdateContentsDto body; - - private ContentsBulkUpdateAllContentsRequest(Optional schema, BulkUpdateContentsDto body) { - this.schema = schema; - this.body = body; - } - - /** - * @return The name of the schema. - */ - @JsonProperty("schema") - public Optional getSchema() { - return schema; - } - - @JsonProperty("body") - public BulkUpdateContentsDto getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsBulkUpdateAllContentsRequest - && equalTo((ContentsBulkUpdateAllContentsRequest) other); - } - - private boolean equalTo(ContentsBulkUpdateAllContentsRequest other) { - return schema.equals(other.schema) && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.schema, this.body); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static BodyStage builder() { - return new Builder(); - } - - public interface BodyStage { - _FinalStage body(BulkUpdateContentsDto body); - - Builder from(ContentsBulkUpdateAllContentsRequest other); - } - - public interface _FinalStage { - ContentsBulkUpdateAllContentsRequest build(); - - _FinalStage schema(Optional schema); - - _FinalStage schema(String schema); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements BodyStage, _FinalStage { - private BulkUpdateContentsDto body; - - private Optional schema = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ContentsBulkUpdateAllContentsRequest other) { - schema(other.getSchema()); - body(other.getBody()); - return this; - } - - @Override - @JsonSetter("body") - public _FinalStage body(BulkUpdateContentsDto body) { - this.body = body; - return this; - } - - /** - *

The name of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schema(String schema) { - this.schema = Optional.of(schema); - return this; - } - - @Override - @JsonSetter(value = "schema", nulls = Nulls.SKIP) - public _FinalStage schema(Optional schema) { - this.schema = schema; - return this; - } - - @Override - public ContentsBulkUpdateAllContentsRequest build() { - return new ContentsBulkUpdateAllContentsRequest(schema, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsCreateDraftRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsCreateDraftRequest.java deleted file mode 100644 index e9ed7b5..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsCreateDraftRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsCreateDraftRequest.Builder.class) -public final class ContentsCreateDraftRequest { - private final Optional unpublished; - - private final Optional languages; - - private ContentsCreateDraftRequest(Optional unpublished, Optional languages) { - this.unpublished = unpublished; - this.languages = languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsCreateDraftRequest && equalTo((ContentsCreateDraftRequest) other); - } - - private boolean equalTo(ContentsCreateDraftRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsCreateDraftRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - public ContentsCreateDraftRequest build() { - return new ContentsCreateDraftRequest(unpublished, languages); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentRequest.java deleted file mode 100644 index 4454f35..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsDeleteContentRequest.Builder.class) -public final class ContentsDeleteContentRequest { - private final Optional checkReferrers; - - private final Optional permanent; - - private ContentsDeleteContentRequest(Optional checkReferrers, Optional permanent) { - this.checkReferrers = checkReferrers; - this.permanent = permanent; - } - - /** - * @return True to check referrers of this content. - */ - @JsonProperty("checkReferrers") - public Optional getCheckReferrers() { - return checkReferrers; - } - - /** - * @return True to delete the content permanently. - */ - @JsonProperty("permanent") - public Optional getPermanent() { - return permanent; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsDeleteContentRequest && equalTo((ContentsDeleteContentRequest) other); - } - - private boolean equalTo(ContentsDeleteContentRequest other) { - return checkReferrers.equals(other.checkReferrers) && permanent.equals(other.permanent); - } - - @Override - public int hashCode() { - return Objects.hash(this.checkReferrers, this.permanent); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional checkReferrers = Optional.empty(); - - private Optional permanent = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsDeleteContentRequest other) { - checkReferrers(other.getCheckReferrers()); - permanent(other.getPermanent()); - return this; - } - - @JsonSetter(value = "checkReferrers", nulls = Nulls.SKIP) - public Builder checkReferrers(Optional checkReferrers) { - this.checkReferrers = checkReferrers; - return this; - } - - public Builder checkReferrers(Boolean checkReferrers) { - this.checkReferrers = Optional.of(checkReferrers); - return this; - } - - @JsonSetter(value = "permanent", nulls = Nulls.SKIP) - public Builder permanent(Optional permanent) { - this.permanent = permanent; - return this; - } - - public Builder permanent(Boolean permanent) { - this.permanent = Optional.of(permanent); - return this; - } - - public ContentsDeleteContentRequest build() { - return new ContentsDeleteContentRequest(checkReferrers, permanent); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentStatusRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentStatusRequest.java deleted file mode 100644 index 7b11744..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentStatusRequest.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsDeleteContentStatusRequest.Builder.class) -public final class ContentsDeleteContentStatusRequest { - private final Optional unpublished; - - private final Optional languages; - - private ContentsDeleteContentStatusRequest(Optional unpublished, Optional languages) { - this.unpublished = unpublished; - this.languages = languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsDeleteContentStatusRequest - && equalTo((ContentsDeleteContentStatusRequest) other); - } - - private boolean equalTo(ContentsDeleteContentStatusRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsDeleteContentStatusRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - public ContentsDeleteContentStatusRequest build() { - return new ContentsDeleteContentStatusRequest(unpublished, languages); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteVersionRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteVersionRequest.java deleted file mode 100644 index 3da94ba..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteVersionRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsDeleteVersionRequest.Builder.class) -public final class ContentsDeleteVersionRequest { - private final Optional unpublished; - - private final Optional languages; - - private ContentsDeleteVersionRequest(Optional unpublished, Optional languages) { - this.unpublished = unpublished; - this.languages = languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsDeleteVersionRequest && equalTo((ContentsDeleteVersionRequest) other); - } - - private boolean equalTo(ContentsDeleteVersionRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsDeleteVersionRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - public ContentsDeleteVersionRequest build() { - return new ContentsDeleteVersionRequest(unpublished, languages); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetAllContentsRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetAllContentsRequest.java deleted file mode 100644 index 78501c4..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetAllContentsRequest.java +++ /dev/null @@ -1,406 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.time.OffsetDateTime; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetAllContentsRequest.Builder.class) -public final class ContentsGetAllContentsRequest { - private final Optional fields; - - private final Optional flatten; - - private final Optional languages; - - private final Optional noSlowTotal; - - private final Optional noTotal; - - private final Optional unpublished; - - private final Optional ids; - - private final Optional scheduleFrom; - - private final Optional scheduleTo; - - private final Optional referencing; - - private final Optional references; - - private final Optional q; - - private ContentsGetAllContentsRequest( - Optional fields, - Optional flatten, - Optional languages, - Optional noSlowTotal, - Optional noTotal, - Optional unpublished, - Optional ids, - Optional scheduleFrom, - Optional scheduleTo, - Optional referencing, - Optional references, - Optional q) { - this.fields = fields; - this.flatten = flatten; - this.languages = languages; - this.noSlowTotal = noSlowTotal; - this.noTotal = noTotal; - this.unpublished = unpublished; - this.ids = ids; - this.scheduleFrom = scheduleFrom; - this.scheduleTo = scheduleTo; - this.referencing = referencing; - this.references = references; - this.q = q; - } - - /** - * @return The list of content fields (comma-separated). - */ - @JsonProperty("X-Fields") - public Optional getFields() { - return fields; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of ids to query. - */ - @JsonProperty("ids") - public Optional getIds() { - return ids; - } - - /** - * @return The start of the schedule. - */ - @JsonProperty("scheduleFrom") - public Optional getScheduleFrom() { - return scheduleFrom; - } - - /** - * @return The end of the schedule. - */ - @JsonProperty("scheduleTo") - public Optional getScheduleTo() { - return scheduleTo; - } - - /** - * @return The ID of the referencing content item. - */ - @JsonProperty("referencing") - public Optional getReferencing() { - return referencing; - } - - /** - * @return The ID of the reference content item. - */ - @JsonProperty("references") - public Optional getReferences() { - return references; - } - - /** - * @return The optional json query. - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetAllContentsRequest && equalTo((ContentsGetAllContentsRequest) other); - } - - private boolean equalTo(ContentsGetAllContentsRequest other) { - return fields.equals(other.fields) - && flatten.equals(other.flatten) - && languages.equals(other.languages) - && noSlowTotal.equals(other.noSlowTotal) - && noTotal.equals(other.noTotal) - && unpublished.equals(other.unpublished) - && ids.equals(other.ids) - && scheduleFrom.equals(other.scheduleFrom) - && scheduleTo.equals(other.scheduleTo) - && referencing.equals(other.referencing) - && references.equals(other.references) - && q.equals(other.q); - } - - @Override - public int hashCode() { - return Objects.hash( - this.fields, - this.flatten, - this.languages, - this.noSlowTotal, - this.noTotal, - this.unpublished, - this.ids, - this.scheduleFrom, - this.scheduleTo, - this.referencing, - this.references, - this.q); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional fields = Optional.empty(); - - private Optional flatten = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Optional ids = Optional.empty(); - - private Optional scheduleFrom = Optional.empty(); - - private Optional scheduleTo = Optional.empty(); - - private Optional referencing = Optional.empty(); - - private Optional references = Optional.empty(); - - private Optional q = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetAllContentsRequest other) { - fields(other.getFields()); - flatten(other.getFlatten()); - languages(other.getLanguages()); - noSlowTotal(other.getNoSlowTotal()); - noTotal(other.getNoTotal()); - unpublished(other.getUnpublished()); - ids(other.getIds()); - scheduleFrom(other.getScheduleFrom()); - scheduleTo(other.getScheduleTo()); - referencing(other.getReferencing()); - references(other.getReferences()); - q(other.getQ()); - return this; - } - - @JsonSetter(value = "X-Fields", nulls = Nulls.SKIP) - public Builder fields(Optional fields) { - this.fields = fields; - return this; - } - - public Builder fields(String fields) { - this.fields = Optional.of(fields); - return this; - } - - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public Builder flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - public Builder flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public Builder noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - public Builder noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public Builder noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - public Builder noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional ids) { - this.ids = ids; - return this; - } - - public Builder ids(String ids) { - this.ids = Optional.of(ids); - return this; - } - - @JsonSetter(value = "scheduleFrom", nulls = Nulls.SKIP) - public Builder scheduleFrom(Optional scheduleFrom) { - this.scheduleFrom = scheduleFrom; - return this; - } - - public Builder scheduleFrom(OffsetDateTime scheduleFrom) { - this.scheduleFrom = Optional.of(scheduleFrom); - return this; - } - - @JsonSetter(value = "scheduleTo", nulls = Nulls.SKIP) - public Builder scheduleTo(Optional scheduleTo) { - this.scheduleTo = scheduleTo; - return this; - } - - public Builder scheduleTo(OffsetDateTime scheduleTo) { - this.scheduleTo = Optional.of(scheduleTo); - return this; - } - - @JsonSetter(value = "referencing", nulls = Nulls.SKIP) - public Builder referencing(Optional referencing) { - this.referencing = referencing; - return this; - } - - public Builder referencing(String referencing) { - this.referencing = Optional.of(referencing); - return this; - } - - @JsonSetter(value = "references", nulls = Nulls.SKIP) - public Builder references(Optional references) { - this.references = references; - return this; - } - - public Builder references(String references) { - this.references = Optional.of(references); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(String q) { - this.q = Optional.of(q); - return this; - } - - public ContentsGetAllContentsRequest build() { - return new ContentsGetAllContentsRequest( - fields, - flatten, - languages, - noSlowTotal, - noTotal, - unpublished, - ids, - scheduleFrom, - scheduleTo, - referencing, - references, - q); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentRequest.java deleted file mode 100644 index 7849e01..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentRequest.java +++ /dev/null @@ -1,192 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetContentRequest.Builder.class) -public final class ContentsGetContentRequest { - private final Optional fields; - - private final Optional flatten; - - private final Optional languages; - - private final Optional unpublished; - - private final Optional version; - - private ContentsGetContentRequest( - Optional fields, - Optional flatten, - Optional languages, - Optional unpublished, - Optional version) { - this.fields = fields; - this.flatten = flatten; - this.languages = languages; - this.unpublished = unpublished; - this.version = version; - } - - /** - * @return The list of content fields (comma-separated). - */ - @JsonProperty("X-Fields") - public Optional getFields() { - return fields; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The optional version. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetContentRequest && equalTo((ContentsGetContentRequest) other); - } - - private boolean equalTo(ContentsGetContentRequest other) { - return fields.equals(other.fields) - && flatten.equals(other.flatten) - && languages.equals(other.languages) - && unpublished.equals(other.unpublished) - && version.equals(other.version); - } - - @Override - public int hashCode() { - return Objects.hash(this.fields, this.flatten, this.languages, this.unpublished, this.version); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional fields = Optional.empty(); - - private Optional flatten = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Optional version = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetContentRequest other) { - fields(other.getFields()); - flatten(other.getFlatten()); - languages(other.getLanguages()); - unpublished(other.getUnpublished()); - version(other.getVersion()); - return this; - } - - @JsonSetter(value = "X-Fields", nulls = Nulls.SKIP) - public Builder fields(Optional fields) { - this.fields = fields; - return this; - } - - public Builder fields(String fields) { - this.fields = Optional.of(fields); - return this; - } - - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public Builder flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - public Builder flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - public ContentsGetContentRequest build() { - return new ContentsGetContentRequest(fields, flatten, languages, unpublished, version); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentVersionRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentVersionRequest.java deleted file mode 100644 index b34edf9..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentVersionRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetContentVersionRequest.Builder.class) -public final class ContentsGetContentVersionRequest { - private final Optional unpublished; - - private final Optional languages; - - private ContentsGetContentVersionRequest(Optional unpublished, Optional languages) { - this.unpublished = unpublished; - this.languages = languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetContentVersionRequest && equalTo((ContentsGetContentVersionRequest) other); - } - - private boolean equalTo(ContentsGetContentVersionRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetContentVersionRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - public ContentsGetContentVersionRequest build() { - return new ContentsGetContentVersionRequest(unpublished, languages); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsPostRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsPostRequest.java deleted file mode 100644 index 012f053..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsPostRequest.java +++ /dev/null @@ -1,314 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.QueryDto; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetContentsPostRequest.Builder.class) -public final class ContentsGetContentsPostRequest { - private final Optional fields; - - private final Optional flatten; - - private final Optional languages; - - private final Optional noSlowTotal; - - private final Optional noTotal; - - private final Optional unpublished; - - private final QueryDto body; - - private ContentsGetContentsPostRequest( - Optional fields, - Optional flatten, - Optional languages, - Optional noSlowTotal, - Optional noTotal, - Optional unpublished, - QueryDto body) { - this.fields = fields; - this.flatten = flatten; - this.languages = languages; - this.noSlowTotal = noSlowTotal; - this.noTotal = noTotal; - this.unpublished = unpublished; - this.body = body; - } - - /** - * @return The list of content fields (comma-separated). - */ - @JsonProperty("X-Fields") - public Optional getFields() { - return fields; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - @JsonProperty("body") - public QueryDto getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetContentsPostRequest && equalTo((ContentsGetContentsPostRequest) other); - } - - private boolean equalTo(ContentsGetContentsPostRequest other) { - return fields.equals(other.fields) - && flatten.equals(other.flatten) - && languages.equals(other.languages) - && noSlowTotal.equals(other.noSlowTotal) - && noTotal.equals(other.noTotal) - && unpublished.equals(other.unpublished) - && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash( - this.fields, this.flatten, this.languages, this.noSlowTotal, this.noTotal, this.unpublished, this.body); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static BodyStage builder() { - return new Builder(); - } - - public interface BodyStage { - _FinalStage body(QueryDto body); - - Builder from(ContentsGetContentsPostRequest other); - } - - public interface _FinalStage { - ContentsGetContentsPostRequest build(); - - _FinalStage fields(Optional fields); - - _FinalStage fields(String fields); - - _FinalStage flatten(Optional flatten); - - _FinalStage flatten(Boolean flatten); - - _FinalStage languages(Optional languages); - - _FinalStage languages(String languages); - - _FinalStage noSlowTotal(Optional noSlowTotal); - - _FinalStage noSlowTotal(Boolean noSlowTotal); - - _FinalStage noTotal(Optional noTotal); - - _FinalStage noTotal(Boolean noTotal); - - _FinalStage unpublished(Optional unpublished); - - _FinalStage unpublished(Boolean unpublished); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements BodyStage, _FinalStage { - private QueryDto body; - - private Optional unpublished = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional flatten = Optional.empty(); - - private Optional fields = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ContentsGetContentsPostRequest other) { - fields(other.getFields()); - flatten(other.getFlatten()); - languages(other.getLanguages()); - noSlowTotal(other.getNoSlowTotal()); - noTotal(other.getNoTotal()); - unpublished(other.getUnpublished()); - body(other.getBody()); - return this; - } - - @Override - @JsonSetter("body") - public _FinalStage body(QueryDto body) { - this.body = body; - return this; - } - - /** - *

Return unpublished content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @Override - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public _FinalStage unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - /** - *

Do not return the total amount.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @Override - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public _FinalStage noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - /** - *

Do not return the total amount, if it would be slow.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @Override - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public _FinalStage noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - /** - *

The list of languages to resolve (comma-separated).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @Override - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public _FinalStage languages(Optional languages) { - this.languages = languages; - return this; - } - - /** - *

Provide the data as flat object.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @Override - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public _FinalStage flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - /** - *

The list of content fields (comma-separated).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fields(String fields) { - this.fields = Optional.of(fields); - return this; - } - - @Override - @JsonSetter(value = "X-Fields", nulls = Nulls.SKIP) - public _FinalStage fields(Optional fields) { - this.fields = fields; - return this; - } - - @Override - public ContentsGetContentsPostRequest build() { - return new ContentsGetContentsPostRequest( - fields, flatten, languages, noSlowTotal, noTotal, unpublished, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsRequest.java deleted file mode 100644 index cc46d2a..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsRequest.java +++ /dev/null @@ -1,434 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetContentsRequest.Builder.class) -public final class ContentsGetContentsRequest { - private final Optional fields; - - private final Optional flatten; - - private final Optional languages; - - private final Optional noSlowTotal; - - private final Optional noTotal; - - private final Optional unpublished; - - private final Optional ids; - - private final Optional q; - - private final Optional search; - - private final Optional top; - - private final Optional skip; - - private final Optional orderby; - - private final Optional filter; - - private ContentsGetContentsRequest( - Optional fields, - Optional flatten, - Optional languages, - Optional noSlowTotal, - Optional noTotal, - Optional unpublished, - Optional ids, - Optional q, - Optional search, - Optional top, - Optional skip, - Optional orderby, - Optional filter) { - this.fields = fields; - this.flatten = flatten; - this.languages = languages; - this.noSlowTotal = noSlowTotal; - this.noTotal = noTotal; - this.unpublished = unpublished; - this.ids = ids; - this.q = q; - this.search = search; - this.top = top; - this.skip = skip; - this.orderby = orderby; - this.filter = filter; - } - - /** - * @return The list of content fields (comma-separated). - */ - @JsonProperty("X-Fields") - public Optional getFields() { - return fields; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The optional ids of the content to fetch. - */ - @JsonProperty("ids") - public Optional getIds() { - return ids; - } - - /** - * @return The optional json query. - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - /** - * @return Optional number of items to skip. - */ - @JsonProperty("$search") - public Optional getSearch() { - return search; - } - - /** - * @return Optional number of items to take. - */ - @JsonProperty("$top") - public Optional getTop() { - return top; - } - - /** - * @return Optional number of items to skip. - */ - @JsonProperty("$skip") - public Optional getSkip() { - return skip; - } - - /** - * @return Optional OData order definition. - */ - @JsonProperty("$orderby") - public Optional getOrderby() { - return orderby; - } - - /** - * @return Optional OData filter. - */ - @JsonProperty("$filter") - public Optional getFilter() { - return filter; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetContentsRequest && equalTo((ContentsGetContentsRequest) other); - } - - private boolean equalTo(ContentsGetContentsRequest other) { - return fields.equals(other.fields) - && flatten.equals(other.flatten) - && languages.equals(other.languages) - && noSlowTotal.equals(other.noSlowTotal) - && noTotal.equals(other.noTotal) - && unpublished.equals(other.unpublished) - && ids.equals(other.ids) - && q.equals(other.q) - && search.equals(other.search) - && top.equals(other.top) - && skip.equals(other.skip) - && orderby.equals(other.orderby) - && filter.equals(other.filter); - } - - @Override - public int hashCode() { - return Objects.hash( - this.fields, - this.flatten, - this.languages, - this.noSlowTotal, - this.noTotal, - this.unpublished, - this.ids, - this.q, - this.search, - this.top, - this.skip, - this.orderby, - this.filter); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional fields = Optional.empty(); - - private Optional flatten = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Optional ids = Optional.empty(); - - private Optional q = Optional.empty(); - - private Optional search = Optional.empty(); - - private Optional top = Optional.empty(); - - private Optional skip = Optional.empty(); - - private Optional orderby = Optional.empty(); - - private Optional filter = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetContentsRequest other) { - fields(other.getFields()); - flatten(other.getFlatten()); - languages(other.getLanguages()); - noSlowTotal(other.getNoSlowTotal()); - noTotal(other.getNoTotal()); - unpublished(other.getUnpublished()); - ids(other.getIds()); - q(other.getQ()); - search(other.getSearch()); - top(other.getTop()); - skip(other.getSkip()); - orderby(other.getOrderby()); - filter(other.getFilter()); - return this; - } - - @JsonSetter(value = "X-Fields", nulls = Nulls.SKIP) - public Builder fields(Optional fields) { - this.fields = fields; - return this; - } - - public Builder fields(String fields) { - this.fields = Optional.of(fields); - return this; - } - - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public Builder flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - public Builder flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public Builder noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - public Builder noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public Builder noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - public Builder noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional ids) { - this.ids = ids; - return this; - } - - public Builder ids(String ids) { - this.ids = Optional.of(ids); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(String q) { - this.q = Optional.of(q); - return this; - } - - @JsonSetter(value = "$search", nulls = Nulls.SKIP) - public Builder search(Optional search) { - this.search = search; - return this; - } - - public Builder search(String search) { - this.search = Optional.of(search); - return this; - } - - @JsonSetter(value = "$top", nulls = Nulls.SKIP) - public Builder top(Optional top) { - this.top = top; - return this; - } - - public Builder top(Double top) { - this.top = Optional.of(top); - return this; - } - - @JsonSetter(value = "$skip", nulls = Nulls.SKIP) - public Builder skip(Optional skip) { - this.skip = skip; - return this; - } - - public Builder skip(Double skip) { - this.skip = Optional.of(skip); - return this; - } - - @JsonSetter(value = "$orderby", nulls = Nulls.SKIP) - public Builder orderby(Optional orderby) { - this.orderby = orderby; - return this; - } - - public Builder orderby(String orderby) { - this.orderby = Optional.of(orderby); - return this; - } - - @JsonSetter(value = "$filter", nulls = Nulls.SKIP) - public Builder filter(Optional filter) { - this.filter = filter; - return this; - } - - public Builder filter(String filter) { - this.filter = Optional.of(filter); - return this; - } - - public ContentsGetContentsRequest build() { - return new ContentsGetContentsRequest( - fields, - flatten, - languages, - noSlowTotal, - noTotal, - unpublished, - ids, - q, - search, - top, - skip, - orderby, - filter); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetGraphQlBatchRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetGraphQlBatchRequest.java deleted file mode 100644 index 3bf1eac..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetGraphQlBatchRequest.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetGraphQlBatchRequest.Builder.class) -public final class ContentsGetGraphQlBatchRequest { - private final Optional unpublished; - - private final Optional query; - - private final Optional operationName; - - private final Optional variables; - - private ContentsGetGraphQlBatchRequest( - Optional unpublished, - Optional query, - Optional operationName, - Optional variables) { - this.unpublished = unpublished; - this.query = query; - this.operationName = operationName; - this.variables = variables; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The query string. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return The optional operation name. - */ - @JsonProperty("operationName") - public Optional getOperationName() { - return operationName; - } - - /** - * @return The optional variables. - */ - @JsonProperty("variables") - public Optional getVariables() { - return variables; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetGraphQlBatchRequest && equalTo((ContentsGetGraphQlBatchRequest) other); - } - - private boolean equalTo(ContentsGetGraphQlBatchRequest other) { - return unpublished.equals(other.unpublished) - && query.equals(other.query) - && operationName.equals(other.operationName) - && variables.equals(other.variables); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.query, this.operationName, this.variables); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional query = Optional.empty(); - - private Optional operationName = Optional.empty(); - - private Optional variables = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetGraphQlBatchRequest other) { - unpublished(other.getUnpublished()); - query(other.getQuery()); - operationName(other.getOperationName()); - variables(other.getVariables()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "operationName", nulls = Nulls.SKIP) - public Builder operationName(Optional operationName) { - this.operationName = operationName; - return this; - } - - public Builder operationName(String operationName) { - this.operationName = Optional.of(operationName); - return this; - } - - @JsonSetter(value = "variables", nulls = Nulls.SKIP) - public Builder variables(Optional variables) { - this.variables = variables; - return this; - } - - public Builder variables(String variables) { - this.variables = Optional.of(variables); - return this; - } - - public ContentsGetGraphQlBatchRequest build() { - return new ContentsGetGraphQlBatchRequest(unpublished, query, operationName, variables); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetGraphQlRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetGraphQlRequest.java deleted file mode 100644 index 115b8e7..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetGraphQlRequest.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetGraphQlRequest.Builder.class) -public final class ContentsGetGraphQlRequest { - private final Optional unpublished; - - private final Optional query; - - private final Optional operationName; - - private final Optional variables; - - private ContentsGetGraphQlRequest( - Optional unpublished, - Optional query, - Optional operationName, - Optional variables) { - this.unpublished = unpublished; - this.query = query; - this.operationName = operationName; - this.variables = variables; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The query string. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return The optional operation name. - */ - @JsonProperty("operationName") - public Optional getOperationName() { - return operationName; - } - - /** - * @return The optional variables. - */ - @JsonProperty("variables") - public Optional getVariables() { - return variables; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetGraphQlRequest && equalTo((ContentsGetGraphQlRequest) other); - } - - private boolean equalTo(ContentsGetGraphQlRequest other) { - return unpublished.equals(other.unpublished) - && query.equals(other.query) - && operationName.equals(other.operationName) - && variables.equals(other.variables); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.query, this.operationName, this.variables); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional query = Optional.empty(); - - private Optional operationName = Optional.empty(); - - private Optional variables = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetGraphQlRequest other) { - unpublished(other.getUnpublished()); - query(other.getQuery()); - operationName(other.getOperationName()); - variables(other.getVariables()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "operationName", nulls = Nulls.SKIP) - public Builder operationName(Optional operationName) { - this.operationName = operationName; - return this; - } - - public Builder operationName(String operationName) { - this.operationName = Optional.of(operationName); - return this; - } - - @JsonSetter(value = "variables", nulls = Nulls.SKIP) - public Builder variables(Optional variables) { - this.variables = variables; - return this; - } - - public Builder variables(String variables) { - this.variables = Optional.of(variables); - return this; - } - - public ContentsGetGraphQlRequest build() { - return new ContentsGetGraphQlRequest(unpublished, query, operationName, variables); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencesRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencesRequest.java deleted file mode 100644 index f0c0535..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencesRequest.java +++ /dev/null @@ -1,247 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetReferencesRequest.Builder.class) -public final class ContentsGetReferencesRequest { - private final Optional fields; - - private final Optional flatten; - - private final Optional languages; - - private final Optional unpublished; - - private final Optional noSlowTotal; - - private final Optional noTotal; - - private final Optional q; - - private ContentsGetReferencesRequest( - Optional fields, - Optional flatten, - Optional languages, - Optional unpublished, - Optional noSlowTotal, - Optional noTotal, - Optional q) { - this.fields = fields; - this.flatten = flatten; - this.languages = languages; - this.unpublished = unpublished; - this.noSlowTotal = noSlowTotal; - this.noTotal = noTotal; - this.q = q; - } - - /** - * @return The list of content fields (comma-separated). - */ - @JsonProperty("X-Fields") - public Optional getFields() { - return fields; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return The optional json query. - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetReferencesRequest && equalTo((ContentsGetReferencesRequest) other); - } - - private boolean equalTo(ContentsGetReferencesRequest other) { - return fields.equals(other.fields) - && flatten.equals(other.flatten) - && languages.equals(other.languages) - && unpublished.equals(other.unpublished) - && noSlowTotal.equals(other.noSlowTotal) - && noTotal.equals(other.noTotal) - && q.equals(other.q); - } - - @Override - public int hashCode() { - return Objects.hash( - this.fields, this.flatten, this.languages, this.unpublished, this.noSlowTotal, this.noTotal, this.q); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional fields = Optional.empty(); - - private Optional flatten = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Optional q = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetReferencesRequest other) { - fields(other.getFields()); - flatten(other.getFlatten()); - languages(other.getLanguages()); - unpublished(other.getUnpublished()); - noSlowTotal(other.getNoSlowTotal()); - noTotal(other.getNoTotal()); - q(other.getQ()); - return this; - } - - @JsonSetter(value = "X-Fields", nulls = Nulls.SKIP) - public Builder fields(Optional fields) { - this.fields = fields; - return this; - } - - public Builder fields(String fields) { - this.fields = Optional.of(fields); - return this; - } - - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public Builder flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - public Builder flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public Builder noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - public Builder noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public Builder noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - public Builder noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(String q) { - this.q = Optional.of(q); - return this; - } - - public ContentsGetReferencesRequest build() { - return new ContentsGetReferencesRequest(fields, flatten, languages, unpublished, noSlowTotal, noTotal, q); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencingRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencingRequest.java deleted file mode 100644 index c786b3b..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencingRequest.java +++ /dev/null @@ -1,247 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsGetReferencingRequest.Builder.class) -public final class ContentsGetReferencingRequest { - private final Optional fields; - - private final Optional flatten; - - private final Optional languages; - - private final Optional unpublished; - - private final Optional noSlowTotal; - - private final Optional noTotal; - - private final Optional q; - - private ContentsGetReferencingRequest( - Optional fields, - Optional flatten, - Optional languages, - Optional unpublished, - Optional noSlowTotal, - Optional noTotal, - Optional q) { - this.fields = fields; - this.flatten = flatten; - this.languages = languages; - this.unpublished = unpublished; - this.noSlowTotal = noSlowTotal; - this.noTotal = noTotal; - this.q = q; - } - - /** - * @return The list of content fields (comma-separated). - */ - @JsonProperty("X-Fields") - public Optional getFields() { - return fields; - } - - /** - * @return Provide the data as flat object. - */ - @JsonProperty("X-Flatten") - public Optional getFlatten() { - return flatten; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return Do not return the total amount, if it would be slow. - */ - @JsonProperty("X-NoSlowTotal") - public Optional getNoSlowTotal() { - return noSlowTotal; - } - - /** - * @return Do not return the total amount. - */ - @JsonProperty("X-NoTotal") - public Optional getNoTotal() { - return noTotal; - } - - /** - * @return The optional json query. - */ - @JsonProperty("q") - public Optional getQ() { - return q; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsGetReferencingRequest && equalTo((ContentsGetReferencingRequest) other); - } - - private boolean equalTo(ContentsGetReferencingRequest other) { - return fields.equals(other.fields) - && flatten.equals(other.flatten) - && languages.equals(other.languages) - && unpublished.equals(other.unpublished) - && noSlowTotal.equals(other.noSlowTotal) - && noTotal.equals(other.noTotal) - && q.equals(other.q); - } - - @Override - public int hashCode() { - return Objects.hash( - this.fields, this.flatten, this.languages, this.unpublished, this.noSlowTotal, this.noTotal, this.q); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional fields = Optional.empty(); - - private Optional flatten = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional unpublished = Optional.empty(); - - private Optional noSlowTotal = Optional.empty(); - - private Optional noTotal = Optional.empty(); - - private Optional q = Optional.empty(); - - private Builder() {} - - public Builder from(ContentsGetReferencingRequest other) { - fields(other.getFields()); - flatten(other.getFlatten()); - languages(other.getLanguages()); - unpublished(other.getUnpublished()); - noSlowTotal(other.getNoSlowTotal()); - noTotal(other.getNoTotal()); - q(other.getQ()); - return this; - } - - @JsonSetter(value = "X-Fields", nulls = Nulls.SKIP) - public Builder fields(Optional fields) { - this.fields = fields; - return this; - } - - public Builder fields(String fields) { - this.fields = Optional.of(fields); - return this; - } - - @JsonSetter(value = "X-Flatten", nulls = Nulls.SKIP) - public Builder flatten(Optional flatten) { - this.flatten = flatten; - return this; - } - - public Builder flatten(Boolean flatten) { - this.flatten = Optional.of(flatten); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-NoSlowTotal", nulls = Nulls.SKIP) - public Builder noSlowTotal(Optional noSlowTotal) { - this.noSlowTotal = noSlowTotal; - return this; - } - - public Builder noSlowTotal(Boolean noSlowTotal) { - this.noSlowTotal = Optional.of(noSlowTotal); - return this; - } - - @JsonSetter(value = "X-NoTotal", nulls = Nulls.SKIP) - public Builder noTotal(Optional noTotal) { - this.noTotal = noTotal; - return this; - } - - public Builder noTotal(Boolean noTotal) { - this.noTotal = Optional.of(noTotal); - return this; - } - - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; - } - - public Builder q(String q) { - this.q = Optional.of(q); - return this; - } - - public ContentsGetReferencingRequest build() { - return new ContentsGetReferencingRequest(fields, flatten, languages, unpublished, noSlowTotal, noTotal, q); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPatchContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPatchContentRequest.java deleted file mode 100644 index 094416c..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPatchContentRequest.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsPatchContentRequest.Builder.class) -public final class ContentsPatchContentRequest { - private final Optional unpublished; - - private final Optional languages; - - private final Map> body; - - private ContentsPatchContentRequest( - Optional unpublished, Optional languages, Map> body) { - this.unpublished = unpublished; - this.languages = languages; - this.body = body; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @JsonProperty("body") - public Map> getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsPatchContentRequest && equalTo((ContentsPatchContentRequest) other); - } - - private boolean equalTo(ContentsPatchContentRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages) && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages, this.body); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Map> body = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(ContentsPatchContentRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - body(other.getBody()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Map> body) { - this.body.clear(); - this.body.putAll(body); - return this; - } - - public Builder putAllBody(Map> body) { - this.body.putAll(body); - return this; - } - - public Builder body(String key, Map value) { - this.body.put(key, value); - return this; - } - - public ContentsPatchContentRequest build() { - return new ContentsPatchContentRequest(unpublished, languages, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostContentRequest.java deleted file mode 100644 index e1df1b6..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostContentRequest.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsPostContentRequest.Builder.class) -public final class ContentsPostContentRequest { - private final Optional unpublished; - - private final Optional languages; - - private final Optional status; - - private final Optional id; - - private final Optional publish; - - private final Map> body; - - private ContentsPostContentRequest( - Optional unpublished, - Optional languages, - Optional status, - Optional id, - Optional publish, - Map> body) { - this.unpublished = unpublished; - this.languages = languages; - this.status = status; - this.id = id; - this.publish = publish; - this.body = body; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return The initial status. - */ - @JsonProperty("status") - public Optional getStatus() { - return status; - } - - /** - * @return The optional custom content id. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - /** - * @return True to automatically publish the content. - */ - @JsonProperty("publish") - public Optional getPublish() { - return publish; - } - - @JsonProperty("body") - public Map> getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsPostContentRequest && equalTo((ContentsPostContentRequest) other); - } - - private boolean equalTo(ContentsPostContentRequest other) { - return unpublished.equals(other.unpublished) - && languages.equals(other.languages) - && status.equals(other.status) - && id.equals(other.id) - && publish.equals(other.publish) - && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages, this.status, this.id, this.publish, this.body); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional status = Optional.empty(); - - private Optional id = Optional.empty(); - - private Optional publish = Optional.empty(); - - private Map> body = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(ContentsPostContentRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - status(other.getStatus()); - id(other.getId()); - publish(other.getPublish()); - body(other.getBody()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; - return this; - } - - public Builder status(String status) { - this.status = Optional.of(status); - return this; - } - - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.of(id); - return this; - } - - @JsonSetter(value = "publish", nulls = Nulls.SKIP) - public Builder publish(Optional publish) { - this.publish = publish; - return this; - } - - public Builder publish(Boolean publish) { - this.publish = Optional.of(publish); - return this; - } - - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Map> body) { - this.body.clear(); - this.body.putAll(body); - return this; - } - - public Builder putAllBody(Map> body) { - this.body.putAll(body); - return this; - } - - public Builder body(String key, Map value) { - this.body.put(key, value); - return this; - } - - public ContentsPostContentRequest build() { - return new ContentsPostContentRequest(unpublished, languages, status, id, publish, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostGraphQlBatchRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostGraphQlBatchRequest.java deleted file mode 100644 index 701ef41..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostGraphQlBatchRequest.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsPostGraphQlBatchRequest.Builder.class) -public final class ContentsPostGraphQlBatchRequest { - private final Optional unpublished; - - private final Object body; - - private ContentsPostGraphQlBatchRequest(Optional unpublished, Object body) { - this.unpublished = unpublished; - this.body = body; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - @JsonProperty("body") - public Object getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsPostGraphQlBatchRequest && equalTo((ContentsPostGraphQlBatchRequest) other); - } - - private boolean equalTo(ContentsPostGraphQlBatchRequest other) { - return unpublished.equals(other.unpublished) && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.body); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static BodyStage builder() { - return new Builder(); - } - - public interface BodyStage { - _FinalStage body(Object body); - - Builder from(ContentsPostGraphQlBatchRequest other); - } - - public interface _FinalStage { - ContentsPostGraphQlBatchRequest build(); - - _FinalStage unpublished(Optional unpublished); - - _FinalStage unpublished(Boolean unpublished); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements BodyStage, _FinalStage { - private Object body; - - private Optional unpublished = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ContentsPostGraphQlBatchRequest other) { - unpublished(other.getUnpublished()); - body(other.getBody()); - return this; - } - - @Override - @JsonSetter("body") - public _FinalStage body(Object body) { - this.body = body; - return this; - } - - /** - *

Return unpublished content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @Override - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public _FinalStage unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - @Override - public ContentsPostGraphQlBatchRequest build() { - return new ContentsPostGraphQlBatchRequest(unpublished, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostGraphQlRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostGraphQlRequest.java deleted file mode 100644 index c5484da..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostGraphQlRequest.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsPostGraphQlRequest.Builder.class) -public final class ContentsPostGraphQlRequest { - private final Optional unpublished; - - private final Object body; - - private ContentsPostGraphQlRequest(Optional unpublished, Object body) { - this.unpublished = unpublished; - this.body = body; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - @JsonProperty("body") - public Object getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsPostGraphQlRequest && equalTo((ContentsPostGraphQlRequest) other); - } - - private boolean equalTo(ContentsPostGraphQlRequest other) { - return unpublished.equals(other.unpublished) && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.body); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static BodyStage builder() { - return new Builder(); - } - - public interface BodyStage { - _FinalStage body(Object body); - - Builder from(ContentsPostGraphQlRequest other); - } - - public interface _FinalStage { - ContentsPostGraphQlRequest build(); - - _FinalStage unpublished(Optional unpublished); - - _FinalStage unpublished(Boolean unpublished); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements BodyStage, _FinalStage { - private Object body; - - private Optional unpublished = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ContentsPostGraphQlRequest other) { - unpublished(other.getUnpublished()); - body(other.getBody()); - return this; - } - - @Override - @JsonSetter("body") - public _FinalStage body(Object body) { - this.body = body; - return this; - } - - /** - *

Return unpublished content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @Override - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public _FinalStage unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - @Override - public ContentsPostGraphQlRequest build() { - return new ContentsPostGraphQlRequest(unpublished, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostUpsertContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostUpsertContentRequest.java deleted file mode 100644 index add6809..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostUpsertContentRequest.java +++ /dev/null @@ -1,224 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsPostUpsertContentRequest.Builder.class) -public final class ContentsPostUpsertContentRequest { - private final Optional unpublished; - - private final Optional languages; - - private final Optional status; - - private final Optional patch; - - private final Optional publish; - - private final Map> body; - - private ContentsPostUpsertContentRequest( - Optional unpublished, - Optional languages, - Optional status, - Optional patch, - Optional publish, - Map> body) { - this.unpublished = unpublished; - this.languages = languages; - this.status = status; - this.patch = patch; - this.publish = publish; - this.body = body; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - /** - * @return The initial status. - */ - @JsonProperty("status") - public Optional getStatus() { - return status; - } - - /** - * @return Makes the update as patch. - */ - @JsonProperty("patch") - public Optional getPatch() { - return patch; - } - - /** - * @return True to automatically publish the content. - */ - @JsonProperty("publish") - public Optional getPublish() { - return publish; - } - - @JsonProperty("body") - public Map> getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsPostUpsertContentRequest && equalTo((ContentsPostUpsertContentRequest) other); - } - - private boolean equalTo(ContentsPostUpsertContentRequest other) { - return unpublished.equals(other.unpublished) - && languages.equals(other.languages) - && status.equals(other.status) - && patch.equals(other.patch) - && publish.equals(other.publish) - && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages, this.status, this.patch, this.publish, this.body); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Optional status = Optional.empty(); - - private Optional patch = Optional.empty(); - - private Optional publish = Optional.empty(); - - private Map> body = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(ContentsPostUpsertContentRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - status(other.getStatus()); - patch(other.getPatch()); - publish(other.getPublish()); - body(other.getBody()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; - return this; - } - - public Builder status(String status) { - this.status = Optional.of(status); - return this; - } - - @JsonSetter(value = "patch", nulls = Nulls.SKIP) - public Builder patch(Optional patch) { - this.patch = patch; - return this; - } - - public Builder patch(Boolean patch) { - this.patch = Optional.of(patch); - return this; - } - - @JsonSetter(value = "publish", nulls = Nulls.SKIP) - public Builder publish(Optional publish) { - this.publish = publish; - return this; - } - - public Builder publish(Boolean publish) { - this.publish = Optional.of(publish); - return this; - } - - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Map> body) { - this.body.clear(); - this.body.putAll(body); - return this; - } - - public Builder putAllBody(Map> body) { - this.body.putAll(body); - return this; - } - - public Builder body(String key, Map value) { - this.body.put(key, value); - return this; - } - - public ContentsPostUpsertContentRequest build() { - return new ContentsPostUpsertContentRequest(unpublished, languages, status, patch, publish, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPutContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPutContentRequest.java deleted file mode 100644 index 7a38fad..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ContentsPutContentRequest.java +++ /dev/null @@ -1,139 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsPutContentRequest.Builder.class) -public final class ContentsPutContentRequest { - private final Optional unpublished; - - private final Optional languages; - - private final Map> body; - - private ContentsPutContentRequest( - Optional unpublished, Optional languages, Map> body) { - this.unpublished = unpublished; - this.languages = languages; - this.body = body; - } - - /** - * @return Return unpublished content items. - */ - @JsonProperty("X-Unpublished") - public Optional getUnpublished() { - return unpublished; - } - - /** - * @return The list of languages to resolve (comma-separated). - */ - @JsonProperty("X-Languages") - public Optional getLanguages() { - return languages; - } - - @JsonProperty("body") - public Map> getBody() { - return body; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsPutContentRequest && equalTo((ContentsPutContentRequest) other); - } - - private boolean equalTo(ContentsPutContentRequest other) { - return unpublished.equals(other.unpublished) && languages.equals(other.languages) && body.equals(other.body); - } - - @Override - public int hashCode() { - return Objects.hash(this.unpublished, this.languages, this.body); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional unpublished = Optional.empty(); - - private Optional languages = Optional.empty(); - - private Map> body = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(ContentsPutContentRequest other) { - unpublished(other.getUnpublished()); - languages(other.getLanguages()); - body(other.getBody()); - return this; - } - - @JsonSetter(value = "X-Unpublished", nulls = Nulls.SKIP) - public Builder unpublished(Optional unpublished) { - this.unpublished = unpublished; - return this; - } - - public Builder unpublished(Boolean unpublished) { - this.unpublished = Optional.of(unpublished); - return this; - } - - @JsonSetter(value = "X-Languages", nulls = Nulls.SKIP) - public Builder languages(Optional languages) { - this.languages = languages; - return this; - } - - public Builder languages(String languages) { - this.languages = Optional.of(languages); - return this; - } - - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Map> body) { - this.body.clear(); - this.body.putAll(body); - return this; - } - - public Builder putAllBody(Map> body) { - this.body.putAll(body); - return this; - } - - public Builder body(String key, Map value) { - this.body.put(key, value); - return this; - } - - public ContentsPutContentRequest build() { - return new ContentsPutContentRequest(unpublished, languages, body); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/ImportContentsDto.java b/src/main/java/com/squidex/api/resources/contents/requests/ImportContentsDto.java deleted file mode 100644 index 11d1395..0000000 --- a/src/main/java/com/squidex/api/resources/contents/requests/ImportContentsDto.java +++ /dev/null @@ -1,174 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.contents.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ImportContentsDto.Builder.class) -public final class ImportContentsDto { - private final List>> datas; - - private final Optional publish; - - private final Optional doNotScript; - - private final Optional optimizeValidation; - - private ImportContentsDto( - List>> datas, - Optional publish, - Optional doNotScript, - Optional optimizeValidation) { - this.datas = datas; - this.publish = publish; - this.doNotScript = doNotScript; - this.optimizeValidation = optimizeValidation; - } - - /** - * @return The data to import. - */ - @JsonProperty("datas") - public List>> getDatas() { - return datas; - } - - /** - * @return True to automatically publish the content. - */ - @JsonProperty("publish") - public Optional getPublish() { - return publish; - } - - /** - * @return True to turn off scripting for faster inserts. Default: true. - */ - @JsonProperty("doNotScript") - public Optional getDoNotScript() { - return doNotScript; - } - - /** - * @return True to turn off costly validation: Unique checks, asset checks and reference checks. Default: true. - */ - @JsonProperty("optimizeValidation") - public Optional getOptimizeValidation() { - return optimizeValidation; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ImportContentsDto && equalTo((ImportContentsDto) other); - } - - private boolean equalTo(ImportContentsDto other) { - return datas.equals(other.datas) - && publish.equals(other.publish) - && doNotScript.equals(other.doNotScript) - && optimizeValidation.equals(other.optimizeValidation); - } - - @Override - public int hashCode() { - return Objects.hash(this.datas, this.publish, this.doNotScript, this.optimizeValidation); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private List>> datas = new ArrayList<>(); - - private Optional publish = Optional.empty(); - - private Optional doNotScript = Optional.empty(); - - private Optional optimizeValidation = Optional.empty(); - - private Builder() {} - - public Builder from(ImportContentsDto other) { - datas(other.getDatas()); - publish(other.getPublish()); - doNotScript(other.getDoNotScript()); - optimizeValidation(other.getOptimizeValidation()); - return this; - } - - @JsonSetter(value = "datas", nulls = Nulls.SKIP) - public Builder datas(List>> datas) { - this.datas.clear(); - this.datas.addAll(datas); - return this; - } - - public Builder addDatas(Map> datas) { - this.datas.add(datas); - return this; - } - - public Builder addAllDatas(List>> datas) { - this.datas.addAll(datas); - return this; - } - - @JsonSetter(value = "publish", nulls = Nulls.SKIP) - public Builder publish(Optional publish) { - this.publish = publish; - return this; - } - - public Builder publish(Boolean publish) { - this.publish = Optional.of(publish); - return this; - } - - @JsonSetter(value = "doNotScript", nulls = Nulls.SKIP) - public Builder doNotScript(Optional doNotScript) { - this.doNotScript = doNotScript; - return this; - } - - public Builder doNotScript(Boolean doNotScript) { - this.doNotScript = Optional.of(doNotScript); - return this; - } - - @JsonSetter(value = "optimizeValidation", nulls = Nulls.SKIP) - public Builder optimizeValidation(Optional optimizeValidation) { - this.optimizeValidation = optimizeValidation; - return this; - } - - public Builder optimizeValidation(Boolean optimizeValidation) { - this.optimizeValidation = Optional.of(optimizeValidation); - return this; - } - - public ImportContentsDto build() { - return new ImportContentsDto(datas, publish, doNotScript, optimizeValidation); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/diagnostics/DiagnosticsClient.java b/src/main/java/com/squidex/api/resources/diagnostics/DiagnosticsClient.java deleted file mode 100644 index 06af994..0000000 --- a/src/main/java/com/squidex/api/resources/diagnostics/DiagnosticsClient.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.diagnostics; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class DiagnosticsClient { - protected final ClientOptions clientOptions; - - public DiagnosticsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public void getDump(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/diagnostics/dump") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void getDump() { - getDump(null); - } - - public void getGcDump(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/diagnostics/gcdump") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void getGcDump() { - getGcDump(null); - } -} diff --git a/src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java b/src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java deleted file mode 100644 index 62f56c9..0000000 --- a/src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java +++ /dev/null @@ -1,146 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.eventconsumers; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.types.EventConsumerDto; -import com.squidex.api.types.EventConsumersDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class EventConsumersClient { - protected final ClientOptions clientOptions; - - public EventConsumersClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public EventConsumersDto getEventConsumers(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/event-consumers") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), EventConsumersDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public EventConsumersDto getEventConsumers() { - return getEventConsumers(null); - } - - public EventConsumerDto startEventConsumer(String consumerName, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/event-consumers") - .addPathSegment(consumerName) - .addPathSegments("start") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), EventConsumerDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public EventConsumerDto startEventConsumer(String consumerName) { - return startEventConsumer(consumerName, null); - } - - public EventConsumerDto stopEventConsumer(String consumerName, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/event-consumers") - .addPathSegment(consumerName) - .addPathSegments("stop") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), EventConsumerDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public EventConsumerDto stopEventConsumer(String consumerName) { - return stopEventConsumer(consumerName, null); - } - - public EventConsumerDto resetEventConsumer(String consumerName, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/event-consumers") - .addPathSegment(consumerName) - .addPathSegments("reset") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), EventConsumerDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public EventConsumerDto resetEventConsumer(String consumerName) { - return resetEventConsumer(consumerName, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/history/HistoryClient.java b/src/main/java/com/squidex/api/resources/history/HistoryClient.java deleted file mode 100644 index fa9d99b..0000000 --- a/src/main/java/com/squidex/api/resources/history/HistoryClient.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.history; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.history.requests.HistoryGetAppHistoryRequest; -import com.squidex.api.resources.history.requests.HistoryGetTeamHistoryRequest; -import com.squidex.api.types.HistoryEventDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class HistoryClient { - protected final ClientOptions clientOptions; - - public HistoryClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public List getAppHistory() { - return getAppHistory(HistoryGetAppHistoryRequest.builder().build()); - } - - public List getAppHistory(HistoryGetAppHistoryRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("history"); - if (request.getChannel().isPresent()) { - httpUrl.addQueryParameter("channel", request.getChannel().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getAppHistory(HistoryGetAppHistoryRequest request) { - return getAppHistory(request, null); - } - - public List getTeamHistory(String team) { - return getTeamHistory(team, HistoryGetTeamHistoryRequest.builder().build()); - } - - public List getTeamHistory( - String team, HistoryGetTeamHistoryRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("history"); - if (request.getChannel().isPresent()) { - httpUrl.addQueryParameter("channel", request.getChannel().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getTeamHistory(String team, HistoryGetTeamHistoryRequest request) { - return getTeamHistory(team, request, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/history/requests/HistoryGetAppHistoryRequest.java b/src/main/java/com/squidex/api/resources/history/requests/HistoryGetAppHistoryRequest.java deleted file mode 100644 index d8bab86..0000000 --- a/src/main/java/com/squidex/api/resources/history/requests/HistoryGetAppHistoryRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.history.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = HistoryGetAppHistoryRequest.Builder.class) -public final class HistoryGetAppHistoryRequest { - private final Optional channel; - - private HistoryGetAppHistoryRequest(Optional channel) { - this.channel = channel; - } - - /** - * @return The name of the channel. - */ - @JsonProperty("channel") - public Optional getChannel() { - return channel; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof HistoryGetAppHistoryRequest && equalTo((HistoryGetAppHistoryRequest) other); - } - - private boolean equalTo(HistoryGetAppHistoryRequest other) { - return channel.equals(other.channel); - } - - @Override - public int hashCode() { - return Objects.hash(this.channel); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional channel = Optional.empty(); - - private Builder() {} - - public Builder from(HistoryGetAppHistoryRequest other) { - channel(other.getChannel()); - return this; - } - - @JsonSetter(value = "channel", nulls = Nulls.SKIP) - public Builder channel(Optional channel) { - this.channel = channel; - return this; - } - - public Builder channel(String channel) { - this.channel = Optional.of(channel); - return this; - } - - public HistoryGetAppHistoryRequest build() { - return new HistoryGetAppHistoryRequest(channel); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/history/requests/HistoryGetTeamHistoryRequest.java b/src/main/java/com/squidex/api/resources/history/requests/HistoryGetTeamHistoryRequest.java deleted file mode 100644 index f5cf79f..0000000 --- a/src/main/java/com/squidex/api/resources/history/requests/HistoryGetTeamHistoryRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.history.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = HistoryGetTeamHistoryRequest.Builder.class) -public final class HistoryGetTeamHistoryRequest { - private final Optional channel; - - private HistoryGetTeamHistoryRequest(Optional channel) { - this.channel = channel; - } - - /** - * @return The name of the channel. - */ - @JsonProperty("channel") - public Optional getChannel() { - return channel; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof HistoryGetTeamHistoryRequest && equalTo((HistoryGetTeamHistoryRequest) other); - } - - private boolean equalTo(HistoryGetTeamHistoryRequest other) { - return channel.equals(other.channel); - } - - @Override - public int hashCode() { - return Objects.hash(this.channel); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional channel = Optional.empty(); - - private Builder() {} - - public Builder from(HistoryGetTeamHistoryRequest other) { - channel(other.getChannel()); - return this; - } - - @JsonSetter(value = "channel", nulls = Nulls.SKIP) - public Builder channel(Optional channel) { - this.channel = channel; - return this; - } - - public Builder channel(String channel) { - this.channel = Optional.of(channel); - return this; - } - - public HistoryGetTeamHistoryRequest build() { - return new HistoryGetTeamHistoryRequest(channel); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/languages/LanguagesClient.java b/src/main/java/com/squidex/api/resources/languages/LanguagesClient.java deleted file mode 100644 index d798fd6..0000000 --- a/src/main/java/com/squidex/api/resources/languages/LanguagesClient.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.languages; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.types.LanguageDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class LanguagesClient { - protected final ClientOptions clientOptions; - - public LanguagesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Provide a list of supported language codes, following the ISO2Code standard. - */ - public List getLanguages(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/languages") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Provide a list of supported language codes, following the ISO2Code standard. - */ - public List getLanguages() { - return getLanguages(null); - } -} diff --git a/src/main/java/com/squidex/api/resources/news/NewsClient.java b/src/main/java/com/squidex/api/resources/news/NewsClient.java deleted file mode 100644 index 0870878..0000000 --- a/src/main/java/com/squidex/api/resources/news/NewsClient.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.news; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.news.requests.NewsGetNewsRequest; -import com.squidex.api.types.FeaturesDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class NewsClient { - protected final ClientOptions clientOptions; - - public NewsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public FeaturesDto getNews() { - return getNews(NewsGetNewsRequest.builder().build()); - } - - public FeaturesDto getNews(NewsGetNewsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/news/features"); - if (request.getVersion().isPresent()) { - httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), FeaturesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public FeaturesDto getNews(NewsGetNewsRequest request) { - return getNews(request, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/news/requests/NewsGetNewsRequest.java b/src/main/java/com/squidex/api/resources/news/requests/NewsGetNewsRequest.java deleted file mode 100644 index e6f9f82..0000000 --- a/src/main/java/com/squidex/api/resources/news/requests/NewsGetNewsRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.news.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = NewsGetNewsRequest.Builder.class) -public final class NewsGetNewsRequest { - private final Optional version; - - private NewsGetNewsRequest(Optional version) { - this.version = version; - } - - /** - * @return The latest received version. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NewsGetNewsRequest && equalTo((NewsGetNewsRequest) other); - } - - private boolean equalTo(NewsGetNewsRequest other) { - return version.equals(other.version); - } - - @Override - public int hashCode() { - return Objects.hash(this.version); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional version = Optional.empty(); - - private Builder() {} - - public Builder from(NewsGetNewsRequest other) { - version(other.getVersion()); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - public NewsGetNewsRequest build() { - return new NewsGetNewsRequest(version); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/notifications/NotificationsClient.java b/src/main/java/com/squidex/api/resources/notifications/NotificationsClient.java deleted file mode 100644 index 45135d9..0000000 --- a/src/main/java/com/squidex/api/resources/notifications/NotificationsClient.java +++ /dev/null @@ -1,103 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.notifications; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.notifications.requests.NotificationsGetNotificationsRequest; -import com.squidex.api.types.CommentsDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class NotificationsClient { - protected final ClientOptions clientOptions; - - public NotificationsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * When passing in a version you can retrieve all updates since then. - */ - public CommentsDto getNotifications(String userId) { - return getNotifications( - userId, NotificationsGetNotificationsRequest.builder().build()); - } - - /** - * When passing in a version you can retrieve all updates since then. - */ - public CommentsDto getNotifications( - String userId, NotificationsGetNotificationsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/users") - .addPathSegment(userId) - .addPathSegments("notifications"); - if (request.getVersion().isPresent()) { - httpUrl.addQueryParameter("version", request.getVersion().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), CommentsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * When passing in a version you can retrieve all updates since then. - */ - public CommentsDto getNotifications(String userId, NotificationsGetNotificationsRequest request) { - return getNotifications(userId, request, null); - } - - public void deleteComment(String userId, String commentId, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/users") - .addPathSegment(userId) - .addPathSegments("notifications") - .addPathSegment(commentId) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteComment(String userId, String commentId) { - deleteComment(userId, commentId, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/notifications/requests/NotificationsGetNotificationsRequest.java b/src/main/java/com/squidex/api/resources/notifications/requests/NotificationsGetNotificationsRequest.java deleted file mode 100644 index 4fac0e3..0000000 --- a/src/main/java/com/squidex/api/resources/notifications/requests/NotificationsGetNotificationsRequest.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.notifications.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = NotificationsGetNotificationsRequest.Builder.class) -public final class NotificationsGetNotificationsRequest { - private final Optional version; - - private NotificationsGetNotificationsRequest(Optional version) { - this.version = version; - } - - /** - * @return The current version. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NotificationsGetNotificationsRequest - && equalTo((NotificationsGetNotificationsRequest) other); - } - - private boolean equalTo(NotificationsGetNotificationsRequest other) { - return version.equals(other.version); - } - - @Override - public int hashCode() { - return Objects.hash(this.version); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional version = Optional.empty(); - - private Builder() {} - - public Builder from(NotificationsGetNotificationsRequest other) { - version(other.getVersion()); - return this; - } - - @JsonSetter(value = "version", nulls = Nulls.SKIP) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(Integer version) { - this.version = Optional.of(version); - return this; - } - - public NotificationsGetNotificationsRequest build() { - return new NotificationsGetNotificationsRequest(version); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/ping/PingClient.java b/src/main/java/com/squidex/api/resources/ping/PingClient.java deleted file mode 100644 index c06b29b..0000000 --- a/src/main/java/com/squidex/api/resources/ping/PingClient.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.ping; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import java.io.IOException; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class PingClient { - protected final ClientOptions clientOptions; - - public PingClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public Map getInfo(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/info") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Map getInfo() { - return getInfo(null); - } - - /** - * Can be used to test, if the Squidex API is alive and responding. - */ - public void getPing(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/ping") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Can be used to test, if the Squidex API is alive and responding. - */ - public void getPing() { - getPing(null); - } - - /** - * Can be used to test, if the Squidex API is alive and responding. - */ - public void getAppPing(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/ping") - .addPathSegment(clientOptions.appName()) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Can be used to test, if the Squidex API is alive and responding. - */ - public void getAppPing() { - getAppPing(null); - } -} diff --git a/src/main/java/com/squidex/api/resources/plans/PlansClient.java b/src/main/java/com/squidex/api/resources/plans/PlansClient.java deleted file mode 100644 index 6ee6d64..0000000 --- a/src/main/java/com/squidex/api/resources/plans/PlansClient.java +++ /dev/null @@ -1,165 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.plans; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.types.ChangePlanDto; -import com.squidex.api.types.PlanChangedDto; -import com.squidex.api.types.PlansDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class PlansClient { - protected final ClientOptions clientOptions; - - public PlansClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public PlansDto getPlans(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("plans") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), PlansDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public PlansDto getPlans() { - return getPlans(null); - } - - public PlanChangedDto putPlan(ChangePlanDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("plan") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), PlanChangedDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public PlanChangedDto putPlan(ChangePlanDto request) { - return putPlan(request, null); - } - - public PlansDto getTeamPlans(String team, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("plans") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), PlansDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public PlansDto getTeamPlans(String team) { - return getTeamPlans(team, null); - } - - public PlanChangedDto putTeamPlan(String team, ChangePlanDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("plan") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), PlanChangedDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public PlanChangedDto putTeamPlan(String team, ChangePlanDto request) { - return putTeamPlan(team, request, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/rules/RulesClient.java b/src/main/java/com/squidex/api/resources/rules/RulesClient.java deleted file mode 100644 index f27b9a6..0000000 --- a/src/main/java/com/squidex/api/resources/rules/RulesClient.java +++ /dev/null @@ -1,674 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.rules; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.rules.requests.RulesGetEventsRequest; -import com.squidex.api.resources.rules.requests.RulesPutRuleRunRequest; -import com.squidex.api.resources.rules.requests.UpdateRuleDto; -import com.squidex.api.types.CreateRuleDto; -import com.squidex.api.types.RuleDto; -import com.squidex.api.types.RuleElementDto; -import com.squidex.api.types.RuleEventsDto; -import com.squidex.api.types.RulesDto; -import com.squidex.api.types.SimulatedRuleEventsDto; -import java.io.IOException; -import java.util.List; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class RulesClient { - protected final ClientOptions clientOptions; - - public RulesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public Map getActions(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/rules/actions") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Map getActions() { - return getActions(null); - } - - public RulesDto getRules(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RulesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RulesDto getRules() { - return getRules(null); - } - - public RuleDto postRule(CreateRuleDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RuleDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RuleDto postRule(CreateRuleDto request) { - return postRule(request, null); - } - - public void deleteRuleRun(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/run") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteRuleRun() { - deleteRuleRun(null); - } - - public RuleDto putRule(String id) { - return putRule(id, UpdateRuleDto.builder().build()); - } - - public RuleDto putRule(String id, UpdateRuleDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RuleDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RuleDto putRule(String id, UpdateRuleDto request) { - return putRule(id, request, null); - } - - public void deleteRule(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteRule(String id) { - deleteRule(id, null); - } - - public RuleDto enableRule(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("enable") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RuleDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RuleDto enableRule(String id) { - return enableRule(id, null); - } - - public RuleDto disableRule(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("disable") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RuleDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RuleDto disableRule(String id) { - return disableRule(id, null); - } - - public void triggerRule(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("trigger") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void triggerRule(String id) { - triggerRule(id, null); - } - - public void putRuleRun(String id) { - putRuleRun(id, RulesPutRuleRunRequest.builder().build()); - } - - public void putRuleRun(String id, RulesPutRuleRunRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("run"); - if (request.getFromSnapshots().isPresent()) { - httpUrl.addQueryParameter( - "fromSnapshots", request.getFromSnapshots().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void putRuleRun(String id, RulesPutRuleRunRequest request) { - putRuleRun(id, request, null); - } - - public void deleteRuleEvents(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("events") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteRuleEvents(String id) { - deleteRuleEvents(id, null); - } - - public SimulatedRuleEventsDto simulatePost(CreateRuleDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/simulate") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SimulatedRuleEventsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SimulatedRuleEventsDto simulatePost(CreateRuleDto request) { - return simulatePost(request, null); - } - - public SimulatedRuleEventsDto simulateGet(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules") - .addPathSegment(id) - .addPathSegments("simulate") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SimulatedRuleEventsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SimulatedRuleEventsDto simulateGet(String id) { - return simulateGet(id, null); - } - - public RuleEventsDto getEvents() { - return getEvents(RulesGetEventsRequest.builder().build()); - } - - public RuleEventsDto getEvents(RulesGetEventsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/events"); - if (request.getRuleId().isPresent()) { - httpUrl.addQueryParameter("ruleId", request.getRuleId().get()); - } - if (request.getSkip().isPresent()) { - httpUrl.addQueryParameter("skip", request.getSkip().get().toString()); - } - if (request.getTake().isPresent()) { - httpUrl.addQueryParameter("take", request.getTake().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), RuleEventsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public RuleEventsDto getEvents(RulesGetEventsRequest request) { - return getEvents(request, null); - } - - public void deleteEvents(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/events") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteEvents() { - deleteEvents(null); - } - - public void putEvent(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/events") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void putEvent(String id) { - putEvent(id, null); - } - - public void deleteEvent(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("rules/events") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteEvent(String id) { - deleteEvent(id, null); - } - - public List getEventTypes(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/rules/eventtypes") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getEventTypes() { - return getEventTypes(null); - } - - public Object getEventSchema(String type, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/rules/eventtypes") - .addPathSegment(type) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public Object getEventSchema(String type) { - return getEventSchema(type, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/rules/requests/RulesGetEventsRequest.java b/src/main/java/com/squidex/api/resources/rules/requests/RulesGetEventsRequest.java deleted file mode 100644 index f972ca6..0000000 --- a/src/main/java/com/squidex/api/resources/rules/requests/RulesGetEventsRequest.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.rules.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RulesGetEventsRequest.Builder.class) -public final class RulesGetEventsRequest { - private final Optional ruleId; - - private final Optional skip; - - private final Optional take; - - private RulesGetEventsRequest(Optional ruleId, Optional skip, Optional take) { - this.ruleId = ruleId; - this.skip = skip; - this.take = take; - } - - /** - * @return The optional rule id to filter to events. - */ - @JsonProperty("ruleId") - public Optional getRuleId() { - return ruleId; - } - - /** - * @return The number of events to skip. - */ - @JsonProperty("skip") - public Optional getSkip() { - return skip; - } - - /** - * @return The number of events to take. - */ - @JsonProperty("take") - public Optional getTake() { - return take; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RulesGetEventsRequest && equalTo((RulesGetEventsRequest) other); - } - - private boolean equalTo(RulesGetEventsRequest other) { - return ruleId.equals(other.ruleId) && skip.equals(other.skip) && take.equals(other.take); - } - - @Override - public int hashCode() { - return Objects.hash(this.ruleId, this.skip, this.take); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional ruleId = Optional.empty(); - - private Optional skip = Optional.empty(); - - private Optional take = Optional.empty(); - - private Builder() {} - - public Builder from(RulesGetEventsRequest other) { - ruleId(other.getRuleId()); - skip(other.getSkip()); - take(other.getTake()); - return this; - } - - @JsonSetter(value = "ruleId", nulls = Nulls.SKIP) - public Builder ruleId(Optional ruleId) { - this.ruleId = ruleId; - return this; - } - - public Builder ruleId(String ruleId) { - this.ruleId = Optional.of(ruleId); - return this; - } - - @JsonSetter(value = "skip", nulls = Nulls.SKIP) - public Builder skip(Optional skip) { - this.skip = skip; - return this; - } - - public Builder skip(Integer skip) { - this.skip = Optional.of(skip); - return this; - } - - @JsonSetter(value = "take", nulls = Nulls.SKIP) - public Builder take(Optional take) { - this.take = take; - return this; - } - - public Builder take(Integer take) { - this.take = Optional.of(take); - return this; - } - - public RulesGetEventsRequest build() { - return new RulesGetEventsRequest(ruleId, skip, take); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/rules/requests/RulesPutRuleRunRequest.java b/src/main/java/com/squidex/api/resources/rules/requests/RulesPutRuleRunRequest.java deleted file mode 100644 index a5c4d92..0000000 --- a/src/main/java/com/squidex/api/resources/rules/requests/RulesPutRuleRunRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.rules.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RulesPutRuleRunRequest.Builder.class) -public final class RulesPutRuleRunRequest { - private final Optional fromSnapshots; - - private RulesPutRuleRunRequest(Optional fromSnapshots) { - this.fromSnapshots = fromSnapshots; - } - - /** - * @return Runs the rule from snapeshots if possible. - */ - @JsonProperty("fromSnapshots") - public Optional getFromSnapshots() { - return fromSnapshots; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RulesPutRuleRunRequest && equalTo((RulesPutRuleRunRequest) other); - } - - private boolean equalTo(RulesPutRuleRunRequest other) { - return fromSnapshots.equals(other.fromSnapshots); - } - - @Override - public int hashCode() { - return Objects.hash(this.fromSnapshots); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional fromSnapshots = Optional.empty(); - - private Builder() {} - - public Builder from(RulesPutRuleRunRequest other) { - fromSnapshots(other.getFromSnapshots()); - return this; - } - - @JsonSetter(value = "fromSnapshots", nulls = Nulls.SKIP) - public Builder fromSnapshots(Optional fromSnapshots) { - this.fromSnapshots = fromSnapshots; - return this; - } - - public Builder fromSnapshots(Boolean fromSnapshots) { - this.fromSnapshots = Optional.of(fromSnapshots); - return this; - } - - public RulesPutRuleRunRequest build() { - return new RulesPutRuleRunRequest(fromSnapshots); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/rules/requests/UpdateRuleDto.java b/src/main/java/com/squidex/api/resources/rules/requests/UpdateRuleDto.java deleted file mode 100644 index 38b6e17..0000000 --- a/src/main/java/com/squidex/api/resources/rules/requests/UpdateRuleDto.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.rules.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.RuleActionDto; -import com.squidex.api.types.RuleTriggerDto; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateRuleDto.Builder.class) -public final class UpdateRuleDto { - private final Optional name; - - private final Optional trigger; - - private final Optional action; - - private final Optional isEnabled; - - private UpdateRuleDto( - Optional name, - Optional trigger, - Optional action, - Optional isEnabled) { - this.name = name; - this.trigger = trigger; - this.action = action; - this.isEnabled = isEnabled; - } - - /** - * @return Optional rule name. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The trigger properties. - */ - @JsonProperty("trigger") - public Optional getTrigger() { - return trigger; - } - - /** - * @return The action properties. - */ - @JsonProperty("action") - public Optional getAction() { - return action; - } - - /** - * @return Enable or disable the rule. - */ - @JsonProperty("isEnabled") - public Optional getIsEnabled() { - return isEnabled; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateRuleDto && equalTo((UpdateRuleDto) other); - } - - private boolean equalTo(UpdateRuleDto other) { - return name.equals(other.name) - && trigger.equals(other.trigger) - && action.equals(other.action) - && isEnabled.equals(other.isEnabled); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.trigger, this.action, this.isEnabled); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional name = Optional.empty(); - - private Optional trigger = Optional.empty(); - - private Optional action = Optional.empty(); - - private Optional isEnabled = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateRuleDto other) { - name(other.getName()); - trigger(other.getTrigger()); - action(other.getAction()); - isEnabled(other.getIsEnabled()); - return this; - } - - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.of(name); - return this; - } - - @JsonSetter(value = "trigger", nulls = Nulls.SKIP) - public Builder trigger(Optional trigger) { - this.trigger = trigger; - return this; - } - - public Builder trigger(RuleTriggerDto trigger) { - this.trigger = Optional.of(trigger); - return this; - } - - @JsonSetter(value = "action", nulls = Nulls.SKIP) - public Builder action(Optional action) { - this.action = action; - return this; - } - - public Builder action(RuleActionDto action) { - this.action = Optional.of(action); - return this; - } - - @JsonSetter(value = "isEnabled", nulls = Nulls.SKIP) - public Builder isEnabled(Optional isEnabled) { - this.isEnabled = isEnabled; - return this; - } - - public Builder isEnabled(Boolean isEnabled) { - this.isEnabled = Optional.of(isEnabled); - return this; - } - - public UpdateRuleDto build() { - return new UpdateRuleDto(name, trigger, action, isEnabled); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/SchemasClient.java b/src/main/java/com/squidex/api/resources/schemas/SchemasClient.java deleted file mode 100644 index 28a35e9..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/SchemasClient.java +++ /dev/null @@ -1,1278 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.schemas; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.schemas.requests.ChangeCategoryDto; -import com.squidex.api.resources.schemas.requests.ConfigureFieldRulesDto; -import com.squidex.api.resources.schemas.requests.ConfigureUiFieldsDto; -import com.squidex.api.resources.schemas.requests.CreateSchemaDto; -import com.squidex.api.resources.schemas.requests.SynchronizeSchemaDto; -import com.squidex.api.resources.schemas.requests.UpdateSchemaDto; -import com.squidex.api.types.AddFieldDto; -import com.squidex.api.types.ReorderFieldsDto; -import com.squidex.api.types.SchemaDto; -import com.squidex.api.types.SchemaScriptsDto; -import com.squidex.api.types.SchemasDto; -import com.squidex.api.types.UpdateFieldDto; -import java.io.IOException; -import java.util.Map; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class SchemasClient { - protected final ClientOptions clientOptions; - - public SchemasClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public SchemaDto postField(String schema, AddFieldDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto postField(String schema, AddFieldDto request) { - return postField(schema, request, null); - } - - public SchemaDto postNestedField(String schema, int parentId, AddFieldDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto postNestedField(String schema, int parentId, AddFieldDto request) { - return postNestedField(schema, parentId, request, null); - } - - public SchemaDto putSchemaUiFields(String schema) { - return putSchemaUiFields(schema, ConfigureUiFieldsDto.builder().build()); - } - - public SchemaDto putSchemaUiFields(String schema, ConfigureUiFieldsDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields/ui") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putSchemaUiFields(String schema, ConfigureUiFieldsDto request) { - return putSchemaUiFields(schema, request, null); - } - - public SchemaDto putSchemaFieldOrdering(String schema, ReorderFieldsDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields/ordering") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putSchemaFieldOrdering(String schema, ReorderFieldsDto request) { - return putSchemaFieldOrdering(schema, request, null); - } - - public SchemaDto putNestedFieldOrdering( - String schema, int parentId, ReorderFieldsDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested/ordering") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putNestedFieldOrdering(String schema, int parentId, ReorderFieldsDto request) { - return putNestedFieldOrdering(schema, parentId, request, null); - } - - public SchemaDto putField(String schema, int id, UpdateFieldDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putField(String schema, int id, UpdateFieldDto request) { - return putField(schema, id, request, null); - } - - public SchemaDto deleteField(String schema, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto deleteField(String schema, int id) { - return deleteField(schema, id, null); - } - - public SchemaDto putNestedField( - String schema, int parentId, int id, UpdateFieldDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putNestedField(String schema, int parentId, int id, UpdateFieldDto request) { - return putNestedField(schema, parentId, id, request, null); - } - - public SchemaDto deleteNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto deleteNestedField(String schema, int parentId, int id) { - return deleteNestedField(schema, parentId, id, null); - } - - /** - * A locked field cannot be updated or deleted. - */ - public SchemaDto lockField(String schema, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .addPathSegments("lock") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * A locked field cannot be updated or deleted. - */ - public SchemaDto lockField(String schema, int id) { - return lockField(schema, id, null); - } - - /** - * A locked field cannot be edited or deleted. - */ - public SchemaDto lockNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .addPathSegments("lock") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * A locked field cannot be edited or deleted. - */ - public SchemaDto lockNestedField(String schema, int parentId, int id) { - return lockNestedField(schema, parentId, id, null); - } - - /** - * A hidden field is not part of the API response, but can still be edited in the portal. - */ - public SchemaDto hideField(String schema, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .addPathSegments("hide") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * A hidden field is not part of the API response, but can still be edited in the portal. - */ - public SchemaDto hideField(String schema, int id) { - return hideField(schema, id, null); - } - - /** - * A hidden field is not part of the API response, but can still be edited in the portal. - */ - public SchemaDto hideNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .addPathSegments("hide") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * A hidden field is not part of the API response, but can still be edited in the portal. - */ - public SchemaDto hideNestedField(String schema, int parentId, int id) { - return hideNestedField(schema, parentId, id, null); - } - - /** - * A hidden field is not part of the API response, but can still be edited in the portal. - */ - public SchemaDto showField(String schema, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .addPathSegments("show") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * A hidden field is not part of the API response, but can still be edited in the portal. - */ - public SchemaDto showField(String schema, int id) { - return showField(schema, id, null); - } - - /** - * A hidden field is not part of the API response, but can still be edited in the portal. - */ - public SchemaDto showNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .addPathSegments("show") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * A hidden field is not part of the API response, but can still be edited in the portal. - */ - public SchemaDto showNestedField(String schema, int parentId, int id) { - return showNestedField(schema, parentId, id, null); - } - - /** - * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. - */ - public SchemaDto enableField(String schema, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .addPathSegments("enable") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. - */ - public SchemaDto enableField(String schema, int id) { - return enableField(schema, id, null); - } - - /** - * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. - */ - public SchemaDto enableNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .addPathSegments("enable") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. - */ - public SchemaDto enableNestedField(String schema, int parentId, int id) { - return enableNestedField(schema, parentId, id, null); - } - - /** - * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. - */ - public SchemaDto disableField(String schema, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(id)) - .addPathSegments("disable") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. - */ - public SchemaDto disableField(String schema, int id) { - return disableField(schema, id, null); - } - - /** - * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. - */ - public SchemaDto disableNestedField(String schema, int parentId, int id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("fields") - .addPathSegment(Integer.toString(parentId)) - .addPathSegments("nested") - .addPathSegment(Integer.toString(id)) - .addPathSegments("disable") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * A disabled field cannot not be edited in the squidex portal anymore, but will be part of the API response. - */ - public SchemaDto disableNestedField(String schema, int parentId, int id) { - return disableNestedField(schema, parentId, id, null); - } - - public SchemasDto getSchemas(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemasDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemasDto getSchemas() { - return getSchemas(null); - } - - public SchemaDto postSchema(CreateSchemaDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto postSchema(CreateSchemaDto request) { - return postSchema(request, null); - } - - public SchemaDto getSchema(String schema, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto getSchema(String schema) { - return getSchema(schema, null); - } - - public SchemaDto putSchema(String schema) { - return putSchema(schema, UpdateSchemaDto.builder().build()); - } - - public SchemaDto putSchema(String schema, UpdateSchemaDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putSchema(String schema, UpdateSchemaDto request) { - return putSchema(schema, request, null); - } - - public void deleteSchema(String schema, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteSchema(String schema) { - deleteSchema(schema, null); - } - - public SchemaDto putSchemaSync(String schema) { - return putSchemaSync(schema, SynchronizeSchemaDto.builder().build()); - } - - public SchemaDto putSchemaSync(String schema, SynchronizeSchemaDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("sync") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putSchemaSync(String schema, SynchronizeSchemaDto request) { - return putSchemaSync(schema, request, null); - } - - public SchemaDto putCategory(String schema) { - return putCategory(schema, ChangeCategoryDto.builder().build()); - } - - public SchemaDto putCategory(String schema, ChangeCategoryDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("category") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putCategory(String schema, ChangeCategoryDto request) { - return putCategory(schema, request, null); - } - - public SchemaDto putPreviewUrls(String schema, Map request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("preview-urls") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putPreviewUrls(String schema, Map request) { - return putPreviewUrls(schema, request, null); - } - - public SchemaDto putScripts(String schema) { - return putScripts(schema, SchemaScriptsDto.builder().build()); - } - - public SchemaDto putScripts(String schema, SchemaScriptsDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("scripts") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putScripts(String schema, SchemaScriptsDto request) { - return putScripts(schema, request, null); - } - - public SchemaDto putRules(String schema) { - return putRules(schema, ConfigureFieldRulesDto.builder().build()); - } - - public SchemaDto putRules(String schema, ConfigureFieldRulesDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("rules") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto putRules(String schema, ConfigureFieldRulesDto request) { - return putRules(schema, request, null); - } - - public SchemaDto publishSchema(String schema, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("publish") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto publishSchema(String schema) { - return publishSchema(schema, null); - } - - public SchemaDto unpublishSchema(String schema, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("schemas") - .addPathSegment(schema) - .addPathSegments("unpublish") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), SchemaDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public SchemaDto unpublishSchema(String schema) { - return unpublishSchema(schema, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/ChangeCategoryDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/ChangeCategoryDto.java deleted file mode 100644 index d9d2100..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/ChangeCategoryDto.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ChangeCategoryDto.Builder.class) -public final class ChangeCategoryDto { - private final Optional name; - - private ChangeCategoryDto(Optional name) { - this.name = name; - } - - /** - * @return The name of the category. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ChangeCategoryDto && equalTo((ChangeCategoryDto) other); - } - - private boolean equalTo(ChangeCategoryDto other) { - return name.equals(other.name); - } - - @Override - public int hashCode() { - return Objects.hash(this.name); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional name = Optional.empty(); - - private Builder() {} - - public Builder from(ChangeCategoryDto other) { - name(other.getName()); - return this; - } - - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.of(name); - return this; - } - - public ChangeCategoryDto build() { - return new ChangeCategoryDto(name); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureFieldRulesDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureFieldRulesDto.java deleted file mode 100644 index 8ff1678..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureFieldRulesDto.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.FieldRuleDto; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ConfigureFieldRulesDto.Builder.class) -public final class ConfigureFieldRulesDto { - private final Optional> fieldRules; - - private ConfigureFieldRulesDto(Optional> fieldRules) { - this.fieldRules = fieldRules; - } - - /** - * @return The field rules to configure. - */ - @JsonProperty("fieldRules") - public Optional> getFieldRules() { - return fieldRules; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ConfigureFieldRulesDto && equalTo((ConfigureFieldRulesDto) other); - } - - private boolean equalTo(ConfigureFieldRulesDto other) { - return fieldRules.equals(other.fieldRules); - } - - @Override - public int hashCode() { - return Objects.hash(this.fieldRules); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> fieldRules = Optional.empty(); - - private Builder() {} - - public Builder from(ConfigureFieldRulesDto other) { - fieldRules(other.getFieldRules()); - return this; - } - - @JsonSetter(value = "fieldRules", nulls = Nulls.SKIP) - public Builder fieldRules(Optional> fieldRules) { - this.fieldRules = fieldRules; - return this; - } - - public Builder fieldRules(List fieldRules) { - this.fieldRules = Optional.of(fieldRules); - return this; - } - - public ConfigureFieldRulesDto build() { - return new ConfigureFieldRulesDto(fieldRules); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureUiFieldsDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureUiFieldsDto.java deleted file mode 100644 index cfb5e87..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureUiFieldsDto.java +++ /dev/null @@ -1,109 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ConfigureUiFieldsDto.Builder.class) -public final class ConfigureUiFieldsDto { - private final Optional> fieldsInLists; - - private final Optional> fieldsInReferences; - - private ConfigureUiFieldsDto(Optional> fieldsInLists, Optional> fieldsInReferences) { - this.fieldsInLists = fieldsInLists; - this.fieldsInReferences = fieldsInReferences; - } - - /** - * @return The name of fields that are used in content lists. - */ - @JsonProperty("fieldsInLists") - public Optional> getFieldsInLists() { - return fieldsInLists; - } - - /** - * @return The name of fields that are used in content references. - */ - @JsonProperty("fieldsInReferences") - public Optional> getFieldsInReferences() { - return fieldsInReferences; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ConfigureUiFieldsDto && equalTo((ConfigureUiFieldsDto) other); - } - - private boolean equalTo(ConfigureUiFieldsDto other) { - return fieldsInLists.equals(other.fieldsInLists) && fieldsInReferences.equals(other.fieldsInReferences); - } - - @Override - public int hashCode() { - return Objects.hash(this.fieldsInLists, this.fieldsInReferences); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> fieldsInLists = Optional.empty(); - - private Optional> fieldsInReferences = Optional.empty(); - - private Builder() {} - - public Builder from(ConfigureUiFieldsDto other) { - fieldsInLists(other.getFieldsInLists()); - fieldsInReferences(other.getFieldsInReferences()); - return this; - } - - @JsonSetter(value = "fieldsInLists", nulls = Nulls.SKIP) - public Builder fieldsInLists(Optional> fieldsInLists) { - this.fieldsInLists = fieldsInLists; - return this; - } - - public Builder fieldsInLists(List fieldsInLists) { - this.fieldsInLists = Optional.of(fieldsInLists); - return this; - } - - @JsonSetter(value = "fieldsInReferences", nulls = Nulls.SKIP) - public Builder fieldsInReferences(Optional> fieldsInReferences) { - this.fieldsInReferences = fieldsInReferences; - return this; - } - - public Builder fieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences = Optional.of(fieldsInReferences); - return this; - } - - public ConfigureUiFieldsDto build() { - return new ConfigureUiFieldsDto(fieldsInLists, fieldsInReferences); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/CreateSchemaDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/CreateSchemaDto.java deleted file mode 100644 index 32e6101..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/CreateSchemaDto.java +++ /dev/null @@ -1,544 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.FieldRuleDto; -import com.squidex.api.types.IUpsertSchemaDto; -import com.squidex.api.types.SchemaPropertiesDto; -import com.squidex.api.types.SchemaScriptsDto; -import com.squidex.api.types.SchemaType; -import com.squidex.api.types.UpsertSchemaFieldDto; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateSchemaDto.Builder.class) -public final class CreateSchemaDto implements IUpsertSchemaDto { - private final Optional properties; - - private final Optional scripts; - - private final Optional> fieldsInReferences; - - private final Optional> fieldsInLists; - - private final Optional> fields; - - private final Optional>> previewUrls; - - private final Optional> fieldRules; - - private final Optional category; - - private final Optional isPublished; - - private final String name; - - private final Optional type; - - private final Optional isSingleton; - - private CreateSchemaDto( - Optional properties, - Optional scripts, - Optional> fieldsInReferences, - Optional> fieldsInLists, - Optional> fields, - Optional>> previewUrls, - Optional> fieldRules, - Optional category, - Optional isPublished, - String name, - Optional type, - Optional isSingleton) { - this.properties = properties; - this.scripts = scripts; - this.fieldsInReferences = fieldsInReferences; - this.fieldsInLists = fieldsInLists; - this.fields = fields; - this.previewUrls = previewUrls; - this.fieldRules = fieldRules; - this.category = category; - this.isPublished = isPublished; - this.name = name; - this.type = type; - this.isSingleton = isSingleton; - } - - /** - * @return The optional properties. - */ - @JsonProperty("properties") - @Override - public Optional getProperties() { - return properties; - } - - /** - * @return The optional scripts. - */ - @JsonProperty("scripts") - @Override - public Optional getScripts() { - return scripts; - } - - /** - * @return The names of the fields that should be used in references. - */ - @JsonProperty("fieldsInReferences") - @Override - public Optional> getFieldsInReferences() { - return fieldsInReferences; - } - - /** - * @return The names of the fields that should be shown in lists, including meta fields. - */ - @JsonProperty("fieldsInLists") - @Override - public Optional> getFieldsInLists() { - return fieldsInLists; - } - - /** - * @return Optional fields. - */ - @JsonProperty("fields") - @Override - public Optional> getFields() { - return fields; - } - - /** - * @return The optional preview urls. - */ - @JsonProperty("previewUrls") - @Override - public Optional>> getPreviewUrls() { - return previewUrls; - } - - /** - * @return The optional field Rules. - */ - @JsonProperty("fieldRules") - @Override - public Optional> getFieldRules() { - return fieldRules; - } - - /** - * @return The category. - */ - @JsonProperty("category") - @Override - public Optional getCategory() { - return category; - } - - /** - * @return Set it to true to autopublish the schema. - */ - @JsonProperty("isPublished") - @Override - public Optional getIsPublished() { - return isPublished; - } - - /** - * @return The name of the schema. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The type of the schema. - */ - @JsonProperty("type") - public Optional getType() { - return type; - } - - /** - * @return Set to true to allow a single content item only. - */ - @JsonProperty("isSingleton") - public Optional getIsSingleton() { - return isSingleton; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateSchemaDto && equalTo((CreateSchemaDto) other); - } - - private boolean equalTo(CreateSchemaDto other) { - return properties.equals(other.properties) - && scripts.equals(other.scripts) - && fieldsInReferences.equals(other.fieldsInReferences) - && fieldsInLists.equals(other.fieldsInLists) - && fields.equals(other.fields) - && previewUrls.equals(other.previewUrls) - && fieldRules.equals(other.fieldRules) - && category.equals(other.category) - && isPublished.equals(other.isPublished) - && name.equals(other.name) - && type.equals(other.type) - && isSingleton.equals(other.isSingleton); - } - - @Override - public int hashCode() { - return Objects.hash( - this.properties, - this.scripts, - this.fieldsInReferences, - this.fieldsInLists, - this.fields, - this.previewUrls, - this.fieldRules, - this.category, - this.isPublished, - this.name, - this.type, - this.isSingleton); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(CreateSchemaDto other); - } - - public interface _FinalStage { - CreateSchemaDto build(); - - _FinalStage properties(Optional properties); - - _FinalStage properties(SchemaPropertiesDto properties); - - _FinalStage scripts(Optional scripts); - - _FinalStage scripts(SchemaScriptsDto scripts); - - _FinalStage fieldsInReferences(Optional> fieldsInReferences); - - _FinalStage fieldsInReferences(List fieldsInReferences); - - _FinalStage fieldsInLists(Optional> fieldsInLists); - - _FinalStage fieldsInLists(List fieldsInLists); - - _FinalStage fields(Optional> fields); - - _FinalStage fields(List fields); - - _FinalStage previewUrls(Optional>> previewUrls); - - _FinalStage previewUrls(Map> previewUrls); - - _FinalStage fieldRules(Optional> fieldRules); - - _FinalStage fieldRules(List fieldRules); - - _FinalStage category(Optional category); - - _FinalStage category(String category); - - _FinalStage isPublished(Optional isPublished); - - _FinalStage isPublished(Boolean isPublished); - - _FinalStage type(Optional type); - - _FinalStage type(SchemaType type); - - _FinalStage isSingleton(Optional isSingleton); - - _FinalStage isSingleton(Boolean isSingleton); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Optional isSingleton = Optional.empty(); - - private Optional type = Optional.empty(); - - private Optional isPublished = Optional.empty(); - - private Optional category = Optional.empty(); - - private Optional> fieldRules = Optional.empty(); - - private Optional>> previewUrls = Optional.empty(); - - private Optional> fields = Optional.empty(); - - private Optional> fieldsInLists = Optional.empty(); - - private Optional> fieldsInReferences = Optional.empty(); - - private Optional scripts = Optional.empty(); - - private Optional properties = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CreateSchemaDto other) { - properties(other.getProperties()); - scripts(other.getScripts()); - fieldsInReferences(other.getFieldsInReferences()); - fieldsInLists(other.getFieldsInLists()); - fields(other.getFields()); - previewUrls(other.getPreviewUrls()); - fieldRules(other.getFieldRules()); - category(other.getCategory()); - isPublished(other.getIsPublished()); - name(other.getName()); - type(other.getType()); - isSingleton(other.getIsSingleton()); - return this; - } - - /** - *

The name of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - /** - *

Set to true to allow a single content item only.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isSingleton(Boolean isSingleton) { - this.isSingleton = Optional.of(isSingleton); - return this; - } - - @Override - @JsonSetter(value = "isSingleton", nulls = Nulls.SKIP) - public _FinalStage isSingleton(Optional isSingleton) { - this.isSingleton = isSingleton; - return this; - } - - /** - *

The type of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage type(SchemaType type) { - this.type = Optional.of(type); - return this; - } - - @Override - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public _FinalStage type(Optional type) { - this.type = type; - return this; - } - - /** - *

Set it to true to autopublish the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isPublished(Boolean isPublished) { - this.isPublished = Optional.of(isPublished); - return this; - } - - @Override - @JsonSetter(value = "isPublished", nulls = Nulls.SKIP) - public _FinalStage isPublished(Optional isPublished) { - this.isPublished = isPublished; - return this; - } - - /** - *

The category.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage category(String category) { - this.category = Optional.of(category); - return this; - } - - @Override - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public _FinalStage category(Optional category) { - this.category = category; - return this; - } - - /** - *

The optional field Rules.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fieldRules(List fieldRules) { - this.fieldRules = Optional.of(fieldRules); - return this; - } - - @Override - @JsonSetter(value = "fieldRules", nulls = Nulls.SKIP) - public _FinalStage fieldRules(Optional> fieldRules) { - this.fieldRules = fieldRules; - return this; - } - - /** - *

The optional preview urls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage previewUrls(Map> previewUrls) { - this.previewUrls = Optional.of(previewUrls); - return this; - } - - @Override - @JsonSetter(value = "previewUrls", nulls = Nulls.SKIP) - public _FinalStage previewUrls(Optional>> previewUrls) { - this.previewUrls = previewUrls; - return this; - } - - /** - *

Optional fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fields(List fields) { - this.fields = Optional.of(fields); - return this; - } - - @Override - @JsonSetter(value = "fields", nulls = Nulls.SKIP) - public _FinalStage fields(Optional> fields) { - this.fields = fields; - return this; - } - - /** - *

The names of the fields that should be shown in lists, including meta fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fieldsInLists(List fieldsInLists) { - this.fieldsInLists = Optional.of(fieldsInLists); - return this; - } - - @Override - @JsonSetter(value = "fieldsInLists", nulls = Nulls.SKIP) - public _FinalStage fieldsInLists(Optional> fieldsInLists) { - this.fieldsInLists = fieldsInLists; - return this; - } - - /** - *

The names of the fields that should be used in references.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences = Optional.of(fieldsInReferences); - return this; - } - - @Override - @JsonSetter(value = "fieldsInReferences", nulls = Nulls.SKIP) - public _FinalStage fieldsInReferences(Optional> fieldsInReferences) { - this.fieldsInReferences = fieldsInReferences; - return this; - } - - /** - *

The optional scripts.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage scripts(SchemaScriptsDto scripts) { - this.scripts = Optional.of(scripts); - return this; - } - - @Override - @JsonSetter(value = "scripts", nulls = Nulls.SKIP) - public _FinalStage scripts(Optional scripts) { - this.scripts = scripts; - return this; - } - - /** - *

The optional properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage properties(SchemaPropertiesDto properties) { - this.properties = Optional.of(properties); - return this; - } - - @Override - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public _FinalStage properties(Optional properties) { - this.properties = properties; - return this; - } - - @Override - public CreateSchemaDto build() { - return new CreateSchemaDto( - properties, - scripts, - fieldsInReferences, - fieldsInLists, - fields, - previewUrls, - fieldRules, - category, - isPublished, - name, - type, - isSingleton); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/SynchronizeSchemaDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/SynchronizeSchemaDto.java deleted file mode 100644 index 6279713..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/SynchronizeSchemaDto.java +++ /dev/null @@ -1,392 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.types.FieldRuleDto; -import com.squidex.api.types.IUpsertSchemaDto; -import com.squidex.api.types.SchemaPropertiesDto; -import com.squidex.api.types.SchemaScriptsDto; -import com.squidex.api.types.UpsertSchemaFieldDto; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SynchronizeSchemaDto.Builder.class) -public final class SynchronizeSchemaDto implements IUpsertSchemaDto { - private final Optional properties; - - private final Optional scripts; - - private final Optional> fieldsInReferences; - - private final Optional> fieldsInLists; - - private final Optional> fields; - - private final Optional>> previewUrls; - - private final Optional> fieldRules; - - private final Optional category; - - private final Optional isPublished; - - private final Optional noFieldDeletion; - - private final Optional noFieldRecreation; - - private SynchronizeSchemaDto( - Optional properties, - Optional scripts, - Optional> fieldsInReferences, - Optional> fieldsInLists, - Optional> fields, - Optional>> previewUrls, - Optional> fieldRules, - Optional category, - Optional isPublished, - Optional noFieldDeletion, - Optional noFieldRecreation) { - this.properties = properties; - this.scripts = scripts; - this.fieldsInReferences = fieldsInReferences; - this.fieldsInLists = fieldsInLists; - this.fields = fields; - this.previewUrls = previewUrls; - this.fieldRules = fieldRules; - this.category = category; - this.isPublished = isPublished; - this.noFieldDeletion = noFieldDeletion; - this.noFieldRecreation = noFieldRecreation; - } - - /** - * @return The optional properties. - */ - @JsonProperty("properties") - @Override - public Optional getProperties() { - return properties; - } - - /** - * @return The optional scripts. - */ - @JsonProperty("scripts") - @Override - public Optional getScripts() { - return scripts; - } - - /** - * @return The names of the fields that should be used in references. - */ - @JsonProperty("fieldsInReferences") - @Override - public Optional> getFieldsInReferences() { - return fieldsInReferences; - } - - /** - * @return The names of the fields that should be shown in lists, including meta fields. - */ - @JsonProperty("fieldsInLists") - @Override - public Optional> getFieldsInLists() { - return fieldsInLists; - } - - /** - * @return Optional fields. - */ - @JsonProperty("fields") - @Override - public Optional> getFields() { - return fields; - } - - /** - * @return The optional preview urls. - */ - @JsonProperty("previewUrls") - @Override - public Optional>> getPreviewUrls() { - return previewUrls; - } - - /** - * @return The optional field Rules. - */ - @JsonProperty("fieldRules") - @Override - public Optional> getFieldRules() { - return fieldRules; - } - - /** - * @return The category. - */ - @JsonProperty("category") - @Override - public Optional getCategory() { - return category; - } - - /** - * @return Set it to true to autopublish the schema. - */ - @JsonProperty("isPublished") - @Override - public Optional getIsPublished() { - return isPublished; - } - - /** - * @return True, when fields should not be deleted. - */ - @JsonProperty("noFieldDeletion") - public Optional getNoFieldDeletion() { - return noFieldDeletion; - } - - /** - * @return True, when fields with different types should not be recreated. - */ - @JsonProperty("noFieldRecreation") - public Optional getNoFieldRecreation() { - return noFieldRecreation; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SynchronizeSchemaDto && equalTo((SynchronizeSchemaDto) other); - } - - private boolean equalTo(SynchronizeSchemaDto other) { - return properties.equals(other.properties) - && scripts.equals(other.scripts) - && fieldsInReferences.equals(other.fieldsInReferences) - && fieldsInLists.equals(other.fieldsInLists) - && fields.equals(other.fields) - && previewUrls.equals(other.previewUrls) - && fieldRules.equals(other.fieldRules) - && category.equals(other.category) - && isPublished.equals(other.isPublished) - && noFieldDeletion.equals(other.noFieldDeletion) - && noFieldRecreation.equals(other.noFieldRecreation); - } - - @Override - public int hashCode() { - return Objects.hash( - this.properties, - this.scripts, - this.fieldsInReferences, - this.fieldsInLists, - this.fields, - this.previewUrls, - this.fieldRules, - this.category, - this.isPublished, - this.noFieldDeletion, - this.noFieldRecreation); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional properties = Optional.empty(); - - private Optional scripts = Optional.empty(); - - private Optional> fieldsInReferences = Optional.empty(); - - private Optional> fieldsInLists = Optional.empty(); - - private Optional> fields = Optional.empty(); - - private Optional>> previewUrls = Optional.empty(); - - private Optional> fieldRules = Optional.empty(); - - private Optional category = Optional.empty(); - - private Optional isPublished = Optional.empty(); - - private Optional noFieldDeletion = Optional.empty(); - - private Optional noFieldRecreation = Optional.empty(); - - private Builder() {} - - public Builder from(SynchronizeSchemaDto other) { - properties(other.getProperties()); - scripts(other.getScripts()); - fieldsInReferences(other.getFieldsInReferences()); - fieldsInLists(other.getFieldsInLists()); - fields(other.getFields()); - previewUrls(other.getPreviewUrls()); - fieldRules(other.getFieldRules()); - category(other.getCategory()); - isPublished(other.getIsPublished()); - noFieldDeletion(other.getNoFieldDeletion()); - noFieldRecreation(other.getNoFieldRecreation()); - return this; - } - - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public Builder properties(Optional properties) { - this.properties = properties; - return this; - } - - public Builder properties(SchemaPropertiesDto properties) { - this.properties = Optional.of(properties); - return this; - } - - @JsonSetter(value = "scripts", nulls = Nulls.SKIP) - public Builder scripts(Optional scripts) { - this.scripts = scripts; - return this; - } - - public Builder scripts(SchemaScriptsDto scripts) { - this.scripts = Optional.of(scripts); - return this; - } - - @JsonSetter(value = "fieldsInReferences", nulls = Nulls.SKIP) - public Builder fieldsInReferences(Optional> fieldsInReferences) { - this.fieldsInReferences = fieldsInReferences; - return this; - } - - public Builder fieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences = Optional.of(fieldsInReferences); - return this; - } - - @JsonSetter(value = "fieldsInLists", nulls = Nulls.SKIP) - public Builder fieldsInLists(Optional> fieldsInLists) { - this.fieldsInLists = fieldsInLists; - return this; - } - - public Builder fieldsInLists(List fieldsInLists) { - this.fieldsInLists = Optional.of(fieldsInLists); - return this; - } - - @JsonSetter(value = "fields", nulls = Nulls.SKIP) - public Builder fields(Optional> fields) { - this.fields = fields; - return this; - } - - public Builder fields(List fields) { - this.fields = Optional.of(fields); - return this; - } - - @JsonSetter(value = "previewUrls", nulls = Nulls.SKIP) - public Builder previewUrls(Optional>> previewUrls) { - this.previewUrls = previewUrls; - return this; - } - - public Builder previewUrls(Map> previewUrls) { - this.previewUrls = Optional.of(previewUrls); - return this; - } - - @JsonSetter(value = "fieldRules", nulls = Nulls.SKIP) - public Builder fieldRules(Optional> fieldRules) { - this.fieldRules = fieldRules; - return this; - } - - public Builder fieldRules(List fieldRules) { - this.fieldRules = Optional.of(fieldRules); - return this; - } - - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public Builder category(Optional category) { - this.category = category; - return this; - } - - public Builder category(String category) { - this.category = Optional.of(category); - return this; - } - - @JsonSetter(value = "isPublished", nulls = Nulls.SKIP) - public Builder isPublished(Optional isPublished) { - this.isPublished = isPublished; - return this; - } - - public Builder isPublished(Boolean isPublished) { - this.isPublished = Optional.of(isPublished); - return this; - } - - @JsonSetter(value = "noFieldDeletion", nulls = Nulls.SKIP) - public Builder noFieldDeletion(Optional noFieldDeletion) { - this.noFieldDeletion = noFieldDeletion; - return this; - } - - public Builder noFieldDeletion(Boolean noFieldDeletion) { - this.noFieldDeletion = Optional.of(noFieldDeletion); - return this; - } - - @JsonSetter(value = "noFieldRecreation", nulls = Nulls.SKIP) - public Builder noFieldRecreation(Optional noFieldRecreation) { - this.noFieldRecreation = noFieldRecreation; - return this; - } - - public Builder noFieldRecreation(Boolean noFieldRecreation) { - this.noFieldRecreation = Optional.of(noFieldRecreation); - return this; - } - - public SynchronizeSchemaDto build() { - return new SynchronizeSchemaDto( - properties, - scripts, - fieldsInReferences, - fieldsInLists, - fields, - previewUrls, - fieldRules, - category, - isPublished, - noFieldDeletion, - noFieldRecreation); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/schemas/requests/UpdateSchemaDto.java b/src/main/java/com/squidex/api/resources/schemas/requests/UpdateSchemaDto.java deleted file mode 100644 index eaa9004..0000000 --- a/src/main/java/com/squidex/api/resources/schemas/requests/UpdateSchemaDto.java +++ /dev/null @@ -1,255 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.schemas.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateSchemaDto.Builder.class) -public final class UpdateSchemaDto { - private final Optional label; - - private final Optional hints; - - private final Optional contentsSidebarUrl; - - private final Optional contentSidebarUrl; - - private final Optional contentEditorUrl; - - private final Optional validateOnPublish; - - private final Optional> tags; - - private UpdateSchemaDto( - Optional label, - Optional hints, - Optional contentsSidebarUrl, - Optional contentSidebarUrl, - Optional contentEditorUrl, - Optional validateOnPublish, - Optional> tags) { - this.label = label; - this.hints = hints; - this.contentsSidebarUrl = contentsSidebarUrl; - this.contentSidebarUrl = contentSidebarUrl; - this.contentEditorUrl = contentEditorUrl; - this.validateOnPublish = validateOnPublish; - this.tags = tags; - } - - /** - * @return Optional label for the editor. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; - } - - /** - * @return Hints to describe the schema. - */ - @JsonProperty("hints") - public Optional getHints() { - return hints; - } - - /** - * @return The url to a the sidebar plugin for content lists. - */ - @JsonProperty("contentsSidebarUrl") - public Optional getContentsSidebarUrl() { - return contentsSidebarUrl; - } - - /** - * @return The url to a the sidebar plugin for content items. - */ - @JsonProperty("contentSidebarUrl") - public Optional getContentSidebarUrl() { - return contentSidebarUrl; - } - - /** - * @return The url to the editor plugin. - */ - @JsonProperty("contentEditorUrl") - public Optional getContentEditorUrl() { - return contentEditorUrl; - } - - /** - * @return True to validate the content items on publish. - */ - @JsonProperty("validateOnPublish") - public Optional getValidateOnPublish() { - return validateOnPublish; - } - - /** - * @return Tags for automation processes. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateSchemaDto && equalTo((UpdateSchemaDto) other); - } - - private boolean equalTo(UpdateSchemaDto other) { - return label.equals(other.label) - && hints.equals(other.hints) - && contentsSidebarUrl.equals(other.contentsSidebarUrl) - && contentSidebarUrl.equals(other.contentSidebarUrl) - && contentEditorUrl.equals(other.contentEditorUrl) - && validateOnPublish.equals(other.validateOnPublish) - && tags.equals(other.tags); - } - - @Override - public int hashCode() { - return Objects.hash( - this.label, - this.hints, - this.contentsSidebarUrl, - this.contentSidebarUrl, - this.contentEditorUrl, - this.validateOnPublish, - this.tags); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional label = Optional.empty(); - - private Optional hints = Optional.empty(); - - private Optional contentsSidebarUrl = Optional.empty(); - - private Optional contentSidebarUrl = Optional.empty(); - - private Optional contentEditorUrl = Optional.empty(); - - private Optional validateOnPublish = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateSchemaDto other) { - label(other.getLabel()); - hints(other.getHints()); - contentsSidebarUrl(other.getContentsSidebarUrl()); - contentSidebarUrl(other.getContentSidebarUrl()); - contentEditorUrl(other.getContentEditorUrl()); - validateOnPublish(other.getValidateOnPublish()); - tags(other.getTags()); - return this; - } - - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public Builder label(Optional label) { - this.label = label; - return this; - } - - public Builder label(String label) { - this.label = Optional.of(label); - return this; - } - - @JsonSetter(value = "hints", nulls = Nulls.SKIP) - public Builder hints(Optional hints) { - this.hints = hints; - return this; - } - - public Builder hints(String hints) { - this.hints = Optional.of(hints); - return this; - } - - @JsonSetter(value = "contentsSidebarUrl", nulls = Nulls.SKIP) - public Builder contentsSidebarUrl(Optional contentsSidebarUrl) { - this.contentsSidebarUrl = contentsSidebarUrl; - return this; - } - - public Builder contentsSidebarUrl(String contentsSidebarUrl) { - this.contentsSidebarUrl = Optional.of(contentsSidebarUrl); - return this; - } - - @JsonSetter(value = "contentSidebarUrl", nulls = Nulls.SKIP) - public Builder contentSidebarUrl(Optional contentSidebarUrl) { - this.contentSidebarUrl = contentSidebarUrl; - return this; - } - - public Builder contentSidebarUrl(String contentSidebarUrl) { - this.contentSidebarUrl = Optional.of(contentSidebarUrl); - return this; - } - - @JsonSetter(value = "contentEditorUrl", nulls = Nulls.SKIP) - public Builder contentEditorUrl(Optional contentEditorUrl) { - this.contentEditorUrl = contentEditorUrl; - return this; - } - - public Builder contentEditorUrl(String contentEditorUrl) { - this.contentEditorUrl = Optional.of(contentEditorUrl); - return this; - } - - @JsonSetter(value = "validateOnPublish", nulls = Nulls.SKIP) - public Builder validateOnPublish(Optional validateOnPublish) { - this.validateOnPublish = validateOnPublish; - return this; - } - - public Builder validateOnPublish(Boolean validateOnPublish) { - this.validateOnPublish = Optional.of(validateOnPublish); - return this; - } - - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.of(tags); - return this; - } - - public UpdateSchemaDto build() { - return new UpdateSchemaDto( - label, hints, contentsSidebarUrl, contentSidebarUrl, contentEditorUrl, validateOnPublish, tags); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/search/SearchClient.java b/src/main/java/com/squidex/api/resources/search/SearchClient.java deleted file mode 100644 index 4c4095e..0000000 --- a/src/main/java/com/squidex/api/resources/search/SearchClient.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.search; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.search.requests.SearchGetSearchResultsRequest; -import com.squidex.api.types.SearchResultDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class SearchClient { - protected final ClientOptions clientOptions; - - public SearchClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public List getSearchResults() { - return getSearchResults(SearchGetSearchResultsRequest.builder().build()); - } - - public List getSearchResults( - SearchGetSearchResultsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("search"); - if (request.getQuery().isPresent()) { - httpUrl.addQueryParameter("query", request.getQuery().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getSearchResults(SearchGetSearchResultsRequest request) { - return getSearchResults(request, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/search/requests/SearchGetSearchResultsRequest.java b/src/main/java/com/squidex/api/resources/search/requests/SearchGetSearchResultsRequest.java deleted file mode 100644 index 9c0cf34..0000000 --- a/src/main/java/com/squidex/api/resources/search/requests/SearchGetSearchResultsRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.search.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SearchGetSearchResultsRequest.Builder.class) -public final class SearchGetSearchResultsRequest { - private final Optional query; - - private SearchGetSearchResultsRequest(Optional query) { - this.query = query; - } - - /** - * @return The search query. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SearchGetSearchResultsRequest && equalTo((SearchGetSearchResultsRequest) other); - } - - private boolean equalTo(SearchGetSearchResultsRequest other) { - return query.equals(other.query); - } - - @Override - public int hashCode() { - return Objects.hash(this.query); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Builder() {} - - public Builder from(SearchGetSearchResultsRequest other) { - query(other.getQuery()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - public SearchGetSearchResultsRequest build() { - return new SearchGetSearchResultsRequest(query); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/statistics/StatisticsClient.java b/src/main/java/com/squidex/api/resources/statistics/StatisticsClient.java deleted file mode 100644 index fe1de18..0000000 --- a/src/main/java/com/squidex/api/resources/statistics/StatisticsClient.java +++ /dev/null @@ -1,257 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.statistics; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.types.CallsUsageDtoDto; -import com.squidex.api.types.CurrentStorageDto; -import com.squidex.api.types.LogDownloadDto; -import com.squidex.api.types.StorageUsagePerDateDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class StatisticsClient { - protected final ClientOptions clientOptions; - - public StatisticsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public LogDownloadDto getLog(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("usages/log") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), LogDownloadDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public LogDownloadDto getLog() { - return getLog(null); - } - - public CallsUsageDtoDto getUsages(String fromDate, String toDate, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("usages/calls") - .addPathSegment(fromDate) - .addPathSegment(toDate) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), CallsUsageDtoDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CallsUsageDtoDto getUsages(String fromDate, String toDate) { - return getUsages(fromDate, toDate, null); - } - - public CallsUsageDtoDto getUsagesForTeam( - String team, String fromDate, String toDate, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("usages/calls") - .addPathSegment(fromDate) - .addPathSegment(toDate) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), CallsUsageDtoDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CallsUsageDtoDto getUsagesForTeam(String team, String fromDate, String toDate) { - return getUsagesForTeam(team, fromDate, toDate, null); - } - - public CurrentStorageDto getCurrentStorageSize(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("usages/storage/today") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), CurrentStorageDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CurrentStorageDto getCurrentStorageSize() { - return getCurrentStorageSize(null); - } - - public CurrentStorageDto getTeamCurrentStorageSizeForTeam(String team, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("usages/storage/today") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), CurrentStorageDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public CurrentStorageDto getTeamCurrentStorageSizeForTeam(String team) { - return getTeamCurrentStorageSizeForTeam(team, null); - } - - public List getStorageSizes(String fromDate, String toDate, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("usages/storage") - .addPathSegment(fromDate) - .addPathSegment(toDate) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getStorageSizes(String fromDate, String toDate) { - return getStorageSizes(fromDate, toDate, null); - } - - public List getStorageSizesForTeam( - String team, String fromDate, String toDate, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("usages/storage") - .addPathSegment(fromDate) - .addPathSegment(toDate) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List getStorageSizesForTeam(String team, String fromDate, String toDate) { - return getStorageSizesForTeam(team, fromDate, toDate, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/teams/TeamsClient.java b/src/main/java/com/squidex/api/resources/teams/TeamsClient.java deleted file mode 100644 index 2b0f73c..0000000 --- a/src/main/java/com/squidex/api/resources/teams/TeamsClient.java +++ /dev/null @@ -1,312 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.teams; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.teams.requests.CreateTeamDto; -import com.squidex.api.resources.teams.requests.UpdateTeamDto; -import com.squidex.api.types.AssignContributorDto; -import com.squidex.api.types.ContributorsDto; -import com.squidex.api.types.TeamDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class TeamsClient { - protected final ClientOptions clientOptions; - - public TeamsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public ContributorsDto getContributors(String team, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("contributors") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContributorsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto getContributors(String team) { - return getContributors(team, null); - } - - public ContributorsDto postContributor(String team, AssignContributorDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("contributors") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContributorsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto postContributor(String team, AssignContributorDto request) { - return postContributor(team, request, null); - } - - public ContributorsDto deleteMyself(String team, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("contributors/me") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContributorsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto deleteMyself(String team) { - return deleteMyself(team, null); - } - - public ContributorsDto deleteContributor(String team, String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .addPathSegments("contributors") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ContributorsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ContributorsDto deleteContributor(String team, String id) { - return deleteContributor(team, id, null); - } - - /** - * You can only retrieve the list of teams when you are authenticated as a user (OpenID implicit flow). - * You will retrieve all teams, where you are assigned as a contributor. - */ - public List getTeams(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can only retrieve the list of teams when you are authenticated as a user (OpenID implicit flow). - * You will retrieve all teams, where you are assigned as a contributor. - */ - public List getTeams() { - return getTeams(null); - } - - /** - * You can only create an team when you are authenticated as a user (OpenID implicit flow). - * You will be assigned as owner of the new team automatically. - */ - public TeamDto postTeam(CreateTeamDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), TeamDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * You can only create an team when you are authenticated as a user (OpenID implicit flow). - * You will be assigned as owner of the new team automatically. - */ - public TeamDto postTeam(CreateTeamDto request) { - return postTeam(request, null); - } - - public TeamDto getTeam(String team, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), TeamDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public TeamDto getTeam(String team) { - return getTeam(team, null); - } - - public TeamDto putTeam(String team, UpdateTeamDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/teams") - .addPathSegment(team) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), TeamDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public TeamDto putTeam(String team, UpdateTeamDto request) { - return putTeam(team, request, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/teams/requests/CreateTeamDto.java b/src/main/java/com/squidex/api/resources/teams/requests/CreateTeamDto.java deleted file mode 100644 index 2608859..0000000 --- a/src/main/java/com/squidex/api/resources/teams/requests/CreateTeamDto.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.teams.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateTeamDto.Builder.class) -public final class CreateTeamDto { - private final String name; - - private CreateTeamDto(String name) { - this.name = name; - } - - /** - * @return The name of the team. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateTeamDto && equalTo((CreateTeamDto) other); - } - - private boolean equalTo(CreateTeamDto other) { - return name.equals(other.name); - } - - @Override - public int hashCode() { - return Objects.hash(this.name); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(CreateTeamDto other); - } - - public interface _FinalStage { - CreateTeamDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Builder() {} - - @Override - public Builder from(CreateTeamDto other) { - name(other.getName()); - return this; - } - - /** - *

The name of the team.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - @Override - public CreateTeamDto build() { - return new CreateTeamDto(name); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/teams/requests/UpdateTeamDto.java b/src/main/java/com/squidex/api/resources/teams/requests/UpdateTeamDto.java deleted file mode 100644 index dfd6159..0000000 --- a/src/main/java/com/squidex/api/resources/teams/requests/UpdateTeamDto.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.teams.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateTeamDto.Builder.class) -public final class UpdateTeamDto { - private final String name; - - private UpdateTeamDto(String name) { - this.name = name; - } - - /** - * @return The name of the team. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateTeamDto && equalTo((UpdateTeamDto) other); - } - - private boolean equalTo(UpdateTeamDto other) { - return name.equals(other.name); - } - - @Override - public int hashCode() { - return Objects.hash(this.name); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - _FinalStage name(String name); - - Builder from(UpdateTeamDto other); - } - - public interface _FinalStage { - UpdateTeamDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, _FinalStage { - private String name; - - private Builder() {} - - @Override - public Builder from(UpdateTeamDto other) { - name(other.getName()); - return this; - } - - /** - *

The name of the team.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - @Override - public UpdateTeamDto build() { - return new UpdateTeamDto(name); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/templates/TemplatesClient.java b/src/main/java/com/squidex/api/resources/templates/TemplatesClient.java deleted file mode 100644 index fec9583..0000000 --- a/src/main/java/com/squidex/api/resources/templates/TemplatesClient.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.templates; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.types.TemplateDetailsDto; -import com.squidex.api.types.TemplatesDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.Request; -import okhttp3.Response; - -public class TemplatesClient { - protected final ClientOptions clientOptions; - - public TemplatesClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public TemplatesDto getTemplates(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/templates") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), TemplatesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public TemplatesDto getTemplates() { - return getTemplates(null); - } - - public TemplateDetailsDto getTemplate(String name, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/templates") - .addPathSegment(name) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), TemplateDetailsDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public TemplateDetailsDto getTemplate(String name) { - return getTemplate(name, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/translations/TranslationsClient.java b/src/main/java/com/squidex/api/resources/translations/TranslationsClient.java deleted file mode 100644 index 0a7fb9a..0000000 --- a/src/main/java/com/squidex/api/resources/translations/TranslationsClient.java +++ /dev/null @@ -1,106 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.translations; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.translations.requests.AskDto; -import com.squidex.api.resources.translations.requests.TranslateDto; -import com.squidex.api.types.TranslationDto; -import java.io.IOException; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class TranslationsClient { - protected final ClientOptions clientOptions; - - public TranslationsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public TranslationDto postTranslation(TranslateDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("translations") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), TranslationDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public TranslationDto postTranslation(TranslateDto request) { - return postTranslation(request, null); - } - - public List postQuestion(AskDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/apps") - .addPathSegment(clientOptions.appName()) - .addPathSegments("ask") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public List postQuestion(AskDto request) { - return postQuestion(request, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/translations/requests/AskDto.java b/src/main/java/com/squidex/api/resources/translations/requests/AskDto.java deleted file mode 100644 index 5617ac8..0000000 --- a/src/main/java/com/squidex/api/resources/translations/requests/AskDto.java +++ /dev/null @@ -1,93 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.translations.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AskDto.Builder.class) -public final class AskDto { - private final String prompt; - - private AskDto(String prompt) { - this.prompt = prompt; - } - - /** - * @return The text to ask. - */ - @JsonProperty("prompt") - public String getPrompt() { - return prompt; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AskDto && equalTo((AskDto) other); - } - - private boolean equalTo(AskDto other) { - return prompt.equals(other.prompt); - } - - @Override - public int hashCode() { - return Objects.hash(this.prompt); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static PromptStage builder() { - return new Builder(); - } - - public interface PromptStage { - _FinalStage prompt(String prompt); - - Builder from(AskDto other); - } - - public interface _FinalStage { - AskDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements PromptStage, _FinalStage { - private String prompt; - - private Builder() {} - - @Override - public Builder from(AskDto other) { - prompt(other.getPrompt()); - return this; - } - - /** - *

The text to ask.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("prompt") - public _FinalStage prompt(String prompt) { - this.prompt = prompt; - return this; - } - - @Override - public AskDto build() { - return new AskDto(prompt); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/translations/requests/TranslateDto.java b/src/main/java/com/squidex/api/resources/translations/requests/TranslateDto.java deleted file mode 100644 index 93118a0..0000000 --- a/src/main/java/com/squidex/api/resources/translations/requests/TranslateDto.java +++ /dev/null @@ -1,161 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.translations.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TranslateDto.Builder.class) -public final class TranslateDto { - private final String text; - - private final String targetLanguage; - - private final Optional sourceLanguage; - - private TranslateDto(String text, String targetLanguage, Optional sourceLanguage) { - this.text = text; - this.targetLanguage = targetLanguage; - this.sourceLanguage = sourceLanguage; - } - - /** - * @return The text to translate. - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return The target language. - */ - @JsonProperty("targetLanguage") - public String getTargetLanguage() { - return targetLanguage; - } - - /** - * @return The optional source language. - */ - @JsonProperty("sourceLanguage") - public Optional getSourceLanguage() { - return sourceLanguage; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TranslateDto && equalTo((TranslateDto) other); - } - - private boolean equalTo(TranslateDto other) { - return text.equals(other.text) - && targetLanguage.equals(other.targetLanguage) - && sourceLanguage.equals(other.sourceLanguage); - } - - @Override - public int hashCode() { - return Objects.hash(this.text, this.targetLanguage, this.sourceLanguage); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TextStage builder() { - return new Builder(); - } - - public interface TextStage { - TargetLanguageStage text(String text); - - Builder from(TranslateDto other); - } - - public interface TargetLanguageStage { - _FinalStage targetLanguage(String targetLanguage); - } - - public interface _FinalStage { - TranslateDto build(); - - _FinalStage sourceLanguage(Optional sourceLanguage); - - _FinalStage sourceLanguage(String sourceLanguage); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TextStage, TargetLanguageStage, _FinalStage { - private String text; - - private String targetLanguage; - - private Optional sourceLanguage = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(TranslateDto other) { - text(other.getText()); - targetLanguage(other.getTargetLanguage()); - sourceLanguage(other.getSourceLanguage()); - return this; - } - - /** - *

The text to translate.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public TargetLanguageStage text(String text) { - this.text = text; - return this; - } - - /** - *

The target language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("targetLanguage") - public _FinalStage targetLanguage(String targetLanguage) { - this.targetLanguage = targetLanguage; - return this; - } - - /** - *

The optional source language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage sourceLanguage(String sourceLanguage) { - this.sourceLanguage = Optional.of(sourceLanguage); - return this; - } - - @Override - @JsonSetter(value = "sourceLanguage", nulls = Nulls.SKIP) - public _FinalStage sourceLanguage(Optional sourceLanguage) { - this.sourceLanguage = sourceLanguage; - return this; - } - - @Override - public TranslateDto build() { - return new TranslateDto(text, targetLanguage, sourceLanguage); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/usermanagement/UserManagementClient.java b/src/main/java/com/squidex/api/resources/usermanagement/UserManagementClient.java deleted file mode 100644 index 76d69d9..0000000 --- a/src/main/java/com/squidex/api/resources/usermanagement/UserManagementClient.java +++ /dev/null @@ -1,264 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.usermanagement; - -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.usermanagement.requests.CreateUserDto; -import com.squidex.api.resources.usermanagement.requests.UpdateUserDto; -import com.squidex.api.resources.usermanagement.requests.UserManagementGetUsersRequest; -import com.squidex.api.types.UserDto; -import com.squidex.api.types.UsersDto; -import java.io.IOException; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class UserManagementClient { - protected final ClientOptions clientOptions; - - public UserManagementClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public UsersDto getUsers() { - return getUsers(UserManagementGetUsersRequest.builder().build()); - } - - public UsersDto getUsers(UserManagementGetUsersRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management"); - if (request.getQuery().isPresent()) { - httpUrl.addQueryParameter("query", request.getQuery().get()); - } - if (request.getSkip().isPresent()) { - httpUrl.addQueryParameter("skip", request.getSkip().get().toString()); - } - if (request.getTake().isPresent()) { - httpUrl.addQueryParameter("take", request.getTake().get().toString()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), UsersDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UsersDto getUsers(UserManagementGetUsersRequest request) { - return getUsers(request, null); - } - - public UserDto postUser(CreateUserDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), UserDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto postUser(CreateUserDto request) { - return postUser(request, null); - } - - public UserDto getUser(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), UserDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto getUser(String id) { - return getUser(id, null); - } - - public UserDto putUser(String id, UpdateUserDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .addPathSegment(id) - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), UserDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto putUser(String id, UpdateUserDto request) { - return putUser(id, request, null); - } - - public void deleteUser(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void deleteUser(String id) { - deleteUser(id, null); - } - - public UserDto lockUser(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .addPathSegment(id) - .addPathSegments("lock") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), UserDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto lockUser(String id) { - return lockUser(id, null); - } - - public UserDto unlockUser(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user-management") - .addPathSegment(id) - .addPathSegments("unlock") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("PUT", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), UserDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto unlockUser(String id) { - return unlockUser(id, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/usermanagement/requests/CreateUserDto.java b/src/main/java/com/squidex/api/resources/usermanagement/requests/CreateUserDto.java deleted file mode 100644 index 2c5a311..0000000 --- a/src/main/java/com/squidex/api/resources/usermanagement/requests/CreateUserDto.java +++ /dev/null @@ -1,205 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.usermanagement.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateUserDto.Builder.class) -public final class CreateUserDto { - private final String email; - - private final String displayName; - - private final String password; - - private final List permissions; - - private CreateUserDto(String email, String displayName, String password, List permissions) { - this.email = email; - this.displayName = displayName; - this.password = password; - this.permissions = permissions; - } - - /** - * @return The email of the user. Unique value. - */ - @JsonProperty("email") - public String getEmail() { - return email; - } - - /** - * @return The display name (usually first name and last name) of the user. - */ - @JsonProperty("displayName") - public String getDisplayName() { - return displayName; - } - - /** - * @return The password of the user. - */ - @JsonProperty("password") - public String getPassword() { - return password; - } - - /** - * @return Additional permissions for the user. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateUserDto && equalTo((CreateUserDto) other); - } - - private boolean equalTo(CreateUserDto other) { - return email.equals(other.email) - && displayName.equals(other.displayName) - && password.equals(other.password) - && permissions.equals(other.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(this.email, this.displayName, this.password, this.permissions); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static EmailStage builder() { - return new Builder(); - } - - public interface EmailStage { - DisplayNameStage email(String email); - - Builder from(CreateUserDto other); - } - - public interface DisplayNameStage { - PasswordStage displayName(String displayName); - } - - public interface PasswordStage { - _FinalStage password(String password); - } - - public interface _FinalStage { - CreateUserDto build(); - - _FinalStage permissions(List permissions); - - _FinalStage addPermissions(String permissions); - - _FinalStage addAllPermissions(List permissions); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements EmailStage, DisplayNameStage, PasswordStage, _FinalStage { - private String email; - - private String displayName; - - private String password; - - private List permissions = new ArrayList<>(); - - private Builder() {} - - @Override - public Builder from(CreateUserDto other) { - email(other.getEmail()); - displayName(other.getDisplayName()); - password(other.getPassword()); - permissions(other.getPermissions()); - return this; - } - - /** - *

The email of the user. Unique value.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("email") - public DisplayNameStage email(String email) { - this.email = email; - return this; - } - - /** - *

The display name (usually first name and last name) of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("displayName") - public PasswordStage displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - *

The password of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("password") - public _FinalStage password(String password) { - this.password = password; - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - @Override - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public _FinalStage permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - @Override - public CreateUserDto build() { - return new CreateUserDto(email, displayName, password, permissions); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/usermanagement/requests/UpdateUserDto.java b/src/main/java/com/squidex/api/resources/usermanagement/requests/UpdateUserDto.java deleted file mode 100644 index 96bd64f..0000000 --- a/src/main/java/com/squidex/api/resources/usermanagement/requests/UpdateUserDto.java +++ /dev/null @@ -1,212 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.usermanagement.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateUserDto.Builder.class) -public final class UpdateUserDto { - private final String email; - - private final String displayName; - - private final Optional password; - - private final List permissions; - - private UpdateUserDto(String email, String displayName, Optional password, List permissions) { - this.email = email; - this.displayName = displayName; - this.password = password; - this.permissions = permissions; - } - - /** - * @return The email of the user. Unique value. - */ - @JsonProperty("email") - public String getEmail() { - return email; - } - - /** - * @return The display name (usually first name and last name) of the user. - */ - @JsonProperty("displayName") - public String getDisplayName() { - return displayName; - } - - /** - * @return The password of the user. - */ - @JsonProperty("password") - public Optional getPassword() { - return password; - } - - /** - * @return Additional permissions for the user. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateUserDto && equalTo((UpdateUserDto) other); - } - - private boolean equalTo(UpdateUserDto other) { - return email.equals(other.email) - && displayName.equals(other.displayName) - && password.equals(other.password) - && permissions.equals(other.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(this.email, this.displayName, this.password, this.permissions); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static EmailStage builder() { - return new Builder(); - } - - public interface EmailStage { - DisplayNameStage email(String email); - - Builder from(UpdateUserDto other); - } - - public interface DisplayNameStage { - _FinalStage displayName(String displayName); - } - - public interface _FinalStage { - UpdateUserDto build(); - - _FinalStage password(Optional password); - - _FinalStage password(String password); - - _FinalStage permissions(List permissions); - - _FinalStage addPermissions(String permissions); - - _FinalStage addAllPermissions(List permissions); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements EmailStage, DisplayNameStage, _FinalStage { - private String email; - - private String displayName; - - private List permissions = new ArrayList<>(); - - private Optional password = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UpdateUserDto other) { - email(other.getEmail()); - displayName(other.getDisplayName()); - password(other.getPassword()); - permissions(other.getPermissions()); - return this; - } - - /** - *

The email of the user. Unique value.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("email") - public DisplayNameStage email(String email) { - this.email = email; - return this; - } - - /** - *

The display name (usually first name and last name) of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("displayName") - public _FinalStage displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - @Override - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public _FinalStage permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - /** - *

The password of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage password(String password) { - this.password = Optional.of(password); - return this; - } - - @Override - @JsonSetter(value = "password", nulls = Nulls.SKIP) - public _FinalStage password(Optional password) { - this.password = password; - return this; - } - - @Override - public UpdateUserDto build() { - return new UpdateUserDto(email, displayName, password, permissions); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/usermanagement/requests/UserManagementGetUsersRequest.java b/src/main/java/com/squidex/api/resources/usermanagement/requests/UserManagementGetUsersRequest.java deleted file mode 100644 index cca0edb..0000000 --- a/src/main/java/com/squidex/api/resources/usermanagement/requests/UserManagementGetUsersRequest.java +++ /dev/null @@ -1,133 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.usermanagement.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UserManagementGetUsersRequest.Builder.class) -public final class UserManagementGetUsersRequest { - private final Optional query; - - private final Optional skip; - - private final Optional take; - - private UserManagementGetUsersRequest(Optional query, Optional skip, Optional take) { - this.query = query; - this.skip = skip; - this.take = take; - } - - /** - * @return Optional query to search by email address or username. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return The number of users to skip. - */ - @JsonProperty("skip") - public Optional getSkip() { - return skip; - } - - /** - * @return The number of users to return. - */ - @JsonProperty("take") - public Optional getTake() { - return take; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UserManagementGetUsersRequest && equalTo((UserManagementGetUsersRequest) other); - } - - private boolean equalTo(UserManagementGetUsersRequest other) { - return query.equals(other.query) && skip.equals(other.skip) && take.equals(other.take); - } - - @Override - public int hashCode() { - return Objects.hash(this.query, this.skip, this.take); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Optional skip = Optional.empty(); - - private Optional take = Optional.empty(); - - private Builder() {} - - public Builder from(UserManagementGetUsersRequest other) { - query(other.getQuery()); - skip(other.getSkip()); - take(other.getTake()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "skip", nulls = Nulls.SKIP) - public Builder skip(Optional skip) { - this.skip = skip; - return this; - } - - public Builder skip(Integer skip) { - this.skip = Optional.of(skip); - return this; - } - - @JsonSetter(value = "take", nulls = Nulls.SKIP) - public Builder take(Optional take) { - this.take = take; - return this; - } - - public Builder take(Integer take) { - this.take = Optional.of(take); - return this; - } - - public UserManagementGetUsersRequest build() { - return new UserManagementGetUsersRequest(query, skip, take); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/users/UsersClient.java b/src/main/java/com/squidex/api/resources/users/UsersClient.java deleted file mode 100644 index dc58aba..0000000 --- a/src/main/java/com/squidex/api/resources/users/UsersClient.java +++ /dev/null @@ -1,206 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.users; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.squidex.api.core.ApiError; -import com.squidex.api.core.ClientOptions; -import com.squidex.api.core.ObjectMappers; -import com.squidex.api.core.RequestOptions; -import com.squidex.api.resources.users.requests.UpdateProfileDto; -import com.squidex.api.resources.users.requests.UsersGetUsersRequest; -import com.squidex.api.types.ResourcesDto; -import com.squidex.api.types.UserDto; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.MediaType; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; - -public class UsersClient { - protected final ClientOptions clientOptions; - - public UsersClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - public ResourcesDto getUserResources(RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), ResourcesDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public ResourcesDto getUserResources() { - return getUserResources(null); - } - - public void postUser() { - postUser(UpdateProfileDto.builder().build()); - } - - public void postUser(UpdateProfileDto request, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/user") - .build(); - RequestBody body; - try { - body = RequestBody.create( - ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); - } catch (Exception e) { - throw new RuntimeException(e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return; - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public void postUser(UpdateProfileDto request) { - postUser(request, null); - } - - /** - * Search the user by query that contains the email address or the part of the email address. - */ - public List getUsers() { - return getUsers(UsersGetUsersRequest.builder().build()); - } - - /** - * Search the user by query that contains the email address or the part of the email address. - */ - public List getUsers(UsersGetUsersRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/users"); - if (request.getQuery().isPresent()) { - httpUrl.addQueryParameter("query", request.getQuery().get()); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue( - response.body().string(), new TypeReference>() {}); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - /** - * Search the user by query that contains the email address or the part of the email address. - */ - public List getUsers(UsersGetUsersRequest request) { - return getUsers(request, null); - } - - public UserDto getUser(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/users") - .addPathSegment(id) - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return ObjectMappers.JSON_MAPPER.readValue(response.body().string(), UserDto.class); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public UserDto getUser(String id) { - return getUser(id, null); - } - - public InputStream getUserPicture(String id, RequestOptions requestOptions) { - HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) - .newBuilder() - .addPathSegments("api/users") - .addPathSegment(id) - .addPathSegments("picture") - .build(); - Request okhttpRequest = new Request.Builder() - .url(httpUrl) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .build(); - try { - Response response = - clientOptions.httpClient().newCall(okhttpRequest).execute(); - if (response.isSuccessful()) { - return response.body().byteStream(); - } - throw new ApiError( - response.code(), - ObjectMappers.JSON_MAPPER.readValue(response.body().string(), Object.class)); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - public InputStream getUserPicture(String id) { - return getUserPicture(id, null); - } -} diff --git a/src/main/java/com/squidex/api/resources/users/requests/UpdateProfileDto.java b/src/main/java/com/squidex/api/resources/users/requests/UpdateProfileDto.java deleted file mode 100644 index e9df43f..0000000 --- a/src/main/java/com/squidex/api/resources/users/requests/UpdateProfileDto.java +++ /dev/null @@ -1,84 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.users.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateProfileDto.Builder.class) -public final class UpdateProfileDto { - private final Optional>> answers; - - private UpdateProfileDto(Optional>> answers) { - this.answers = answers; - } - - /** - * @return The answers from a questionaire. - */ - @JsonProperty("answers") - public Optional>> getAnswers() { - return answers; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateProfileDto && equalTo((UpdateProfileDto) other); - } - - private boolean equalTo(UpdateProfileDto other) { - return answers.equals(other.answers); - } - - @Override - public int hashCode() { - return Objects.hash(this.answers); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> answers = Optional.empty(); - - private Builder() {} - - public Builder from(UpdateProfileDto other) { - answers(other.getAnswers()); - return this; - } - - @JsonSetter(value = "answers", nulls = Nulls.SKIP) - public Builder answers(Optional>> answers) { - this.answers = answers; - return this; - } - - public Builder answers(Map> answers) { - this.answers = Optional.of(answers); - return this; - } - - public UpdateProfileDto build() { - return new UpdateProfileDto(answers); - } - } -} diff --git a/src/main/java/com/squidex/api/resources/users/requests/UsersGetUsersRequest.java b/src/main/java/com/squidex/api/resources/users/requests/UsersGetUsersRequest.java deleted file mode 100644 index 8ec591f..0000000 --- a/src/main/java/com/squidex/api/resources/users/requests/UsersGetUsersRequest.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.resources.users.requests; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UsersGetUsersRequest.Builder.class) -public final class UsersGetUsersRequest { - private final Optional query; - - private UsersGetUsersRequest(Optional query) { - this.query = query; - } - - /** - * @return The query to search the user by email address. Case invariant. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsersGetUsersRequest && equalTo((UsersGetUsersRequest) other); - } - - private boolean equalTo(UsersGetUsersRequest other) { - return query.equals(other.query); - } - - @Override - public int hashCode() { - return Objects.hash(this.query); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Builder() {} - - public Builder from(UsersGetUsersRequest other) { - query(other.getQuery()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - public UsersGetUsersRequest build() { - return new UsersGetUsersRequest(query); - } - } -} diff --git a/src/main/java/com/squidex/api/types/AbstractOpenApiSchema.java b/src/main/java/com/squidex/api/types/AbstractOpenApiSchema.java new file mode 100644 index 0000000..f81f0d3 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AbstractOpenApiSchema.java @@ -0,0 +1,146 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +import com.squidex.api.core.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.9.0-SNAPSHOT") +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/squidex/api/types/ActionTypeEnum.java b/src/main/java/com/squidex/api/types/ActionTypeEnum.java index b9c4d39..fa9eb17 100644 --- a/src/main/java/com/squidex/api/types/ActionTypeEnum.java +++ b/src/main/java/com/squidex/api/types/ActionTypeEnum.java @@ -1,26 +1,80 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(ActionTypeEnum.Adapter.class) public enum ActionTypeEnum { - BROADCAST("Broadcast"), + + BROADCAST("Broadcast"), + + USER("User"), + + GROUP("Group"); - USER("User"), + private String value; - GROUP("Group"); + ActionTypeEnum(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - ActionTypeEnum(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static ActionTypeEnum fromValue(String value) { + for (ActionTypeEnum b : ActionTypeEnum.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 ActionTypeEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public ActionTypeEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ActionTypeEnum.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ActionTypeEnum.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/AddFieldDto.java b/src/main/java/com/squidex/api/types/AddFieldDto.java index 2b21b12..e05971a 100644 --- a/src/main/java/com/squidex/api/types/AddFieldDto.java +++ b/src/main/java/com/squidex/api/types/AddFieldDto.java @@ -1,161 +1,274 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.FieldPropertiesDto; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AddFieldDto.Builder.class) -public final class AddFieldDto { - private final String name; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final Optional partitioning; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final FieldPropertiesDto properties; +import com.squidex.api.core.JSON; - private AddFieldDto(String name, Optional partitioning, FieldPropertiesDto properties) { - this.name = name; - this.partitioning = partitioning; - this.properties = properties; - } +/** + * AddFieldDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AddFieldDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_PARTITIONING = "partitioning"; + @SerializedName(SERIALIZED_NAME_PARTITIONING) + private String partitioning; + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private FieldPropertiesDto properties; + public AddFieldDto() { + } + public AddFieldDto name(String name) { + this.name = name; + return this; + } - /** - * @return The name of the field. Must be unique within the schema. - */ - @JsonProperty("name") - public String getName() { - return name; - } + /** + * The name of the field. Must be unique within the schema. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - /** - * @return Determines the optional partitioning of the field. - */ - @JsonProperty("partitioning") - public Optional getPartitioning() { - return partitioning; - } + public void setName(String name) { + this.name = name; + } + public AddFieldDto partitioning(String partitioning) { + this.partitioning = partitioning; + return this; + } - /** - * @return The field properties. - */ - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } + /** + * Determines the optional partitioning of the field. + * @return partitioning + */ + @javax.annotation.Nullable + public String getPartitioning() { + return partitioning; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AddFieldDto && equalTo((AddFieldDto) other); - } + public void setPartitioning(String partitioning) { + this.partitioning = partitioning; + } + public AddFieldDto properties(FieldPropertiesDto properties) { + this.properties = properties; + return this; + } - private boolean equalTo(AddFieldDto other) { - return name.equals(other.name) - && partitioning.equals(other.partitioning) - && properties.equals(other.properties); - } + /** + * Get properties + * @return properties + */ + @javax.annotation.Nonnull + public FieldPropertiesDto getProperties() { + return properties; + } - @Override - public int hashCode() { - return Objects.hash(this.name, this.partitioning, this.properties); - } + public void setProperties(FieldPropertiesDto properties) { + this.properties = properties; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static NameStage builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + AddFieldDto addFieldDto = (AddFieldDto) o; + return Objects.equals(this.name, addFieldDto.name) && + Objects.equals(this.partitioning, addFieldDto.partitioning) && + Objects.equals(this.properties, addFieldDto.properties); + } - public interface NameStage { - PropertiesStage name(String name); + 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())); + } - Builder from(AddFieldDto other); - } + @Override + public int hashCode() { + return Objects.hash(name, partitioning, properties); + } - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - public interface _FinalStage { - AddFieldDto build(); - - _FinalStage partitioning(Optional partitioning); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddFieldDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" partitioning: ").append(toIndentedString(partitioning)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append("}"); + return sb.toString(); + } - _FinalStage partitioning(String partitioning); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, PropertiesStage, _FinalStage { - private String name; - private FieldPropertiesDto properties; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Optional partitioning = Optional.empty(); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("partitioning"); + openapiFields.add("properties"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("properties"); + } - @Override - public Builder from(AddFieldDto other) { - name(other.getName()); - partitioning(other.getPartitioning()); - properties(other.getProperties()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AddFieldDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddFieldDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AddFieldDto is not found in the empty JSON string", AddFieldDto.openapiRequiredFields.toString())); } + } - /** - *

The name of the field. Must be unique within the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public PropertiesStage name(String name) { - this.name = name; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddFieldDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddFieldDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The field properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddFieldDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("partitioning") != null && !jsonObj.get("partitioning").isJsonNull()) && !jsonObj.get("partitioning").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `partitioning` to be a primitive type in the JSON string but got `%s`", jsonObj.get("partitioning").toString())); + } + // validate the required field `properties` + FieldPropertiesDto.validateJsonElement(jsonObj.get("properties")); + } - /** - *

Determines the optional partitioning of the field.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage partitioning(String partitioning) { - this.partitioning = Optional.of(partitioning); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddFieldDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddFieldDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AddFieldDto.class)); - @Override - @JsonSetter(value = "partitioning", nulls = Nulls.SKIP) - public _FinalStage partitioning(Optional partitioning) { - this.partitioning = partitioning; - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AddFieldDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public AddFieldDto build() { - return new AddFieldDto(name, partitioning, properties); - } + @Override + public AddFieldDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AddFieldDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddFieldDto + * @throws IOException if the JSON string is invalid with respect to AddFieldDto + */ + public static AddFieldDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddFieldDto.class); + } + + /** + * Convert an instance of AddFieldDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AddLanguageDto.java b/src/main/java/com/squidex/api/types/AddLanguageDto.java new file mode 100644 index 0000000..847935f --- /dev/null +++ b/src/main/java/com/squidex/api/types/AddLanguageDto.java @@ -0,0 +1,209 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * AddLanguageDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AddLanguageDto { + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + private String language; + public AddLanguageDto() { + } + public AddLanguageDto language(String language) { + this.language = language; + return this; + } + + /** + * The language to add. + * @return language + */ + @javax.annotation.Nonnull + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddLanguageDto addLanguageDto = (AddLanguageDto) o; + return Objects.equals(this.language, addLanguageDto.language); + } + + @Override + public int hashCode() { + return Objects.hash(language); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddLanguageDto {\n"); + sb.append(" language: ").append(toIndentedString(language)).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("language"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("language"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AddLanguageDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddLanguageDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AddLanguageDto is not found in the empty JSON string", AddLanguageDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddLanguageDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddLanguageDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddLanguageDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("language").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `language` to be a primitive type in the JSON string but got `%s`", jsonObj.get("language").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AddLanguageDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddLanguageDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AddLanguageDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AddLanguageDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddLanguageDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AddLanguageDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddLanguageDto + * @throws IOException if the JSON string is invalid with respect to AddLanguageDto + */ + public static AddLanguageDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddLanguageDto.class); + } + + /** + * Convert an instance of AddLanguageDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/AddRoleDto.java b/src/main/java/com/squidex/api/types/AddRoleDto.java new file mode 100644 index 0000000..4aa36ed --- /dev/null +++ b/src/main/java/com/squidex/api/types/AddRoleDto.java @@ -0,0 +1,209 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * AddRoleDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AddRoleDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public AddRoleDto() { + } + public AddRoleDto name(String name) { + this.name = name; + return this; + } + + /** + * The role name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddRoleDto addRoleDto = (AddRoleDto) o; + return Objects.equals(this.name, addRoleDto.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddRoleDto {\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("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 AddRoleDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddRoleDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AddRoleDto is not found in the empty JSON string", AddRoleDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddRoleDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddRoleDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddRoleDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!AddRoleDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddRoleDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AddRoleDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AddRoleDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddRoleDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AddRoleDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddRoleDto + * @throws IOException if the JSON string is invalid with respect to AddRoleDto + */ + public static AddRoleDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddRoleDto.class); + } + + /** + * Convert an instance of AddRoleDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/AddWorkflowDto.java b/src/main/java/com/squidex/api/types/AddWorkflowDto.java new file mode 100644 index 0000000..7abd3b4 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AddWorkflowDto.java @@ -0,0 +1,209 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * AddWorkflowDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AddWorkflowDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public AddWorkflowDto() { + } + public AddWorkflowDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the workflow. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AddWorkflowDto addWorkflowDto = (AddWorkflowDto) o; + return Objects.equals(this.name, addWorkflowDto.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AddWorkflowDto {\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("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 AddWorkflowDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AddWorkflowDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AddWorkflowDto is not found in the empty JSON string", AddWorkflowDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AddWorkflowDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AddWorkflowDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AddWorkflowDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!AddWorkflowDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AddWorkflowDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AddWorkflowDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AddWorkflowDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AddWorkflowDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AddWorkflowDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AddWorkflowDto + * @throws IOException if the JSON string is invalid with respect to AddWorkflowDto + */ + public static AddWorkflowDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AddWorkflowDto.class); + } + + /** + * Convert an instance of AddWorkflowDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java b/src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java index 194ec90..ffdcc63 100644 --- a/src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java @@ -1,228 +1,316 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AlgoliaRuleActionDto.Builder.class) -public final class AlgoliaRuleActionDto { - private final String appId; - - private final String apiKey; - - private final String indexName; - - private final Optional document; - private final Optional delete; - - private AlgoliaRuleActionDto( - String appId, String apiKey, String indexName, Optional document, Optional delete) { - this.appId = appId; - this.apiKey = apiKey; - this.indexName = indexName; - this.document = document; - this.delete = delete; - } - - /** - * @return The application ID. - */ - @JsonProperty("appId") - public String getAppId() { - return appId; - } - - /** - * @return The API key to grant access to Squidex. - */ - @JsonProperty("apiKey") - public String getApiKey() { - return apiKey; - } - - /** - * @return The name of the index. - */ - @JsonProperty("indexName") - public String getIndexName() { - return indexName; - } - - /** - * @return The optional custom document. - */ - @JsonProperty("document") - public Optional getDocument() { - return document; - } - - /** - * @return The condition when to delete the entry. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AlgoliaRuleActionDto && equalTo((AlgoliaRuleActionDto) other); - } - - private boolean equalTo(AlgoliaRuleActionDto other) { - return appId.equals(other.appId) - && apiKey.equals(other.apiKey) - && indexName.equals(other.indexName) - && document.equals(other.document) - && delete.equals(other.delete); - } - - @Override - public int hashCode() { - return Objects.hash(this.appId, this.apiKey, this.indexName, this.document, this.delete); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static AppIdStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface AppIdStage { - ApiKeyStage appId(String appId); +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.squidex.api.types.RuleActionDto; +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.squidex.api.core.JSON; - Builder from(AlgoliaRuleActionDto other); +/** + * AlgoliaRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AlgoliaRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_APP_ID = "appId"; + @SerializedName(SERIALIZED_NAME_APP_ID) + private String appId; + public static final String SERIALIZED_NAME_API_KEY = "apiKey"; + @SerializedName(SERIALIZED_NAME_API_KEY) + private String apiKey; + public static final String SERIALIZED_NAME_INDEX_NAME = "indexName"; + @SerializedName(SERIALIZED_NAME_INDEX_NAME) + private String indexName; + public static final String SERIALIZED_NAME_DOCUMENT = "document"; + @SerializedName(SERIALIZED_NAME_DOCUMENT) + private String document; + public static final String SERIALIZED_NAME_DELETE = "delete"; + @SerializedName(SERIALIZED_NAME_DELETE) + private String delete; + public AlgoliaRuleActionDto() { + } + public AlgoliaRuleActionDto appId(String appId) { + this.appId = appId; + return this; + } + + /** + * The application ID. + * @return appId + */ + @javax.annotation.Nonnull + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + public AlgoliaRuleActionDto apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The API key to grant access to Squidex. + * @return apiKey + */ + @javax.annotation.Nonnull + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + public AlgoliaRuleActionDto indexName(String indexName) { + this.indexName = indexName; + return this; + } + + /** + * The name of the index. + * @return indexName + */ + @javax.annotation.Nonnull + public String getIndexName() { + return indexName; + } + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + public AlgoliaRuleActionDto document(String document) { + this.document = document; + return this; + } + + /** + * The optional custom document. + * @return document + */ + @javax.annotation.Nullable + public String getDocument() { + return document; + } + + public void setDocument(String document) { + this.document = document; + } + public AlgoliaRuleActionDto delete(String delete) { + this.delete = delete; + return this; + } + + /** + * The condition when to delete the entry. + * @return delete + */ + @javax.annotation.Nullable + public String getDelete() { + return delete; + } + + public void setDelete(String delete) { + this.delete = delete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ApiKeyStage { - IndexNameStage apiKey(String apiKey); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface IndexNameStage { - _FinalStage indexName(String indexName); + AlgoliaRuleActionDto algoliaRuleActionDto = (AlgoliaRuleActionDto) o; + return Objects.equals(this.appId, algoliaRuleActionDto.appId) && + Objects.equals(this.apiKey, algoliaRuleActionDto.apiKey) && + Objects.equals(this.indexName, algoliaRuleActionDto.indexName) && + Objects.equals(this.document, algoliaRuleActionDto.document) && + Objects.equals(this.delete, algoliaRuleActionDto.delete) && + super.equals(o); + } + + 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(appId, apiKey, indexName, document, delete, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - AlgoliaRuleActionDto build(); - - _FinalStage document(Optional document); - - _FinalStage document(String document); - - _FinalStage delete(Optional delete); - - _FinalStage delete(String delete); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AlgoliaRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" appId: ").append(toIndentedString(appId)).append("\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" indexName: ").append(toIndentedString(indexName)).append("\n"); + sb.append(" document: ").append(toIndentedString(document)).append("\n"); + sb.append(" delete: ").append(toIndentedString(delete)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AppIdStage, ApiKeyStage, IndexNameStage, _FinalStage { - private String appId; - - private String apiKey; - - private String indexName; - - private Optional delete = Optional.empty(); - - private Optional document = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(AlgoliaRuleActionDto other) { - appId(other.getAppId()); - apiKey(other.getApiKey()); - indexName(other.getIndexName()); - document(other.getDocument()); - delete(other.getDelete()); - return this; - } - - /** - *

The application ID.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("appId") - public ApiKeyStage appId(String appId) { - this.appId = appId; - return this; - } - - /** - *

The API key to grant access to Squidex.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiKey") - public IndexNameStage apiKey(String apiKey) { - this.apiKey = apiKey; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("appId"); + openapiFields.add("apiKey"); + openapiFields.add("indexName"); + openapiFields.add("document"); + openapiFields.add("delete"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("appId"); + openapiRequiredFields.add("apiKey"); + openapiRequiredFields.add("indexName"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AlgoliaRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AlgoliaRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AlgoliaRuleActionDto is not found in the empty JSON string", AlgoliaRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The name of the index.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("indexName") - public _FinalStage indexName(String indexName) { - this.indexName = indexName; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AlgoliaRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AlgoliaRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The condition when to delete the entry.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage delete(String delete) { - this.delete = Optional.of(delete); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AlgoliaRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @Override - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public _FinalStage delete(Optional delete) { - this.delete = delete; - return this; - } - - /** - *

The optional custom document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage document(String document) { - this.document = Optional.of(document); - return this; - } - - @Override - @JsonSetter(value = "document", nulls = Nulls.SKIP) - public _FinalStage document(Optional document) { - this.document = document; - return this; - } - - @Override - public AlgoliaRuleActionDto build() { - return new AlgoliaRuleActionDto(appId, apiKey, indexName, document, delete); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AlgoliaRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AlgoliaRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AlgoliaRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AlgoliaRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AlgoliaRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AlgoliaRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AlgoliaRuleActionDto + * @throws IOException if the JSON string is invalid with respect to AlgoliaRuleActionDto + */ + public static AlgoliaRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AlgoliaRuleActionDto.class); + } + + /** + * Convert an instance of AlgoliaRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AllContentsByPostDto.java b/src/main/java/com/squidex/api/types/AllContentsByPostDto.java new file mode 100644 index 0000000..011315d --- /dev/null +++ b/src/main/java/com/squidex/api/types/AllContentsByPostDto.java @@ -0,0 +1,372 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.ArrayList; +import java.util.Arrays; +import java.util.List; +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.squidex.api.core.JSON; + +/** + * AllContentsByPostDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AllContentsByPostDto { + public static final String SERIALIZED_NAME_IDS = "ids"; + @SerializedName(SERIALIZED_NAME_IDS) + private List ids; + public static final String SERIALIZED_NAME_SCHEDULED_FROM = "scheduledFrom"; + @SerializedName(SERIALIZED_NAME_SCHEDULED_FROM) + private OffsetDateTime scheduledFrom; + public static final String SERIALIZED_NAME_SCHEDULED_TO = "scheduledTo"; + @SerializedName(SERIALIZED_NAME_SCHEDULED_TO) + private OffsetDateTime scheduledTo; + public static final String SERIALIZED_NAME_REFERENCING = "referencing"; + @SerializedName(SERIALIZED_NAME_REFERENCING) + private String referencing; + public static final String SERIALIZED_NAME_REFERENCES = "references"; + @SerializedName(SERIALIZED_NAME_REFERENCES) + private String references; + public static final String SERIALIZED_NAME_O_DATA = "oData"; + @SerializedName(SERIALIZED_NAME_O_DATA) + private String oData; + public static final String SERIALIZED_NAME_Q = "q"; + @SerializedName(SERIALIZED_NAME_Q) + private Object q = null; + public AllContentsByPostDto() { + } + public AllContentsByPostDto ids(List ids) { + this.ids = ids; + return this; + } + + public AllContentsByPostDto addIdsItem(String idsItem) { + if (this.ids == null) { + this.ids = new ArrayList<>(); + } + this.ids.add(idsItem); + return this; + } + + /** + * The list of ids to query. + * @return ids + */ + @javax.annotation.Nullable + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } + public AllContentsByPostDto scheduledFrom(OffsetDateTime scheduledFrom) { + this.scheduledFrom = scheduledFrom; + return this; + } + + /** + * The start of the schedule. + * @return scheduledFrom + */ + @javax.annotation.Nullable + public OffsetDateTime getScheduledFrom() { + return scheduledFrom; + } + + public void setScheduledFrom(OffsetDateTime scheduledFrom) { + this.scheduledFrom = scheduledFrom; + } + public AllContentsByPostDto scheduledTo(OffsetDateTime scheduledTo) { + this.scheduledTo = scheduledTo; + return this; + } + + /** + * The end of the schedule. + * @return scheduledTo + */ + @javax.annotation.Nullable + public OffsetDateTime getScheduledTo() { + return scheduledTo; + } + + public void setScheduledTo(OffsetDateTime scheduledTo) { + this.scheduledTo = scheduledTo; + } + public AllContentsByPostDto referencing(String referencing) { + this.referencing = referencing; + return this; + } + + /** + * The ID of the referencing content item. + * @return referencing + */ + @javax.annotation.Nullable + public String getReferencing() { + return referencing; + } + + public void setReferencing(String referencing) { + this.referencing = referencing; + } + public AllContentsByPostDto references(String references) { + this.references = references; + return this; + } + + /** + * The ID of the reference content item. + * @return references + */ + @javax.annotation.Nullable + public String getReferences() { + return references; + } + + public void setReferences(String references) { + this.references = references; + } + public AllContentsByPostDto oData(String oData) { + this.oData = oData; + return this; + } + + /** + * The optional odata query. + * @return oData + */ + @javax.annotation.Nullable + public String getoData() { + return oData; + } + + public void setoData(String oData) { + this.oData = oData; + } + public AllContentsByPostDto q(Object q) { + this.q = q; + return this; + } + + /** + * The optional json query. + * @return q + */ + @javax.annotation.Nullable + public Object getQ() { + return q; + } + + public void setQ(Object q) { + this.q = q; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AllContentsByPostDto allContentsByPostDto = (AllContentsByPostDto) o; + return Objects.equals(this.ids, allContentsByPostDto.ids) && + Objects.equals(this.scheduledFrom, allContentsByPostDto.scheduledFrom) && + Objects.equals(this.scheduledTo, allContentsByPostDto.scheduledTo) && + Objects.equals(this.referencing, allContentsByPostDto.referencing) && + Objects.equals(this.references, allContentsByPostDto.references) && + Objects.equals(this.oData, allContentsByPostDto.oData) && + Objects.equals(this.q, allContentsByPostDto.q); + } + + 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(ids, scheduledFrom, scheduledTo, referencing, references, oData, q); + } + + 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 AllContentsByPostDto {\n"); + sb.append(" ids: ").append(toIndentedString(ids)).append("\n"); + sb.append(" scheduledFrom: ").append(toIndentedString(scheduledFrom)).append("\n"); + sb.append(" scheduledTo: ").append(toIndentedString(scheduledTo)).append("\n"); + sb.append(" referencing: ").append(toIndentedString(referencing)).append("\n"); + sb.append(" references: ").append(toIndentedString(references)).append("\n"); + sb.append(" oData: ").append(toIndentedString(oData)).append("\n"); + sb.append(" q: ").append(toIndentedString(q)).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("ids"); + openapiFields.add("scheduledFrom"); + openapiFields.add("scheduledTo"); + openapiFields.add("referencing"); + openapiFields.add("references"); + openapiFields.add("oData"); + openapiFields.add("q"); + + // 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 AllContentsByPostDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AllContentsByPostDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AllContentsByPostDto is not found in the empty JSON string", AllContentsByPostDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AllContentsByPostDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AllContentsByPostDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("ids") != null && !jsonObj.get("ids").isJsonNull() && !jsonObj.get("ids").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ids` to be an array in the JSON string but got `%s`", jsonObj.get("ids").toString())); + } + if ((jsonObj.get("referencing") != null && !jsonObj.get("referencing").isJsonNull()) && !jsonObj.get("referencing").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `referencing` to be a primitive type in the JSON string but got `%s`", jsonObj.get("referencing").toString())); + } + if ((jsonObj.get("references") != null && !jsonObj.get("references").isJsonNull()) && !jsonObj.get("references").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `references` to be a primitive type in the JSON string but got `%s`", jsonObj.get("references").toString())); + } + if ((jsonObj.get("oData") != null && !jsonObj.get("oData").isJsonNull()) && !jsonObj.get("oData").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `oData` to be a primitive type in the JSON string but got `%s`", jsonObj.get("oData").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AllContentsByPostDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AllContentsByPostDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AllContentsByPostDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AllContentsByPostDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AllContentsByPostDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AllContentsByPostDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AllContentsByPostDto + * @throws IOException if the JSON string is invalid with respect to AllContentsByPostDto + */ + public static AllContentsByPostDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AllContentsByPostDto.class); + } + + /** + * Convert an instance of AllContentsByPostDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/AnnotateAssetDto.java b/src/main/java/com/squidex/api/types/AnnotateAssetDto.java new file mode 100644 index 0000000..a8636a4 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AnnotateAssetDto.java @@ -0,0 +1,332 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +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.squidex.api.core.JSON; + +/** + * AnnotateAssetDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AnnotateAssetDto { + public static final String SERIALIZED_NAME_FILE_NAME = "fileName"; + @SerializedName(SERIALIZED_NAME_FILE_NAME) + private String fileName; + public static final String SERIALIZED_NAME_SLUG = "slug"; + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; + public static final String SERIALIZED_NAME_IS_PROTECTED = "isProtected"; + @SerializedName(SERIALIZED_NAME_IS_PROTECTED) + private Boolean isProtected; + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private List tags; + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + private Map metadata; + public AnnotateAssetDto() { + } + public AnnotateAssetDto fileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * The new name of the asset. + * @return fileName + */ + @javax.annotation.Nullable + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + public AnnotateAssetDto slug(String slug) { + this.slug = slug; + return this; + } + + /** + * The new slug of the asset. + * @return slug + */ + @javax.annotation.Nullable + public String getSlug() { + return slug; + } + + public void setSlug(String slug) { + this.slug = slug; + } + public AnnotateAssetDto isProtected(Boolean isProtected) { + this.isProtected = isProtected; + return this; + } + + /** + * True, when the asset is not public. + * @return isProtected + */ + @javax.annotation.Nullable + public Boolean getIsProtected() { + return isProtected; + } + + public void setIsProtected(Boolean isProtected) { + this.isProtected = isProtected; + } + public AnnotateAssetDto tags(List tags) { + this.tags = tags; + return this; + } + + public AnnotateAssetDto addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * The new asset tags. + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + public AnnotateAssetDto metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public AnnotateAssetDto putMetadataItem(String key, Object metadataItem) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.put(key, metadataItem); + return this; + } + + /** + * The asset metadata. + * @return metadata + */ + @javax.annotation.Nullable + public Map getMetadata() { + return metadata; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AnnotateAssetDto annotateAssetDto = (AnnotateAssetDto) o; + return Objects.equals(this.fileName, annotateAssetDto.fileName) && + Objects.equals(this.slug, annotateAssetDto.slug) && + Objects.equals(this.isProtected, annotateAssetDto.isProtected) && + Objects.equals(this.tags, annotateAssetDto.tags) && + Objects.equals(this.metadata, annotateAssetDto.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(fileName, slug, isProtected, tags, 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(); + sb.append("class AnnotateAssetDto {\n"); + sb.append(" fileName: ").append(toIndentedString(fileName)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" isProtected: ").append(toIndentedString(isProtected)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).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("fileName"); + openapiFields.add("slug"); + openapiFields.add("isProtected"); + openapiFields.add("tags"); + 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 AnnotateAssetDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AnnotateAssetDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AnnotateAssetDto is not found in the empty JSON string", AnnotateAssetDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AnnotateAssetDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AnnotateAssetDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + 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())); + } + if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull() && !jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AnnotateAssetDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AnnotateAssetDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AnnotateAssetDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AnnotateAssetDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AnnotateAssetDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AnnotateAssetDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AnnotateAssetDto + * @throws IOException if the JSON string is invalid with respect to AnnotateAssetDto + */ + public static AnnotateAssetDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AnnotateAssetDto.class); + } + + /** + * Convert an instance of AnnotateAssetDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/AppDto.java b/src/main/java/com/squidex/api/types/AppDto.java index e63d9a3..28ec6fe 100644 --- a/src/main/java/com/squidex/api/types/AppDto.java +++ b/src/main/java/com/squidex/api/types/AppDto.java @@ -1,622 +1,585 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AppDto.Builder.class) -public final class AppDto implements IResource { - private final Map links; - - private final String id; - - private final String name; - - private final Optional label; - - private final Optional description; - - private final int version; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final Optional teamId; - - private final List permissions; - - private final boolean canAccessApi; - - private final boolean canAccessContent; - - private final Optional roleName; - - private final Map roleProperties; - - private AppDto( - Map links, - String id, - String name, - Optional label, - Optional description, - int version, - OffsetDateTime created, - OffsetDateTime lastModified, - Optional teamId, - List permissions, - boolean canAccessApi, - boolean canAccessContent, - Optional roleName, - Map roleProperties) { - this.links = links; - this.id = id; - this.name = name; - this.label = label; - this.description = description; - this.version = version; - this.created = created; - this.lastModified = lastModified; - this.teamId = teamId; - this.permissions = permissions; - this.canAccessApi = canAccessApi; - this.canAccessContent = canAccessContent; - this.roleName = roleName; - this.roleProperties = roleProperties; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the app. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The name of the app. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The optional label of the app. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; - } - - /** - * @return The optional description of the app. - */ - @JsonProperty("description") - public Optional getDescription() { - return description; - } - - /** - * @return The version of the app. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - /** - * @return The timestamp when the app has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The timestamp when the app has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The ID of the team. - */ - @JsonProperty("teamId") - public Optional getTeamId() { - return teamId; - } - - /** - * @return The permission level of the user. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - /** - * @return Indicates if the user can access the api. - */ - @JsonProperty("canAccessApi") - public boolean getCanAccessApi() { - return canAccessApi; - } - - /** - * @return Indicates if the user can access at least one content. - */ - @JsonProperty("canAccessContent") - public boolean getCanAccessContent() { - return canAccessContent; - } - - /** - * @return The role name of the user. - */ - @JsonProperty("roleName") - public Optional getRoleName() { - return roleName; - } - - /** - * @return The properties from the role. - */ - @JsonProperty("roleProperties") - public Map getRoleProperties() { - return roleProperties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AppDto && equalTo((AppDto) other); - } - - private boolean equalTo(AppDto other) { - return links.equals(other.links) - && id.equals(other.id) - && name.equals(other.name) - && label.equals(other.label) - && description.equals(other.description) - && version == other.version - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && teamId.equals(other.teamId) - && permissions.equals(other.permissions) - && canAccessApi == other.canAccessApi - && canAccessContent == other.canAccessContent - && roleName.equals(other.roleName) - && roleProperties.equals(other.roleProperties); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.name, - this.label, - this.description, - this.version, - this.created, - this.lastModified, - this.teamId, - this.permissions, - this.canAccessApi, - this.canAccessContent, - this.roleName, - this.roleProperties); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } +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; - public interface IdStage { - NameStage id(String id); +import com.squidex.api.core.JSON; - Builder from(AppDto other); +/** + * AppDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AppDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + private String label; + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Long version; + public static final String SERIALIZED_NAME_CREATED = "created"; + @SerializedName(SERIALIZED_NAME_CREATED) + private OffsetDateTime created; + public static final String SERIALIZED_NAME_LAST_MODIFIED = "lastModified"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED) + private OffsetDateTime lastModified; + public static final String SERIALIZED_NAME_TEAM_ID = "teamId"; + @SerializedName(SERIALIZED_NAME_TEAM_ID) + private String teamId; + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); + public static final String SERIALIZED_NAME_CAN_ACCESS_API = "canAccessApi"; + @Deprecated + @SerializedName(SERIALIZED_NAME_CAN_ACCESS_API) + private Boolean canAccessApi; + public static final String SERIALIZED_NAME_CAN_ACCESS_CONTENT = "canAccessContent"; + @SerializedName(SERIALIZED_NAME_CAN_ACCESS_CONTENT) + private Boolean canAccessContent; + public static final String SERIALIZED_NAME_ROLE_NAME = "roleName"; + @SerializedName(SERIALIZED_NAME_ROLE_NAME) + private String roleName; + public static final String SERIALIZED_NAME_ROLE_PROPERTIES = "roleProperties"; + @SerializedName(SERIALIZED_NAME_ROLE_PROPERTIES) + private Map roleProperties = new HashMap<>(); + public AppDto() { + } + public AppDto links(Map links) { + this.links = links; + return this; + } + + public AppDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface NameStage { - VersionStage name(String name); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public AppDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the app. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public AppDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the app. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public AppDto label(String label) { + this.label = label; + return this; + } + + /** + * The optional label of the app. + * @return label + */ + @javax.annotation.Nullable + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + public AppDto description(String description) { + this.description = description; + return this; + } + + /** + * The optional description of the app. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public AppDto version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the app. + * @return version + */ + @javax.annotation.Nonnull + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + public AppDto created(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * The timestamp when the app has been created. + * @return created + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreated() { + return created; + } + + public void setCreated(OffsetDateTime created) { + this.created = created; + } + public AppDto lastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * The timestamp when the app has been modified last. + * @return lastModified + */ + @javax.annotation.Nonnull + public OffsetDateTime getLastModified() { + return lastModified; + } + + public void setLastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + } + public AppDto teamId(String teamId) { + this.teamId = teamId; + return this; + } + + /** + * The ID of the team. + * @return teamId + */ + @javax.annotation.Nullable + public String getTeamId() { + return teamId; + } + + public void setTeamId(String teamId) { + this.teamId = teamId; + } + public AppDto permissions(List permissions) { + this.permissions = permissions; + return this; + } + + public AppDto addPermissionsItem(String permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); } - - public interface VersionStage { - CreatedStage version(int version); + this.permissions.add(permissionsItem); + return this; + } + + /** + * The permission level of the user. + * @return permissions + */ + @javax.annotation.Nonnull + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + @Deprecated + public AppDto canAccessApi(Boolean canAccessApi) { + this.canAccessApi = canAccessApi; + return this; + } + + /** + * Indicates if the user can access the api. + * @return canAccessApi + * @deprecated + */ + @Deprecated + @javax.annotation.Nonnull + public Boolean getCanAccessApi() { + return canAccessApi; + } + + @Deprecated + public void setCanAccessApi(Boolean canAccessApi) { + this.canAccessApi = canAccessApi; + } + public AppDto canAccessContent(Boolean canAccessContent) { + this.canAccessContent = canAccessContent; + return this; + } + + /** + * Indicates if the user can access at least one content. + * @return canAccessContent + */ + @javax.annotation.Nonnull + public Boolean getCanAccessContent() { + return canAccessContent; + } + + public void setCanAccessContent(Boolean canAccessContent) { + this.canAccessContent = canAccessContent; + } + public AppDto roleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * The role name of the user. + * @return roleName + */ + @javax.annotation.Nullable + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + public AppDto roleProperties(Map roleProperties) { + this.roleProperties = roleProperties; + return this; + } + + public AppDto putRolePropertiesItem(String key, Object rolePropertiesItem) { + if (this.roleProperties == null) { + this.roleProperties = new HashMap<>(); } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); + this.roleProperties.put(key, rolePropertiesItem); + return this; + } + + /** + * The properties from the role. + * @return roleProperties + */ + @javax.annotation.Nonnull + public Map getRoleProperties() { + return roleProperties; + } + + public void setRoleProperties(Map roleProperties) { + this.roleProperties = roleProperties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface LastModifiedStage { - CanAccessApiStage lastModified(OffsetDateTime lastModified); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface CanAccessApiStage { - CanAccessContentStage canAccessApi(boolean canAccessApi); + AppDto appDto = (AppDto) o; + return Objects.equals(this.links, appDto.links) && + Objects.equals(this.id, appDto.id) && + Objects.equals(this.name, appDto.name) && + Objects.equals(this.label, appDto.label) && + Objects.equals(this.description, appDto.description) && + Objects.equals(this.version, appDto.version) && + Objects.equals(this.created, appDto.created) && + Objects.equals(this.lastModified, appDto.lastModified) && + Objects.equals(this.teamId, appDto.teamId) && + Objects.equals(this.permissions, appDto.permissions) && + Objects.equals(this.canAccessApi, appDto.canAccessApi) && + Objects.equals(this.canAccessContent, appDto.canAccessContent) && + Objects.equals(this.roleName, appDto.roleName) && + Objects.equals(this.roleProperties, appDto.roleProperties); + } + + 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(links, id, name, label, description, version, created, lastModified, teamId, permissions, canAccessApi, canAccessContent, roleName, roleProperties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface CanAccessContentStage { - _FinalStage canAccessContent(boolean canAccessContent); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" lastModified: ").append(toIndentedString(lastModified)).append("\n"); + sb.append(" teamId: ").append(toIndentedString(teamId)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" canAccessApi: ").append(toIndentedString(canAccessApi)).append("\n"); + sb.append(" canAccessContent: ").append(toIndentedString(canAccessContent)).append("\n"); + sb.append(" roleName: ").append(toIndentedString(roleName)).append("\n"); + sb.append(" roleProperties: ").append(toIndentedString(roleProperties)).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"; } - - public interface _FinalStage { - AppDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage label(Optional label); - - _FinalStage label(String label); - - _FinalStage description(Optional description); - - _FinalStage description(String description); - - _FinalStage teamId(Optional teamId); - - _FinalStage teamId(String teamId); - - _FinalStage permissions(List permissions); - - _FinalStage addPermissions(String permissions); - - _FinalStage addAllPermissions(List permissions); - - _FinalStage roleName(Optional roleName); - - _FinalStage roleName(String roleName); - - _FinalStage roleProperties(Map roleProperties); - - _FinalStage putAllRoleProperties(Map roleProperties); - - _FinalStage roleProperties(String key, Object value); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - NameStage, - VersionStage, - CreatedStage, - LastModifiedStage, - CanAccessApiStage, - CanAccessContentStage, - _FinalStage { - private String id; - - private String name; - - private int version; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private boolean canAccessApi; - - private boolean canAccessContent; - - private Map roleProperties = new LinkedHashMap<>(); - - private Optional roleName = Optional.empty(); - - private List permissions = new ArrayList<>(); - - private Optional teamId = Optional.empty(); - - private Optional description = Optional.empty(); - - private Optional label = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AppDto other) { - links(other.getLinks()); - id(other.getId()); - name(other.getName()); - label(other.getLabel()); - description(other.getDescription()); - version(other.getVersion()); - created(other.getCreated()); - lastModified(other.getLastModified()); - teamId(other.getTeamId()); - permissions(other.getPermissions()); - canAccessApi(other.getCanAccessApi()); - canAccessContent(other.getCanAccessContent()); - roleName(other.getRoleName()); - roleProperties(other.getRoleProperties()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("label"); + openapiFields.add("description"); + openapiFields.add("version"); + openapiFields.add("created"); + openapiFields.add("lastModified"); + openapiFields.add("teamId"); + openapiFields.add("permissions"); + openapiFields.add("canAccessApi"); + openapiFields.add("canAccessContent"); + openapiFields.add("roleName"); + openapiFields.add("roleProperties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("lastModified"); + openapiRequiredFields.add("permissions"); + openapiRequiredFields.add("canAccessApi"); + openapiRequiredFields.add("canAccessContent"); + openapiRequiredFields.add("roleProperties"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AppDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AppDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AppDto is not found in the empty JSON string", AppDto.openapiRequiredFields.toString())); } + } - /** - *

The ID of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public NameStage id(String id) { - this.id = id; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AppDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AppDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The name of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public VersionStage name(String name) { - this.name = name; - return this; - } - - /** - *

The version of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public CreatedStage version(int version) { - this.version = version; - return this; - } - - /** - *

The timestamp when the app has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The timestamp when the app has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public CanAccessApiStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

Indicates if the user can access the api.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("canAccessApi") - public CanAccessContentStage canAccessApi(boolean canAccessApi) { - this.canAccessApi = canAccessApi; - return this; - } - - /** - *

Indicates if the user can access at least one content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("canAccessContent") - public _FinalStage canAccessContent(boolean canAccessContent) { - this.canAccessContent = canAccessContent; - return this; - } - - /** - *

The properties from the role.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage roleProperties(String key, Object value) { - this.roleProperties.put(key, value); - return this; - } - - /** - *

The properties from the role.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllRoleProperties(Map roleProperties) { - this.roleProperties.putAll(roleProperties); - return this; - } - - @Override - @JsonSetter(value = "roleProperties", nulls = Nulls.SKIP) - public _FinalStage roleProperties(Map roleProperties) { - this.roleProperties.clear(); - this.roleProperties.putAll(roleProperties); - return this; - } - - /** - *

The role name of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage roleName(String roleName) { - this.roleName = Optional.of(roleName); - return this; - } - - @Override - @JsonSetter(value = "roleName", nulls = Nulls.SKIP) - public _FinalStage roleName(Optional roleName) { - this.roleName = roleName; - return this; - } - - /** - *

The permission level of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - /** - *

The permission level of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - @Override - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public _FinalStage permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - /** - *

The ID of the team.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage teamId(String teamId) { - this.teamId = Optional.of(teamId); - return this; - } - - @Override - @JsonSetter(value = "teamId", nulls = Nulls.SKIP) - public _FinalStage teamId(Optional teamId) { - this.teamId = teamId; - return this; - } - - /** - *

The optional description of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage description(String description) { - this.description = Optional.of(description); - return this; - } - - @Override - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public _FinalStage description(Optional description) { - this.description = description; - return this; - } - - /** - *

The optional label of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage label(String label) { - this.label = Optional.of(label); - return this; - } - - @Override - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public _FinalStage label(Optional label) { - this.label = label; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AppDto build() { - return new AppDto( - links, - id, - name, - label, - description, - version, - created, - lastModified, - teamId, - permissions, - canAccessApi, - canAccessContent, - roleName, - roleProperties); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AppDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("label") != null && !jsonObj.get("label").isJsonNull()) && !jsonObj.get("label").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `label` to be a primitive type in the JSON string but got `%s`", jsonObj.get("label").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if ((jsonObj.get("teamId") != null && !jsonObj.get("teamId").isJsonNull()) && !jsonObj.get("teamId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `teamId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("teamId").toString())); + } + // ensure the required json array is present + if (jsonObj.get("permissions") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("permissions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be an array in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + if ((jsonObj.get("roleName") != null && !jsonObj.get("roleName").isJsonNull()) && !jsonObj.get("roleName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `roleName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("roleName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AppDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AppDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AppDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AppDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AppDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AppDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AppDto + * @throws IOException if the JSON string is invalid with respect to AppDto + */ + public static AppDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AppDto.class); + } + + /** + * Convert an instance of AppDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AppLanguageDto.java b/src/main/java/com/squidex/api/types/AppLanguageDto.java index 0e4417c..7f6f9b4 100644 --- a/src/main/java/com/squidex/api/types/AppLanguageDto.java +++ b/src/main/java/com/squidex/api/types/AppLanguageDto.java @@ -1,294 +1,359 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AppLanguageDto.Builder.class) -public final class AppLanguageDto implements IResource { - private final Map links; - - private final String iso2Code; - - private final String englishName; - - private final List fallback; - - private final boolean isMaster; - - private final boolean isOptional; - - private AppLanguageDto( - Map links, - String iso2Code, - String englishName, - List fallback, - boolean isMaster, - boolean isOptional) { - this.links = links; - this.iso2Code = iso2Code; - this.englishName = englishName; - this.fallback = fallback; - this.isMaster = isMaster; - this.isOptional = isOptional; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The iso code of the language. - */ - @JsonProperty("iso2Code") - public String getIso2Code() { - return iso2Code; - } - - /** - * @return The english name of the language. - */ - @JsonProperty("englishName") - public String getEnglishName() { - return englishName; - } - /** - * @return The fallback languages. - */ - @JsonProperty("fallback") - public List getFallback() { - return fallback; - } - - /** - * @return Indicates if the language is the master language. - */ - @JsonProperty("isMaster") - public boolean getIsMaster() { - return isMaster; - } - - /** - * @return Indicates if the language is optional. - */ - @JsonProperty("isOptional") - public boolean getIsOptional() { - return isOptional; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AppLanguageDto && equalTo((AppLanguageDto) other); - } - - private boolean equalTo(AppLanguageDto other) { - return links.equals(other.links) - && iso2Code.equals(other.iso2Code) - && englishName.equals(other.englishName) - && fallback.equals(other.fallback) - && isMaster == other.isMaster - && isOptional == other.isOptional; - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.iso2Code, this.englishName, this.fallback, this.isMaster, this.isOptional); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Iso2CodeStage builder() { - return new Builder(); - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - public interface Iso2CodeStage { - EnglishNameStage iso2Code(String iso2Code); +import com.squidex.api.core.JSON; - Builder from(AppLanguageDto other); +/** + * AppLanguageDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AppLanguageDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ISO2_CODE = "iso2Code"; + @SerializedName(SERIALIZED_NAME_ISO2_CODE) + private String iso2Code; + public static final String SERIALIZED_NAME_ENGLISH_NAME = "englishName"; + @SerializedName(SERIALIZED_NAME_ENGLISH_NAME) + private String englishName; + public static final String SERIALIZED_NAME_FALLBACK = "fallback"; + @SerializedName(SERIALIZED_NAME_FALLBACK) + private List fallback = new ArrayList<>(); + public static final String SERIALIZED_NAME_IS_MASTER = "isMaster"; + @SerializedName(SERIALIZED_NAME_IS_MASTER) + private Boolean isMaster; + public static final String SERIALIZED_NAME_IS_OPTIONAL = "isOptional"; + @SerializedName(SERIALIZED_NAME_IS_OPTIONAL) + private Boolean isOptional; + public AppLanguageDto() { + } + public AppLanguageDto links(Map links) { + this.links = links; + return this; + } + + public AppLanguageDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface EnglishNameStage { - IsMasterStage englishName(String englishName); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public AppLanguageDto iso2Code(String iso2Code) { + this.iso2Code = iso2Code; + return this; + } + + /** + * The iso code of the language. + * @return iso2Code + */ + @javax.annotation.Nonnull + public String getIso2Code() { + return iso2Code; + } + + public void setIso2Code(String iso2Code) { + this.iso2Code = iso2Code; + } + public AppLanguageDto englishName(String englishName) { + this.englishName = englishName; + return this; + } + + /** + * The english name of the language. + * @return englishName + */ + @javax.annotation.Nonnull + public String getEnglishName() { + return englishName; + } + + public void setEnglishName(String englishName) { + this.englishName = englishName; + } + public AppLanguageDto fallback(List fallback) { + this.fallback = fallback; + return this; + } + + public AppLanguageDto addFallbackItem(String fallbackItem) { + if (this.fallback == null) { + this.fallback = new ArrayList<>(); } - - public interface IsMasterStage { - IsOptionalStage isMaster(boolean isMaster); + this.fallback.add(fallbackItem); + return this; + } + + /** + * The fallback languages. + * @return fallback + */ + @javax.annotation.Nonnull + public List getFallback() { + return fallback; + } + + public void setFallback(List fallback) { + this.fallback = fallback; + } + public AppLanguageDto isMaster(Boolean isMaster) { + this.isMaster = isMaster; + return this; + } + + /** + * Indicates if the language is the master language. + * @return isMaster + */ + @javax.annotation.Nonnull + public Boolean getIsMaster() { + return isMaster; + } + + public void setIsMaster(Boolean isMaster) { + this.isMaster = isMaster; + } + public AppLanguageDto isOptional(Boolean isOptional) { + this.isOptional = isOptional; + return this; + } + + /** + * Indicates if the language is optional. + * @return isOptional + */ + @javax.annotation.Nonnull + public Boolean getIsOptional() { + return isOptional; + } + + public void setIsOptional(Boolean isOptional) { + this.isOptional = isOptional; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface IsOptionalStage { - _FinalStage isOptional(boolean isOptional); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - AppLanguageDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage fallback(List fallback); - - _FinalStage addFallback(String fallback); - - _FinalStage addAllFallback(List fallback); + AppLanguageDto appLanguageDto = (AppLanguageDto) o; + return Objects.equals(this.links, appLanguageDto.links) && + Objects.equals(this.iso2Code, appLanguageDto.iso2Code) && + Objects.equals(this.englishName, appLanguageDto.englishName) && + Objects.equals(this.fallback, appLanguageDto.fallback) && + Objects.equals(this.isMaster, appLanguageDto.isMaster) && + Objects.equals(this.isOptional, appLanguageDto.isOptional); + } + + @Override + public int hashCode() { + return Objects.hash(links, iso2Code, englishName, fallback, isMaster, isOptional); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppLanguageDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" iso2Code: ").append(toIndentedString(iso2Code)).append("\n"); + sb.append(" englishName: ").append(toIndentedString(englishName)).append("\n"); + sb.append(" fallback: ").append(toIndentedString(fallback)).append("\n"); + sb.append(" isMaster: ").append(toIndentedString(isMaster)).append("\n"); + sb.append(" isOptional: ").append(toIndentedString(isOptional)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements Iso2CodeStage, EnglishNameStage, IsMasterStage, IsOptionalStage, _FinalStage { - private String iso2Code; - - private String englishName; - - private boolean isMaster; - - private boolean isOptional; - - private List fallback = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AppLanguageDto other) { - links(other.getLinks()); - iso2Code(other.getIso2Code()); - englishName(other.getEnglishName()); - fallback(other.getFallback()); - isMaster(other.getIsMaster()); - isOptional(other.getIsOptional()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("iso2Code"); + openapiFields.add("englishName"); + openapiFields.add("fallback"); + openapiFields.add("isMaster"); + openapiFields.add("isOptional"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("iso2Code"); + openapiRequiredFields.add("englishName"); + openapiRequiredFields.add("fallback"); + openapiRequiredFields.add("isMaster"); + openapiRequiredFields.add("isOptional"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AppLanguageDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AppLanguageDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AppLanguageDto is not found in the empty JSON string", AppLanguageDto.openapiRequiredFields.toString())); } + } - /** - *

The iso code of the language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("iso2Code") - public EnglishNameStage iso2Code(String iso2Code) { - this.iso2Code = iso2Code; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AppLanguageDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AppLanguageDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The english name of the language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("englishName") - public IsMasterStage englishName(String englishName) { - this.englishName = englishName; - return this; - } - - /** - *

Indicates if the language is the master language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isMaster") - public IsOptionalStage isMaster(boolean isMaster) { - this.isMaster = isMaster; - return this; - } - - /** - *

Indicates if the language is optional.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isOptional") - public _FinalStage isOptional(boolean isOptional) { - this.isOptional = isOptional; - return this; - } - - /** - *

The fallback languages.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFallback(List fallback) { - this.fallback.addAll(fallback); - return this; - } - - /** - *

The fallback languages.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFallback(String fallback) { - this.fallback.add(fallback); - return this; - } - - @Override - @JsonSetter(value = "fallback", nulls = Nulls.SKIP) - public _FinalStage fallback(List fallback) { - this.fallback.clear(); - this.fallback.addAll(fallback); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AppLanguageDto build() { - return new AppLanguageDto(links, iso2Code, englishName, fallback, isMaster, isOptional); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AppLanguageDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("iso2Code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `iso2Code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("iso2Code").toString())); + } + if (!jsonObj.get("englishName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `englishName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("englishName").toString())); + } + // ensure the required json array is present + if (jsonObj.get("fallback") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("fallback").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fallback` to be an array in the JSON string but got `%s`", jsonObj.get("fallback").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AppLanguageDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AppLanguageDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AppLanguageDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AppLanguageDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AppLanguageDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AppLanguageDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AppLanguageDto + * @throws IOException if the JSON string is invalid with respect to AppLanguageDto + */ + public static AppLanguageDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AppLanguageDto.class); + } + + /** + * Convert an instance of AppLanguageDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AppLanguagesDto.java b/src/main/java/com/squidex/api/types/AppLanguagesDto.java index 2ccb7a6..5ea1921 100644 --- a/src/main/java/com/squidex/api/types/AppLanguagesDto.java +++ b/src/main/java/com/squidex/api/types/AppLanguagesDto.java @@ -1,124 +1,262 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.AppLanguageDto; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AppLanguagesDto.Builder.class) -public final class AppLanguagesDto implements IResource { - private final Map links; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final List items; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private AppLanguagesDto(Map links, List items) { - this.links = links; - this.items = items; - } +import com.squidex.api.core.JSON; - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } +/** + * AppLanguagesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AppLanguagesDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public AppLanguagesDto() { + } + public AppLanguagesDto links(Map links) { + this.links = links; + return this; + } - /** - * @return The languages. - */ - @JsonProperty("items") - public List getItems() { - return items; + public AppLanguagesDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } + this.links.put(key, linksItem); + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AppLanguagesDto && equalTo((AppLanguagesDto) other); - } + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } - private boolean equalTo(AppLanguagesDto other) { - return links.equals(other.links) && items.equals(other.items); - } + public void setLinks(Map links) { + this.links = links; + } + public AppLanguagesDto items(List items) { + this.items = items; + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); + public AppLanguagesDto addItemsItem(AppLanguageDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } + this.items.add(itemsItem); + return this; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + /** + * The languages. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + AppLanguagesDto appLanguagesDto = (AppLanguagesDto) o; + return Objects.equals(this.links, appLanguagesDto.links) && + Objects.equals(this.items, appLanguagesDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, items); + } - public static Builder builder() { - return new Builder(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppLanguagesDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - private List items = new ArrayList<>(); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Builder() {} + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("items"); - public Builder from(AppLanguagesDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + } - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AppLanguagesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AppLanguagesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AppLanguagesDto is not found in the empty JSON string", AppLanguagesDto.openapiRequiredFields.toString())); } + } - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AppLanguagesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AppLanguagesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AppLanguagesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + AppLanguageDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } - public Builder addItems(AppLanguageDto items) { - this.items.add(items); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AppLanguagesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AppLanguagesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AppLanguagesDto.class)); - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AppLanguagesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public AppLanguagesDto build() { - return new AppLanguagesDto(links, items); - } + @Override + public AppLanguagesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AppLanguagesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AppLanguagesDto + * @throws IOException if the JSON string is invalid with respect to AppLanguagesDto + */ + public static AppLanguagesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AppLanguagesDto.class); + } + + /** + * Convert an instance of AppLanguagesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AppSettingsDto.java b/src/main/java/com/squidex/api/types/AppSettingsDto.java index c2be16c..5609603 100644 --- a/src/main/java/com/squidex/api/types/AppSettingsDto.java +++ b/src/main/java/com/squidex/api/types/AppSettingsDto.java @@ -1,314 +1,377 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.EditorDto; +import com.squidex.api.types.PatternDto; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AppSettingsDto.Builder.class) -public final class AppSettingsDto implements IResource { - private final Map links; - - private final List patterns; - - private final List editors; - - private final boolean hideScheduler; - - private final boolean hideDateTimeModeButton; - - private final int version; - - private AppSettingsDto( - Map links, - List patterns, - List editors, - boolean hideScheduler, - boolean hideDateTimeModeButton, - int version) { - this.links = links; - this.patterns = patterns; - this.editors = editors; - this.hideScheduler = hideScheduler; - this.hideDateTimeModeButton = hideDateTimeModeButton; - this.version = version; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The configured app patterns. - */ - @JsonProperty("patterns") - public List getPatterns() { - return patterns; - } - - /** - * @return The configured UI editors. - */ - @JsonProperty("editors") - public List getEditors() { - return editors; - } - - /** - * @return Hide the scheduler for content items. - */ - @JsonProperty("hideScheduler") - public boolean getHideScheduler() { - return hideScheduler; - } - - /** - * @return Hide the datetime mode button. - */ - @JsonProperty("hideDateTimeModeButton") - public boolean getHideDateTimeModeButton() { - return hideDateTimeModeButton; - } - /** - * @return The version of the app. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AppSettingsDto && equalTo((AppSettingsDto) other); - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private boolean equalTo(AppSettingsDto other) { - return links.equals(other.links) - && patterns.equals(other.patterns) - && editors.equals(other.editors) - && hideScheduler == other.hideScheduler - && hideDateTimeModeButton == other.hideDateTimeModeButton - && version == other.version; - } +import com.squidex.api.core.JSON; - @Override - public int hashCode() { - return Objects.hash( - this.links, this.patterns, this.editors, this.hideScheduler, this.hideDateTimeModeButton, this.version); +/** + * AppSettingsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AppSettingsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_PATTERNS = "patterns"; + @SerializedName(SERIALIZED_NAME_PATTERNS) + private List patterns = new ArrayList<>(); + public static final String SERIALIZED_NAME_EDITORS = "editors"; + @SerializedName(SERIALIZED_NAME_EDITORS) + private List editors = new ArrayList<>(); + public static final String SERIALIZED_NAME_HIDE_SCHEDULER = "hideScheduler"; + @SerializedName(SERIALIZED_NAME_HIDE_SCHEDULER) + private Boolean hideScheduler; + public static final String SERIALIZED_NAME_HIDE_DATE_TIME_MODE_BUTTON = "hideDateTimeModeButton"; + @SerializedName(SERIALIZED_NAME_HIDE_DATE_TIME_MODE_BUTTON) + private Boolean hideDateTimeModeButton; + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Long version; + public AppSettingsDto() { + } + public AppSettingsDto links(Map links) { + this.links = links; + return this; + } + + public AppSettingsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public AppSettingsDto patterns(List patterns) { + this.patterns = patterns; + return this; + } + + public AppSettingsDto addPatternsItem(PatternDto patternsItem) { + if (this.patterns == null) { + this.patterns = new ArrayList<>(); } - - public static HideSchedulerStage builder() { - return new Builder(); + this.patterns.add(patternsItem); + return this; + } + + /** + * The configured app patterns. + * @return patterns + */ + @javax.annotation.Nonnull + public List getPatterns() { + return patterns; + } + + public void setPatterns(List patterns) { + this.patterns = patterns; + } + public AppSettingsDto editors(List editors) { + this.editors = editors; + return this; + } + + public AppSettingsDto addEditorsItem(EditorDto editorsItem) { + if (this.editors == null) { + this.editors = new ArrayList<>(); } - - public interface HideSchedulerStage { - HideDateTimeModeButtonStage hideScheduler(boolean hideScheduler); - - Builder from(AppSettingsDto other); + this.editors.add(editorsItem); + return this; + } + + /** + * The configured UI editors. + * @return editors + */ + @javax.annotation.Nonnull + public List getEditors() { + return editors; + } + + public void setEditors(List editors) { + this.editors = editors; + } + public AppSettingsDto hideScheduler(Boolean hideScheduler) { + this.hideScheduler = hideScheduler; + return this; + } + + /** + * Hide the scheduler for content items. + * @return hideScheduler + */ + @javax.annotation.Nonnull + public Boolean getHideScheduler() { + return hideScheduler; + } + + public void setHideScheduler(Boolean hideScheduler) { + this.hideScheduler = hideScheduler; + } + public AppSettingsDto hideDateTimeModeButton(Boolean hideDateTimeModeButton) { + this.hideDateTimeModeButton = hideDateTimeModeButton; + return this; + } + + /** + * Hide the datetime mode button. + * @return hideDateTimeModeButton + */ + @javax.annotation.Nonnull + public Boolean getHideDateTimeModeButton() { + return hideDateTimeModeButton; + } + + public void setHideDateTimeModeButton(Boolean hideDateTimeModeButton) { + this.hideDateTimeModeButton = hideDateTimeModeButton; + } + public AppSettingsDto version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the app. + * @return version + */ + @javax.annotation.Nonnull + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface HideDateTimeModeButtonStage { - VersionStage hideDateTimeModeButton(boolean hideDateTimeModeButton); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface VersionStage { - _FinalStage version(int version); + AppSettingsDto appSettingsDto = (AppSettingsDto) o; + return Objects.equals(this.links, appSettingsDto.links) && + Objects.equals(this.patterns, appSettingsDto.patterns) && + Objects.equals(this.editors, appSettingsDto.editors) && + Objects.equals(this.hideScheduler, appSettingsDto.hideScheduler) && + Objects.equals(this.hideDateTimeModeButton, appSettingsDto.hideDateTimeModeButton) && + Objects.equals(this.version, appSettingsDto.version); + } + + @Override + public int hashCode() { + return Objects.hash(links, patterns, editors, hideScheduler, hideDateTimeModeButton, version); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AppSettingsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" patterns: ").append(toIndentedString(patterns)).append("\n"); + sb.append(" editors: ").append(toIndentedString(editors)).append("\n"); + sb.append(" hideScheduler: ").append(toIndentedString(hideScheduler)).append("\n"); + sb.append(" hideDateTimeModeButton: ").append(toIndentedString(hideDateTimeModeButton)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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"; } - - public interface _FinalStage { - AppSettingsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage patterns(List patterns); - - _FinalStage addPatterns(PatternDto patterns); - - _FinalStage addAllPatterns(List patterns); - - _FinalStage editors(List editors); - - _FinalStage addEditors(EditorDto editors); - - _FinalStage addAllEditors(List editors); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements HideSchedulerStage, HideDateTimeModeButtonStage, VersionStage, _FinalStage { - private boolean hideScheduler; - - private boolean hideDateTimeModeButton; - - private int version; - - private List editors = new ArrayList<>(); - - private List patterns = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AppSettingsDto other) { - links(other.getLinks()); - patterns(other.getPatterns()); - editors(other.getEditors()); - hideScheduler(other.getHideScheduler()); - hideDateTimeModeButton(other.getHideDateTimeModeButton()); - version(other.getVersion()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("patterns"); + openapiFields.add("editors"); + openapiFields.add("hideScheduler"); + openapiFields.add("hideDateTimeModeButton"); + openapiFields.add("version"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("patterns"); + openapiRequiredFields.add("editors"); + openapiRequiredFields.add("hideScheduler"); + openapiRequiredFields.add("hideDateTimeModeButton"); + openapiRequiredFields.add("version"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AppSettingsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AppSettingsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AppSettingsDto is not found in the empty JSON string", AppSettingsDto.openapiRequiredFields.toString())); } + } - /** - *

Hide the scheduler for content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("hideScheduler") - public HideDateTimeModeButtonStage hideScheduler(boolean hideScheduler) { - this.hideScheduler = hideScheduler; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AppSettingsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AppSettingsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

Hide the datetime mode button.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("hideDateTimeModeButton") - public VersionStage hideDateTimeModeButton(boolean hideDateTimeModeButton) { - this.hideDateTimeModeButton = hideDateTimeModeButton; - return this; - } - - /** - *

The version of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The configured UI editors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllEditors(List editors) { - this.editors.addAll(editors); - return this; - } - - /** - *

The configured UI editors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addEditors(EditorDto editors) { - this.editors.add(editors); - return this; - } - - @Override - @JsonSetter(value = "editors", nulls = Nulls.SKIP) - public _FinalStage editors(List editors) { - this.editors.clear(); - this.editors.addAll(editors); - return this; - } - - /** - *

The configured app patterns.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPatterns(List patterns) { - this.patterns.addAll(patterns); - return this; - } - - /** - *

The configured app patterns.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPatterns(PatternDto patterns) { - this.patterns.add(patterns); - return this; - } - - @Override - @JsonSetter(value = "patterns", nulls = Nulls.SKIP) - public _FinalStage patterns(List patterns) { - this.patterns.clear(); - this.patterns.addAll(patterns); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AppSettingsDto build() { - return new AppSettingsDto(links, patterns, editors, hideScheduler, hideDateTimeModeButton, version); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AppSettingsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("patterns").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `patterns` to be an array in the JSON string but got `%s`", jsonObj.get("patterns").toString())); + } + + JsonArray jsonArraypatterns = jsonObj.getAsJsonArray("patterns"); + // validate the required field `patterns` (array) + for (int i = 0; i < jsonArraypatterns.size(); i++) { + PatternDto.validateJsonElement(jsonArraypatterns.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("editors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `editors` to be an array in the JSON string but got `%s`", jsonObj.get("editors").toString())); + } + + JsonArray jsonArrayeditors = jsonObj.getAsJsonArray("editors"); + // validate the required field `editors` (array) + for (int i = 0; i < jsonArrayeditors.size(); i++) { + EditorDto.validateJsonElement(jsonArrayeditors.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AppSettingsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AppSettingsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AppSettingsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AppSettingsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AppSettingsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AppSettingsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AppSettingsDto + * @throws IOException if the JSON string is invalid with respect to AppSettingsDto + */ + public static AppSettingsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AppSettingsDto.class); + } + + /** + * Convert an instance of AppSettingsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ArrayCalculatedDefaultValue.java b/src/main/java/com/squidex/api/types/ArrayCalculatedDefaultValue.java index b2c0a8b..00c5945 100644 --- a/src/main/java/com/squidex/api/types/ArrayCalculatedDefaultValue.java +++ b/src/main/java/com/squidex/api/types/ArrayCalculatedDefaultValue.java @@ -1,24 +1,78 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; +/** + * + */ +@JsonAdapter(ArrayCalculatedDefaultValue.Adapter.class) public enum ArrayCalculatedDefaultValue { - EMPTY_ARRAY("EmptyArray"), + + EMPTY_ARRAY("EmptyArray"), + + NULL("Null"); + + private String value; - NULL("Null"); + ArrayCalculatedDefaultValue(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - ArrayCalculatedDefaultValue(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static ArrayCalculatedDefaultValue fromValue(String value) { + for (ArrayCalculatedDefaultValue b : ArrayCalculatedDefaultValue.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 ArrayCalculatedDefaultValue enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public ArrayCalculatedDefaultValue read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ArrayCalculatedDefaultValue.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ArrayCalculatedDefaultValue.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java index d5feb17..2940f22 100644 --- a/src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java @@ -1,166 +1,309 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.ArrayCalculatedDefaultValue; +import com.squidex.api.types.FieldPropertiesDto; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ArrayFieldPropertiesDto.Builder.class) -public final class ArrayFieldPropertiesDto { - private final Optional minItems; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final Optional maxItems; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final Optional calculatedDefaultValue; +import com.squidex.api.core.JSON; - private final Optional> uniqueFields; +/** + * ArrayFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ArrayFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_MIN_ITEMS = "minItems"; + @SerializedName(SERIALIZED_NAME_MIN_ITEMS) + private Integer minItems; + public static final String SERIALIZED_NAME_MAX_ITEMS = "maxItems"; + @SerializedName(SERIALIZED_NAME_MAX_ITEMS) + private Integer maxItems; + public static final String SERIALIZED_NAME_CALCULATED_DEFAULT_VALUE = "calculatedDefaultValue"; + @SerializedName(SERIALIZED_NAME_CALCULATED_DEFAULT_VALUE) + private ArrayCalculatedDefaultValue calculatedDefaultValue; + public static final String SERIALIZED_NAME_UNIQUE_FIELDS = "uniqueFields"; + @SerializedName(SERIALIZED_NAME_UNIQUE_FIELDS) + private List uniqueFields; + public ArrayFieldPropertiesDto() { + } + public ArrayFieldPropertiesDto minItems(Integer minItems) { + this.minItems = minItems; + return this; + } - private ArrayFieldPropertiesDto( - Optional minItems, - Optional maxItems, - Optional calculatedDefaultValue, - Optional> uniqueFields) { - this.minItems = minItems; - this.maxItems = maxItems; - this.calculatedDefaultValue = calculatedDefaultValue; - this.uniqueFields = uniqueFields; - } + /** + * The minimum allowed items for the field value. + * @return minItems + */ + @javax.annotation.Nullable + public Integer getMinItems() { + return minItems; + } - /** - * @return The minimum allowed items for the field value. - */ - @JsonProperty("minItems") - public Optional getMinItems() { - return minItems; - } + public void setMinItems(Integer minItems) { + this.minItems = minItems; + } + public ArrayFieldPropertiesDto maxItems(Integer maxItems) { + this.maxItems = maxItems; + return this; + } - /** - * @return The maximum allowed items for the field value. - */ - @JsonProperty("maxItems") - public Optional getMaxItems() { - return maxItems; - } + /** + * The maximum allowed items for the field value. + * @return maxItems + */ + @javax.annotation.Nullable + public Integer getMaxItems() { + return maxItems; + } - /** - * @return The calculated default value for the field value. - */ - @JsonProperty("calculatedDefaultValue") - public Optional getCalculatedDefaultValue() { - return calculatedDefaultValue; - } + public void setMaxItems(Integer maxItems) { + this.maxItems = maxItems; + } + public ArrayFieldPropertiesDto calculatedDefaultValue(ArrayCalculatedDefaultValue calculatedDefaultValue) { + this.calculatedDefaultValue = calculatedDefaultValue; + return this; + } - /** - * @return The fields that must be unique. - */ - @JsonProperty("uniqueFields") - public Optional> getUniqueFields() { - return uniqueFields; - } + /** + * Get calculatedDefaultValue + * @return calculatedDefaultValue + */ + @javax.annotation.Nullable + public ArrayCalculatedDefaultValue getCalculatedDefaultValue() { + return calculatedDefaultValue; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ArrayFieldPropertiesDto && equalTo((ArrayFieldPropertiesDto) other); - } + public void setCalculatedDefaultValue(ArrayCalculatedDefaultValue calculatedDefaultValue) { + this.calculatedDefaultValue = calculatedDefaultValue; + } + public ArrayFieldPropertiesDto uniqueFields(List uniqueFields) { + this.uniqueFields = uniqueFields; + return this; + } - private boolean equalTo(ArrayFieldPropertiesDto other) { - return minItems.equals(other.minItems) - && maxItems.equals(other.maxItems) - && calculatedDefaultValue.equals(other.calculatedDefaultValue) - && uniqueFields.equals(other.uniqueFields); + public ArrayFieldPropertiesDto addUniqueFieldsItem(String uniqueFieldsItem) { + if (this.uniqueFields == null) { + this.uniqueFields = new ArrayList<>(); } + this.uniqueFields.add(uniqueFieldsItem); + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.minItems, this.maxItems, this.calculatedDefaultValue, this.uniqueFields); - } + /** + * The fields that must be unique. + * @return uniqueFields + */ + @javax.annotation.Nullable + public List getUniqueFields() { + return uniqueFields; + } + + public void setUniqueFields(List uniqueFields) { + this.uniqueFields = uniqueFields; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static Builder builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayFieldPropertiesDto arrayFieldPropertiesDto = (ArrayFieldPropertiesDto) o; + return Objects.equals(this.minItems, arrayFieldPropertiesDto.minItems) && + Objects.equals(this.maxItems, arrayFieldPropertiesDto.maxItems) && + Objects.equals(this.calculatedDefaultValue, arrayFieldPropertiesDto.calculatedDefaultValue) && + Objects.equals(this.uniqueFields, arrayFieldPropertiesDto.uniqueFields) && + super.equals(o); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional minItems = Optional.empty(); + 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())); + } - private Optional maxItems = Optional.empty(); + @Override + public int hashCode() { + return Objects.hash(minItems, maxItems, calculatedDefaultValue, uniqueFields, super.hashCode()); + } - private Optional calculatedDefaultValue = Optional.empty(); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - private Optional> uniqueFields = Optional.empty(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" minItems: ").append(toIndentedString(minItems)).append("\n"); + sb.append(" maxItems: ").append(toIndentedString(maxItems)).append("\n"); + sb.append(" calculatedDefaultValue: ").append(toIndentedString(calculatedDefaultValue)).append("\n"); + sb.append(" uniqueFields: ").append(toIndentedString(uniqueFields)).append("\n"); + sb.append("}"); + return sb.toString(); + } - private Builder() {} + /** + * 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 Builder from(ArrayFieldPropertiesDto other) { - minItems(other.getMinItems()); - maxItems(other.getMaxItems()); - calculatedDefaultValue(other.getCalculatedDefaultValue()); - uniqueFields(other.getUniqueFields()); - return this; - } - @JsonSetter(value = "minItems", nulls = Nulls.SKIP) - public Builder minItems(Optional minItems) { - this.minItems = minItems; - return this; - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder minItems(Integer minItems) { - this.minItems = Optional.of(minItems); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("minItems"); + openapiFields.add("maxItems"); + openapiFields.add("calculatedDefaultValue"); + openapiFields.add("uniqueFields"); - @JsonSetter(value = "maxItems", nulls = Nulls.SKIP) - public Builder maxItems(Optional maxItems) { - this.maxItems = maxItems; - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } - public Builder maxItems(Integer maxItems) { - this.maxItems = Optional.of(maxItems); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ArrayFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ArrayFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ArrayFieldPropertiesDto is not found in the empty JSON string", ArrayFieldPropertiesDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "calculatedDefaultValue", nulls = Nulls.SKIP) - public Builder calculatedDefaultValue(Optional calculatedDefaultValue) { - this.calculatedDefaultValue = calculatedDefaultValue; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ArrayFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ArrayFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder calculatedDefaultValue(ArrayCalculatedDefaultValue calculatedDefaultValue) { - this.calculatedDefaultValue = Optional.of(calculatedDefaultValue); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ArrayFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @JsonSetter(value = "uniqueFields", nulls = Nulls.SKIP) - public Builder uniqueFields(Optional> uniqueFields) { - this.uniqueFields = uniqueFields; - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ArrayFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ArrayFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ArrayFieldPropertiesDto.class)); - public Builder uniqueFields(List uniqueFields) { - this.uniqueFields = Optional.of(uniqueFields); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ArrayFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public ArrayFieldPropertiesDto build() { - return new ArrayFieldPropertiesDto(minItems, maxItems, calculatedDefaultValue, uniqueFields); - } + @Override + public ArrayFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ArrayFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ArrayFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to ArrayFieldPropertiesDto + */ + public static ArrayFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ArrayFieldPropertiesDto.class); + } + + /** + * Convert an instance of ArrayFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java b/src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java index cd2fe92..3a80c9e 100644 --- a/src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java +++ b/src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java @@ -1,83 +1,221 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.RuleTriggerDto; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetChangedRuleTriggerDto.Builder.class) -public final class AssetChangedRuleTriggerDto { - private final Optional condition; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private AssetChangedRuleTriggerDto(Optional condition) { - this.condition = condition; - } +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return Javascript condition when to trigger. - */ - @JsonProperty("condition") - public Optional getCondition() { - return condition; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetChangedRuleTriggerDto && equalTo((AssetChangedRuleTriggerDto) other); - } +/** + * AssetChangedRuleTriggerDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AssetChangedRuleTriggerDto extends RuleTriggerDto { + public static final String SERIALIZED_NAME_CONDITION = "condition"; + @SerializedName(SERIALIZED_NAME_CONDITION) + private String condition; + public AssetChangedRuleTriggerDto() { + } + public AssetChangedRuleTriggerDto condition(String condition) { + this.condition = condition; + return this; + } - private boolean equalTo(AssetChangedRuleTriggerDto other) { - return condition.equals(other.condition); - } + /** + * Javascript condition when to trigger. + * @return condition + */ + @javax.annotation.Nullable + public String getCondition() { + return condition; + } - @Override - public int hashCode() { - return Objects.hash(this.condition); + public void setCondition(String condition) { + this.condition = condition; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + AssetChangedRuleTriggerDto assetChangedRuleTriggerDto = (AssetChangedRuleTriggerDto) o; + return Objects.equals(this.condition, assetChangedRuleTriggerDto.condition) && + super.equals(o); + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + 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(condition, super.hashCode()); + } + + 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 AssetChangedRuleTriggerDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" condition: ").append(toIndentedString(condition)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public static Builder builder() { - return new Builder(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional condition = Optional.empty(); - private Builder() {} + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder from(AssetChangedRuleTriggerDto other) { - condition(other.getCondition()); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("triggerType"); + openapiFields.add("condition"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("triggerType"); + } - @JsonSetter(value = "condition", nulls = Nulls.SKIP) - public Builder condition(Optional condition) { - this.condition = condition; - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AssetChangedRuleTriggerDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AssetChangedRuleTriggerDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AssetChangedRuleTriggerDto is not found in the empty JSON string", AssetChangedRuleTriggerDto.openapiRequiredFields.toString())); } + } - public Builder condition(String condition) { - this.condition = Optional.of(condition); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AssetChangedRuleTriggerDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AssetChangedRuleTriggerDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public AssetChangedRuleTriggerDto build() { - return new AssetChangedRuleTriggerDto(condition); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AssetChangedRuleTriggerDto.openapiRequiredFields) { + if (jsonElement.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 (!AssetChangedRuleTriggerDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AssetChangedRuleTriggerDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AssetChangedRuleTriggerDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AssetChangedRuleTriggerDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AssetChangedRuleTriggerDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AssetChangedRuleTriggerDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AssetChangedRuleTriggerDto + * @throws IOException if the JSON string is invalid with respect to AssetChangedRuleTriggerDto + */ + public static AssetChangedRuleTriggerDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AssetChangedRuleTriggerDto.class); + } + + /** + * Convert an instance of AssetChangedRuleTriggerDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AssetDto.java b/src/main/java/com/squidex/api/types/AssetDto.java index dea9fa3..8f0c7cb 100644 --- a/src/main/java/com/squidex/api/types/AssetDto.java +++ b/src/main/java/com/squidex/api/types/AssetDto.java @@ -1,987 +1,878 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.AssetMeta; +import com.squidex.api.types.AssetType; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; import java.time.OffsetDateTime; -import java.util.LinkedHashMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetDto.Builder.class) -public final class AssetDto implements IResource { - private final Map links; - - private final String id; - - private final String parentId; - - private final String fileName; - - private final Optional fileHash; - - private final boolean isProtected; - - private final String slug; - - private final String mimeType; - - private final String fileType; - - private final String metadataText; - - private final Optional editToken; - - private final Map metadata; - - private final Optional> tags; - - private final int fileSize; - - private final int fileVersion; - - private final AssetType type; - - private final String createdBy; - - private final String lastModifiedBy; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final int version; - - private final Optional meta; - - private final boolean isImage; - - private final Optional pixelWidth; - - private final Optional pixelHeight; - - private AssetDto( - Map links, - String id, - String parentId, - String fileName, - Optional fileHash, - boolean isProtected, - String slug, - String mimeType, - String fileType, - String metadataText, - Optional editToken, - Map metadata, - Optional> tags, - int fileSize, - int fileVersion, - AssetType type, - String createdBy, - String lastModifiedBy, - OffsetDateTime created, - OffsetDateTime lastModified, - int version, - Optional meta, - boolean isImage, - Optional pixelWidth, - Optional pixelHeight) { - this.links = links; - this.id = id; - this.parentId = parentId; - this.fileName = fileName; - this.fileHash = fileHash; - this.isProtected = isProtected; - this.slug = slug; - this.mimeType = mimeType; - this.fileType = fileType; - this.metadataText = metadataText; - this.editToken = editToken; - this.metadata = metadata; - this.tags = tags; - this.fileSize = fileSize; - this.fileVersion = fileVersion; - this.type = type; - this.createdBy = createdBy; - this.lastModifiedBy = lastModifiedBy; - this.created = created; - this.lastModified = lastModified; - this.version = version; - this.meta = meta; - this.isImage = isImage; - this.pixelWidth = pixelWidth; - this.pixelHeight = pixelHeight; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the asset. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The ID of the parent folder. Empty for files without parent. - */ - @JsonProperty("parentId") - public String getParentId() { - return parentId; - } - - /** - * @return The file name. - */ - @JsonProperty("fileName") - public String getFileName() { - return fileName; - } - - /** - * @return The file hash. - */ - @JsonProperty("fileHash") - public Optional getFileHash() { - return fileHash; - } - - /** - * @return True, when the asset is not public. - */ - @JsonProperty("isProtected") - public boolean getIsProtected() { - return isProtected; - } - - /** - * @return The slug. - */ - @JsonProperty("slug") - public String getSlug() { - return slug; - } - - /** - * @return The mime type. - */ - @JsonProperty("mimeType") - public String getMimeType() { - return mimeType; - } - - /** - * @return The file type. - */ - @JsonProperty("fileType") - public String getFileType() { - return fileType; - } - - /** - * @return The formatted text representation of the metadata. - */ - @JsonProperty("metadataText") - public String getMetadataText() { - return metadataText; - } - - /** - * @return The UI token. - */ - @JsonProperty("editToken") - public Optional getEditToken() { - return editToken; - } - - /** - * @return The asset metadata. - */ - @JsonProperty("metadata") - public Map getMetadata() { - return metadata; - } - - /** - * @return The asset tags. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return The size of the file in bytes. - */ - @JsonProperty("fileSize") - public int getFileSize() { - return fileSize; - } - - /** - * @return The version of the file. - */ - @JsonProperty("fileVersion") - public int getFileVersion() { - return fileVersion; - } - - /** - * @return The type of the asset. - */ - @JsonProperty("type") - public AssetType getType() { - return type; - } - - /** - * @return The user that has created the schema. - */ - @JsonProperty("createdBy") - public String getCreatedBy() { - return createdBy; - } - - /** - * @return The user that has updated the asset. - */ - @JsonProperty("lastModifiedBy") - public String getLastModifiedBy() { - return lastModifiedBy; - } - - /** - * @return The date and time when the asset has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The date and time when the asset has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The version of the asset. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - /** - * @return The metadata. - */ - @JsonProperty("_meta") - public Optional getMeta() { - return meta; - } - - /** - * @return Determines of the created file is an image. - */ - @JsonProperty("isImage") - public boolean getIsImage() { - return isImage; - } - - /** - * @return The width of the image in pixels if the asset is an image. - */ - @JsonProperty("pixelWidth") - public Optional getPixelWidth() { - return pixelWidth; - } - - /** - * @return The height of the image in pixels if the asset is an image. - */ - @JsonProperty("pixelHeight") - public Optional getPixelHeight() { - return pixelHeight; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetDto && equalTo((AssetDto) other); - } - - private boolean equalTo(AssetDto other) { - return links.equals(other.links) - && id.equals(other.id) - && parentId.equals(other.parentId) - && fileName.equals(other.fileName) - && fileHash.equals(other.fileHash) - && isProtected == other.isProtected - && slug.equals(other.slug) - && mimeType.equals(other.mimeType) - && fileType.equals(other.fileType) - && metadataText.equals(other.metadataText) - && editToken.equals(other.editToken) - && metadata.equals(other.metadata) - && tags.equals(other.tags) - && fileSize == other.fileSize - && fileVersion == other.fileVersion - && type.equals(other.type) - && createdBy.equals(other.createdBy) - && lastModifiedBy.equals(other.lastModifiedBy) - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && version == other.version - && meta.equals(other.meta) - && isImage == other.isImage - && pixelWidth.equals(other.pixelWidth) - && pixelHeight.equals(other.pixelHeight); - } +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; - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.parentId, - this.fileName, - this.fileHash, - this.isProtected, - this.slug, - this.mimeType, - this.fileType, - this.metadataText, - this.editToken, - this.metadata, - this.tags, - this.fileSize, - this.fileVersion, - this.type, - this.createdBy, - this.lastModifiedBy, - this.created, - this.lastModified, - this.version, - this.meta, - this.isImage, - this.pixelWidth, - this.pixelHeight); - } +import com.squidex.api.core.JSON; +/** + * AssetDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AssetDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_PARENT_ID = "parentId"; + @SerializedName(SERIALIZED_NAME_PARENT_ID) + private String parentId; + public static final String SERIALIZED_NAME_FILE_NAME = "fileName"; + @SerializedName(SERIALIZED_NAME_FILE_NAME) + private String fileName; + public static final String SERIALIZED_NAME_FILE_HASH = "fileHash"; + @SerializedName(SERIALIZED_NAME_FILE_HASH) + private String fileHash; + public static final String SERIALIZED_NAME_IS_PROTECTED = "isProtected"; + @SerializedName(SERIALIZED_NAME_IS_PROTECTED) + private Boolean isProtected; + public static final String SERIALIZED_NAME_SLUG = "slug"; + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; + public static final String SERIALIZED_NAME_MIME_TYPE = "mimeType"; + @SerializedName(SERIALIZED_NAME_MIME_TYPE) + private String mimeType; + public static final String SERIALIZED_NAME_FILE_TYPE = "fileType"; + @SerializedName(SERIALIZED_NAME_FILE_TYPE) + private String fileType; + public static final String SERIALIZED_NAME_METADATA_TEXT = "metadataText"; + @SerializedName(SERIALIZED_NAME_METADATA_TEXT) + private String metadataText; + public static final String SERIALIZED_NAME_EDIT_TOKEN = "editToken"; + @SerializedName(SERIALIZED_NAME_EDIT_TOKEN) + private String editToken; + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + private Map metadata = new HashMap<>(); + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private List tags; + public static final String SERIALIZED_NAME_FILE_SIZE = "fileSize"; + @SerializedName(SERIALIZED_NAME_FILE_SIZE) + private Long fileSize; + public static final String SERIALIZED_NAME_FILE_VERSION = "fileVersion"; + @SerializedName(SERIALIZED_NAME_FILE_VERSION) + private Long fileVersion; + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private AssetType type; + public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; + @SerializedName(SERIALIZED_NAME_CREATED_BY) + private String createdBy; + public static final String SERIALIZED_NAME_LAST_MODIFIED_BY = "lastModifiedBy"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED_BY) + private String lastModifiedBy; + public static final String SERIALIZED_NAME_CREATED = "created"; + @SerializedName(SERIALIZED_NAME_CREATED) + private OffsetDateTime created; + public static final String SERIALIZED_NAME_LAST_MODIFIED = "lastModified"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED) + private OffsetDateTime lastModified; + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Long version; + public static final String SERIALIZED_NAME_META = "_meta"; + @SerializedName(SERIALIZED_NAME_META) + private AssetMeta meta; + public static final String SERIALIZED_NAME_IS_IMAGE = "isImage"; + @Deprecated + @SerializedName(SERIALIZED_NAME_IS_IMAGE) + private Boolean isImage; + public static final String SERIALIZED_NAME_PIXEL_WIDTH = "pixelWidth"; + @Deprecated + @SerializedName(SERIALIZED_NAME_PIXEL_WIDTH) + private Integer pixelWidth; + public static final String SERIALIZED_NAME_PIXEL_HEIGHT = "pixelHeight"; + @Deprecated + @SerializedName(SERIALIZED_NAME_PIXEL_HEIGHT) + private Integer pixelHeight; + public AssetDto() { + } + public AssetDto links(Map links) { + this.links = links; + return this; + } + + public AssetDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public AssetDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the asset. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public AssetDto parentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * The ID of the parent folder. Empty for files without parent. + * @return parentId + */ + @javax.annotation.Nonnull + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + public AssetDto fileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * The file name. + * @return fileName + */ + @javax.annotation.Nonnull + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + public AssetDto fileHash(String fileHash) { + this.fileHash = fileHash; + return this; + } + + /** + * The file hash. + * @return fileHash + */ + @javax.annotation.Nullable + public String getFileHash() { + return fileHash; + } + + public void setFileHash(String fileHash) { + this.fileHash = fileHash; + } + public AssetDto isProtected(Boolean isProtected) { + this.isProtected = isProtected; + return this; + } + + /** + * True, when the asset is not public. + * @return isProtected + */ + @javax.annotation.Nonnull + public Boolean getIsProtected() { + return isProtected; + } + + public void setIsProtected(Boolean isProtected) { + this.isProtected = isProtected; + } + public AssetDto slug(String slug) { + this.slug = slug; + return this; + } + + /** + * The slug. + * @return slug + */ + @javax.annotation.Nonnull + public String getSlug() { + return slug; + } + + public void setSlug(String slug) { + this.slug = slug; + } + public AssetDto mimeType(String mimeType) { + this.mimeType = mimeType; + return this; + } + + /** + * The mime type. + * @return mimeType + */ + @javax.annotation.Nonnull + public String getMimeType() { + return mimeType; + } + + public void setMimeType(String mimeType) { + this.mimeType = mimeType; + } + public AssetDto fileType(String fileType) { + this.fileType = fileType; + return this; + } + + /** + * The file type. + * @return fileType + */ + @javax.annotation.Nonnull + public String getFileType() { + return fileType; + } + + public void setFileType(String fileType) { + this.fileType = fileType; + } + public AssetDto metadataText(String metadataText) { + this.metadataText = metadataText; + return this; + } + + /** + * The formatted text representation of the metadata. + * @return metadataText + */ + @javax.annotation.Nonnull + public String getMetadataText() { + return metadataText; + } + + public void setMetadataText(String metadataText) { + this.metadataText = metadataText; + } + public AssetDto editToken(String editToken) { + this.editToken = editToken; + return this; + } + + /** + * The UI token. + * @return editToken + */ + @javax.annotation.Nullable + public String getEditToken() { + return editToken; + } + + public void setEditToken(String editToken) { + this.editToken = editToken; + } + public AssetDto metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public AssetDto putMetadataItem(String key, Object metadataItem) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); + } + this.metadata.put(key, metadataItem); + return this; + } + + /** + * The asset metadata. + * @return metadata + */ + @javax.annotation.Nonnull + public Map getMetadata() { + return metadata; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + public AssetDto tags(List tags) { + this.tags = tags; + return this; + } + + public AssetDto addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * The asset tags. + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + public AssetDto fileSize(Long fileSize) { + this.fileSize = fileSize; + return this; + } + + /** + * The size of the file in bytes. + * @return fileSize + */ + @javax.annotation.Nonnull + public Long getFileSize() { + return fileSize; + } + + public void setFileSize(Long fileSize) { + this.fileSize = fileSize; + } + public AssetDto fileVersion(Long fileVersion) { + this.fileVersion = fileVersion; + return this; + } + + /** + * The version of the file. + * @return fileVersion + */ + @javax.annotation.Nonnull + public Long getFileVersion() { + return fileVersion; + } + + public void setFileVersion(Long fileVersion) { + this.fileVersion = fileVersion; + } + public AssetDto type(AssetType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public AssetType getType() { + return type; + } + + public void setType(AssetType type) { + this.type = type; + } + public AssetDto createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The user that has created the schema. + * @return createdBy + */ + @javax.annotation.Nonnull + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + public AssetDto lastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * The user that has updated the asset. + * @return lastModifiedBy + */ + @javax.annotation.Nonnull + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + public AssetDto created(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * The date and time when the asset has been created. + * @return created + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreated() { + return created; + } + + public void setCreated(OffsetDateTime created) { + this.created = created; + } + public AssetDto lastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * The date and time when the asset has been modified last. + * @return lastModified + */ + @javax.annotation.Nonnull + public OffsetDateTime getLastModified() { + return lastModified; + } + + public void setLastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + } + public AssetDto version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the asset. + * @return version + */ + @javax.annotation.Nonnull + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + public AssetDto meta(AssetMeta meta) { + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + */ + @javax.annotation.Nullable + public AssetMeta getMeta() { + return meta; + } + + public void setMeta(AssetMeta meta) { + this.meta = meta; + } + @Deprecated + public AssetDto isImage(Boolean isImage) { + this.isImage = isImage; + return this; + } + + /** + * Determines of the created file is an image. + * @return isImage + * @deprecated + */ + @Deprecated + @javax.annotation.Nonnull + public Boolean getIsImage() { + return isImage; + } + + @Deprecated + public void setIsImage(Boolean isImage) { + this.isImage = isImage; + } + @Deprecated + public AssetDto pixelWidth(Integer pixelWidth) { + this.pixelWidth = pixelWidth; + return this; + } + + /** + * The width of the image in pixels if the asset is an image. + * @return pixelWidth + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Integer getPixelWidth() { + return pixelWidth; + } + + @Deprecated + public void setPixelWidth(Integer pixelWidth) { + this.pixelWidth = pixelWidth; + } + @Deprecated + public AssetDto pixelHeight(Integer pixelHeight) { + this.pixelHeight = pixelHeight; + return this; + } + + /** + * The height of the image in pixels if the asset is an image. + * @return pixelHeight + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Integer getPixelHeight() { + return pixelHeight; + } + + @Deprecated + public void setPixelHeight(Integer pixelHeight) { + this.pixelHeight = pixelHeight; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AssetDto assetDto = (AssetDto) o; + return Objects.equals(this.links, assetDto.links) && + Objects.equals(this.id, assetDto.id) && + Objects.equals(this.parentId, assetDto.parentId) && + Objects.equals(this.fileName, assetDto.fileName) && + Objects.equals(this.fileHash, assetDto.fileHash) && + Objects.equals(this.isProtected, assetDto.isProtected) && + Objects.equals(this.slug, assetDto.slug) && + Objects.equals(this.mimeType, assetDto.mimeType) && + Objects.equals(this.fileType, assetDto.fileType) && + Objects.equals(this.metadataText, assetDto.metadataText) && + Objects.equals(this.editToken, assetDto.editToken) && + Objects.equals(this.metadata, assetDto.metadata) && + Objects.equals(this.tags, assetDto.tags) && + Objects.equals(this.fileSize, assetDto.fileSize) && + Objects.equals(this.fileVersion, assetDto.fileVersion) && + Objects.equals(this.type, assetDto.type) && + Objects.equals(this.createdBy, assetDto.createdBy) && + Objects.equals(this.lastModifiedBy, assetDto.lastModifiedBy) && + Objects.equals(this.created, assetDto.created) && + Objects.equals(this.lastModified, assetDto.lastModified) && + Objects.equals(this.version, assetDto.version) && + Objects.equals(this.meta, assetDto.meta) && + Objects.equals(this.isImage, assetDto.isImage) && + Objects.equals(this.pixelWidth, assetDto.pixelWidth) && + Objects.equals(this.pixelHeight, assetDto.pixelHeight); + } + + 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(links, id, parentId, fileName, fileHash, isProtected, slug, mimeType, fileType, metadataText, editToken, metadata, tags, fileSize, fileVersion, type, createdBy, lastModifiedBy, created, lastModified, version, meta, isImage, pixelWidth, pixelHeight); + } + + 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 AssetDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n"); + sb.append(" fileName: ").append(toIndentedString(fileName)).append("\n"); + sb.append(" fileHash: ").append(toIndentedString(fileHash)).append("\n"); + sb.append(" isProtected: ").append(toIndentedString(isProtected)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" mimeType: ").append(toIndentedString(mimeType)).append("\n"); + sb.append(" fileType: ").append(toIndentedString(fileType)).append("\n"); + sb.append(" metadataText: ").append(toIndentedString(metadataText)).append("\n"); + sb.append(" editToken: ").append(toIndentedString(editToken)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" fileSize: ").append(toIndentedString(fileSize)).append("\n"); + sb.append(" fileVersion: ").append(toIndentedString(fileVersion)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" lastModifiedBy: ").append(toIndentedString(lastModifiedBy)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" lastModified: ").append(toIndentedString(lastModified)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).append("\n"); + sb.append(" isImage: ").append(toIndentedString(isImage)).append("\n"); + sb.append(" pixelWidth: ").append(toIndentedString(pixelWidth)).append("\n"); + sb.append(" pixelHeight: ").append(toIndentedString(pixelHeight)).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("_links"); + openapiFields.add("id"); + openapiFields.add("parentId"); + openapiFields.add("fileName"); + openapiFields.add("fileHash"); + openapiFields.add("isProtected"); + openapiFields.add("slug"); + openapiFields.add("mimeType"); + openapiFields.add("fileType"); + openapiFields.add("metadataText"); + openapiFields.add("editToken"); + openapiFields.add("metadata"); + openapiFields.add("tags"); + openapiFields.add("fileSize"); + openapiFields.add("fileVersion"); + openapiFields.add("type"); + openapiFields.add("createdBy"); + openapiFields.add("lastModifiedBy"); + openapiFields.add("created"); + openapiFields.add("lastModified"); + openapiFields.add("version"); + openapiFields.add("_meta"); + openapiFields.add("isImage"); + openapiFields.add("pixelWidth"); + openapiFields.add("pixelHeight"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("parentId"); + openapiRequiredFields.add("fileName"); + openapiRequiredFields.add("isProtected"); + openapiRequiredFields.add("slug"); + openapiRequiredFields.add("mimeType"); + openapiRequiredFields.add("fileType"); + openapiRequiredFields.add("metadataText"); + openapiRequiredFields.add("metadata"); + openapiRequiredFields.add("fileSize"); + openapiRequiredFields.add("fileVersion"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("lastModifiedBy"); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("lastModified"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("isImage"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AssetDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AssetDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AssetDto is not found in the empty JSON string", AssetDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AssetDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AssetDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AssetDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("parentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentId").toString())); + } + if (!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())); + } + if ((jsonObj.get("fileHash") != null && !jsonObj.get("fileHash").isJsonNull()) && !jsonObj.get("fileHash").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fileHash` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fileHash").toString())); + } + if (!jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); + } + if (!jsonObj.get("mimeType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `mimeType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("mimeType").toString())); + } + if (!jsonObj.get("fileType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fileType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fileType").toString())); + } + if (!jsonObj.get("metadataText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `metadataText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metadataText").toString())); + } + if ((jsonObj.get("editToken") != null && !jsonObj.get("editToken").isJsonNull()) && !jsonObj.get("editToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `editToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("editToken").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull() && !jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + // validate the required field `type` + AssetType.validateJsonElement(jsonObj.get("type")); + if (!jsonObj.get("createdBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); + } + if (!jsonObj.get("lastModifiedBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastModifiedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastModifiedBy").toString())); + } + // validate the optional field `_meta` + if (jsonObj.get("_meta") != null && !jsonObj.get("_meta").isJsonNull()) { + AssetMeta.validateJsonElement(jsonObj.get("_meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - ParentIdStage id(String id); - - Builder from(AssetDto other); - } - - public interface ParentIdStage { - FileNameStage parentId(String parentId); - } - - public interface FileNameStage { - IsProtectedStage fileName(String fileName); - } - - public interface IsProtectedStage { - SlugStage isProtected(boolean isProtected); - } - - public interface SlugStage { - MimeTypeStage slug(String slug); - } - - public interface MimeTypeStage { - FileTypeStage mimeType(String mimeType); - } - - public interface FileTypeStage { - MetadataTextStage fileType(String fileType); - } - - public interface MetadataTextStage { - FileSizeStage metadataText(String metadataText); - } - - public interface FileSizeStage { - FileVersionStage fileSize(int fileSize); - } - - public interface FileVersionStage { - TypeStage fileVersion(int fileVersion); - } - - public interface TypeStage { - CreatedByStage type(AssetType type); - } - - public interface CreatedByStage { - LastModifiedByStage createdBy(String createdBy); - } - - public interface LastModifiedByStage { - CreatedStage lastModifiedBy(String lastModifiedBy); - } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); - } - - public interface LastModifiedStage { - VersionStage lastModified(OffsetDateTime lastModified); - } - - public interface VersionStage { - IsImageStage version(int version); - } - - public interface IsImageStage { - _FinalStage isImage(boolean isImage); - } - - public interface _FinalStage { - AssetDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage fileHash(Optional fileHash); - - _FinalStage fileHash(String fileHash); - - _FinalStage editToken(Optional editToken); - - _FinalStage editToken(String editToken); - - _FinalStage metadata(Map metadata); - - _FinalStage putAllMetadata(Map metadata); - - _FinalStage metadata(String key, Object value); - - _FinalStage tags(Optional> tags); - - _FinalStage tags(List tags); - - _FinalStage meta(Optional meta); - - _FinalStage meta(AssetMeta meta); - - _FinalStage pixelWidth(Optional pixelWidth); - - _FinalStage pixelWidth(Integer pixelWidth); - - _FinalStage pixelHeight(Optional pixelHeight); - - _FinalStage pixelHeight(Integer pixelHeight); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - ParentIdStage, - FileNameStage, - IsProtectedStage, - SlugStage, - MimeTypeStage, - FileTypeStage, - MetadataTextStage, - FileSizeStage, - FileVersionStage, - TypeStage, - CreatedByStage, - LastModifiedByStage, - CreatedStage, - LastModifiedStage, - VersionStage, - IsImageStage, - _FinalStage { - private String id; - - private String parentId; - - private String fileName; - - private boolean isProtected; - - private String slug; - - private String mimeType; - - private String fileType; - - private String metadataText; - - private int fileSize; - - private int fileVersion; - - private AssetType type; - - private String createdBy; - - private String lastModifiedBy; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private int version; - - private boolean isImage; - - private Optional pixelHeight = Optional.empty(); - - private Optional pixelWidth = Optional.empty(); - - private Optional meta = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Map metadata = new LinkedHashMap<>(); - - private Optional editToken = Optional.empty(); - - private Optional fileHash = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AssetDto other) { - links(other.getLinks()); - id(other.getId()); - parentId(other.getParentId()); - fileName(other.getFileName()); - fileHash(other.getFileHash()); - isProtected(other.getIsProtected()); - slug(other.getSlug()); - mimeType(other.getMimeType()); - fileType(other.getFileType()); - metadataText(other.getMetadataText()); - editToken(other.getEditToken()); - metadata(other.getMetadata()); - tags(other.getTags()); - fileSize(other.getFileSize()); - fileVersion(other.getFileVersion()); - type(other.getType()); - createdBy(other.getCreatedBy()); - lastModifiedBy(other.getLastModifiedBy()); - created(other.getCreated()); - lastModified(other.getLastModified()); - version(other.getVersion()); - meta(other.getMeta()); - isImage(other.getIsImage()); - pixelWidth(other.getPixelWidth()); - pixelHeight(other.getPixelHeight()); - return this; - } - - /** - *

The ID of the asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public ParentIdStage id(String id) { - this.id = id; - return this; - } - - /** - *

The ID of the parent folder. Empty for files without parent.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("parentId") - public FileNameStage parentId(String parentId) { - this.parentId = parentId; - return this; - } - - /** - *

The file name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fileName") - public IsProtectedStage fileName(String fileName) { - this.fileName = fileName; - return this; - } - - /** - *

True, when the asset is not public.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isProtected") - public SlugStage isProtected(boolean isProtected) { - this.isProtected = isProtected; - return this; - } - - /** - *

The slug.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("slug") - public MimeTypeStage slug(String slug) { - this.slug = slug; - return this; - } - - /** - *

The mime type.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("mimeType") - public FileTypeStage mimeType(String mimeType) { - this.mimeType = mimeType; - return this; - } - - /** - *

The file type.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fileType") - public MetadataTextStage fileType(String fileType) { - this.fileType = fileType; - return this; - } - - /** - *

The formatted text representation of the metadata.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("metadataText") - public FileSizeStage metadataText(String metadataText) { - this.metadataText = metadataText; - return this; - } - - /** - *

The size of the file in bytes.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fileSize") - public FileVersionStage fileSize(int fileSize) { - this.fileSize = fileSize; - return this; - } - - /** - *

The version of the file.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fileVersion") - public TypeStage fileVersion(int fileVersion) { - this.fileVersion = fileVersion; - return this; - } - - /** - *

The type of the asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("type") - public CreatedByStage type(AssetType type) { - this.type = type; - return this; - } - - /** - *

The user that has created the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("createdBy") - public LastModifiedByStage createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - *

The user that has updated the asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModifiedBy") - public CreatedStage lastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - return this; - } - - /** - *

The date and time when the asset has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The date and time when the asset has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public VersionStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

The version of the asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public IsImageStage version(int version) { - this.version = version; - return this; - } - - /** - *

Determines of the created file is an image.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isImage") - public _FinalStage isImage(boolean isImage) { - this.isImage = isImage; - return this; - } - - /** - *

The height of the image in pixels if the asset is an image.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage pixelHeight(Integer pixelHeight) { - this.pixelHeight = Optional.of(pixelHeight); - return this; - } - - @Override - @JsonSetter(value = "pixelHeight", nulls = Nulls.SKIP) - public _FinalStage pixelHeight(Optional pixelHeight) { - this.pixelHeight = pixelHeight; - return this; - } - - /** - *

The width of the image in pixels if the asset is an image.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage pixelWidth(Integer pixelWidth) { - this.pixelWidth = Optional.of(pixelWidth); - return this; - } - - @Override - @JsonSetter(value = "pixelWidth", nulls = Nulls.SKIP) - public _FinalStage pixelWidth(Optional pixelWidth) { - this.pixelWidth = pixelWidth; - return this; - } - - /** - *

The metadata.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage meta(AssetMeta meta) { - this.meta = Optional.of(meta); - return this; - } - - @Override - @JsonSetter(value = "_meta", nulls = Nulls.SKIP) - public _FinalStage meta(Optional meta) { - this.meta = meta; - return this; - } - - /** - *

The asset tags.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage tags(List tags) { - this.tags = Optional.of(tags); - return this; - } - - @Override - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public _FinalStage tags(Optional> tags) { - this.tags = tags; - return this; - } - - /** - *

The asset metadata.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage metadata(String key, Object value) { - this.metadata.put(key, value); - return this; - } - - /** - *

The asset metadata.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllMetadata(Map metadata) { - this.metadata.putAll(metadata); - return this; - } - - @Override - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public _FinalStage metadata(Map metadata) { - this.metadata.clear(); - this.metadata.putAll(metadata); - return this; - } - - /** - *

The UI token.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage editToken(String editToken) { - this.editToken = Optional.of(editToken); - return this; - } - - @Override - @JsonSetter(value = "editToken", nulls = Nulls.SKIP) - public _FinalStage editToken(Optional editToken) { - this.editToken = editToken; - return this; - } - - /** - *

The file hash.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage fileHash(String fileHash) { - this.fileHash = Optional.of(fileHash); - return this; - } - - @Override - @JsonSetter(value = "fileHash", nulls = Nulls.SKIP) - public _FinalStage fileHash(Optional fileHash) { - this.fileHash = fileHash; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AssetDto build() { - return new AssetDto( - links, - id, - parentId, - fileName, - fileHash, - isProtected, - slug, - mimeType, - fileType, - metadataText, - editToken, - metadata, - tags, - fileSize, - fileVersion, - type, - createdBy, - lastModifiedBy, - created, - lastModified, - version, - meta, - isImage, - pixelWidth, - pixelHeight); - } - } + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AssetDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AssetDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AssetDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AssetDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AssetDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AssetDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AssetDto + * @throws IOException if the JSON string is invalid with respect to AssetDto + */ + public static AssetDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AssetDto.class); + } + + /** + * Convert an instance of AssetDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AssetFolderDto.java b/src/main/java/com/squidex/api/types/AssetFolderDto.java index bd8d29f..ceab7bd 100644 --- a/src/main/java/com/squidex/api/types/AssetFolderDto.java +++ b/src/main/java/com/squidex/api/types/AssetFolderDto.java @@ -1,237 +1,322 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetFolderDto.Builder.class) -public final class AssetFolderDto implements IResource { - private final Map links; - - private final String id; - - private final String parentId; - - private final String folderName; - private final int version; - private AssetFolderDto( - Map links, String id, String parentId, String folderName, int version) { - this.links = links; - this.id = id; - this.parentId = parentId; - this.folderName = folderName; - this.version = version; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the asset. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The ID of the parent folder. Empty for files without parent. - */ - @JsonProperty("parentId") - public String getParentId() { - return parentId; - } - - /** - * @return The folder name. - */ - @JsonProperty("folderName") - public String getFolderName() { - return folderName; - } - - /** - * @return The version of the asset folder. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetFolderDto && equalTo((AssetFolderDto) other); - } - - private boolean equalTo(AssetFolderDto other) { - return links.equals(other.links) - && id.equals(other.id) - && parentId.equals(other.parentId) - && folderName.equals(other.folderName) - && version == other.version; - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.id, this.parentId, this.folderName, this.version); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +package com.squidex.api.types; - public static IdStage builder() { - return new Builder(); - } +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.squidex.api.types.ResourceLink; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; - public interface IdStage { - ParentIdStage id(String id); +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - Builder from(AssetFolderDto other); - } +import com.squidex.api.core.JSON; - public interface ParentIdStage { - FolderNameStage parentId(String parentId); +/** + * AssetFolderDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AssetFolderDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_PARENT_ID = "parentId"; + @SerializedName(SERIALIZED_NAME_PARENT_ID) + private String parentId; + public static final String SERIALIZED_NAME_FOLDER_NAME = "folderName"; + @SerializedName(SERIALIZED_NAME_FOLDER_NAME) + private String folderName; + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Long version; + public AssetFolderDto() { + } + public AssetFolderDto links(Map links) { + this.links = links; + return this; + } + + public AssetFolderDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface FolderNameStage { - VersionStage folderName(String folderName); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public AssetFolderDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the asset. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public AssetFolderDto parentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * The ID of the parent folder. Empty for files without parent. + * @return parentId + */ + @javax.annotation.Nonnull + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + public AssetFolderDto folderName(String folderName) { + this.folderName = folderName; + return this; + } + + /** + * The folder name. + * @return folderName + */ + @javax.annotation.Nonnull + public String getFolderName() { + return folderName; + } + + public void setFolderName(String folderName) { + this.folderName = folderName; + } + public AssetFolderDto version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the asset folder. + * @return version + */ + @javax.annotation.Nonnull + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface VersionStage { - _FinalStage version(int version); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - AssetFolderDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); + AssetFolderDto assetFolderDto = (AssetFolderDto) o; + return Objects.equals(this.links, assetFolderDto.links) && + Objects.equals(this.id, assetFolderDto.id) && + Objects.equals(this.parentId, assetFolderDto.parentId) && + Objects.equals(this.folderName, assetFolderDto.folderName) && + Objects.equals(this.version, assetFolderDto.version); + } + + @Override + public int hashCode() { + return Objects.hash(links, id, parentId, folderName, version); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AssetFolderDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n"); + sb.append(" folderName: ").append(toIndentedString(folderName)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, ParentIdStage, FolderNameStage, VersionStage, _FinalStage { - private String id; - - private String parentId; - - private String folderName; - - private int version; - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AssetFolderDto other) { - links(other.getLinks()); - id(other.getId()); - parentId(other.getParentId()); - folderName(other.getFolderName()); - version(other.getVersion()); - return this; - } - - /** - *

The ID of the asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public ParentIdStage id(String id) { - this.id = id; - return this; - } - - /** - *

The ID of the parent folder. Empty for files without parent.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("parentId") - public FolderNameStage parentId(String parentId) { - this.parentId = parentId; - return this; - } - - /** - *

The folder name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("folderName") - public VersionStage folderName(String folderName) { - this.folderName = folderName; - return this; - } - - /** - *

The version of the asset folder.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("id"); + openapiFields.add("parentId"); + openapiFields.add("folderName"); + openapiFields.add("version"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("parentId"); + openapiRequiredFields.add("folderName"); + openapiRequiredFields.add("version"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AssetFolderDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AssetFolderDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AssetFolderDto is not found in the empty JSON string", AssetFolderDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AssetFolderDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AssetFolderDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public AssetFolderDto build() { - return new AssetFolderDto(links, id, parentId, folderName, version); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AssetFolderDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("parentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentId").toString())); + } + if (!jsonObj.get("folderName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `folderName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("folderName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AssetFolderDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AssetFolderDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AssetFolderDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AssetFolderDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AssetFolderDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AssetFolderDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AssetFolderDto + * @throws IOException if the JSON string is invalid with respect to AssetFolderDto + */ + public static AssetFolderDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AssetFolderDto.class); + } + + /** + * Convert an instance of AssetFolderDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AssetFolderScope.java b/src/main/java/com/squidex/api/types/AssetFolderScope.java index 1abb74f..9fdf5ba 100644 --- a/src/main/java/com/squidex/api/types/AssetFolderScope.java +++ b/src/main/java/com/squidex/api/types/AssetFolderScope.java @@ -1,26 +1,80 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(AssetFolderScope.Adapter.class) public enum AssetFolderScope { - PATH_AND_ITEMS("PathAndItems"), + + PATH_AND_ITEMS("PathAndItems"), + + PATH("Path"), + + ITEMS("Items"); - PATH("Path"), + private String value; - ITEMS("Items"); + AssetFolderScope(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - AssetFolderScope(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static AssetFolderScope fromValue(String value) { + for (AssetFolderScope b : AssetFolderScope.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 AssetFolderScope enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public AssetFolderScope read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetFolderScope.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetFolderScope.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/AssetFoldersDto.java b/src/main/java/com/squidex/api/types/AssetFoldersDto.java index f8f3b7f..249139e 100644 --- a/src/main/java/com/squidex/api/types/AssetFoldersDto.java +++ b/src/main/java/com/squidex/api/types/AssetFoldersDto.java @@ -1,247 +1,328 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.AssetFolderDto; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetFoldersDto.Builder.class) -public final class AssetFoldersDto implements IResource { - private final Map links; - - private final int total; - - private final List items; - - private final List path; - private AssetFoldersDto( - Map links, int total, List items, List path) { - this.links = links; - this.total = total; - this.items = items; - this.path = path; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of assets. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } - - /** - * @return The assets folders. - */ - @JsonProperty("items") - public List getItems() { - return items; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The path to the current folder. - */ - @JsonProperty("path") - public List getPath() { - return path; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetFoldersDto && equalTo((AssetFoldersDto) other); +/** + * AssetFoldersDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AssetFoldersDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + private Long total; + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + private List path = new ArrayList<>(); + public AssetFoldersDto() { + } + public AssetFoldersDto links(Map links) { + this.links = links; + return this; + } + + public AssetFoldersDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - private boolean equalTo(AssetFoldersDto other) { - return links.equals(other.links) - && total == other.total - && items.equals(other.items) - && path.equals(other.path); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public AssetFoldersDto total(Long total) { + this.total = total; + return this; + } + + /** + * The total number of assets. + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + public AssetFoldersDto items(List items) { + this.items = items; + return this; + } + + public AssetFoldersDto addItemsItem(AssetFolderDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items, this.path); + this.items.add(itemsItem); + return this; + } + + /** + * The assets folders. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + public AssetFoldersDto path(List path) { + this.path = path; + return this; + } + + public AssetFoldersDto addPathItem(AssetFolderDto pathItem) { + if (this.path == null) { + this.path = new ArrayList<>(); } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + this.path.add(pathItem); + return this; + } + + /** + * The path to the current folder. + * @return path + */ + @javax.annotation.Nonnull + public List getPath() { + return path; + } + + public void setPath(List path) { + this.path = path; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public static TotalStage builder() { - return new Builder(); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(AssetFoldersDto other); + AssetFoldersDto assetFoldersDto = (AssetFoldersDto) o; + return Objects.equals(this.links, assetFoldersDto.links) && + Objects.equals(this.total, assetFoldersDto.total) && + Objects.equals(this.items, assetFoldersDto.items) && + Objects.equals(this.path, assetFoldersDto.path); + } + + @Override + public int hashCode() { + return Objects.hash(links, total, items, path); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AssetFoldersDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" path: ").append(toIndentedString(path)).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"; } - - public interface _FinalStage { - AssetFoldersDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(AssetFolderDto items); - - _FinalStage addAllItems(List items); - - _FinalStage path(List path); - - _FinalStage addPath(AssetFolderDto path); - - _FinalStage addAllPath(List path); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List path = new ArrayList<>(); - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AssetFoldersDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - path(other.getPath()); - return this; - } - - /** - *

The total number of assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("total"); + openapiFields.add("items"); + openapiFields.add("path"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("items"); + openapiRequiredFields.add("path"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AssetFoldersDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AssetFoldersDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AssetFoldersDto is not found in the empty JSON string", AssetFoldersDto.openapiRequiredFields.toString())); } + } - /** - *

The path to the current folder.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPath(List path) { - this.path.addAll(path); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AssetFoldersDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AssetFoldersDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The path to the current folder.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPath(AssetFolderDto path) { - this.path.add(path); - return this; - } - - @Override - @JsonSetter(value = "path", nulls = Nulls.SKIP) - public _FinalStage path(List path) { - this.path.clear(); - this.path.addAll(path); - return this; - } - - /** - *

The assets folders.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The assets folders.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(AssetFolderDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AssetFoldersDto build() { - return new AssetFoldersDto(links, total, items, path); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AssetFoldersDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + AssetFolderDto.validateJsonElement(jsonArrayitems.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("path").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be an array in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + + JsonArray jsonArraypath = jsonObj.getAsJsonArray("path"); + // validate the required field `path` (array) + for (int i = 0; i < jsonArraypath.size(); i++) { + AssetFolderDto.validateJsonElement(jsonArraypath.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AssetFoldersDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AssetFoldersDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AssetFoldersDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AssetFoldersDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AssetFoldersDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AssetFoldersDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AssetFoldersDto + * @throws IOException if the JSON string is invalid with respect to AssetFoldersDto + */ + public static AssetFoldersDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AssetFoldersDto.class); + } + + /** + * Convert an instance of AssetFoldersDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AssetMeta.java b/src/main/java/com/squidex/api/types/AssetMeta.java index 4a1d7c0..2d6b2f8 100644 --- a/src/main/java/com/squidex/api/types/AssetMeta.java +++ b/src/main/java/com/squidex/api/types/AssetMeta.java @@ -1,93 +1,209 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetMeta.Builder.class) -public final class AssetMeta { - private final String isDuplicate; - - private AssetMeta(String isDuplicate) { - this.isDuplicate = isDuplicate; - } - /** - * @return Indicates whether the asset is a duplicate. - */ - @JsonProperty("isDuplicate") - public String getIsDuplicate() { - return isDuplicate; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetMeta && equalTo((AssetMeta) other); - } - private boolean equalTo(AssetMeta other) { - return isDuplicate.equals(other.isDuplicate); - } - - @Override - public int hashCode() { - return Objects.hash(this.isDuplicate); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.core.JSON; - public static IsDuplicateStage builder() { - return new Builder(); +/** + * AssetMeta + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AssetMeta { + public static final String SERIALIZED_NAME_IS_DUPLICATE = "isDuplicate"; + @SerializedName(SERIALIZED_NAME_IS_DUPLICATE) + private String isDuplicate; + public AssetMeta() { + } + public AssetMeta isDuplicate(String isDuplicate) { + this.isDuplicate = isDuplicate; + return this; + } + + /** + * Indicates whether the asset is a duplicate. + * @return isDuplicate + */ + @javax.annotation.Nonnull + public String getIsDuplicate() { + return isDuplicate; + } + + public void setIsDuplicate(String isDuplicate) { + this.isDuplicate = isDuplicate; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface IsDuplicateStage { - _FinalStage isDuplicate(String isDuplicate); - - Builder from(AssetMeta other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - AssetMeta build(); + AssetMeta assetMeta = (AssetMeta) o; + return Objects.equals(this.isDuplicate, assetMeta.isDuplicate); + } + + @Override + public int hashCode() { + return Objects.hash(isDuplicate); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AssetMeta {\n"); + sb.append(" isDuplicate: ").append(toIndentedString(isDuplicate)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IsDuplicateStage, _FinalStage { - private String isDuplicate; - - private Builder() {} - - @Override - public Builder from(AssetMeta other) { - isDuplicate(other.getIsDuplicate()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("isDuplicate"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("isDuplicate"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AssetMeta + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AssetMeta.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AssetMeta is not found in the empty JSON string", AssetMeta.openapiRequiredFields.toString())); } + } - /** - *

Indicates whether the asset is a duplicate.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isDuplicate") - public _FinalStage isDuplicate(String isDuplicate) { - this.isDuplicate = isDuplicate; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AssetMeta.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AssetMeta` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public AssetMeta build() { - return new AssetMeta(isDuplicate); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AssetMeta.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("isDuplicate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `isDuplicate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("isDuplicate").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AssetMeta.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AssetMeta' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AssetMeta.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AssetMeta value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AssetMeta read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AssetMeta given an JSON string + * + * @param jsonString JSON string + * @return An instance of AssetMeta + * @throws IOException if the JSON string is invalid with respect to AssetMeta + */ + public static AssetMeta fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AssetMeta.class); + } + + /** + * Convert an instance of AssetMeta to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AssetPreviewMode.java b/src/main/java/com/squidex/api/types/AssetPreviewMode.java index 1b3054b..1103004 100644 --- a/src/main/java/com/squidex/api/types/AssetPreviewMode.java +++ b/src/main/java/com/squidex/api/types/AssetPreviewMode.java @@ -1,26 +1,80 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(AssetPreviewMode.Adapter.class) public enum AssetPreviewMode { - IMAGE_AND_FILE_NAME("ImageAndFileName"), + + IMAGE_AND_FILE_NAME("ImageAndFileName"), + + IMAGE("Image"), + + FILE_NAME("FileName"); - IMAGE("Image"), + private String value; - FILE_NAME("FileName"); + AssetPreviewMode(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - AssetPreviewMode(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static AssetPreviewMode fromValue(String value) { + for (AssetPreviewMode b : AssetPreviewMode.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 AssetPreviewMode enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public AssetPreviewMode read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetPreviewMode.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetPreviewMode.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/AssetScriptsDto.java b/src/main/java/com/squidex/api/types/AssetScriptsDto.java index ac272f0..22ab0af 100644 --- a/src/main/java/com/squidex/api/types/AssetScriptsDto.java +++ b/src/main/java/com/squidex/api/types/AssetScriptsDto.java @@ -1,417 +1,435 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetScriptsDto.Builder.class) -public final class AssetScriptsDto implements IResource { - private final Map links; - - private final Optional query; - - private final Optional queryPre; - - private final Optional create; - - private final Optional update; - - private final Optional annotate; - - private final Optional move; - - private final Optional delete; - - private final int version; - - private AssetScriptsDto( - Map links, - Optional query, - Optional queryPre, - Optional create, - Optional update, - Optional annotate, - Optional move, - Optional delete, - int version) { - this.links = links; - this.query = query; - this.queryPre = queryPre; - this.create = create; - this.update = update; - this.annotate = annotate; - this.move = move; - this.delete = delete; - this.version = version; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The script that is executed for each asset when querying assets. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return The script that is executed for all assets when querying assets. - */ - @JsonProperty("queryPre") - public Optional getQueryPre() { - return queryPre; - } - - /** - * @return The script that is executed when creating an asset. - */ - @JsonProperty("create") - public Optional getCreate() { - return create; - } - - /** - * @return The script that is executed when updating a content. - */ - @JsonProperty("update") - public Optional getUpdate() { - return update; - } - - /** - * @return The script that is executed when annotating a content. - */ - @JsonProperty("annotate") - public Optional getAnnotate() { - return annotate; - } - - /** - * @return The script that is executed when moving a content. - */ - @JsonProperty("move") - public Optional getMove() { - return move; - } - /** - * @return The script that is executed when deleting a content. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - /** - * @return The version of the app. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } +package com.squidex.api.types; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetScriptsDto && equalTo((AssetScriptsDto) other); - } +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.squidex.api.types.ResourceLink; +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; - private boolean equalTo(AssetScriptsDto other) { - return links.equals(other.links) - && query.equals(other.query) - && queryPre.equals(other.queryPre) - && create.equals(other.create) - && update.equals(other.update) - && annotate.equals(other.annotate) - && move.equals(other.move) - && delete.equals(other.delete) - && version == other.version; - } +import com.squidex.api.core.JSON; - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.query, - this.queryPre, - this.create, - this.update, - this.annotate, - this.move, - this.delete, - this.version); +/** + * AssetScriptsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AssetScriptsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + public static final String SERIALIZED_NAME_QUERY_PRE = "queryPre"; + @SerializedName(SERIALIZED_NAME_QUERY_PRE) + private String queryPre; + public static final String SERIALIZED_NAME_CREATE = "create"; + @SerializedName(SERIALIZED_NAME_CREATE) + private String create; + public static final String SERIALIZED_NAME_UPDATE = "update"; + @SerializedName(SERIALIZED_NAME_UPDATE) + private String update; + public static final String SERIALIZED_NAME_ANNOTATE = "annotate"; + @SerializedName(SERIALIZED_NAME_ANNOTATE) + private String annotate; + public static final String SERIALIZED_NAME_MOVE = "move"; + @SerializedName(SERIALIZED_NAME_MOVE) + private String move; + public static final String SERIALIZED_NAME_DELETE = "delete"; + @SerializedName(SERIALIZED_NAME_DELETE) + private String delete; + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Long version; + public AssetScriptsDto() { + } + public AssetScriptsDto links(Map links) { + this.links = links; + return this; + } + + public AssetScriptsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public AssetScriptsDto query(String query) { + this.query = query; + return this; + } + + /** + * The script that is executed for each asset when querying assets. + * @return query + */ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + public AssetScriptsDto queryPre(String queryPre) { + this.queryPre = queryPre; + return this; + } + + /** + * The script that is executed for all assets when querying assets. + * @return queryPre + */ + @javax.annotation.Nullable + public String getQueryPre() { + return queryPre; + } + + public void setQueryPre(String queryPre) { + this.queryPre = queryPre; + } + public AssetScriptsDto create(String create) { + this.create = create; + return this; + } + + /** + * The script that is executed when creating an asset. + * @return create + */ + @javax.annotation.Nullable + public String getCreate() { + return create; + } + + public void setCreate(String create) { + this.create = create; + } + public AssetScriptsDto update(String update) { + this.update = update; + return this; + } + + /** + * The script that is executed when updating a content. + * @return update + */ + @javax.annotation.Nullable + public String getUpdate() { + return update; + } + + public void setUpdate(String update) { + this.update = update; + } + public AssetScriptsDto annotate(String annotate) { + this.annotate = annotate; + return this; + } + + /** + * The script that is executed when annotating a content. + * @return annotate + */ + @javax.annotation.Nullable + public String getAnnotate() { + return annotate; + } + + public void setAnnotate(String annotate) { + this.annotate = annotate; + } + public AssetScriptsDto move(String move) { + this.move = move; + return this; + } + + /** + * The script that is executed when moving a content. + * @return move + */ + @javax.annotation.Nullable + public String getMove() { + return move; + } + + public void setMove(String move) { + this.move = move; + } + public AssetScriptsDto delete(String delete) { + this.delete = delete; + return this; + } + + /** + * The script that is executed when deleting a content. + * @return delete + */ + @javax.annotation.Nullable + public String getDelete() { + return delete; + } + + public void setDelete(String delete) { + this.delete = delete; + } + public AssetScriptsDto version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the app. + * @return version + */ + @javax.annotation.Nonnull + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public static VersionStage builder() { - return new Builder(); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface VersionStage { - _FinalStage version(int version); - - Builder from(AssetScriptsDto other); + AssetScriptsDto assetScriptsDto = (AssetScriptsDto) o; + return Objects.equals(this.links, assetScriptsDto.links) && + Objects.equals(this.query, assetScriptsDto.query) && + Objects.equals(this.queryPre, assetScriptsDto.queryPre) && + Objects.equals(this.create, assetScriptsDto.create) && + Objects.equals(this.update, assetScriptsDto.update) && + Objects.equals(this.annotate, assetScriptsDto.annotate) && + Objects.equals(this.move, assetScriptsDto.move) && + Objects.equals(this.delete, assetScriptsDto.delete) && + Objects.equals(this.version, assetScriptsDto.version); + } + + 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(links, query, queryPre, create, update, annotate, move, delete, version); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - AssetScriptsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage query(Optional query); - - _FinalStage query(String query); - - _FinalStage queryPre(Optional queryPre); - - _FinalStage queryPre(String queryPre); - - _FinalStage create(Optional create); - - _FinalStage create(String create); - - _FinalStage update(Optional update); - - _FinalStage update(String update); - - _FinalStage annotate(Optional annotate); - - _FinalStage annotate(String annotate); - - _FinalStage move(Optional move); - - _FinalStage move(String move); - - _FinalStage delete(Optional delete); - - _FinalStage delete(String delete); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AssetScriptsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" queryPre: ").append(toIndentedString(queryPre)).append("\n"); + sb.append(" create: ").append(toIndentedString(create)).append("\n"); + sb.append(" update: ").append(toIndentedString(update)).append("\n"); + sb.append(" annotate: ").append(toIndentedString(annotate)).append("\n"); + sb.append(" move: ").append(toIndentedString(move)).append("\n"); + sb.append(" delete: ").append(toIndentedString(delete)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements VersionStage, _FinalStage { - private int version; - - private Optional delete = Optional.empty(); - - private Optional move = Optional.empty(); - - private Optional annotate = Optional.empty(); - - private Optional update = Optional.empty(); - - private Optional create = Optional.empty(); - - private Optional queryPre = Optional.empty(); - - private Optional query = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AssetScriptsDto other) { - links(other.getLinks()); - query(other.getQuery()); - queryPre(other.getQueryPre()); - create(other.getCreate()); - update(other.getUpdate()); - annotate(other.getAnnotate()); - move(other.getMove()); - delete(other.getDelete()); - version(other.getVersion()); - return this; - } - - /** - *

The version of the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The script that is executed when deleting a content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - @Override - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public _FinalStage delete(Optional delete) { - this.delete = delete; - return this; - } - - /** - *

The script that is executed when moving a content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage move(String move) { - this.move = Optional.of(move); - return this; - } - - @Override - @JsonSetter(value = "move", nulls = Nulls.SKIP) - public _FinalStage move(Optional move) { - this.move = move; - return this; - } - - /** - *

The script that is executed when annotating a content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage annotate(String annotate) { - this.annotate = Optional.of(annotate); - return this; - } - - @Override - @JsonSetter(value = "annotate", nulls = Nulls.SKIP) - public _FinalStage annotate(Optional annotate) { - this.annotate = annotate; - return this; - } - - /** - *

The script that is executed when updating a content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage update(String update) { - this.update = Optional.of(update); - return this; - } - - @Override - @JsonSetter(value = "update", nulls = Nulls.SKIP) - public _FinalStage update(Optional update) { - this.update = update; - return this; - } - - /** - *

The script that is executed when creating an asset.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage create(String create) { - this.create = Optional.of(create); - return this; - } - - @Override - @JsonSetter(value = "create", nulls = Nulls.SKIP) - public _FinalStage create(Optional create) { - this.create = create; - return this; - } - - /** - *

The script that is executed for all assets when querying assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage queryPre(String queryPre) { - this.queryPre = Optional.of(queryPre); - return this; - } - - @Override - @JsonSetter(value = "queryPre", nulls = Nulls.SKIP) - public _FinalStage queryPre(Optional queryPre) { - this.queryPre = queryPre; - return this; - } - - /** - *

The script that is executed for each asset when querying assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage query(String query) { - this.query = Optional.of(query); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("query"); + openapiFields.add("queryPre"); + openapiFields.add("create"); + openapiFields.add("update"); + openapiFields.add("annotate"); + openapiFields.add("move"); + openapiFields.add("delete"); + openapiFields.add("version"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("version"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AssetScriptsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AssetScriptsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AssetScriptsDto is not found in the empty JSON string", AssetScriptsDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public _FinalStage query(Optional query) { - this.query = query; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AssetScriptsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AssetScriptsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AssetScriptsDto build() { - return new AssetScriptsDto(links, query, queryPre, create, update, annotate, move, delete, version); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AssetScriptsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString())); + } + if ((jsonObj.get("queryPre") != null && !jsonObj.get("queryPre").isJsonNull()) && !jsonObj.get("queryPre").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `queryPre` to be a primitive type in the JSON string but got `%s`", jsonObj.get("queryPre").toString())); + } + if ((jsonObj.get("create") != null && !jsonObj.get("create").isJsonNull()) && !jsonObj.get("create").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `create` to be a primitive type in the JSON string but got `%s`", jsonObj.get("create").toString())); + } + if ((jsonObj.get("update") != null && !jsonObj.get("update").isJsonNull()) && !jsonObj.get("update").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `update` to be a primitive type in the JSON string but got `%s`", jsonObj.get("update").toString())); + } + if ((jsonObj.get("annotate") != null && !jsonObj.get("annotate").isJsonNull()) && !jsonObj.get("annotate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `annotate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("annotate").toString())); + } + if ((jsonObj.get("move") != null && !jsonObj.get("move").isJsonNull()) && !jsonObj.get("move").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `move` to be a primitive type in the JSON string but got `%s`", jsonObj.get("move").toString())); + } + if ((jsonObj.get("delete") != null && !jsonObj.get("delete").isJsonNull()) && !jsonObj.get("delete").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `delete` to be a primitive type in the JSON string but got `%s`", jsonObj.get("delete").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AssetScriptsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AssetScriptsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AssetScriptsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AssetScriptsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AssetScriptsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AssetScriptsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AssetScriptsDto + * @throws IOException if the JSON string is invalid with respect to AssetScriptsDto + */ + public static AssetScriptsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AssetScriptsDto.class); + } + + /** + * Convert an instance of AssetScriptsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AssetType.java b/src/main/java/com/squidex/api/types/AssetType.java index 4388b5f..68f1749 100644 --- a/src/main/java/com/squidex/api/types/AssetType.java +++ b/src/main/java/com/squidex/api/types/AssetType.java @@ -1,28 +1,82 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(AssetType.Adapter.class) public enum AssetType { - UNKNOWN("Unknown"), + + UNKNOWN("Unknown"), + + IMAGE("Image"), + + AUDIO("Audio"), + + VIDEO("Video"); - IMAGE("Image"), + private String value; - AUDIO("Audio"), + AssetType(String value) { + this.value = value; + } - VIDEO("Video"); + public String getValue() { + return value; + } - private final String value; + @Override + public String toString() { + return String.valueOf(value); + } - AssetType(String value) { - this.value = value; + public static AssetType fromValue(String value) { + for (AssetType b : AssetType.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - @JsonValue + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return this.value; + public void write(final JsonWriter jsonWriter, final AssetType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } + + @Override + public AssetType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return AssetType.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + AssetType.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/AssetsDto.java b/src/main/java/com/squidex/api/types/AssetsDto.java index 47aaffd..f894110 100644 --- a/src/main/java/com/squidex/api/types/AssetsDto.java +++ b/src/main/java/com/squidex/api/types/AssetsDto.java @@ -1,195 +1,286 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.AssetDto; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsDto.Builder.class) -public final class AssetsDto implements IResource { - private final Map links; - - private final int total; - private final List items; - - private AssetsDto(Map links, int total, List items) { - this.links = links; - this.total = total; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of assets. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The assets. - */ - @JsonProperty("items") - public List getItems() { - return items; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsDto && equalTo((AssetsDto) other); +/** + * AssetsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AssetsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + private Long total; + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public AssetsDto() { + } + public AssetsDto links(Map links) { + this.links = links; + return this; + } + + public AssetsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - private boolean equalTo(AssetsDto other) { - return links.equals(other.links) && total == other.total && items.equals(other.items); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public AssetsDto total(Long total) { + this.total = total; + return this; + } + + /** + * The total number of assets. + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + public AssetsDto items(List items) { + this.items = items; + return this; + } + + public AssetsDto addItemsItem(AssetDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items); + this.items.add(itemsItem); + return this; + } + + /** + * The assets. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static TotalStage builder() { - return new Builder(); + AssetsDto assetsDto = (AssetsDto) o; + return Objects.equals(this.links, assetsDto.links) && + Objects.equals(this.total, assetsDto.total) && + Objects.equals(this.items, assetsDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, total, items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AssetsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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"; } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(AssetsDto other); - } - - public interface _FinalStage { - AssetsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(AssetDto items); - - _FinalStage addAllItems(List items); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(AssetsDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("total"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("items"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AssetsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AssetsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AssetsDto is not found in the empty JSON string", AssetsDto.openapiRequiredFields.toString())); } + } - /** - *

The total number of assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AssetsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AssetsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(AssetDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public AssetsDto build() { - return new AssetsDto(links, total, items); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AssetsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + AssetDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AssetsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AssetsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AssetsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AssetsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AssetsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AssetsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AssetsDto + * @throws IOException if the JSON string is invalid with respect to AssetsDto + */ + public static AssetsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AssetsDto.class); + } + + /** + * Convert an instance of AssetsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java index 914b096..5481f3a 100644 --- a/src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java @@ -1,668 +1,729 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.AssetPreviewMode; +import com.squidex.api.types.AssetType; +import com.squidex.api.types.FieldPropertiesDto; +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.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssetsFieldPropertiesDto.Builder.class) -public final class AssetsFieldPropertiesDto { - private final Optional previewMode; - - private final Optional>> defaultValues; - - private final Optional> defaultValue; - - private final Optional folderId; - - private final Optional previewFormat; - - private final Optional minItems; - - private final Optional maxItems; - - private final Optional minSize; - - private final Optional maxSize; - - private final Optional minWidth; - - private final Optional maxWidth; - - private final Optional minHeight; - - private final Optional maxHeight; - - private final Optional aspectWidth; - - private final Optional aspectHeight; - - private final Optional expectedType; - - private final Optional resolveFirst; - - private final Optional mustBeImage; - - private final Optional resolveImage; - - private final Optional> allowedExtensions; - - private final Optional allowDuplicates; - - private AssetsFieldPropertiesDto( - Optional previewMode, - Optional>> defaultValues, - Optional> defaultValue, - Optional folderId, - Optional previewFormat, - Optional minItems, - Optional maxItems, - Optional minSize, - Optional maxSize, - Optional minWidth, - Optional maxWidth, - Optional minHeight, - Optional maxHeight, - Optional aspectWidth, - Optional aspectHeight, - Optional expectedType, - Optional resolveFirst, - Optional mustBeImage, - Optional resolveImage, - Optional> allowedExtensions, - Optional allowDuplicates) { - this.previewMode = previewMode; - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.folderId = folderId; - this.previewFormat = previewFormat; - this.minItems = minItems; - this.maxItems = maxItems; - this.minSize = minSize; - this.maxSize = maxSize; - this.minWidth = minWidth; - this.maxWidth = maxWidth; - this.minHeight = minHeight; - this.maxHeight = maxHeight; - this.aspectWidth = aspectWidth; - this.aspectHeight = aspectHeight; - this.expectedType = expectedType; - this.resolveFirst = resolveFirst; - this.mustBeImage = mustBeImage; - this.resolveImage = resolveImage; - this.allowedExtensions = allowedExtensions; - this.allowDuplicates = allowDuplicates; - } - - /** - * @return The preview mode for the asset. - */ - @JsonProperty("previewMode") - public Optional getPreviewMode() { - return previewMode; - } - - /** - * @return The language specific default value as a list of asset ids. - */ - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value as a list of asset ids. - */ - @JsonProperty("defaultValue") - public Optional> getDefaultValue() { - return defaultValue; - } - - /** - * @return The initial id to the folder. - */ - @JsonProperty("folderId") - public Optional getFolderId() { - return folderId; - } - - /** - * @return The preview format. - */ - @JsonProperty("previewFormat") - public Optional getPreviewFormat() { - return previewFormat; - } - - /** - * @return The minimum allowed items for the field value. - */ - @JsonProperty("minItems") - public Optional getMinItems() { - return minItems; - } - - /** - * @return The maximum allowed items for the field value. - */ - @JsonProperty("maxItems") - public Optional getMaxItems() { - return maxItems; - } - - /** - * @return The minimum file size in bytes. - */ - @JsonProperty("minSize") - public Optional getMinSize() { - return minSize; - } - - /** - * @return The maximum file size in bytes. - */ - @JsonProperty("maxSize") - public Optional getMaxSize() { - return maxSize; - } - - /** - * @return The minimum image width in pixels. - */ - @JsonProperty("minWidth") - public Optional getMinWidth() { - return minWidth; - } - - /** - * @return The maximum image width in pixels. - */ - @JsonProperty("maxWidth") - public Optional getMaxWidth() { - return maxWidth; - } - - /** - * @return The minimum image height in pixels. - */ - @JsonProperty("minHeight") - public Optional getMinHeight() { - return minHeight; - } - - /** - * @return The maximum image height in pixels. - */ - @JsonProperty("maxHeight") - public Optional getMaxHeight() { - return maxHeight; - } - - /** - * @return The image aspect width in pixels. - */ - @JsonProperty("aspectWidth") - public Optional getAspectWidth() { - return aspectWidth; - } - - /** - * @return The image aspect height in pixels. - */ - @JsonProperty("aspectHeight") - public Optional getAspectHeight() { - return aspectHeight; - } +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; - /** - * @return The expected type. - */ - @JsonProperty("expectedType") - public Optional getExpectedType() { - return expectedType; - } +import com.squidex.api.core.JSON; - /** - * @return True to resolve first asset in the content list. - */ - @JsonProperty("resolveFirst") - public Optional getResolveFirst() { - return resolveFirst; +/** + * AssetsFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AssetsFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_PREVIEW_MODE = "previewMode"; + @SerializedName(SERIALIZED_NAME_PREVIEW_MODE) + private AssetPreviewMode previewMode; + public static final String SERIALIZED_NAME_DEFAULT_VALUES = "defaultValues"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUES) + private Map> defaultValues = new HashMap<>(); + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private List defaultValue; + public static final String SERIALIZED_NAME_FOLDER_ID = "folderId"; + @SerializedName(SERIALIZED_NAME_FOLDER_ID) + private String folderId; + public static final String SERIALIZED_NAME_PREVIEW_FORMAT = "previewFormat"; + @SerializedName(SERIALIZED_NAME_PREVIEW_FORMAT) + private String previewFormat; + public static final String SERIALIZED_NAME_MIN_ITEMS = "minItems"; + @SerializedName(SERIALIZED_NAME_MIN_ITEMS) + private Integer minItems; + public static final String SERIALIZED_NAME_MAX_ITEMS = "maxItems"; + @SerializedName(SERIALIZED_NAME_MAX_ITEMS) + private Integer maxItems; + public static final String SERIALIZED_NAME_MIN_SIZE = "minSize"; + @SerializedName(SERIALIZED_NAME_MIN_SIZE) + private Integer minSize; + public static final String SERIALIZED_NAME_MAX_SIZE = "maxSize"; + @SerializedName(SERIALIZED_NAME_MAX_SIZE) + private Integer maxSize; + public static final String SERIALIZED_NAME_MIN_WIDTH = "minWidth"; + @SerializedName(SERIALIZED_NAME_MIN_WIDTH) + private Integer minWidth; + public static final String SERIALIZED_NAME_MAX_WIDTH = "maxWidth"; + @SerializedName(SERIALIZED_NAME_MAX_WIDTH) + private Integer maxWidth; + public static final String SERIALIZED_NAME_MIN_HEIGHT = "minHeight"; + @SerializedName(SERIALIZED_NAME_MIN_HEIGHT) + private Integer minHeight; + public static final String SERIALIZED_NAME_MAX_HEIGHT = "maxHeight"; + @SerializedName(SERIALIZED_NAME_MAX_HEIGHT) + private Integer maxHeight; + public static final String SERIALIZED_NAME_ASPECT_WIDTH = "aspectWidth"; + @SerializedName(SERIALIZED_NAME_ASPECT_WIDTH) + private Integer aspectWidth; + public static final String SERIALIZED_NAME_ASPECT_HEIGHT = "aspectHeight"; + @SerializedName(SERIALIZED_NAME_ASPECT_HEIGHT) + private Integer aspectHeight; + public static final String SERIALIZED_NAME_EXPECTED_TYPE = "expectedType"; + @SerializedName(SERIALIZED_NAME_EXPECTED_TYPE) + private AssetType expectedType; + public static final String SERIALIZED_NAME_RESOLVE_FIRST = "resolveFirst"; + @SerializedName(SERIALIZED_NAME_RESOLVE_FIRST) + private Boolean resolveFirst; + public static final String SERIALIZED_NAME_MUST_BE_IMAGE = "mustBeImage"; + @Deprecated + @SerializedName(SERIALIZED_NAME_MUST_BE_IMAGE) + private Boolean mustBeImage; + public static final String SERIALIZED_NAME_RESOLVE_IMAGE = "resolveImage"; + @Deprecated + @SerializedName(SERIALIZED_NAME_RESOLVE_IMAGE) + private Boolean resolveImage; + public static final String SERIALIZED_NAME_ALLOWED_EXTENSIONS = "allowedExtensions"; + @SerializedName(SERIALIZED_NAME_ALLOWED_EXTENSIONS) + private List allowedExtensions; + public static final String SERIALIZED_NAME_ALLOW_DUPLICATES = "allowDuplicates"; + @SerializedName(SERIALIZED_NAME_ALLOW_DUPLICATES) + private Boolean allowDuplicates; + public AssetsFieldPropertiesDto() { + } + public AssetsFieldPropertiesDto previewMode(AssetPreviewMode previewMode) { + this.previewMode = previewMode; + return this; + } + + /** + * Get previewMode + * @return previewMode + */ + @javax.annotation.Nullable + public AssetPreviewMode getPreviewMode() { + return previewMode; + } + + public void setPreviewMode(AssetPreviewMode previewMode) { + this.previewMode = previewMode; + } + public AssetsFieldPropertiesDto defaultValues(Map> defaultValues) { + this.defaultValues = defaultValues; + return this; + } + + public AssetsFieldPropertiesDto putDefaultValuesItem(String key, List defaultValuesItem) { + if (this.defaultValues == null) { + this.defaultValues = new HashMap<>(); } - - /** - * @return True to resolve first image in the content list. - */ - @JsonProperty("mustBeImage") - public Optional getMustBeImage() { - return mustBeImage; + this.defaultValues.put(key, defaultValuesItem); + return this; + } + + /** + * Get defaultValues + * @return defaultValues + */ + @javax.annotation.Nullable + public Map> getDefaultValues() { + return defaultValues; + } + + public void setDefaultValues(Map> defaultValues) { + this.defaultValues = defaultValues; + } + public AssetsFieldPropertiesDto defaultValue(List defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + public AssetsFieldPropertiesDto addDefaultValueItem(String defaultValueItem) { + if (this.defaultValue == null) { + this.defaultValue = new ArrayList<>(); } - - /** - * @return True to resolve first image in the content list. - */ - @JsonProperty("resolveImage") - public Optional getResolveImage() { - return resolveImage; + this.defaultValue.add(defaultValueItem); + return this; + } + + /** + * The default value as a list of asset ids. + * @return defaultValue + */ + @javax.annotation.Nullable + public List getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(List defaultValue) { + this.defaultValue = defaultValue; + } + public AssetsFieldPropertiesDto folderId(String folderId) { + this.folderId = folderId; + return this; + } + + /** + * The initial id to the folder. + * @return folderId + */ + @javax.annotation.Nullable + public String getFolderId() { + return folderId; + } + + public void setFolderId(String folderId) { + this.folderId = folderId; + } + public AssetsFieldPropertiesDto previewFormat(String previewFormat) { + this.previewFormat = previewFormat; + return this; + } + + /** + * The preview format. + * @return previewFormat + */ + @javax.annotation.Nullable + public String getPreviewFormat() { + return previewFormat; + } + + public void setPreviewFormat(String previewFormat) { + this.previewFormat = previewFormat; + } + public AssetsFieldPropertiesDto minItems(Integer minItems) { + this.minItems = minItems; + return this; + } + + /** + * The minimum allowed items for the field value. + * @return minItems + */ + @javax.annotation.Nullable + public Integer getMinItems() { + return minItems; + } + + public void setMinItems(Integer minItems) { + this.minItems = minItems; + } + public AssetsFieldPropertiesDto maxItems(Integer maxItems) { + this.maxItems = maxItems; + return this; + } + + /** + * The maximum allowed items for the field value. + * @return maxItems + */ + @javax.annotation.Nullable + public Integer getMaxItems() { + return maxItems; + } + + public void setMaxItems(Integer maxItems) { + this.maxItems = maxItems; + } + public AssetsFieldPropertiesDto minSize(Integer minSize) { + this.minSize = minSize; + return this; + } + + /** + * The minimum file size in bytes. + * @return minSize + */ + @javax.annotation.Nullable + public Integer getMinSize() { + return minSize; + } + + public void setMinSize(Integer minSize) { + this.minSize = minSize; + } + public AssetsFieldPropertiesDto maxSize(Integer maxSize) { + this.maxSize = maxSize; + return this; + } + + /** + * The maximum file size in bytes. + * @return maxSize + */ + @javax.annotation.Nullable + public Integer getMaxSize() { + return maxSize; + } + + public void setMaxSize(Integer maxSize) { + this.maxSize = maxSize; + } + public AssetsFieldPropertiesDto minWidth(Integer minWidth) { + this.minWidth = minWidth; + return this; + } + + /** + * The minimum image width in pixels. + * @return minWidth + */ + @javax.annotation.Nullable + public Integer getMinWidth() { + return minWidth; + } + + public void setMinWidth(Integer minWidth) { + this.minWidth = minWidth; + } + public AssetsFieldPropertiesDto maxWidth(Integer maxWidth) { + this.maxWidth = maxWidth; + return this; + } + + /** + * The maximum image width in pixels. + * @return maxWidth + */ + @javax.annotation.Nullable + public Integer getMaxWidth() { + return maxWidth; + } + + public void setMaxWidth(Integer maxWidth) { + this.maxWidth = maxWidth; + } + public AssetsFieldPropertiesDto minHeight(Integer minHeight) { + this.minHeight = minHeight; + return this; + } + + /** + * The minimum image height in pixels. + * @return minHeight + */ + @javax.annotation.Nullable + public Integer getMinHeight() { + return minHeight; + } + + public void setMinHeight(Integer minHeight) { + this.minHeight = minHeight; + } + public AssetsFieldPropertiesDto maxHeight(Integer maxHeight) { + this.maxHeight = maxHeight; + return this; + } + + /** + * The maximum image height in pixels. + * @return maxHeight + */ + @javax.annotation.Nullable + public Integer getMaxHeight() { + return maxHeight; + } + + public void setMaxHeight(Integer maxHeight) { + this.maxHeight = maxHeight; + } + public AssetsFieldPropertiesDto aspectWidth(Integer aspectWidth) { + this.aspectWidth = aspectWidth; + return this; + } + + /** + * The image aspect width in pixels. + * @return aspectWidth + */ + @javax.annotation.Nullable + public Integer getAspectWidth() { + return aspectWidth; + } + + public void setAspectWidth(Integer aspectWidth) { + this.aspectWidth = aspectWidth; + } + public AssetsFieldPropertiesDto aspectHeight(Integer aspectHeight) { + this.aspectHeight = aspectHeight; + return this; + } + + /** + * The image aspect height in pixels. + * @return aspectHeight + */ + @javax.annotation.Nullable + public Integer getAspectHeight() { + return aspectHeight; + } + + public void setAspectHeight(Integer aspectHeight) { + this.aspectHeight = aspectHeight; + } + public AssetsFieldPropertiesDto expectedType(AssetType expectedType) { + this.expectedType = expectedType; + return this; + } + + /** + * Get expectedType + * @return expectedType + */ + @javax.annotation.Nullable + public AssetType getExpectedType() { + return expectedType; + } + + public void setExpectedType(AssetType expectedType) { + this.expectedType = expectedType; + } + public AssetsFieldPropertiesDto resolveFirst(Boolean resolveFirst) { + this.resolveFirst = resolveFirst; + return this; + } + + /** + * True to resolve first asset in the content list. + * @return resolveFirst + */ + @javax.annotation.Nullable + public Boolean getResolveFirst() { + return resolveFirst; + } + + public void setResolveFirst(Boolean resolveFirst) { + this.resolveFirst = resolveFirst; + } + @Deprecated + public AssetsFieldPropertiesDto mustBeImage(Boolean mustBeImage) { + this.mustBeImage = mustBeImage; + return this; + } + + /** + * True to resolve first image in the content list. + * @return mustBeImage + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Boolean getMustBeImage() { + return mustBeImage; + } + + @Deprecated + public void setMustBeImage(Boolean mustBeImage) { + this.mustBeImage = mustBeImage; + } + @Deprecated + public AssetsFieldPropertiesDto resolveImage(Boolean resolveImage) { + this.resolveImage = resolveImage; + return this; + } + + /** + * True to resolve first image in the content list. + * @return resolveImage + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Boolean getResolveImage() { + return resolveImage; + } + + @Deprecated + public void setResolveImage(Boolean resolveImage) { + this.resolveImage = resolveImage; + } + public AssetsFieldPropertiesDto allowedExtensions(List allowedExtensions) { + this.allowedExtensions = allowedExtensions; + return this; + } + + public AssetsFieldPropertiesDto addAllowedExtensionsItem(String allowedExtensionsItem) { + if (this.allowedExtensions == null) { + this.allowedExtensions = new ArrayList<>(); } - - /** - * @return The allowed file extensions. - */ - @JsonProperty("allowedExtensions") - public Optional> getAllowedExtensions() { - return allowedExtensions; + this.allowedExtensions.add(allowedExtensionsItem); + return this; + } + + /** + * The allowed file extensions. + * @return allowedExtensions + */ + @javax.annotation.Nullable + public List getAllowedExtensions() { + return allowedExtensions; + } + + public void setAllowedExtensions(List allowedExtensions) { + this.allowedExtensions = allowedExtensions; + } + public AssetsFieldPropertiesDto allowDuplicates(Boolean allowDuplicates) { + this.allowDuplicates = allowDuplicates; + return this; + } + + /** + * True, if duplicate values are allowed. + * @return allowDuplicates + */ + @javax.annotation.Nullable + public Boolean getAllowDuplicates() { + return allowDuplicates; + } + + public void setAllowDuplicates(Boolean allowDuplicates) { + this.allowDuplicates = allowDuplicates; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - /** - * @return True, if duplicate values are allowed. - */ - @JsonProperty("allowDuplicates") - public Optional getAllowDuplicates() { - return allowDuplicates; + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsFieldPropertiesDto && equalTo((AssetsFieldPropertiesDto) other); + AssetsFieldPropertiesDto assetsFieldPropertiesDto = (AssetsFieldPropertiesDto) o; + return Objects.equals(this.previewMode, assetsFieldPropertiesDto.previewMode) && + Objects.equals(this.defaultValues, assetsFieldPropertiesDto.defaultValues) && + Objects.equals(this.defaultValue, assetsFieldPropertiesDto.defaultValue) && + Objects.equals(this.folderId, assetsFieldPropertiesDto.folderId) && + Objects.equals(this.previewFormat, assetsFieldPropertiesDto.previewFormat) && + Objects.equals(this.minItems, assetsFieldPropertiesDto.minItems) && + Objects.equals(this.maxItems, assetsFieldPropertiesDto.maxItems) && + Objects.equals(this.minSize, assetsFieldPropertiesDto.minSize) && + Objects.equals(this.maxSize, assetsFieldPropertiesDto.maxSize) && + Objects.equals(this.minWidth, assetsFieldPropertiesDto.minWidth) && + Objects.equals(this.maxWidth, assetsFieldPropertiesDto.maxWidth) && + Objects.equals(this.minHeight, assetsFieldPropertiesDto.minHeight) && + Objects.equals(this.maxHeight, assetsFieldPropertiesDto.maxHeight) && + Objects.equals(this.aspectWidth, assetsFieldPropertiesDto.aspectWidth) && + Objects.equals(this.aspectHeight, assetsFieldPropertiesDto.aspectHeight) && + Objects.equals(this.expectedType, assetsFieldPropertiesDto.expectedType) && + Objects.equals(this.resolveFirst, assetsFieldPropertiesDto.resolveFirst) && + Objects.equals(this.mustBeImage, assetsFieldPropertiesDto.mustBeImage) && + Objects.equals(this.resolveImage, assetsFieldPropertiesDto.resolveImage) && + Objects.equals(this.allowedExtensions, assetsFieldPropertiesDto.allowedExtensions) && + Objects.equals(this.allowDuplicates, assetsFieldPropertiesDto.allowDuplicates) && + super.equals(o); + } + + 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(previewMode, defaultValues, defaultValue, folderId, previewFormat, minItems, maxItems, minSize, maxSize, minWidth, maxWidth, minHeight, maxHeight, aspectWidth, aspectHeight, expectedType, resolveFirst, mustBeImage, resolveImage, allowedExtensions, allowDuplicates, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - private boolean equalTo(AssetsFieldPropertiesDto other) { - return previewMode.equals(other.previewMode) - && defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && folderId.equals(other.folderId) - && previewFormat.equals(other.previewFormat) - && minItems.equals(other.minItems) - && maxItems.equals(other.maxItems) - && minSize.equals(other.minSize) - && maxSize.equals(other.maxSize) - && minWidth.equals(other.minWidth) - && maxWidth.equals(other.maxWidth) - && minHeight.equals(other.minHeight) - && maxHeight.equals(other.maxHeight) - && aspectWidth.equals(other.aspectWidth) - && aspectHeight.equals(other.aspectHeight) - && expectedType.equals(other.expectedType) - && resolveFirst.equals(other.resolveFirst) - && mustBeImage.equals(other.mustBeImage) - && resolveImage.equals(other.resolveImage) - && allowedExtensions.equals(other.allowedExtensions) - && allowDuplicates.equals(other.allowDuplicates); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AssetsFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" previewMode: ").append(toIndentedString(previewMode)).append("\n"); + sb.append(" defaultValues: ").append(toIndentedString(defaultValues)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" folderId: ").append(toIndentedString(folderId)).append("\n"); + sb.append(" previewFormat: ").append(toIndentedString(previewFormat)).append("\n"); + sb.append(" minItems: ").append(toIndentedString(minItems)).append("\n"); + sb.append(" maxItems: ").append(toIndentedString(maxItems)).append("\n"); + sb.append(" minSize: ").append(toIndentedString(minSize)).append("\n"); + sb.append(" maxSize: ").append(toIndentedString(maxSize)).append("\n"); + sb.append(" minWidth: ").append(toIndentedString(minWidth)).append("\n"); + sb.append(" maxWidth: ").append(toIndentedString(maxWidth)).append("\n"); + sb.append(" minHeight: ").append(toIndentedString(minHeight)).append("\n"); + sb.append(" maxHeight: ").append(toIndentedString(maxHeight)).append("\n"); + sb.append(" aspectWidth: ").append(toIndentedString(aspectWidth)).append("\n"); + sb.append(" aspectHeight: ").append(toIndentedString(aspectHeight)).append("\n"); + sb.append(" expectedType: ").append(toIndentedString(expectedType)).append("\n"); + sb.append(" resolveFirst: ").append(toIndentedString(resolveFirst)).append("\n"); + sb.append(" mustBeImage: ").append(toIndentedString(mustBeImage)).append("\n"); + sb.append(" resolveImage: ").append(toIndentedString(resolveImage)).append("\n"); + sb.append(" allowedExtensions: ").append(toIndentedString(allowedExtensions)).append("\n"); + sb.append(" allowDuplicates: ").append(toIndentedString(allowDuplicates)).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("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("previewMode"); + openapiFields.add("defaultValues"); + openapiFields.add("defaultValue"); + openapiFields.add("folderId"); + openapiFields.add("previewFormat"); + openapiFields.add("minItems"); + openapiFields.add("maxItems"); + openapiFields.add("minSize"); + openapiFields.add("maxSize"); + openapiFields.add("minWidth"); + openapiFields.add("maxWidth"); + openapiFields.add("minHeight"); + openapiFields.add("maxHeight"); + openapiFields.add("aspectWidth"); + openapiFields.add("aspectHeight"); + openapiFields.add("expectedType"); + openapiFields.add("resolveFirst"); + openapiFields.add("mustBeImage"); + openapiFields.add("resolveImage"); + openapiFields.add("allowedExtensions"); + openapiFields.add("allowDuplicates"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AssetsFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AssetsFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AssetsFieldPropertiesDto is not found in the empty JSON string", AssetsFieldPropertiesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AssetsFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AssetsFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AssetsFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.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 int hashCode() { - return Objects.hash( - this.previewMode, - this.defaultValues, - this.defaultValue, - this.folderId, - this.previewFormat, - this.minItems, - this.maxItems, - this.minSize, - this.maxSize, - this.minWidth, - this.maxWidth, - this.minHeight, - this.maxHeight, - this.aspectWidth, - this.aspectHeight, - this.expectedType, - this.resolveFirst, - this.mustBeImage, - this.resolveImage, - this.allowedExtensions, - this.allowDuplicates); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional previewMode = Optional.empty(); - - private Optional>> defaultValues = Optional.empty(); - - private Optional> defaultValue = Optional.empty(); - - private Optional folderId = Optional.empty(); - - private Optional previewFormat = Optional.empty(); - - private Optional minItems = Optional.empty(); - - private Optional maxItems = Optional.empty(); - - private Optional minSize = Optional.empty(); - - private Optional maxSize = Optional.empty(); - - private Optional minWidth = Optional.empty(); - - private Optional maxWidth = Optional.empty(); - - private Optional minHeight = Optional.empty(); - - private Optional maxHeight = Optional.empty(); - - private Optional aspectWidth = Optional.empty(); - - private Optional aspectHeight = Optional.empty(); - - private Optional expectedType = Optional.empty(); - - private Optional resolveFirst = Optional.empty(); - - private Optional mustBeImage = Optional.empty(); - - private Optional resolveImage = Optional.empty(); - - private Optional> allowedExtensions = Optional.empty(); - - private Optional allowDuplicates = Optional.empty(); - - private Builder() {} - - public Builder from(AssetsFieldPropertiesDto other) { - previewMode(other.getPreviewMode()); - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - folderId(other.getFolderId()); - previewFormat(other.getPreviewFormat()); - minItems(other.getMinItems()); - maxItems(other.getMaxItems()); - minSize(other.getMinSize()); - maxSize(other.getMaxSize()); - minWidth(other.getMinWidth()); - maxWidth(other.getMaxWidth()); - minHeight(other.getMinHeight()); - maxHeight(other.getMaxHeight()); - aspectWidth(other.getAspectWidth()); - aspectHeight(other.getAspectHeight()); - expectedType(other.getExpectedType()); - resolveFirst(other.getResolveFirst()); - mustBeImage(other.getMustBeImage()); - resolveImage(other.getResolveImage()); - allowedExtensions(other.getAllowedExtensions()); - allowDuplicates(other.getAllowDuplicates()); - return this; - } - - @JsonSetter(value = "previewMode", nulls = Nulls.SKIP) - public Builder previewMode(Optional previewMode) { - this.previewMode = previewMode; - return this; - } - - public Builder previewMode(AssetPreviewMode previewMode) { - this.previewMode = Optional.of(previewMode); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional> defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(List defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "folderId", nulls = Nulls.SKIP) - public Builder folderId(Optional folderId) { - this.folderId = folderId; - return this; - } - - public Builder folderId(String folderId) { - this.folderId = Optional.of(folderId); - return this; - } - - @JsonSetter(value = "previewFormat", nulls = Nulls.SKIP) - public Builder previewFormat(Optional previewFormat) { - this.previewFormat = previewFormat; - return this; - } - - public Builder previewFormat(String previewFormat) { - this.previewFormat = Optional.of(previewFormat); - return this; - } - - @JsonSetter(value = "minItems", nulls = Nulls.SKIP) - public Builder minItems(Optional minItems) { - this.minItems = minItems; - return this; - } - - public Builder minItems(Integer minItems) { - this.minItems = Optional.of(minItems); - return this; - } - - @JsonSetter(value = "maxItems", nulls = Nulls.SKIP) - public Builder maxItems(Optional maxItems) { - this.maxItems = maxItems; - return this; - } - - public Builder maxItems(Integer maxItems) { - this.maxItems = Optional.of(maxItems); - return this; - } - - @JsonSetter(value = "minSize", nulls = Nulls.SKIP) - public Builder minSize(Optional minSize) { - this.minSize = minSize; - return this; - } - - public Builder minSize(Integer minSize) { - this.minSize = Optional.of(minSize); - return this; - } - - @JsonSetter(value = "maxSize", nulls = Nulls.SKIP) - public Builder maxSize(Optional maxSize) { - this.maxSize = maxSize; - return this; - } - - public Builder maxSize(Integer maxSize) { - this.maxSize = Optional.of(maxSize); - return this; - } - - @JsonSetter(value = "minWidth", nulls = Nulls.SKIP) - public Builder minWidth(Optional minWidth) { - this.minWidth = minWidth; - return this; - } - - public Builder minWidth(Integer minWidth) { - this.minWidth = Optional.of(minWidth); - return this; - } - - @JsonSetter(value = "maxWidth", nulls = Nulls.SKIP) - public Builder maxWidth(Optional maxWidth) { - this.maxWidth = maxWidth; - return this; - } - - public Builder maxWidth(Integer maxWidth) { - this.maxWidth = Optional.of(maxWidth); - return this; - } - - @JsonSetter(value = "minHeight", nulls = Nulls.SKIP) - public Builder minHeight(Optional minHeight) { - this.minHeight = minHeight; - return this; - } - - public Builder minHeight(Integer minHeight) { - this.minHeight = Optional.of(minHeight); - return this; - } - - @JsonSetter(value = "maxHeight", nulls = Nulls.SKIP) - public Builder maxHeight(Optional maxHeight) { - this.maxHeight = maxHeight; - return this; - } - - public Builder maxHeight(Integer maxHeight) { - this.maxHeight = Optional.of(maxHeight); - return this; - } - - @JsonSetter(value = "aspectWidth", nulls = Nulls.SKIP) - public Builder aspectWidth(Optional aspectWidth) { - this.aspectWidth = aspectWidth; - return this; - } - - public Builder aspectWidth(Integer aspectWidth) { - this.aspectWidth = Optional.of(aspectWidth); - return this; - } - - @JsonSetter(value = "aspectHeight", nulls = Nulls.SKIP) - public Builder aspectHeight(Optional aspectHeight) { - this.aspectHeight = aspectHeight; - return this; - } - - public Builder aspectHeight(Integer aspectHeight) { - this.aspectHeight = Optional.of(aspectHeight); - return this; - } - - @JsonSetter(value = "expectedType", nulls = Nulls.SKIP) - public Builder expectedType(Optional expectedType) { - this.expectedType = expectedType; - return this; - } - - public Builder expectedType(AssetType expectedType) { - this.expectedType = Optional.of(expectedType); - return this; - } - - @JsonSetter(value = "resolveFirst", nulls = Nulls.SKIP) - public Builder resolveFirst(Optional resolveFirst) { - this.resolveFirst = resolveFirst; - return this; - } - - public Builder resolveFirst(Boolean resolveFirst) { - this.resolveFirst = Optional.of(resolveFirst); - return this; - } - - @JsonSetter(value = "mustBeImage", nulls = Nulls.SKIP) - public Builder mustBeImage(Optional mustBeImage) { - this.mustBeImage = mustBeImage; - return this; - } - - public Builder mustBeImage(Boolean mustBeImage) { - this.mustBeImage = Optional.of(mustBeImage); - return this; - } - - @JsonSetter(value = "resolveImage", nulls = Nulls.SKIP) - public Builder resolveImage(Optional resolveImage) { - this.resolveImage = resolveImage; - return this; - } - - public Builder resolveImage(Boolean resolveImage) { - this.resolveImage = Optional.of(resolveImage); - return this; - } - - @JsonSetter(value = "allowedExtensions", nulls = Nulls.SKIP) - public Builder allowedExtensions(Optional> allowedExtensions) { - this.allowedExtensions = allowedExtensions; - return this; - } - - public Builder allowedExtensions(List allowedExtensions) { - this.allowedExtensions = Optional.of(allowedExtensions); - return this; - } - - @JsonSetter(value = "allowDuplicates", nulls = Nulls.SKIP) - public Builder allowDuplicates(Optional allowDuplicates) { - this.allowDuplicates = allowDuplicates; - return this; - } - - public Builder allowDuplicates(Boolean allowDuplicates) { - this.allowDuplicates = Optional.of(allowDuplicates); - return this; - } - - public AssetsFieldPropertiesDto build() { - return new AssetsFieldPropertiesDto( - previewMode, - defaultValues, - defaultValue, - folderId, - previewFormat, - minItems, - maxItems, - minSize, - maxSize, - minWidth, - maxWidth, - minHeight, - maxHeight, - aspectWidth, - aspectHeight, - expectedType, - resolveFirst, - mustBeImage, - resolveImage, - allowedExtensions, - allowDuplicates); - } + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AssetsFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AssetsFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AssetsFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AssetsFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AssetsFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AssetsFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AssetsFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to AssetsFieldPropertiesDto + */ + public static AssetsFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AssetsFieldPropertiesDto.class); + } + + /** + * Convert an instance of AssetsFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AssignContributorDto.java b/src/main/java/com/squidex/api/types/AssignContributorDto.java index d7dead9..f278c79 100644 --- a/src/main/java/com/squidex/api/types/AssignContributorDto.java +++ b/src/main/java/com/squidex/api/types/AssignContributorDto.java @@ -1,165 +1,270 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AssignContributorDto.Builder.class) -public final class AssignContributorDto { - private final String contributorId; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final Optional role; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final Optional invite; +import com.squidex.api.core.JSON; - private AssignContributorDto(String contributorId, Optional role, Optional invite) { - this.contributorId = contributorId; - this.role = role; - this.invite = invite; - } +/** + * AssignContributorDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AssignContributorDto { + public static final String SERIALIZED_NAME_CONTRIBUTOR_ID = "contributorId"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTOR_ID) + private String contributorId; + public static final String SERIALIZED_NAME_ROLE = "role"; + @SerializedName(SERIALIZED_NAME_ROLE) + private String role; + public static final String SERIALIZED_NAME_INVITE = "invite"; + @SerializedName(SERIALIZED_NAME_INVITE) + private Boolean invite; + public AssignContributorDto() { + } + public AssignContributorDto contributorId(String contributorId) { + this.contributorId = contributorId; + return this; + } - /** - * @return The id or email of the user to add to the app. - */ - @JsonProperty("contributorId") - public String getContributorId() { - return contributorId; - } + /** + * The id or email of the user to add to the app. + * @return contributorId + */ + @javax.annotation.Nonnull + public String getContributorId() { + return contributorId; + } - /** - * @return The role of the contributor. - */ - @JsonProperty("role") - public Optional getRole() { - return role; - } + public void setContributorId(String contributorId) { + this.contributorId = contributorId; + } + public AssignContributorDto role(String role) { + this.role = role; + return this; + } - /** - * @return Set to true to invite the user if he does not exist. - */ - @JsonProperty("invite") - public Optional getInvite() { - return invite; - } + /** + * The role of the contributor. + * @return role + */ + @javax.annotation.Nullable + public String getRole() { + return role; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssignContributorDto && equalTo((AssignContributorDto) other); - } + public void setRole(String role) { + this.role = role; + } + public AssignContributorDto invite(Boolean invite) { + this.invite = invite; + return this; + } - private boolean equalTo(AssignContributorDto other) { - return contributorId.equals(other.contributorId) && role.equals(other.role) && invite.equals(other.invite); - } + /** + * Set to true to invite the user if he does not exist. + * @return invite + */ + @javax.annotation.Nullable + public Boolean getInvite() { + return invite; + } - @Override - public int hashCode() { - return Objects.hash(this.contributorId, this.role, this.invite); - } + public void setInvite(Boolean invite) { + this.invite = invite; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static ContributorIdStage builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ContributorIdStage { - _FinalStage contributorId(String contributorId); - - Builder from(AssignContributorDto other); + if (o == null || getClass() != o.getClass()) { + return false; } + AssignContributorDto assignContributorDto = (AssignContributorDto) o; + return Objects.equals(this.contributorId, assignContributorDto.contributorId) && + Objects.equals(this.role, assignContributorDto.role) && + Objects.equals(this.invite, assignContributorDto.invite); + } - public interface _FinalStage { - AssignContributorDto build(); + 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())); + } - _FinalStage role(Optional role); + @Override + public int hashCode() { + return Objects.hash(contributorId, role, invite); + } - _FinalStage role(String role); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - _FinalStage invite(Optional invite); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AssignContributorDto {\n"); + sb.append(" contributorId: ").append(toIndentedString(contributorId)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" invite: ").append(toIndentedString(invite)).append("\n"); + sb.append("}"); + return sb.toString(); + } - _FinalStage invite(Boolean invite); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ContributorIdStage, _FinalStage { - private String contributorId; - private Optional invite = Optional.empty(); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Optional role = Optional.empty(); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("contributorId"); + openapiFields.add("role"); + openapiFields.add("invite"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("contributorId"); + } - @Override - public Builder from(AssignContributorDto other) { - contributorId(other.getContributorId()); - role(other.getRole()); - invite(other.getInvite()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AssignContributorDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AssignContributorDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AssignContributorDto is not found in the empty JSON string", AssignContributorDto.openapiRequiredFields.toString())); } + } - /** - *

The id or email of the user to add to the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("contributorId") - public _FinalStage contributorId(String contributorId) { - this.contributorId = contributorId; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AssignContributorDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AssignContributorDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

Set to true to invite the user if he does not exist.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage invite(Boolean invite) { - this.invite = Optional.of(invite); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AssignContributorDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("contributorId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contributorId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contributorId").toString())); + } + if ((jsonObj.get("role") != null && !jsonObj.get("role").isJsonNull()) && !jsonObj.get("role").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `role` to be a primitive type in the JSON string but got `%s`", jsonObj.get("role").toString())); + } + } - @Override - @JsonSetter(value = "invite", nulls = Nulls.SKIP) - public _FinalStage invite(Optional invite) { - this.invite = invite; - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AssignContributorDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AssignContributorDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AssignContributorDto.class)); - /** - *

The role of the contributor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage role(String role) { - this.role = Optional.of(role); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AssignContributorDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - @JsonSetter(value = "role", nulls = Nulls.SKIP) - public _FinalStage role(Optional role) { - this.role = role; - return this; - } + @Override + public AssignContributorDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } - @Override - public AssignContributorDto build() { - return new AssignContributorDto(contributorId, role, invite); - } + }.nullSafe(); } + } + + /** + * Create an instance of AssignContributorDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AssignContributorDto + * @throws IOException if the JSON string is invalid with respect to AssignContributorDto + */ + public static AssignContributorDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AssignContributorDto.class); + } + + /** + * Convert an instance of AssignContributorDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/AuthSchemeDto.java b/src/main/java/com/squidex/api/types/AuthSchemeDto.java new file mode 100644 index 0000000..fdf378f --- /dev/null +++ b/src/main/java/com/squidex/api/types/AuthSchemeDto.java @@ -0,0 +1,355 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * AuthSchemeDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AuthSchemeDto { + public static final String SERIALIZED_NAME_DOMAIN = "domain"; + @SerializedName(SERIALIZED_NAME_DOMAIN) + private String domain; + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + private String displayName; + public static final String SERIALIZED_NAME_CLIENT_ID = "clientId"; + @SerializedName(SERIALIZED_NAME_CLIENT_ID) + private String clientId; + public static final String SERIALIZED_NAME_CLIENT_SECRET = "clientSecret"; + @SerializedName(SERIALIZED_NAME_CLIENT_SECRET) + private String clientSecret; + public static final String SERIALIZED_NAME_AUTHORITY = "authority"; + @SerializedName(SERIALIZED_NAME_AUTHORITY) + private String authority; + public static final String SERIALIZED_NAME_SIGNOUT_REDIRECT_URL = "signoutRedirectUrl"; + @SerializedName(SERIALIZED_NAME_SIGNOUT_REDIRECT_URL) + private String signoutRedirectUrl; + public AuthSchemeDto() { + } + public AuthSchemeDto domain(String domain) { + this.domain = domain; + return this; + } + + /** + * The domain name of your user accounts. + * @return domain + */ + @javax.annotation.Nonnull + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + public AuthSchemeDto displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The display name for buttons. + * @return displayName + */ + @javax.annotation.Nonnull + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + public AuthSchemeDto clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * The client ID. + * @return clientId + */ + @javax.annotation.Nonnull + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + public AuthSchemeDto clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * The client secret. + * @return clientSecret + */ + @javax.annotation.Nonnull + public String getClientSecret() { + return clientSecret; + } + + public void setClientSecret(String clientSecret) { + this.clientSecret = clientSecret; + } + public AuthSchemeDto authority(String authority) { + this.authority = authority; + return this; + } + + /** + * The authority URL. + * @return authority + */ + @javax.annotation.Nonnull + public String getAuthority() { + return authority; + } + + public void setAuthority(String authority) { + this.authority = authority; + } + public AuthSchemeDto signoutRedirectUrl(String signoutRedirectUrl) { + this.signoutRedirectUrl = signoutRedirectUrl; + return this; + } + + /** + * The URL to redirect after a signout. + * @return signoutRedirectUrl + */ + @javax.annotation.Nullable + public String getSignoutRedirectUrl() { + return signoutRedirectUrl; + } + + public void setSignoutRedirectUrl(String signoutRedirectUrl) { + this.signoutRedirectUrl = signoutRedirectUrl; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthSchemeDto authSchemeDto = (AuthSchemeDto) o; + return Objects.equals(this.domain, authSchemeDto.domain) && + Objects.equals(this.displayName, authSchemeDto.displayName) && + Objects.equals(this.clientId, authSchemeDto.clientId) && + Objects.equals(this.clientSecret, authSchemeDto.clientSecret) && + Objects.equals(this.authority, authSchemeDto.authority) && + Objects.equals(this.signoutRedirectUrl, authSchemeDto.signoutRedirectUrl); + } + + 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(domain, displayName, clientId, clientSecret, authority, signoutRedirectUrl); + } + + 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 AuthSchemeDto {\n"); + sb.append(" domain: ").append(toIndentedString(domain)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n"); + sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n"); + sb.append(" authority: ").append(toIndentedString(authority)).append("\n"); + sb.append(" signoutRedirectUrl: ").append(toIndentedString(signoutRedirectUrl)).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("domain"); + openapiFields.add("displayName"); + openapiFields.add("clientId"); + openapiFields.add("clientSecret"); + openapiFields.add("authority"); + openapiFields.add("signoutRedirectUrl"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("domain"); + openapiRequiredFields.add("displayName"); + openapiRequiredFields.add("clientId"); + openapiRequiredFields.add("clientSecret"); + openapiRequiredFields.add("authority"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AuthSchemeDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthSchemeDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthSchemeDto is not found in the empty JSON string", AuthSchemeDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthSchemeDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthSchemeDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthSchemeDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("domain").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `domain` to be a primitive type in the JSON string but got `%s`", jsonObj.get("domain").toString())); + } + if (!jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").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("clientSecret").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `clientSecret` to be a primitive type in the JSON string but got `%s`", jsonObj.get("clientSecret").toString())); + } + if (!jsonObj.get("authority").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `authority` to be a primitive type in the JSON string but got `%s`", jsonObj.get("authority").toString())); + } + if ((jsonObj.get("signoutRedirectUrl") != null && !jsonObj.get("signoutRedirectUrl").isJsonNull()) && !jsonObj.get("signoutRedirectUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `signoutRedirectUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("signoutRedirectUrl").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthSchemeDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthSchemeDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthSchemeDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthSchemeDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthSchemeDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthSchemeDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthSchemeDto + * @throws IOException if the JSON string is invalid with respect to AuthSchemeDto + */ + public static AuthSchemeDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthSchemeDto.class); + } + + /** + * Convert an instance of AuthSchemeDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/AuthSchemeResponseDto.java b/src/main/java/com/squidex/api/types/AuthSchemeResponseDto.java new file mode 100644 index 0000000..2a7c1e9 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AuthSchemeResponseDto.java @@ -0,0 +1,245 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.AuthSchemeDto; +import com.squidex.api.types.ResourceLink; +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.squidex.api.core.JSON; + +/** + * AuthSchemeResponseDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AuthSchemeResponseDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + @SerializedName(SERIALIZED_NAME_SCHEME) + private AuthSchemeDto scheme; + public AuthSchemeResponseDto() { + } + public AuthSchemeResponseDto links(Map links) { + this.links = links; + return this; + } + + public AuthSchemeResponseDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public AuthSchemeResponseDto scheme(AuthSchemeDto scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * @return scheme + */ + @javax.annotation.Nullable + public AuthSchemeDto getScheme() { + return scheme; + } + + public void setScheme(AuthSchemeDto scheme) { + this.scheme = scheme; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthSchemeResponseDto authSchemeResponseDto = (AuthSchemeResponseDto) o; + return Objects.equals(this.links, authSchemeResponseDto.links) && + Objects.equals(this.scheme, authSchemeResponseDto.scheme); + } + + @Override + public int hashCode() { + return Objects.hash(links, scheme); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthSchemeResponseDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).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("_links"); + openapiFields.add("scheme"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + 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 AuthSchemeResponseDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthSchemeResponseDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthSchemeResponseDto is not found in the empty JSON string", AuthSchemeResponseDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthSchemeResponseDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthSchemeResponseDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AuthSchemeResponseDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `scheme` + if (jsonObj.get("scheme") != null && !jsonObj.get("scheme").isJsonNull()) { + AuthSchemeDto.validateJsonElement(jsonObj.get("scheme")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthSchemeResponseDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthSchemeResponseDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthSchemeResponseDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthSchemeResponseDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthSchemeResponseDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthSchemeResponseDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthSchemeResponseDto + * @throws IOException if the JSON string is invalid with respect to AuthSchemeResponseDto + */ + public static AuthSchemeResponseDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthSchemeResponseDto.class); + } + + /** + * Convert an instance of AuthSchemeResponseDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/AuthSchemeValueDto.java b/src/main/java/com/squidex/api/types/AuthSchemeValueDto.java new file mode 100644 index 0000000..f6a544b --- /dev/null +++ b/src/main/java/com/squidex/api/types/AuthSchemeValueDto.java @@ -0,0 +1,203 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.AuthSchemeDto; +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.squidex.api.core.JSON; + +/** + * AuthSchemeValueDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AuthSchemeValueDto { + public static final String SERIALIZED_NAME_SCHEME = "scheme"; + @SerializedName(SERIALIZED_NAME_SCHEME) + private AuthSchemeDto scheme; + public AuthSchemeValueDto() { + } + public AuthSchemeValueDto scheme(AuthSchemeDto scheme) { + this.scheme = scheme; + return this; + } + + /** + * Get scheme + * @return scheme + */ + @javax.annotation.Nullable + public AuthSchemeDto getScheme() { + return scheme; + } + + public void setScheme(AuthSchemeDto scheme) { + this.scheme = scheme; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AuthSchemeValueDto authSchemeValueDto = (AuthSchemeValueDto) o; + return Objects.equals(this.scheme, authSchemeValueDto.scheme); + } + + @Override + public int hashCode() { + return Objects.hash(scheme); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AuthSchemeValueDto {\n"); + sb.append(" scheme: ").append(toIndentedString(scheme)).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("scheme"); + + // 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 AuthSchemeValueDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AuthSchemeValueDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AuthSchemeValueDto is not found in the empty JSON string", AuthSchemeValueDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AuthSchemeValueDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AuthSchemeValueDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `scheme` + if (jsonObj.get("scheme") != null && !jsonObj.get("scheme").isJsonNull()) { + AuthSchemeDto.validateJsonElement(jsonObj.get("scheme")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AuthSchemeValueDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AuthSchemeValueDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AuthSchemeValueDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AuthSchemeValueDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public AuthSchemeValueDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of AuthSchemeValueDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AuthSchemeValueDto + * @throws IOException if the JSON string is invalid with respect to AuthSchemeValueDto + */ + public static AuthSchemeValueDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AuthSchemeValueDto.class); + } + + /** + * Convert an instance of AuthSchemeValueDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java b/src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java index 374a72a..ba3e79e 100644 --- a/src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java @@ -1,161 +1,269 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.RuleActionDto; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = AzureQueueRuleActionDto.Builder.class) -public final class AzureQueueRuleActionDto { - private final String connectionString; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final String queue; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final Optional payload; +import com.squidex.api.core.JSON; - private AzureQueueRuleActionDto(String connectionString, String queue, Optional payload) { - this.connectionString = connectionString; - this.queue = queue; - this.payload = payload; - } +/** + * AzureQueueRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class AzureQueueRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_CONNECTION_STRING = "connectionString"; + @SerializedName(SERIALIZED_NAME_CONNECTION_STRING) + private String connectionString; + public static final String SERIALIZED_NAME_QUEUE = "queue"; + @SerializedName(SERIALIZED_NAME_QUEUE) + private String queue; + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + @SerializedName(SERIALIZED_NAME_PAYLOAD) + private String payload; + public AzureQueueRuleActionDto() { + } + public AzureQueueRuleActionDto connectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } - /** - * @return The connection string to the storage account. - */ - @JsonProperty("connectionString") - public String getConnectionString() { - return connectionString; - } + /** + * The connection string to the storage account. + * @return connectionString + */ + @javax.annotation.Nonnull + public String getConnectionString() { + return connectionString; + } - /** - * @return The name of the queue. - */ - @JsonProperty("queue") - public String getQueue() { - return queue; - } + public void setConnectionString(String connectionString) { + this.connectionString = connectionString; + } + public AzureQueueRuleActionDto queue(String queue) { + this.queue = queue; + return this; + } - /** - * @return Leave it empty to use the full event as body. - */ - @JsonProperty("payload") - public Optional getPayload() { - return payload; - } + /** + * The name of the queue. + * @return queue + */ + @javax.annotation.Nonnull + public String getQueue() { + return queue; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AzureQueueRuleActionDto && equalTo((AzureQueueRuleActionDto) other); - } + public void setQueue(String queue) { + this.queue = queue; + } + public AzureQueueRuleActionDto payload(String payload) { + this.payload = payload; + return this; + } - private boolean equalTo(AzureQueueRuleActionDto other) { - return connectionString.equals(other.connectionString) - && queue.equals(other.queue) - && payload.equals(other.payload); - } + /** + * Leave it empty to use the full event as body. + * @return payload + */ + @javax.annotation.Nullable + public String getPayload() { + return payload; + } - @Override - public int hashCode() { - return Objects.hash(this.connectionString, this.queue, this.payload); - } + public void setPayload(String payload) { + this.payload = payload; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static ConnectionStringStage builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + AzureQueueRuleActionDto azureQueueRuleActionDto = (AzureQueueRuleActionDto) o; + return Objects.equals(this.connectionString, azureQueueRuleActionDto.connectionString) && + Objects.equals(this.queue, azureQueueRuleActionDto.queue) && + Objects.equals(this.payload, azureQueueRuleActionDto.payload) && + super.equals(o); + } - public interface ConnectionStringStage { - QueueStage connectionString(String connectionString); + 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())); + } - Builder from(AzureQueueRuleActionDto other); - } + @Override + public int hashCode() { + return Objects.hash(connectionString, queue, payload, super.hashCode()); + } - public interface QueueStage { - _FinalStage queue(String queue); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - public interface _FinalStage { - AzureQueueRuleActionDto build(); - - _FinalStage payload(Optional payload); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AzureQueueRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" connectionString: ").append(toIndentedString(connectionString)).append("\n"); + sb.append(" queue: ").append(toIndentedString(queue)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append("}"); + return sb.toString(); + } - _FinalStage payload(String payload); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ConnectionStringStage, QueueStage, _FinalStage { - private String connectionString; - private String queue; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Optional payload = Optional.empty(); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("connectionString"); + openapiFields.add("queue"); + openapiFields.add("payload"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("connectionString"); + openapiRequiredFields.add("queue"); + openapiRequiredFields.add("actionType"); + } - @Override - public Builder from(AzureQueueRuleActionDto other) { - connectionString(other.getConnectionString()); - queue(other.getQueue()); - payload(other.getPayload()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to AzureQueueRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!AzureQueueRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in AzureQueueRuleActionDto is not found in the empty JSON string", AzureQueueRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The connection string to the storage account.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("connectionString") - public QueueStage connectionString(String connectionString) { - this.connectionString = connectionString; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!AzureQueueRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `AzureQueueRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The name of the queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("queue") - public _FinalStage queue(String queue) { - this.queue = queue; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : AzureQueueRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - /** - *

Leave it empty to use the full event as body.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage payload(String payload) { - this.payload = Optional.of(payload); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!AzureQueueRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'AzureQueueRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(AzureQueueRuleActionDto.class)); - @Override - @JsonSetter(value = "payload", nulls = Nulls.SKIP) - public _FinalStage payload(Optional payload) { - this.payload = payload; - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, AzureQueueRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public AzureQueueRuleActionDto build() { - return new AzureQueueRuleActionDto(connectionString, queue, payload); - } + @Override + public AzureQueueRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of AzureQueueRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of AzureQueueRuleActionDto + * @throws IOException if the JSON string is invalid with respect to AzureQueueRuleActionDto + */ + public static AzureQueueRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, AzureQueueRuleActionDto.class); + } + + /** + * Convert an instance of AzureQueueRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/BackupJobDto.java b/src/main/java/com/squidex/api/types/BackupJobDto.java index d9fefd2..d5401f2 100644 --- a/src/main/java/com/squidex/api/types/BackupJobDto.java +++ b/src/main/java/com/squidex/api/types/BackupJobDto.java @@ -1,313 +1,379 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.JobStatus; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; import java.time.OffsetDateTime; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BackupJobDto.Builder.class) -public final class BackupJobDto implements IResource { - private final Map links; - - private final String id; - - private final OffsetDateTime started; - - private final Optional stopped; - - private final int handledEvents; - - private final int handledAssets; - - private final JobStatus status; - - private BackupJobDto( - Map links, - String id, - OffsetDateTime started, - Optional stopped, - int handledEvents, - int handledAssets, - JobStatus status) { - this.links = links; - this.id = id; - this.started = started; - this.stopped = stopped; - this.handledEvents = handledEvents; - this.handledAssets = handledAssets; - this.status = status; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the backup job. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The time when the job has been started. - */ - @JsonProperty("started") - public OffsetDateTime getStarted() { - return started; - } - - /** - * @return The time when the job has been stopped. - */ - @JsonProperty("stopped") - public Optional getStopped() { - return stopped; - } - - /** - * @return The number of handled events. - */ - @JsonProperty("handledEvents") - public int getHandledEvents() { - return handledEvents; - } - - /** - * @return The number of handled assets. - */ - @JsonProperty("handledAssets") - public int getHandledAssets() { - return handledAssets; - } - - /** - * @return The status of the operation. - */ - @JsonProperty("status") - public JobStatus getStatus() { - return status; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BackupJobDto && equalTo((BackupJobDto) other); - } - - private boolean equalTo(BackupJobDto other) { - return links.equals(other.links) - && id.equals(other.id) - && started.equals(other.started) - && stopped.equals(other.stopped) - && handledEvents == other.handledEvents - && handledAssets == other.handledAssets - && status.equals(other.status); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, this.id, this.started, this.stopped, this.handledEvents, this.handledAssets, this.status); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } +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; - public interface IdStage { - StartedStage id(String id); +import com.squidex.api.core.JSON; - Builder from(BackupJobDto other); +/** + * BackupJobDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class BackupJobDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_STARTED = "started"; + @SerializedName(SERIALIZED_NAME_STARTED) + private OffsetDateTime started; + public static final String SERIALIZED_NAME_STOPPED = "stopped"; + @SerializedName(SERIALIZED_NAME_STOPPED) + private OffsetDateTime stopped; + public static final String SERIALIZED_NAME_HANDLED_EVENTS = "handledEvents"; + @SerializedName(SERIALIZED_NAME_HANDLED_EVENTS) + private Integer handledEvents; + public static final String SERIALIZED_NAME_HANDLED_ASSETS = "handledAssets"; + @SerializedName(SERIALIZED_NAME_HANDLED_ASSETS) + private Integer handledAssets; + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private JobStatus status; + public BackupJobDto() { + } + public BackupJobDto links(Map links) { + this.links = links; + return this; + } + + public BackupJobDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface StartedStage { - HandledEventsStage started(OffsetDateTime started); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public BackupJobDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the backup job. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public BackupJobDto started(OffsetDateTime started) { + this.started = started; + return this; + } + + /** + * The time when the job has been started. + * @return started + */ + @javax.annotation.Nonnull + public OffsetDateTime getStarted() { + return started; + } + + public void setStarted(OffsetDateTime started) { + this.started = started; + } + public BackupJobDto stopped(OffsetDateTime stopped) { + this.stopped = stopped; + return this; + } + + /** + * The time when the job has been stopped. + * @return stopped + */ + @javax.annotation.Nullable + public OffsetDateTime getStopped() { + return stopped; + } + + public void setStopped(OffsetDateTime stopped) { + this.stopped = stopped; + } + public BackupJobDto handledEvents(Integer handledEvents) { + this.handledEvents = handledEvents; + return this; + } + + /** + * The number of handled events. + * @return handledEvents + */ + @javax.annotation.Nonnull + public Integer getHandledEvents() { + return handledEvents; + } + + public void setHandledEvents(Integer handledEvents) { + this.handledEvents = handledEvents; + } + public BackupJobDto handledAssets(Integer handledAssets) { + this.handledAssets = handledAssets; + return this; + } + + /** + * The number of handled assets. + * @return handledAssets + */ + @javax.annotation.Nonnull + public Integer getHandledAssets() { + return handledAssets; + } + + public void setHandledAssets(Integer handledAssets) { + this.handledAssets = handledAssets; + } + public BackupJobDto status(JobStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public JobStatus getStatus() { + return status; + } + + public void setStatus(JobStatus status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface HandledEventsStage { - HandledAssetsStage handledEvents(int handledEvents); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface HandledAssetsStage { - StatusStage handledAssets(int handledAssets); + BackupJobDto backupJobDto = (BackupJobDto) o; + return Objects.equals(this.links, backupJobDto.links) && + Objects.equals(this.id, backupJobDto.id) && + Objects.equals(this.started, backupJobDto.started) && + Objects.equals(this.stopped, backupJobDto.stopped) && + Objects.equals(this.handledEvents, backupJobDto.handledEvents) && + Objects.equals(this.handledAssets, backupJobDto.handledAssets) && + Objects.equals(this.status, backupJobDto.status); + } + + 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(links, id, started, stopped, handledEvents, handledAssets, status); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface StatusStage { - _FinalStage status(JobStatus status); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BackupJobDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" started: ").append(toIndentedString(started)).append("\n"); + sb.append(" stopped: ").append(toIndentedString(stopped)).append("\n"); + sb.append(" handledEvents: ").append(toIndentedString(handledEvents)).append("\n"); + sb.append(" handledAssets: ").append(toIndentedString(handledAssets)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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"; } - - public interface _FinalStage { - BackupJobDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage stopped(Optional stopped); - - _FinalStage stopped(OffsetDateTime stopped); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, StartedStage, HandledEventsStage, HandledAssetsStage, StatusStage, _FinalStage { - private String id; - - private OffsetDateTime started; - - private int handledEvents; - - private int handledAssets; - - private JobStatus status; - - private Optional stopped = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(BackupJobDto other) { - links(other.getLinks()); - id(other.getId()); - started(other.getStarted()); - stopped(other.getStopped()); - handledEvents(other.getHandledEvents()); - handledAssets(other.getHandledAssets()); - status(other.getStatus()); - return this; - } - - /** - *

The ID of the backup job.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public StartedStage id(String id) { - this.id = id; - return this; - } - - /** - *

The time when the job has been started.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("started") - public HandledEventsStage started(OffsetDateTime started) { - this.started = started; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("id"); + openapiFields.add("started"); + openapiFields.add("stopped"); + openapiFields.add("handledEvents"); + openapiFields.add("handledAssets"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("started"); + openapiRequiredFields.add("handledEvents"); + openapiRequiredFields.add("handledAssets"); + 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 BackupJobDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BackupJobDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BackupJobDto is not found in the empty JSON string", BackupJobDto.openapiRequiredFields.toString())); } + } - /** - *

The number of handled events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("handledEvents") - public HandledAssetsStage handledEvents(int handledEvents) { - this.handledEvents = handledEvents; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BackupJobDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BackupJobDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The number of handled assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("handledAssets") - public StatusStage handledAssets(int handledAssets) { - this.handledAssets = handledAssets; - return this; - } - - /** - *

The status of the operation.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public _FinalStage status(JobStatus status) { - this.status = status; - return this; - } - - /** - *

The time when the job has been stopped.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage stopped(OffsetDateTime stopped) { - this.stopped = Optional.of(stopped); - return this; - } - - @Override - @JsonSetter(value = "stopped", nulls = Nulls.SKIP) - public _FinalStage stopped(Optional stopped) { - this.stopped = stopped; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public BackupJobDto build() { - return new BackupJobDto(links, id, started, stopped, handledEvents, handledAssets, status); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BackupJobDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + // validate the required field `status` + JobStatus.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BackupJobDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BackupJobDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BackupJobDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BackupJobDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BackupJobDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of BackupJobDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of BackupJobDto + * @throws IOException if the JSON string is invalid with respect to BackupJobDto + */ + public static BackupJobDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BackupJobDto.class); + } + + /** + * Convert an instance of BackupJobDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/BackupJobsDto.java b/src/main/java/com/squidex/api/types/BackupJobsDto.java index 92268a1..7dde932 100644 --- a/src/main/java/com/squidex/api/types/BackupJobsDto.java +++ b/src/main/java/com/squidex/api/types/BackupJobsDto.java @@ -1,124 +1,262 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.BackupJobDto; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BackupJobsDto.Builder.class) -public final class BackupJobsDto implements IResource { - private final Map links; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final List items; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private BackupJobsDto(Map links, List items) { - this.links = links; - this.items = items; - } +import com.squidex.api.core.JSON; - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } +/** + * BackupJobsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class BackupJobsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public BackupJobsDto() { + } + public BackupJobsDto links(Map links) { + this.links = links; + return this; + } - /** - * @return The backups. - */ - @JsonProperty("items") - public List getItems() { - return items; + public BackupJobsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } + this.links.put(key, linksItem); + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BackupJobsDto && equalTo((BackupJobsDto) other); - } + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } - private boolean equalTo(BackupJobsDto other) { - return links.equals(other.links) && items.equals(other.items); - } + public void setLinks(Map links) { + this.links = links; + } + public BackupJobsDto items(List items) { + this.items = items; + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); + public BackupJobsDto addItemsItem(BackupJobDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } + this.items.add(itemsItem); + return this; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + /** + * The backups. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + BackupJobsDto backupJobsDto = (BackupJobsDto) o; + return Objects.equals(this.links, backupJobsDto.links) && + Objects.equals(this.items, backupJobsDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, items); + } - public static Builder builder() { - return new Builder(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BackupJobsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - private List items = new ArrayList<>(); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Builder() {} + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("items"); - public Builder from(BackupJobsDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + } - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BackupJobsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BackupJobsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BackupJobsDto is not found in the empty JSON string", BackupJobsDto.openapiRequiredFields.toString())); } + } - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BackupJobsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BackupJobsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BackupJobsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + BackupJobDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } - public Builder addItems(BackupJobDto items) { - this.items.add(items); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BackupJobsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BackupJobsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BackupJobsDto.class)); - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BackupJobsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public BackupJobsDto build() { - return new BackupJobsDto(links, items); - } + @Override + public BackupJobsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of BackupJobsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of BackupJobsDto + * @throws IOException if the JSON string is invalid with respect to BackupJobsDto + */ + public static BackupJobsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BackupJobsDto.class); + } + + /** + * Convert an instance of BackupJobsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/BooleanFieldEditor.java b/src/main/java/com/squidex/api/types/BooleanFieldEditor.java index cf2ef74..f610316 100644 --- a/src/main/java/com/squidex/api/types/BooleanFieldEditor.java +++ b/src/main/java/com/squidex/api/types/BooleanFieldEditor.java @@ -1,24 +1,78 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; +/** + * + */ +@JsonAdapter(BooleanFieldEditor.Adapter.class) public enum BooleanFieldEditor { - CHECKBOX("Checkbox"), + + CHECKBOX("Checkbox"), + + TOGGLE("Toggle"); + + private String value; - TOGGLE("Toggle"); + BooleanFieldEditor(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - BooleanFieldEditor(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static BooleanFieldEditor fromValue(String value) { + for (BooleanFieldEditor b : BooleanFieldEditor.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 BooleanFieldEditor enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public BooleanFieldEditor read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return BooleanFieldEditor.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + BooleanFieldEditor.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java index 0bf564a..b196b32 100644 --- a/src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java @@ -1,166 +1,311 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Map; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.BooleanFieldEditor; +import com.squidex.api.types.FieldPropertiesDto; +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 org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BooleanFieldPropertiesDto.Builder.class) -public final class BooleanFieldPropertiesDto { - private final Optional>> defaultValues; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final Optional defaultValue; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final Optional inlineEditable; +import com.squidex.api.core.JSON; - private final Optional editor; +/** + * BooleanFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class BooleanFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_DEFAULT_VALUES = "defaultValues"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUES) + private Map defaultValues = new HashMap<>(); + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private Boolean defaultValue; + public static final String SERIALIZED_NAME_INLINE_EDITABLE = "inlineEditable"; + @SerializedName(SERIALIZED_NAME_INLINE_EDITABLE) + private Boolean inlineEditable; + public static final String SERIALIZED_NAME_EDITOR = "editor"; + @SerializedName(SERIALIZED_NAME_EDITOR) + private BooleanFieldEditor editor; + public BooleanFieldPropertiesDto() { + } + public BooleanFieldPropertiesDto defaultValues(Map defaultValues) { + this.defaultValues = defaultValues; + return this; + } - private BooleanFieldPropertiesDto( - Optional>> defaultValues, - Optional defaultValue, - Optional inlineEditable, - Optional editor) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.inlineEditable = inlineEditable; - this.editor = editor; + public BooleanFieldPropertiesDto putDefaultValuesItem(String key, Boolean defaultValuesItem) { + if (this.defaultValues == null) { + this.defaultValues = new HashMap<>(); } + this.defaultValues.put(key, defaultValuesItem); + return this; + } - /** - * @return The language specific default value for the field value. - */ - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } + /** + * Get defaultValues + * @return defaultValues + */ + @javax.annotation.Nullable + public Map getDefaultValues() { + return defaultValues; + } - /** - * @return The default value for the field value. - */ - @JsonProperty("defaultValue") - public Optional getDefaultValue() { - return defaultValue; - } + public void setDefaultValues(Map defaultValues) { + this.defaultValues = defaultValues; + } + public BooleanFieldPropertiesDto defaultValue(Boolean defaultValue) { + this.defaultValue = defaultValue; + return this; + } - /** - * @return Indicates that the inline editor is enabled for this field. - */ - @JsonProperty("inlineEditable") - public Optional getInlineEditable() { - return inlineEditable; - } + /** + * The default value for the field value. + * @return defaultValue + */ + @javax.annotation.Nullable + public Boolean getDefaultValue() { + return defaultValue; + } - /** - * @return The editor that is used to manage this field. - */ - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } + public void setDefaultValue(Boolean defaultValue) { + this.defaultValue = defaultValue; + } + public BooleanFieldPropertiesDto inlineEditable(Boolean inlineEditable) { + this.inlineEditable = inlineEditable; + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BooleanFieldPropertiesDto && equalTo((BooleanFieldPropertiesDto) other); - } + /** + * Indicates that the inline editor is enabled for this field. + * @return inlineEditable + */ + @javax.annotation.Nullable + public Boolean getInlineEditable() { + return inlineEditable; + } - private boolean equalTo(BooleanFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && inlineEditable.equals(other.inlineEditable) - && editor.equals(other.editor); - } + public void setInlineEditable(Boolean inlineEditable) { + this.inlineEditable = inlineEditable; + } + public BooleanFieldPropertiesDto editor(BooleanFieldEditor editor) { + this.editor = editor; + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.defaultValues, this.defaultValue, this.inlineEditable, this.editor); - } + /** + * Get editor + * @return editor + */ + @javax.annotation.Nullable + public BooleanFieldEditor getEditor() { + return editor; + } + + public void setEditor(BooleanFieldEditor editor) { + this.editor = editor; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static Builder builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + BooleanFieldPropertiesDto booleanFieldPropertiesDto = (BooleanFieldPropertiesDto) o; + return Objects.equals(this.defaultValues, booleanFieldPropertiesDto.defaultValues) && + Objects.equals(this.defaultValue, booleanFieldPropertiesDto.defaultValue) && + Objects.equals(this.inlineEditable, booleanFieldPropertiesDto.inlineEditable) && + Objects.equals(this.editor, booleanFieldPropertiesDto.editor) && + super.equals(o); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> defaultValues = Optional.empty(); + 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())); + } - private Optional defaultValue = Optional.empty(); + @Override + public int hashCode() { + return Objects.hash(defaultValues, defaultValue, inlineEditable, editor, super.hashCode()); + } - private Optional inlineEditable = Optional.empty(); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - private Optional editor = Optional.empty(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BooleanFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" defaultValues: ").append(toIndentedString(defaultValues)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" inlineEditable: ").append(toIndentedString(inlineEditable)).append("\n"); + sb.append(" editor: ").append(toIndentedString(editor)).append("\n"); + sb.append("}"); + return sb.toString(); + } - private Builder() {} + /** + * 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 Builder from(BooleanFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - inlineEditable(other.getInlineEditable()); - editor(other.getEditor()); - return this; - } - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("defaultValues"); + openapiFields.add("defaultValue"); + openapiFields.add("inlineEditable"); + openapiFields.add("editor"); - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional defaultValue) { - this.defaultValue = defaultValue; - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } - public Builder defaultValue(Boolean defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BooleanFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BooleanFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BooleanFieldPropertiesDto is not found in the empty JSON string", BooleanFieldPropertiesDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "inlineEditable", nulls = Nulls.SKIP) - public Builder inlineEditable(Optional inlineEditable) { - this.inlineEditable = inlineEditable; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BooleanFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BooleanFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder inlineEditable(Boolean inlineEditable) { - this.inlineEditable = Optional.of(inlineEditable); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BooleanFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BooleanFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BooleanFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BooleanFieldPropertiesDto.class)); - public Builder editor(BooleanFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BooleanFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public BooleanFieldPropertiesDto build() { - return new BooleanFieldPropertiesDto(defaultValues, defaultValue, inlineEditable, editor); - } + @Override + public BooleanFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of BooleanFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of BooleanFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to BooleanFieldPropertiesDto + */ + public static BooleanFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BooleanFieldPropertiesDto.class); + } + + /** + * Convert an instance of BooleanFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/BulkResultDto.java b/src/main/java/com/squidex/api/types/BulkResultDto.java index bc2de88..1d9a6f0 100644 --- a/src/main/java/com/squidex/api/types/BulkResultDto.java +++ b/src/main/java/com/squidex/api/types/BulkResultDto.java @@ -1,203 +1,303 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BulkResultDto.Builder.class) -public final class BulkResultDto { - private final Optional error; - - private final int jobIndex; - - private final Optional id; - - private final Optional contentId; - private BulkResultDto(Optional error, int jobIndex, Optional id, Optional contentId) { - this.error = error; - this.jobIndex = jobIndex; - this.id = id; - this.contentId = contentId; - } - - /** - * @return The error when the bulk job failed. - */ - @JsonProperty("error") - public Optional getError() { - return error; - } - - /** - * @return The index of the bulk job where the result belongs to. The order can change. - */ - @JsonProperty("jobIndex") - public int getJobIndex() { - return jobIndex; - } - - /** - * @return The ID of the entity that has been handled successfully or not. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - /** - * @return The ID of the entity that has been handled successfully or not. - */ - @JsonProperty("contentId") - public Optional getContentId() { - return contentId; - } +package com.squidex.api.types; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BulkResultDto && equalTo((BulkResultDto) other); - } +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.squidex.api.types.ErrorDto; +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.squidex.api.core.JSON; - private boolean equalTo(BulkResultDto other) { - return error.equals(other.error) - && jobIndex == other.jobIndex - && id.equals(other.id) - && contentId.equals(other.contentId); +/** + * BulkResultDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class BulkResultDto { + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + private ErrorDto error; + public static final String SERIALIZED_NAME_JOB_INDEX = "jobIndex"; + @SerializedName(SERIALIZED_NAME_JOB_INDEX) + private Integer jobIndex; + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_CONTENT_ID = "contentId"; + @Deprecated + @SerializedName(SERIALIZED_NAME_CONTENT_ID) + private String contentId; + public BulkResultDto() { + } + public BulkResultDto error(ErrorDto error) { + this.error = error; + return this; + } + + /** + * Get error + * @return error + */ + @javax.annotation.Nullable + public ErrorDto getError() { + return error; + } + + public void setError(ErrorDto error) { + this.error = error; + } + public BulkResultDto jobIndex(Integer jobIndex) { + this.jobIndex = jobIndex; + return this; + } + + /** + * The index of the bulk job where the result belongs to. The order can change. + * @return jobIndex + */ + @javax.annotation.Nonnull + public Integer getJobIndex() { + return jobIndex; + } + + public void setJobIndex(Integer jobIndex) { + this.jobIndex = jobIndex; + } + public BulkResultDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the entity that has been handled successfully or not. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + @Deprecated + public BulkResultDto contentId(String contentId) { + this.contentId = contentId; + return this; + } + + /** + * The ID of the entity that has been handled successfully or not. + * @return contentId + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public String getContentId() { + return contentId; + } + + @Deprecated + public void setContentId(String contentId) { + this.contentId = contentId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public int hashCode() { - return Objects.hash(this.error, this.jobIndex, this.id, this.contentId); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + BulkResultDto bulkResultDto = (BulkResultDto) o; + return Objects.equals(this.error, bulkResultDto.error) && + Objects.equals(this.jobIndex, bulkResultDto.jobIndex) && + Objects.equals(this.id, bulkResultDto.id) && + Objects.equals(this.contentId, bulkResultDto.contentId); + } + + 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(error, jobIndex, id, contentId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static JobIndexStage builder() { - return new Builder(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BulkResultDto {\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" jobIndex: ").append(toIndentedString(jobIndex)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" contentId: ").append(toIndentedString(contentId)).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"; } - - public interface JobIndexStage { - _FinalStage jobIndex(int jobIndex); - - Builder from(BulkResultDto other); - } - - public interface _FinalStage { - BulkResultDto build(); - - _FinalStage error(Optional error); - - _FinalStage error(ErrorDto error); - - _FinalStage id(Optional id); - - _FinalStage id(String id); - - _FinalStage contentId(Optional contentId); - - _FinalStage contentId(String contentId); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements JobIndexStage, _FinalStage { - private int jobIndex; - - private Optional contentId = Optional.empty(); - - private Optional id = Optional.empty(); - - private Optional error = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(BulkResultDto other) { - error(other.getError()); - jobIndex(other.getJobIndex()); - id(other.getId()); - contentId(other.getContentId()); - return this; - } - - /** - *

The index of the bulk job where the result belongs to. The order can change.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("jobIndex") - public _FinalStage jobIndex(int jobIndex) { - this.jobIndex = jobIndex; - return this; - } - - /** - *

The ID of the entity that has been handled successfully or not.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage contentId(String contentId) { - this.contentId = Optional.of(contentId); - return this; - } - - @Override - @JsonSetter(value = "contentId", nulls = Nulls.SKIP) - public _FinalStage contentId(Optional contentId) { - this.contentId = contentId; - return this; + return o.toString().replace("\n", "\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"); + openapiFields.add("jobIndex"); + openapiFields.add("id"); + openapiFields.add("contentId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("jobIndex"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BulkResultDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BulkResultDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BulkResultDto is not found in the empty JSON string", BulkResultDto.openapiRequiredFields.toString())); } + } - /** - *

The ID of the entity that has been handled successfully or not.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage id(String id) { - this.id = Optional.of(id); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BulkResultDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BulkResultDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public _FinalStage id(Optional id) { - this.id = id; - return this; - } - - /** - *

The error when the bulk job failed.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage error(ErrorDto error) { - this.error = Optional.of(error); - return this; - } - - @Override - @JsonSetter(value = "error", nulls = Nulls.SKIP) - public _FinalStage error(Optional error) { - this.error = error; - return this; - } - - @Override - public BulkResultDto build() { - return new BulkResultDto(error, jobIndex, id, contentId); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BulkResultDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `error` + if (jsonObj.get("error") != null && !jsonObj.get("error").isJsonNull()) { + ErrorDto.validateJsonElement(jsonObj.get("error")); + } + 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("contentId") != null && !jsonObj.get("contentId").isJsonNull()) && !jsonObj.get("contentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BulkResultDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BulkResultDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BulkResultDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BulkResultDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BulkResultDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of BulkResultDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of BulkResultDto + * @throws IOException if the JSON string is invalid with respect to BulkResultDto + */ + public static BulkResultDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BulkResultDto.class); + } + + /** + * Convert an instance of BulkResultDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/BulkUpdateAssetType.java b/src/main/java/com/squidex/api/types/BulkUpdateAssetType.java index 579dbc4..981d0b7 100644 --- a/src/main/java/com/squidex/api/types/BulkUpdateAssetType.java +++ b/src/main/java/com/squidex/api/types/BulkUpdateAssetType.java @@ -1,26 +1,80 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(BulkUpdateAssetType.Adapter.class) public enum BulkUpdateAssetType { - ANNOTATE("Annotate"), + + ANNOTATE("Annotate"), + + MOVE("Move"), + + DELETE("Delete"); - MOVE("Move"), + private String value; - DELETE("Delete"); + BulkUpdateAssetType(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - BulkUpdateAssetType(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static BulkUpdateAssetType fromValue(String value) { + for (BulkUpdateAssetType b : BulkUpdateAssetType.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 BulkUpdateAssetType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public BulkUpdateAssetType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return BulkUpdateAssetType.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + BulkUpdateAssetType.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/BulkUpdateAssetsDto.java b/src/main/java/com/squidex/api/types/BulkUpdateAssetsDto.java new file mode 100644 index 0000000..db8f104 --- /dev/null +++ b/src/main/java/com/squidex/api/types/BulkUpdateAssetsDto.java @@ -0,0 +1,304 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.BulkUpdateAssetsJobDto; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +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.squidex.api.core.JSON; + +/** + * BulkUpdateAssetsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class BulkUpdateAssetsDto { + public static final String SERIALIZED_NAME_JOBS = "jobs"; + @SerializedName(SERIALIZED_NAME_JOBS) + private List jobs; + public static final String SERIALIZED_NAME_CHECK_REFERRERS = "checkReferrers"; + @SerializedName(SERIALIZED_NAME_CHECK_REFERRERS) + private Boolean checkReferrers; + public static final String SERIALIZED_NAME_OPTIMIZE_VALIDATION = "optimizeValidation"; + @SerializedName(SERIALIZED_NAME_OPTIMIZE_VALIDATION) + private Boolean optimizeValidation; + public static final String SERIALIZED_NAME_DO_NOT_SCRIPT = "doNotScript"; + @SerializedName(SERIALIZED_NAME_DO_NOT_SCRIPT) + private Boolean doNotScript; + public BulkUpdateAssetsDto() { + } + public BulkUpdateAssetsDto jobs(List jobs) { + this.jobs = jobs; + return this; + } + + public BulkUpdateAssetsDto addJobsItem(BulkUpdateAssetsJobDto jobsItem) { + if (this.jobs == null) { + this.jobs = new ArrayList<>(); + } + this.jobs.add(jobsItem); + return this; + } + + /** + * The contents to update or insert. + * @return jobs + */ + @javax.annotation.Nullable + public List getJobs() { + return jobs; + } + + public void setJobs(List jobs) { + this.jobs = jobs; + } + public BulkUpdateAssetsDto checkReferrers(Boolean checkReferrers) { + this.checkReferrers = checkReferrers; + return this; + } + + /** + * True to check referrers of deleted assets. + * @return checkReferrers + */ + @javax.annotation.Nullable + public Boolean getCheckReferrers() { + return checkReferrers; + } + + public void setCheckReferrers(Boolean checkReferrers) { + this.checkReferrers = checkReferrers; + } + public BulkUpdateAssetsDto optimizeValidation(Boolean optimizeValidation) { + this.optimizeValidation = optimizeValidation; + return this; + } + + /** + * True to turn off costly validation: Folder checks. Default: true. + * @return optimizeValidation + */ + @javax.annotation.Nullable + public Boolean getOptimizeValidation() { + return optimizeValidation; + } + + public void setOptimizeValidation(Boolean optimizeValidation) { + this.optimizeValidation = optimizeValidation; + } + public BulkUpdateAssetsDto doNotScript(Boolean doNotScript) { + this.doNotScript = doNotScript; + return this; + } + + /** + * True to turn off scripting for faster inserts. Default: true. + * @return doNotScript + */ + @javax.annotation.Nullable + public Boolean getDoNotScript() { + return doNotScript; + } + + public void setDoNotScript(Boolean doNotScript) { + this.doNotScript = doNotScript; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + BulkUpdateAssetsDto bulkUpdateAssetsDto = (BulkUpdateAssetsDto) o; + return Objects.equals(this.jobs, bulkUpdateAssetsDto.jobs) && + Objects.equals(this.checkReferrers, bulkUpdateAssetsDto.checkReferrers) && + Objects.equals(this.optimizeValidation, bulkUpdateAssetsDto.optimizeValidation) && + Objects.equals(this.doNotScript, bulkUpdateAssetsDto.doNotScript); + } + + 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(jobs, checkReferrers, optimizeValidation, doNotScript); + } + + 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 BulkUpdateAssetsDto {\n"); + sb.append(" jobs: ").append(toIndentedString(jobs)).append("\n"); + sb.append(" checkReferrers: ").append(toIndentedString(checkReferrers)).append("\n"); + sb.append(" optimizeValidation: ").append(toIndentedString(optimizeValidation)).append("\n"); + sb.append(" doNotScript: ").append(toIndentedString(doNotScript)).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("jobs"); + openapiFields.add("checkReferrers"); + openapiFields.add("optimizeValidation"); + openapiFields.add("doNotScript"); + + // 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 BulkUpdateAssetsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BulkUpdateAssetsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BulkUpdateAssetsDto is not found in the empty JSON string", BulkUpdateAssetsDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BulkUpdateAssetsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BulkUpdateAssetsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("jobs") != null && !jsonObj.get("jobs").isJsonNull()) { + JsonArray jsonArrayjobs = jsonObj.getAsJsonArray("jobs"); + if (jsonArrayjobs != null) { + // ensure the json data is an array + if (!jsonObj.get("jobs").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `jobs` to be an array in the JSON string but got `%s`", jsonObj.get("jobs").toString())); + } + + // validate the optional field `jobs` (array) + for (int i = 0; i < jsonArrayjobs.size(); i++) { + BulkUpdateAssetsJobDto.validateJsonElement(jsonArrayjobs.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BulkUpdateAssetsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BulkUpdateAssetsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BulkUpdateAssetsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BulkUpdateAssetsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BulkUpdateAssetsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of BulkUpdateAssetsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of BulkUpdateAssetsDto + * @throws IOException if the JSON string is invalid with respect to BulkUpdateAssetsDto + */ + public static BulkUpdateAssetsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BulkUpdateAssetsDto.class); + } + + /** + * Convert an instance of BulkUpdateAssetsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java b/src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java index eddd7b8..6f6f4ee 100644 --- a/src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java +++ b/src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java @@ -1,340 +1,458 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.BulkUpdateAssetType; +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.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BulkUpdateAssetsJobDto.Builder.class) -public final class BulkUpdateAssetsJobDto { - private final Optional id; - - private final Optional type; - - private final Optional parentId; - - private final Optional fileName; - - private final Optional slug; - - private final Optional isProtected; - - private final Optional> tags; - - private final Optional> metadata; - - private final Optional permanent; - - private final Optional expectedVersion; - - private BulkUpdateAssetsJobDto( - Optional id, - Optional type, - Optional parentId, - Optional fileName, - Optional slug, - Optional isProtected, - Optional> tags, - Optional> metadata, - Optional permanent, - Optional expectedVersion) { - this.id = id; - this.type = type; - this.parentId = parentId; - this.fileName = fileName; - this.slug = slug; - this.isProtected = isProtected; - this.tags = tags; - this.metadata = metadata; - this.permanent = permanent; - this.expectedVersion = expectedVersion; - } - - /** - * @return An optional ID of the asset to update. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - /** - * @return The update type. - */ - @JsonProperty("type") - public Optional getType() { - return type; - } - - /** - * @return The parent folder id. - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } - - /** - * @return The new name of the asset. - */ - @JsonProperty("fileName") - public Optional getFileName() { - return fileName; - } +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; - /** - * @return The new slug of the asset. - */ - @JsonProperty("slug") - public Optional getSlug() { - return slug; - } +import com.squidex.api.core.JSON; - /** - * @return True, when the asset is not public. - */ - @JsonProperty("isProtected") - public Optional getIsProtected() { - return isProtected; +/** + * BulkUpdateAssetsJobDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class BulkUpdateAssetsJobDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private BulkUpdateAssetType type; + public static final String SERIALIZED_NAME_PARENT_ID = "parentId"; + @SerializedName(SERIALIZED_NAME_PARENT_ID) + private String parentId; + public static final String SERIALIZED_NAME_FILE_NAME = "fileName"; + @SerializedName(SERIALIZED_NAME_FILE_NAME) + private String fileName; + public static final String SERIALIZED_NAME_SLUG = "slug"; + @SerializedName(SERIALIZED_NAME_SLUG) + private String slug; + public static final String SERIALIZED_NAME_IS_PROTECTED = "isProtected"; + @SerializedName(SERIALIZED_NAME_IS_PROTECTED) + private Boolean isProtected; + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private List tags; + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + private Map metadata; + public static final String SERIALIZED_NAME_PERMANENT = "permanent"; + @SerializedName(SERIALIZED_NAME_PERMANENT) + private Boolean permanent; + public static final String SERIALIZED_NAME_EXPECTED_VERSION = "expectedVersion"; + @SerializedName(SERIALIZED_NAME_EXPECTED_VERSION) + private Long expectedVersion; + public BulkUpdateAssetsJobDto() { + } + public BulkUpdateAssetsJobDto id(String id) { + this.id = id; + return this; + } + + /** + * An optional ID of the asset to update. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public BulkUpdateAssetsJobDto type(BulkUpdateAssetType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public BulkUpdateAssetType getType() { + return type; + } + + public void setType(BulkUpdateAssetType type) { + this.type = type; + } + public BulkUpdateAssetsJobDto parentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * The parent folder id. + * @return parentId + */ + @javax.annotation.Nullable + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + public BulkUpdateAssetsJobDto fileName(String fileName) { + this.fileName = fileName; + return this; + } + + /** + * The new name of the asset. + * @return fileName + */ + @javax.annotation.Nullable + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + public BulkUpdateAssetsJobDto slug(String slug) { + this.slug = slug; + return this; + } + + /** + * The new slug of the asset. + * @return slug + */ + @javax.annotation.Nullable + public String getSlug() { + return slug; + } + + public void setSlug(String slug) { + this.slug = slug; + } + public BulkUpdateAssetsJobDto isProtected(Boolean isProtected) { + this.isProtected = isProtected; + return this; + } + + /** + * True, when the asset is not public. + * @return isProtected + */ + @javax.annotation.Nullable + public Boolean getIsProtected() { + return isProtected; + } + + public void setIsProtected(Boolean isProtected) { + this.isProtected = isProtected; + } + public BulkUpdateAssetsJobDto tags(List tags) { + this.tags = tags; + return this; + } + + public BulkUpdateAssetsJobDto addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); } - - /** - * @return The new asset tags. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; + this.tags.add(tagsItem); + return this; + } + + /** + * The new asset tags. + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + public BulkUpdateAssetsJobDto metadata(Map metadata) { + this.metadata = metadata; + return this; + } + + public BulkUpdateAssetsJobDto putMetadataItem(String key, Object metadataItem) { + if (this.metadata == null) { + this.metadata = new HashMap<>(); } - - /** - * @return The asset metadata. - */ - @JsonProperty("metadata") - public Optional> getMetadata() { - return metadata; + this.metadata.put(key, metadataItem); + return this; + } + + /** + * The asset metadata. + * @return metadata + */ + @javax.annotation.Nullable + public Map getMetadata() { + return metadata; + } + + public void setMetadata(Map metadata) { + this.metadata = metadata; + } + public BulkUpdateAssetsJobDto permanent(Boolean permanent) { + this.permanent = permanent; + return this; + } + + /** + * True to delete the asset permanently. + * @return permanent + */ + @javax.annotation.Nullable + public Boolean getPermanent() { + return permanent; + } + + public void setPermanent(Boolean permanent) { + this.permanent = permanent; + } + public BulkUpdateAssetsJobDto expectedVersion(Long expectedVersion) { + this.expectedVersion = expectedVersion; + return this; + } + + /** + * The expected version. + * @return expectedVersion + */ + @javax.annotation.Nullable + public Long getExpectedVersion() { + return expectedVersion; + } + + public void setExpectedVersion(Long expectedVersion) { + this.expectedVersion = expectedVersion; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - /** - * @return True to delete the asset permanently. - */ - @JsonProperty("permanent") - public Optional getPermanent() { - return permanent; - } - - /** - * @return The expected version. - */ - @JsonProperty("expectedVersion") - public Optional getExpectedVersion() { - return expectedVersion; + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BulkUpdateAssetsJobDto && equalTo((BulkUpdateAssetsJobDto) other); + BulkUpdateAssetsJobDto bulkUpdateAssetsJobDto = (BulkUpdateAssetsJobDto) o; + return Objects.equals(this.id, bulkUpdateAssetsJobDto.id) && + Objects.equals(this.type, bulkUpdateAssetsJobDto.type) && + Objects.equals(this.parentId, bulkUpdateAssetsJobDto.parentId) && + Objects.equals(this.fileName, bulkUpdateAssetsJobDto.fileName) && + Objects.equals(this.slug, bulkUpdateAssetsJobDto.slug) && + Objects.equals(this.isProtected, bulkUpdateAssetsJobDto.isProtected) && + Objects.equals(this.tags, bulkUpdateAssetsJobDto.tags) && + Objects.equals(this.metadata, bulkUpdateAssetsJobDto.metadata) && + Objects.equals(this.permanent, bulkUpdateAssetsJobDto.permanent) && + Objects.equals(this.expectedVersion, bulkUpdateAssetsJobDto.expectedVersion); + } + + 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(id, type, parentId, fileName, slug, isProtected, tags, metadata, permanent, expectedVersion); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - private boolean equalTo(BulkUpdateAssetsJobDto other) { - return id.equals(other.id) - && type.equals(other.type) - && parentId.equals(other.parentId) - && fileName.equals(other.fileName) - && slug.equals(other.slug) - && isProtected.equals(other.isProtected) - && tags.equals(other.tags) - && metadata.equals(other.metadata) - && permanent.equals(other.permanent) - && expectedVersion.equals(other.expectedVersion); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BulkUpdateAssetsJobDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n"); + sb.append(" fileName: ").append(toIndentedString(fileName)).append("\n"); + sb.append(" slug: ").append(toIndentedString(slug)).append("\n"); + sb.append(" isProtected: ").append(toIndentedString(isProtected)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" permanent: ").append(toIndentedString(permanent)).append("\n"); + sb.append(" expectedVersion: ").append(toIndentedString(expectedVersion)).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"; } - - @Override - public int hashCode() { - return Objects.hash( - this.id, - this.type, - this.parentId, - this.fileName, - this.slug, - this.isProtected, - this.tags, - this.metadata, - this.permanent, - this.expectedVersion); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional id = Optional.empty(); - - private Optional type = Optional.empty(); - - private Optional parentId = Optional.empty(); - - private Optional fileName = Optional.empty(); - - private Optional slug = Optional.empty(); - - private Optional isProtected = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional> metadata = Optional.empty(); - - private Optional permanent = Optional.empty(); - - private Optional expectedVersion = Optional.empty(); - - private Builder() {} - - public Builder from(BulkUpdateAssetsJobDto other) { - id(other.getId()); - type(other.getType()); - parentId(other.getParentId()); - fileName(other.getFileName()); - slug(other.getSlug()); - isProtected(other.getIsProtected()); - tags(other.getTags()); - metadata(other.getMetadata()); - permanent(other.getPermanent()); - expectedVersion(other.getExpectedVersion()); - return this; - } - - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; + return o.toString().replace("\n", "\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"); + openapiFields.add("parentId"); + openapiFields.add("fileName"); + openapiFields.add("slug"); + openapiFields.add("isProtected"); + openapiFields.add("tags"); + openapiFields.add("metadata"); + openapiFields.add("permanent"); + openapiFields.add("expectedVersion"); + + // 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 BulkUpdateAssetsJobDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BulkUpdateAssetsJobDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BulkUpdateAssetsJobDto is not found in the empty JSON string", BulkUpdateAssetsJobDto.openapiRequiredFields.toString())); } + } - public Builder id(String id) { - this.id = Optional.of(id); - return this; - } - - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(BulkUpdateAssetType type) { - this.type = Optional.of(type); - return this; - } - - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } - - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } - - @JsonSetter(value = "fileName", nulls = Nulls.SKIP) - public Builder fileName(Optional fileName) { - this.fileName = fileName; - return this; - } - - public Builder fileName(String fileName) { - this.fileName = Optional.of(fileName); - return this; - } - - @JsonSetter(value = "slug", nulls = Nulls.SKIP) - public Builder slug(Optional slug) { - this.slug = slug; - return this; - } - - public Builder slug(String slug) { - this.slug = Optional.of(slug); - return this; - } - - @JsonSetter(value = "isProtected", nulls = Nulls.SKIP) - public Builder isProtected(Optional isProtected) { - this.isProtected = isProtected; - return this; - } - - public Builder isProtected(Boolean isProtected) { - this.isProtected = Optional.of(isProtected); - return this; - } - - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.of(tags); - return this; - } - - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public Builder metadata(Optional> metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(Map metadata) { - this.metadata = Optional.of(metadata); - return this; - } - - @JsonSetter(value = "permanent", nulls = Nulls.SKIP) - public Builder permanent(Optional permanent) { - this.permanent = permanent; - return this; - } - - public Builder permanent(Boolean permanent) { - this.permanent = Optional.of(permanent); - return this; - } - - @JsonSetter(value = "expectedVersion", nulls = Nulls.SKIP) - public Builder expectedVersion(Optional expectedVersion) { - this.expectedVersion = expectedVersion; - return this; - } - - public Builder expectedVersion(Integer expectedVersion) { - this.expectedVersion = Optional.of(expectedVersion); - return this; - } - - public BulkUpdateAssetsJobDto build() { - return new BulkUpdateAssetsJobDto( - id, type, parentId, fileName, slug, isProtected, tags, metadata, permanent, expectedVersion); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BulkUpdateAssetsJobDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BulkUpdateAssetsJobDto` 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())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + BulkUpdateAssetType.validateJsonElement(jsonObj.get("type")); + } + if ((jsonObj.get("parentId") != null && !jsonObj.get("parentId").isJsonNull()) && !jsonObj.get("parentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentId").toString())); + } + 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())); + } + if ((jsonObj.get("slug") != null && !jsonObj.get("slug").isJsonNull()) && !jsonObj.get("slug").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `slug` to be a primitive type in the JSON string but got `%s`", jsonObj.get("slug").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull() && !jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BulkUpdateAssetsJobDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BulkUpdateAssetsJobDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BulkUpdateAssetsJobDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BulkUpdateAssetsJobDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BulkUpdateAssetsJobDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of BulkUpdateAssetsJobDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of BulkUpdateAssetsJobDto + * @throws IOException if the JSON string is invalid with respect to BulkUpdateAssetsJobDto + */ + public static BulkUpdateAssetsJobDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BulkUpdateAssetsJobDto.class); + } + + /** + * Convert an instance of BulkUpdateAssetsJobDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/BulkUpdateContentType.java b/src/main/java/com/squidex/api/types/BulkUpdateContentType.java index f6e241b..2369381 100644 --- a/src/main/java/com/squidex/api/types/BulkUpdateContentType.java +++ b/src/main/java/com/squidex/api/types/BulkUpdateContentType.java @@ -1,34 +1,90 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; -public enum BulkUpdateContentType { - UPSERT("Upsert"), +package com.squidex.api.types; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; - CHANGE_STATUS("ChangeStatus"), +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; - CREATE("Create"), +/** + * + */ +@JsonAdapter(BulkUpdateContentType.Adapter.class) +public enum BulkUpdateContentType { + + UPSERT("Upsert"), + + CHANGE_STATUS("ChangeStatus"), + + CREATE("Create"), + + DELETE("Delete"), + + PATCH("Patch"), + + UPDATE("Update"), + + VALIDATE("Validate"), + + ENRICH_DEFAULTS("EnrichDefaults"); - DELETE("Delete"), + private String value; - PATCH("Patch"), + BulkUpdateContentType(String value) { + this.value = value; + } - UPDATE("Update"), + public String getValue() { + return value; + } - VALIDATE("Validate"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static BulkUpdateContentType fromValue(String value) { + for (BulkUpdateContentType b : BulkUpdateContentType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - BulkUpdateContentType(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final BulkUpdateContentType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public BulkUpdateContentType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return BulkUpdateContentType.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + BulkUpdateContentType.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/BulkUpdateContentsDto.java b/src/main/java/com/squidex/api/types/BulkUpdateContentsDto.java index ae4b926..7c25eda 100644 --- a/src/main/java/com/squidex/api/types/BulkUpdateContentsDto.java +++ b/src/main/java/com/squidex/api/types/BulkUpdateContentsDto.java @@ -1,268 +1,393 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.BulkUpdateContentsJobDto; +import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BulkUpdateContentsDto.Builder.class) -public final class BulkUpdateContentsDto { - private final List jobs; - - private final Optional publish; - - private final Optional doNotScript; - - private final Optional doNotValidate; - - private final Optional doNotValidateWorkflow; - - private final Optional checkReferrers; - - private final Optional optimizeValidation; - - private BulkUpdateContentsDto( - List jobs, - Optional publish, - Optional doNotScript, - Optional doNotValidate, - Optional doNotValidateWorkflow, - Optional checkReferrers, - Optional optimizeValidation) { - this.jobs = jobs; - this.publish = publish; - this.doNotScript = doNotScript; - this.doNotValidate = doNotValidate; - this.doNotValidateWorkflow = doNotValidateWorkflow; - this.checkReferrers = checkReferrers; - this.optimizeValidation = optimizeValidation; - } - - /** - * @return The contents to update or insert. - */ - @JsonProperty("jobs") - public List getJobs() { - return jobs; - } - - /** - * @return True to automatically publish the content. - */ - @JsonProperty("publish") - public Optional getPublish() { - return publish; - } - - /** - * @return True to turn off scripting for faster inserts. Default: true. - */ - @JsonProperty("doNotScript") - public Optional getDoNotScript() { - return doNotScript; - } - - /** - * @return True to turn off validation for faster inserts. Default: false. - */ - @JsonProperty("doNotValidate") - public Optional getDoNotValidate() { - return doNotValidate; - } - - /** - * @return True to turn off validation of workflow rules. Default: false. - */ - @JsonProperty("doNotValidateWorkflow") - public Optional getDoNotValidateWorkflow() { - return doNotValidateWorkflow; - } - /** - * @return True to check referrers of deleted contents. - */ - @JsonProperty("checkReferrers") - public Optional getCheckReferrers() { - return checkReferrers; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return True to turn off costly validation: Unique checks, asset checks and reference checks. Default: true. - */ - @JsonProperty("optimizeValidation") - public Optional getOptimizeValidation() { - return optimizeValidation; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BulkUpdateContentsDto && equalTo((BulkUpdateContentsDto) other); - } - - private boolean equalTo(BulkUpdateContentsDto other) { - return jobs.equals(other.jobs) - && publish.equals(other.publish) - && doNotScript.equals(other.doNotScript) - && doNotValidate.equals(other.doNotValidate) - && doNotValidateWorkflow.equals(other.doNotValidateWorkflow) - && checkReferrers.equals(other.checkReferrers) - && optimizeValidation.equals(other.optimizeValidation); +/** + * BulkUpdateContentsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class BulkUpdateContentsDto { + public static final String SERIALIZED_NAME_JOBS = "jobs"; + @SerializedName(SERIALIZED_NAME_JOBS) + private List jobs = new ArrayList<>(); + public static final String SERIALIZED_NAME_PUBLISH = "publish"; + @Deprecated + @SerializedName(SERIALIZED_NAME_PUBLISH) + private Boolean publish; + public static final String SERIALIZED_NAME_DO_NOT_SCRIPT = "doNotScript"; + @SerializedName(SERIALIZED_NAME_DO_NOT_SCRIPT) + private Boolean doNotScript; + public static final String SERIALIZED_NAME_ENRICH_REQUIRED_FIELDS = "enrichRequiredFields"; + @SerializedName(SERIALIZED_NAME_ENRICH_REQUIRED_FIELDS) + private Boolean enrichRequiredFields; + public static final String SERIALIZED_NAME_DO_NOT_VALIDATE = "doNotValidate"; + @SerializedName(SERIALIZED_NAME_DO_NOT_VALIDATE) + private Boolean doNotValidate; + public static final String SERIALIZED_NAME_DO_NOT_VALIDATE_WORKFLOW = "doNotValidateWorkflow"; + @SerializedName(SERIALIZED_NAME_DO_NOT_VALIDATE_WORKFLOW) + private Boolean doNotValidateWorkflow; + public static final String SERIALIZED_NAME_CHECK_REFERRERS = "checkReferrers"; + @SerializedName(SERIALIZED_NAME_CHECK_REFERRERS) + private Boolean checkReferrers; + public static final String SERIALIZED_NAME_OPTIMIZE_VALIDATION = "optimizeValidation"; + @SerializedName(SERIALIZED_NAME_OPTIMIZE_VALIDATION) + private Boolean optimizeValidation; + public BulkUpdateContentsDto() { + } + public BulkUpdateContentsDto jobs(List jobs) { + this.jobs = jobs; + return this; + } + + public BulkUpdateContentsDto addJobsItem(BulkUpdateContentsJobDto jobsItem) { + if (this.jobs == null) { + this.jobs = new ArrayList<>(); } - - @Override - public int hashCode() { - return Objects.hash( - this.jobs, - this.publish, - this.doNotScript, - this.doNotValidate, - this.doNotValidateWorkflow, - this.checkReferrers, - this.optimizeValidation); + this.jobs.add(jobsItem); + return this; + } + + /** + * The contents to update or insert. + * @return jobs + */ + @javax.annotation.Nonnull + public List getJobs() { + return jobs; + } + + public void setJobs(List jobs) { + this.jobs = jobs; + } + @Deprecated + public BulkUpdateContentsDto publish(Boolean publish) { + this.publish = publish; + return this; + } + + /** + * True to automatically publish the content. + * @return publish + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Boolean getPublish() { + return publish; + } + + @Deprecated + public void setPublish(Boolean publish) { + this.publish = publish; + } + public BulkUpdateContentsDto doNotScript(Boolean doNotScript) { + this.doNotScript = doNotScript; + return this; + } + + /** + * True to turn off scripting for faster inserts. Default: true. + * @return doNotScript + */ + @javax.annotation.Nullable + public Boolean getDoNotScript() { + return doNotScript; + } + + public void setDoNotScript(Boolean doNotScript) { + this.doNotScript = doNotScript; + } + public BulkUpdateContentsDto enrichRequiredFields(Boolean enrichRequiredFields) { + this.enrichRequiredFields = enrichRequiredFields; + return this; + } + + /** + * True, to also enrich required fields. Default: false. + * @return enrichRequiredFields + */ + @javax.annotation.Nullable + public Boolean getEnrichRequiredFields() { + return enrichRequiredFields; + } + + public void setEnrichRequiredFields(Boolean enrichRequiredFields) { + this.enrichRequiredFields = enrichRequiredFields; + } + public BulkUpdateContentsDto doNotValidate(Boolean doNotValidate) { + this.doNotValidate = doNotValidate; + return this; + } + + /** + * True to turn off validation for faster inserts. Default: false. + * @return doNotValidate + */ + @javax.annotation.Nullable + public Boolean getDoNotValidate() { + return doNotValidate; + } + + public void setDoNotValidate(Boolean doNotValidate) { + this.doNotValidate = doNotValidate; + } + public BulkUpdateContentsDto doNotValidateWorkflow(Boolean doNotValidateWorkflow) { + this.doNotValidateWorkflow = doNotValidateWorkflow; + return this; + } + + /** + * True to turn off validation of workflow rules. Default: false. + * @return doNotValidateWorkflow + */ + @javax.annotation.Nullable + public Boolean getDoNotValidateWorkflow() { + return doNotValidateWorkflow; + } + + public void setDoNotValidateWorkflow(Boolean doNotValidateWorkflow) { + this.doNotValidateWorkflow = doNotValidateWorkflow; + } + public BulkUpdateContentsDto checkReferrers(Boolean checkReferrers) { + this.checkReferrers = checkReferrers; + return this; + } + + /** + * True to check referrers of deleted contents. + * @return checkReferrers + */ + @javax.annotation.Nullable + public Boolean getCheckReferrers() { + return checkReferrers; + } + + public void setCheckReferrers(Boolean checkReferrers) { + this.checkReferrers = checkReferrers; + } + public BulkUpdateContentsDto optimizeValidation(Boolean optimizeValidation) { + this.optimizeValidation = optimizeValidation; + return this; + } + + /** + * True to turn off costly validation: Unique checks, asset checks and reference checks. Default: true. + * @return optimizeValidation + */ + @javax.annotation.Nullable + public Boolean getOptimizeValidation() { + return optimizeValidation; + } + + public void setOptimizeValidation(Boolean optimizeValidation) { + this.optimizeValidation = optimizeValidation; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static Builder builder() { - return new Builder(); + BulkUpdateContentsDto bulkUpdateContentsDto = (BulkUpdateContentsDto) o; + return Objects.equals(this.jobs, bulkUpdateContentsDto.jobs) && + Objects.equals(this.publish, bulkUpdateContentsDto.publish) && + Objects.equals(this.doNotScript, bulkUpdateContentsDto.doNotScript) && + Objects.equals(this.enrichRequiredFields, bulkUpdateContentsDto.enrichRequiredFields) && + Objects.equals(this.doNotValidate, bulkUpdateContentsDto.doNotValidate) && + Objects.equals(this.doNotValidateWorkflow, bulkUpdateContentsDto.doNotValidateWorkflow) && + Objects.equals(this.checkReferrers, bulkUpdateContentsDto.checkReferrers) && + Objects.equals(this.optimizeValidation, bulkUpdateContentsDto.optimizeValidation); + } + + @Override + public int hashCode() { + return Objects.hash(jobs, publish, doNotScript, enrichRequiredFields, doNotValidate, doNotValidateWorkflow, checkReferrers, optimizeValidation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BulkUpdateContentsDto {\n"); + sb.append(" jobs: ").append(toIndentedString(jobs)).append("\n"); + sb.append(" publish: ").append(toIndentedString(publish)).append("\n"); + sb.append(" doNotScript: ").append(toIndentedString(doNotScript)).append("\n"); + sb.append(" enrichRequiredFields: ").append(toIndentedString(enrichRequiredFields)).append("\n"); + sb.append(" doNotValidate: ").append(toIndentedString(doNotValidate)).append("\n"); + sb.append(" doNotValidateWorkflow: ").append(toIndentedString(doNotValidateWorkflow)).append("\n"); + sb.append(" checkReferrers: ").append(toIndentedString(checkReferrers)).append("\n"); + sb.append(" optimizeValidation: ").append(toIndentedString(optimizeValidation)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private List jobs = new ArrayList<>(); - - private Optional publish = Optional.empty(); - - private Optional doNotScript = Optional.empty(); - - private Optional doNotValidate = Optional.empty(); - - private Optional doNotValidateWorkflow = Optional.empty(); - - private Optional checkReferrers = Optional.empty(); - - private Optional optimizeValidation = Optional.empty(); - - private Builder() {} - - public Builder from(BulkUpdateContentsDto other) { - jobs(other.getJobs()); - publish(other.getPublish()); - doNotScript(other.getDoNotScript()); - doNotValidate(other.getDoNotValidate()); - doNotValidateWorkflow(other.getDoNotValidateWorkflow()); - checkReferrers(other.getCheckReferrers()); - optimizeValidation(other.getOptimizeValidation()); - return this; - } - - @JsonSetter(value = "jobs", nulls = Nulls.SKIP) - public Builder jobs(List jobs) { - this.jobs.clear(); - this.jobs.addAll(jobs); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("jobs"); + openapiFields.add("publish"); + openapiFields.add("doNotScript"); + openapiFields.add("enrichRequiredFields"); + openapiFields.add("doNotValidate"); + openapiFields.add("doNotValidateWorkflow"); + openapiFields.add("checkReferrers"); + openapiFields.add("optimizeValidation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("jobs"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to BulkUpdateContentsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BulkUpdateContentsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BulkUpdateContentsDto is not found in the empty JSON string", BulkUpdateContentsDto.openapiRequiredFields.toString())); } + } - public Builder addJobs(BulkUpdateContentsJobDto jobs) { - this.jobs.add(jobs); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BulkUpdateContentsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BulkUpdateContentsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder addAllJobs(List jobs) { - this.jobs.addAll(jobs); - return this; - } - - @JsonSetter(value = "publish", nulls = Nulls.SKIP) - public Builder publish(Optional publish) { - this.publish = publish; - return this; - } - - public Builder publish(Boolean publish) { - this.publish = Optional.of(publish); - return this; - } - - @JsonSetter(value = "doNotScript", nulls = Nulls.SKIP) - public Builder doNotScript(Optional doNotScript) { - this.doNotScript = doNotScript; - return this; - } - - public Builder doNotScript(Boolean doNotScript) { - this.doNotScript = Optional.of(doNotScript); - return this; - } - - @JsonSetter(value = "doNotValidate", nulls = Nulls.SKIP) - public Builder doNotValidate(Optional doNotValidate) { - this.doNotValidate = doNotValidate; - return this; - } - - public Builder doNotValidate(Boolean doNotValidate) { - this.doNotValidate = Optional.of(doNotValidate); - return this; - } - - @JsonSetter(value = "doNotValidateWorkflow", nulls = Nulls.SKIP) - public Builder doNotValidateWorkflow(Optional doNotValidateWorkflow) { - this.doNotValidateWorkflow = doNotValidateWorkflow; - return this; - } - - public Builder doNotValidateWorkflow(Boolean doNotValidateWorkflow) { - this.doNotValidateWorkflow = Optional.of(doNotValidateWorkflow); - return this; - } - - @JsonSetter(value = "checkReferrers", nulls = Nulls.SKIP) - public Builder checkReferrers(Optional checkReferrers) { - this.checkReferrers = checkReferrers; - return this; - } - - public Builder checkReferrers(Boolean checkReferrers) { - this.checkReferrers = Optional.of(checkReferrers); - return this; - } - - @JsonSetter(value = "optimizeValidation", nulls = Nulls.SKIP) - public Builder optimizeValidation(Optional optimizeValidation) { - this.optimizeValidation = optimizeValidation; - return this; - } - - public Builder optimizeValidation(Boolean optimizeValidation) { - this.optimizeValidation = Optional.of(optimizeValidation); - return this; - } - - public BulkUpdateContentsDto build() { - return new BulkUpdateContentsDto( - jobs, - publish, - doNotScript, - doNotValidate, - doNotValidateWorkflow, - checkReferrers, - optimizeValidation); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : BulkUpdateContentsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("jobs").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `jobs` to be an array in the JSON string but got `%s`", jsonObj.get("jobs").toString())); + } + + JsonArray jsonArrayjobs = jsonObj.getAsJsonArray("jobs"); + // validate the required field `jobs` (array) + for (int i = 0; i < jsonArrayjobs.size(); i++) { + BulkUpdateContentsJobDto.validateJsonElement(jsonArrayjobs.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BulkUpdateContentsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BulkUpdateContentsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BulkUpdateContentsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BulkUpdateContentsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BulkUpdateContentsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of BulkUpdateContentsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of BulkUpdateContentsDto + * @throws IOException if the JSON string is invalid with respect to BulkUpdateContentsDto + */ + public static BulkUpdateContentsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BulkUpdateContentsDto.class); + } + + /** + * Convert an instance of BulkUpdateContentsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java b/src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java index 5bc5071..75a7ad9 100644 --- a/src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java +++ b/src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java @@ -1,368 +1,493 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.BulkUpdateContentType; +import com.squidex.api.types.QueryJsonDto; +import java.io.IOException; import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = BulkUpdateContentsJobDto.Builder.class) -public final class BulkUpdateContentsJobDto { - private final Optional query; - - private final Optional id; - - private final Optional>> data; - - private final Optional status; - - private final Optional dueTime; - - private final Optional type; - - private final Optional schema; - - private final Optional patch; - - private final Optional permanent; - - private final Optional expectedCount; - - private final Optional expectedVersion; - - private BulkUpdateContentsJobDto( - Optional query, - Optional id, - Optional>> data, - Optional status, - Optional dueTime, - Optional type, - Optional schema, - Optional patch, - Optional permanent, - Optional expectedCount, - Optional expectedVersion) { - this.query = query; - this.id = id; - this.data = data; - this.status = status; - this.dueTime = dueTime; - this.type = type; - this.schema = schema; - this.patch = patch; - this.permanent = permanent; - this.expectedCount = expectedCount; - this.expectedVersion = expectedVersion; - } - - /** - * @return An optional query to identify the content to update. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return An optional ID of the content to update. - */ - @JsonProperty("id") - public Optional getId() { - return id; - } - - /** - * @return The data of the content when type is set to 'Upsert', 'Create', 'Update' or 'Patch. - */ - @JsonProperty("data") - public Optional>> getData() { - return data; - } - - /** - * @return The new status when the type is set to 'ChangeStatus' or 'Upsert'. - */ - @JsonProperty("status") - public Optional getStatus() { - return status; - } - - /** - * @return The due time. - */ - @JsonProperty("dueTime") - public Optional getDueTime() { - return dueTime; - } - - /** - * @return The update type. - */ - @JsonProperty("type") - public Optional getType() { - return type; - } - - /** - * @return The optional schema id or name. - */ - @JsonProperty("schema") - public Optional getSchema() { - return schema; - } - - /** - * @return Makes the update as patch. - */ - @JsonProperty("patch") - public Optional getPatch() { - return patch; - } - - /** - * @return True to delete the content permanently. - */ - @JsonProperty("permanent") - public Optional getPermanent() { - return permanent; - } - - /** - * @return The number of expected items. Set it to a higher number to update multiple items when a query is defined. - */ - @JsonProperty("expectedCount") - public Optional getExpectedCount() { - return expectedCount; - } +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; - /** - * @return The expected version. - */ - @JsonProperty("expectedVersion") - public Optional getExpectedVersion() { - return expectedVersion; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BulkUpdateContentsJobDto && equalTo((BulkUpdateContentsJobDto) other); +/** + * BulkUpdateContentsJobDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class BulkUpdateContentsJobDto { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private QueryJsonDto query; + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Map> data = new HashMap<>(); + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + public static final String SERIALIZED_NAME_DUE_TIME = "dueTime"; + @SerializedName(SERIALIZED_NAME_DUE_TIME) + private OffsetDateTime dueTime; + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private BulkUpdateContentType type; + public static final String SERIALIZED_NAME_SCHEMA = "schema"; + @SerializedName(SERIALIZED_NAME_SCHEMA) + private String schema; + public static final String SERIALIZED_NAME_PATCH = "patch"; + @SerializedName(SERIALIZED_NAME_PATCH) + private Boolean patch; + public static final String SERIALIZED_NAME_PERMANENT = "permanent"; + @SerializedName(SERIALIZED_NAME_PERMANENT) + private Boolean permanent; + public static final String SERIALIZED_NAME_ENRICH_DEFAULTS = "enrichDefaults"; + @SerializedName(SERIALIZED_NAME_ENRICH_DEFAULTS) + private Boolean enrichDefaults; + public static final String SERIALIZED_NAME_EXPECTED_COUNT = "expectedCount"; + @SerializedName(SERIALIZED_NAME_EXPECTED_COUNT) + private Long expectedCount; + public static final String SERIALIZED_NAME_EXPECTED_VERSION = "expectedVersion"; + @SerializedName(SERIALIZED_NAME_EXPECTED_VERSION) + private Long expectedVersion; + public BulkUpdateContentsJobDto() { + } + public BulkUpdateContentsJobDto query(QueryJsonDto query) { + this.query = query; + return this; + } + + /** + * Get query + * @return query + */ + @javax.annotation.Nullable + public QueryJsonDto getQuery() { + return query; + } + + public void setQuery(QueryJsonDto query) { + this.query = query; + } + public BulkUpdateContentsJobDto id(String id) { + this.id = id; + return this; + } + + /** + * An optional ID of the content to update. + * @return id + */ + @javax.annotation.Nullable + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public BulkUpdateContentsJobDto data(Map> data) { + this.data = data; + return this; + } + + public BulkUpdateContentsJobDto putDataItem(String key, Map dataItem) { + if (this.data == null) { + this.data = new HashMap<>(); } - - private boolean equalTo(BulkUpdateContentsJobDto other) { - return query.equals(other.query) - && id.equals(other.id) - && data.equals(other.data) - && status.equals(other.status) - && dueTime.equals(other.dueTime) - && type.equals(other.type) - && schema.equals(other.schema) - && patch.equals(other.patch) - && permanent.equals(other.permanent) - && expectedCount.equals(other.expectedCount) - && expectedVersion.equals(other.expectedVersion); + this.data.put(key, dataItem); + return this; + } + + /** + * Get data + * @return data + */ + @javax.annotation.Nullable + public Map> getData() { + return data; + } + + public void setData(Map> data) { + this.data = data; + } + public BulkUpdateContentsJobDto status(String status) { + this.status = status; + return this; + } + + /** + * The new status when the type is set to 'ChangeStatus' or 'Upsert'. + * @return status + */ + @javax.annotation.Nullable + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + public BulkUpdateContentsJobDto dueTime(OffsetDateTime dueTime) { + this.dueTime = dueTime; + return this; + } + + /** + * The due time. + * @return dueTime + */ + @javax.annotation.Nullable + public OffsetDateTime getDueTime() { + return dueTime; + } + + public void setDueTime(OffsetDateTime dueTime) { + this.dueTime = dueTime; + } + public BulkUpdateContentsJobDto type(BulkUpdateContentType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public BulkUpdateContentType getType() { + return type; + } + + public void setType(BulkUpdateContentType type) { + this.type = type; + } + public BulkUpdateContentsJobDto schema(String schema) { + this.schema = schema; + return this; + } + + /** + * The optional schema id or name. + * @return schema + */ + @javax.annotation.Nullable + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + public BulkUpdateContentsJobDto patch(Boolean patch) { + this.patch = patch; + return this; + } + + /** + * Makes the update as patch. + * @return patch + */ + @javax.annotation.Nullable + public Boolean getPatch() { + return patch; + } + + public void setPatch(Boolean patch) { + this.patch = patch; + } + public BulkUpdateContentsJobDto permanent(Boolean permanent) { + this.permanent = permanent; + return this; + } + + /** + * True to delete the content permanently. + * @return permanent + */ + @javax.annotation.Nullable + public Boolean getPermanent() { + return permanent; + } + + public void setPermanent(Boolean permanent) { + this.permanent = permanent; + } + public BulkUpdateContentsJobDto enrichDefaults(Boolean enrichDefaults) { + this.enrichDefaults = enrichDefaults; + return this; + } + + /** + * Enrich the data with the default values when updating a content item. + * @return enrichDefaults + */ + @javax.annotation.Nullable + public Boolean getEnrichDefaults() { + return enrichDefaults; + } + + public void setEnrichDefaults(Boolean enrichDefaults) { + this.enrichDefaults = enrichDefaults; + } + public BulkUpdateContentsJobDto expectedCount(Long expectedCount) { + this.expectedCount = expectedCount; + return this; + } + + /** + * The number of expected items. Set it to a higher number to update multiple items when a query is defined. + * @return expectedCount + */ + @javax.annotation.Nullable + public Long getExpectedCount() { + return expectedCount; + } + + public void setExpectedCount(Long expectedCount) { + this.expectedCount = expectedCount; + } + public BulkUpdateContentsJobDto expectedVersion(Long expectedVersion) { + this.expectedVersion = expectedVersion; + return this; + } + + /** + * The expected version. + * @return expectedVersion + */ + @javax.annotation.Nullable + public Long getExpectedVersion() { + return expectedVersion; + } + + public void setExpectedVersion(Long expectedVersion) { + this.expectedVersion = expectedVersion; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public int hashCode() { - return Objects.hash( - this.query, - this.id, - this.data, - this.status, - this.dueTime, - this.type, - this.schema, - this.patch, - this.permanent, - this.expectedCount, - this.expectedVersion); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + BulkUpdateContentsJobDto bulkUpdateContentsJobDto = (BulkUpdateContentsJobDto) o; + return Objects.equals(this.query, bulkUpdateContentsJobDto.query) && + Objects.equals(this.id, bulkUpdateContentsJobDto.id) && + Objects.equals(this.data, bulkUpdateContentsJobDto.data) && + Objects.equals(this.status, bulkUpdateContentsJobDto.status) && + Objects.equals(this.dueTime, bulkUpdateContentsJobDto.dueTime) && + Objects.equals(this.type, bulkUpdateContentsJobDto.type) && + Objects.equals(this.schema, bulkUpdateContentsJobDto.schema) && + Objects.equals(this.patch, bulkUpdateContentsJobDto.patch) && + Objects.equals(this.permanent, bulkUpdateContentsJobDto.permanent) && + Objects.equals(this.enrichDefaults, bulkUpdateContentsJobDto.enrichDefaults) && + Objects.equals(this.expectedCount, bulkUpdateContentsJobDto.expectedCount) && + Objects.equals(this.expectedVersion, bulkUpdateContentsJobDto.expectedVersion); + } + + 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(query, id, data, status, dueTime, type, schema, patch, permanent, enrichDefaults, expectedCount, expectedVersion); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static Builder builder() { - return new Builder(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class BulkUpdateContentsJobDto {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" dueTime: ").append(toIndentedString(dueTime)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" schema: ").append(toIndentedString(schema)).append("\n"); + sb.append(" patch: ").append(toIndentedString(patch)).append("\n"); + sb.append(" permanent: ").append(toIndentedString(permanent)).append("\n"); + sb.append(" enrichDefaults: ").append(toIndentedString(enrichDefaults)).append("\n"); + sb.append(" expectedCount: ").append(toIndentedString(expectedCount)).append("\n"); + sb.append(" expectedVersion: ").append(toIndentedString(expectedVersion)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Optional id = Optional.empty(); - - private Optional>> data = Optional.empty(); - - private Optional status = Optional.empty(); - - private Optional dueTime = Optional.empty(); - - private Optional type = Optional.empty(); - - private Optional schema = Optional.empty(); - - private Optional patch = Optional.empty(); - - private Optional permanent = Optional.empty(); - - private Optional expectedCount = Optional.empty(); - - private Optional expectedVersion = Optional.empty(); - - private Builder() {} - - public Builder from(BulkUpdateContentsJobDto other) { - query(other.getQuery()); - id(other.getId()); - data(other.getData()); - status(other.getStatus()); - dueTime(other.getDueTime()); - type(other.getType()); - schema(other.getSchema()); - patch(other.getPatch()); - permanent(other.getPermanent()); - expectedCount(other.getExpectedCount()); - expectedVersion(other.getExpectedVersion()); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(QueryJsonDto query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; + return o.toString().replace("\n", "\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("id"); + openapiFields.add("data"); + openapiFields.add("status"); + openapiFields.add("dueTime"); + openapiFields.add("type"); + openapiFields.add("schema"); + openapiFields.add("patch"); + openapiFields.add("permanent"); + openapiFields.add("enrichDefaults"); + openapiFields.add("expectedCount"); + openapiFields.add("expectedVersion"); + + // 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 BulkUpdateContentsJobDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!BulkUpdateContentsJobDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in BulkUpdateContentsJobDto is not found in the empty JSON string", BulkUpdateContentsJobDto.openapiRequiredFields.toString())); } + } - public Builder id(String id) { - this.id = Optional.of(id); - return this; - } - - @JsonSetter(value = "data", nulls = Nulls.SKIP) - public Builder data(Optional>> data) { - this.data = data; - return this; - } - - public Builder data(Map> data) { - this.data = Optional.of(data); - return this; - } - - @JsonSetter(value = "status", nulls = Nulls.SKIP) - public Builder status(Optional status) { - this.status = status; - return this; - } - - public Builder status(String status) { - this.status = Optional.of(status); - return this; - } - - @JsonSetter(value = "dueTime", nulls = Nulls.SKIP) - public Builder dueTime(Optional dueTime) { - this.dueTime = dueTime; - return this; - } - - public Builder dueTime(OffsetDateTime dueTime) { - this.dueTime = Optional.of(dueTime); - return this; - } - - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(BulkUpdateContentType type) { - this.type = Optional.of(type); - return this; - } - - @JsonSetter(value = "schema", nulls = Nulls.SKIP) - public Builder schema(Optional schema) { - this.schema = schema; - return this; - } - - public Builder schema(String schema) { - this.schema = Optional.of(schema); - return this; - } - - @JsonSetter(value = "patch", nulls = Nulls.SKIP) - public Builder patch(Optional patch) { - this.patch = patch; - return this; - } - - public Builder patch(Boolean patch) { - this.patch = Optional.of(patch); - return this; - } - - @JsonSetter(value = "permanent", nulls = Nulls.SKIP) - public Builder permanent(Optional permanent) { - this.permanent = permanent; - return this; - } - - public Builder permanent(Boolean permanent) { - this.permanent = Optional.of(permanent); - return this; - } - - @JsonSetter(value = "expectedCount", nulls = Nulls.SKIP) - public Builder expectedCount(Optional expectedCount) { - this.expectedCount = expectedCount; - return this; - } - - public Builder expectedCount(Integer expectedCount) { - this.expectedCount = Optional.of(expectedCount); - return this; - } - - @JsonSetter(value = "expectedVersion", nulls = Nulls.SKIP) - public Builder expectedVersion(Optional expectedVersion) { - this.expectedVersion = expectedVersion; - return this; - } - - public Builder expectedVersion(Integer expectedVersion) { - this.expectedVersion = Optional.of(expectedVersion); - return this; - } - - public BulkUpdateContentsJobDto build() { - return new BulkUpdateContentsJobDto( - query, id, data, status, dueTime, type, schema, patch, permanent, expectedCount, expectedVersion); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!BulkUpdateContentsJobDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `BulkUpdateContentsJobDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `query` + if (jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) { + QueryJsonDto.validateJsonElement(jsonObj.get("query")); + } + 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())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + BulkUpdateContentType.validateJsonElement(jsonObj.get("type")); + } + if ((jsonObj.get("schema") != null && !jsonObj.get("schema").isJsonNull()) && !jsonObj.get("schema").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `schema` to be a primitive type in the JSON string but got `%s`", jsonObj.get("schema").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!BulkUpdateContentsJobDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'BulkUpdateContentsJobDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(BulkUpdateContentsJobDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, BulkUpdateContentsJobDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public BulkUpdateContentsJobDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of BulkUpdateContentsJobDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of BulkUpdateContentsJobDto + * @throws IOException if the JSON string is invalid with respect to BulkUpdateContentsJobDto + */ + public static BulkUpdateContentsJobDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, BulkUpdateContentsJobDto.class); + } + + /** + * Convert an instance of BulkUpdateContentsJobDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/CallsUsageDtoDto.java b/src/main/java/com/squidex/api/types/CallsUsageDtoDto.java index 9b33b85..d47abc0 100644 --- a/src/main/java/com/squidex/api/types/CallsUsageDtoDto.java +++ b/src/main/java/com/squidex/api/types/CallsUsageDtoDto.java @@ -1,392 +1,410 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; +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.squidex.api.types.CallsUsagePerDateDto; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CallsUsageDtoDto.Builder.class) -public final class CallsUsageDtoDto { - private final int totalCalls; - - private final int totalBytes; - - private final int monthCalls; - - private final int monthBytes; - - private final int blockingApiCalls; - - private final int allowedBytes; - - private final int allowedCalls; - - private final double averageElapsedMs; - private final Map> details; - - private CallsUsageDtoDto( - int totalCalls, - int totalBytes, - int monthCalls, - int monthBytes, - int blockingApiCalls, - int allowedBytes, - int allowedCalls, - double averageElapsedMs, - Map> details) { - this.totalCalls = totalCalls; - this.totalBytes = totalBytes; - this.monthCalls = monthCalls; - this.monthBytes = monthBytes; - this.blockingApiCalls = blockingApiCalls; - this.allowedBytes = allowedBytes; - this.allowedCalls = allowedCalls; - this.averageElapsedMs = averageElapsedMs; - this.details = details; - } - - /** - * @return The total number of API calls. - */ - @JsonProperty("totalCalls") - public int getTotalCalls() { - return totalCalls; - } - - /** - * @return The total number of bytes transferred. - */ - @JsonProperty("totalBytes") - public int getTotalBytes() { - return totalBytes; - } - - /** - * @return The total number of API calls this month. - */ - @JsonProperty("monthCalls") - public int getMonthCalls() { - return monthCalls; - } - - /** - * @return The total number of bytes transferred this month. - */ - @JsonProperty("monthBytes") - public int getMonthBytes() { - return monthBytes; - } - - /** - * @return The amount of calls that will block the app. - */ - @JsonProperty("blockingApiCalls") - public int getBlockingApiCalls() { - return blockingApiCalls; - } - - /** - * @return The included API traffic. - */ - @JsonProperty("allowedBytes") - public int getAllowedBytes() { - return allowedBytes; - } - - /** - * @return The included API calls. - */ - @JsonProperty("allowedCalls") - public int getAllowedCalls() { - return allowedCalls; - } - - /** - * @return The average duration in milliseconds. - */ - @JsonProperty("averageElapsedMs") - public double getAverageElapsedMs() { - return averageElapsedMs; - } - - /** - * @return The statistics by date and group. - */ - @JsonProperty("details") - public Map> getDetails() { - return details; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CallsUsageDtoDto && equalTo((CallsUsageDtoDto) other); - } - - private boolean equalTo(CallsUsageDtoDto other) { - return totalCalls == other.totalCalls - && totalBytes == other.totalBytes - && monthCalls == other.monthCalls - && monthBytes == other.monthBytes - && blockingApiCalls == other.blockingApiCalls - && allowedBytes == other.allowedBytes - && allowedCalls == other.allowedCalls - && averageElapsedMs == other.averageElapsedMs - && details.equals(other.details); - } - - @Override - public int hashCode() { - return Objects.hash( - this.totalCalls, - this.totalBytes, - this.monthCalls, - this.monthBytes, - this.blockingApiCalls, - this.allowedBytes, - this.allowedCalls, - this.averageElapsedMs, - this.details); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TotalCallsStage builder() { - return new Builder(); - } - - public interface TotalCallsStage { - TotalBytesStage totalCalls(int totalCalls); - - Builder from(CallsUsageDtoDto other); - } - - public interface TotalBytesStage { - MonthCallsStage totalBytes(int totalBytes); - } - - public interface MonthCallsStage { - MonthBytesStage monthCalls(int monthCalls); - } - - public interface MonthBytesStage { - BlockingApiCallsStage monthBytes(int monthBytes); - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - public interface BlockingApiCallsStage { - AllowedBytesStage blockingApiCalls(int blockingApiCalls); - } +import com.squidex.api.core.JSON; - public interface AllowedBytesStage { - AllowedCallsStage allowedBytes(int allowedBytes); +/** + * CallsUsageDtoDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CallsUsageDtoDto { + public static final String SERIALIZED_NAME_TOTAL_CALLS = "totalCalls"; + @SerializedName(SERIALIZED_NAME_TOTAL_CALLS) + private Long totalCalls; + public static final String SERIALIZED_NAME_TOTAL_BYTES = "totalBytes"; + @SerializedName(SERIALIZED_NAME_TOTAL_BYTES) + private Long totalBytes; + public static final String SERIALIZED_NAME_MONTH_CALLS = "monthCalls"; + @SerializedName(SERIALIZED_NAME_MONTH_CALLS) + private Long monthCalls; + public static final String SERIALIZED_NAME_MONTH_BYTES = "monthBytes"; + @SerializedName(SERIALIZED_NAME_MONTH_BYTES) + private Long monthBytes; + public static final String SERIALIZED_NAME_BLOCKING_API_CALLS = "blockingApiCalls"; + @SerializedName(SERIALIZED_NAME_BLOCKING_API_CALLS) + private Long blockingApiCalls; + public static final String SERIALIZED_NAME_ALLOWED_BYTES = "allowedBytes"; + @SerializedName(SERIALIZED_NAME_ALLOWED_BYTES) + private Long allowedBytes; + public static final String SERIALIZED_NAME_ALLOWED_CALLS = "allowedCalls"; + @SerializedName(SERIALIZED_NAME_ALLOWED_CALLS) + private Long allowedCalls; + public static final String SERIALIZED_NAME_AVERAGE_ELAPSED_MS = "averageElapsedMs"; + @SerializedName(SERIALIZED_NAME_AVERAGE_ELAPSED_MS) + private Double averageElapsedMs; + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + private Map> details = new HashMap<>(); + public CallsUsageDtoDto() { + } + public CallsUsageDtoDto totalCalls(Long totalCalls) { + this.totalCalls = totalCalls; + return this; + } + + /** + * The total number of API calls. + * @return totalCalls + */ + @javax.annotation.Nonnull + public Long getTotalCalls() { + return totalCalls; + } + + public void setTotalCalls(Long totalCalls) { + this.totalCalls = totalCalls; + } + public CallsUsageDtoDto totalBytes(Long totalBytes) { + this.totalBytes = totalBytes; + return this; + } + + /** + * The total number of bytes transferred. + * @return totalBytes + */ + @javax.annotation.Nonnull + public Long getTotalBytes() { + return totalBytes; + } + + public void setTotalBytes(Long totalBytes) { + this.totalBytes = totalBytes; + } + public CallsUsageDtoDto monthCalls(Long monthCalls) { + this.monthCalls = monthCalls; + return this; + } + + /** + * The total number of API calls this month. + * @return monthCalls + */ + @javax.annotation.Nonnull + public Long getMonthCalls() { + return monthCalls; + } + + public void setMonthCalls(Long monthCalls) { + this.monthCalls = monthCalls; + } + public CallsUsageDtoDto monthBytes(Long monthBytes) { + this.monthBytes = monthBytes; + return this; + } + + /** + * The total number of bytes transferred this month. + * @return monthBytes + */ + @javax.annotation.Nonnull + public Long getMonthBytes() { + return monthBytes; + } + + public void setMonthBytes(Long monthBytes) { + this.monthBytes = monthBytes; + } + public CallsUsageDtoDto blockingApiCalls(Long blockingApiCalls) { + this.blockingApiCalls = blockingApiCalls; + return this; + } + + /** + * The amount of calls that will block the app. + * @return blockingApiCalls + */ + @javax.annotation.Nonnull + public Long getBlockingApiCalls() { + return blockingApiCalls; + } + + public void setBlockingApiCalls(Long blockingApiCalls) { + this.blockingApiCalls = blockingApiCalls; + } + public CallsUsageDtoDto allowedBytes(Long allowedBytes) { + this.allowedBytes = allowedBytes; + return this; + } + + /** + * The included API traffic. + * @return allowedBytes + */ + @javax.annotation.Nonnull + public Long getAllowedBytes() { + return allowedBytes; + } + + public void setAllowedBytes(Long allowedBytes) { + this.allowedBytes = allowedBytes; + } + public CallsUsageDtoDto allowedCalls(Long allowedCalls) { + this.allowedCalls = allowedCalls; + return this; + } + + /** + * The included API calls. + * @return allowedCalls + */ + @javax.annotation.Nonnull + public Long getAllowedCalls() { + return allowedCalls; + } + + public void setAllowedCalls(Long allowedCalls) { + this.allowedCalls = allowedCalls; + } + public CallsUsageDtoDto averageElapsedMs(Double averageElapsedMs) { + this.averageElapsedMs = averageElapsedMs; + return this; + } + + /** + * The average duration in milliseconds. + * @return averageElapsedMs + */ + @javax.annotation.Nonnull + public Double getAverageElapsedMs() { + return averageElapsedMs; + } + + public void setAverageElapsedMs(Double averageElapsedMs) { + this.averageElapsedMs = averageElapsedMs; + } + public CallsUsageDtoDto details(Map> details) { + this.details = details; + return this; + } + + public CallsUsageDtoDto putDetailsItem(String key, List detailsItem) { + if (this.details == null) { + this.details = new HashMap<>(); } - - public interface AllowedCallsStage { - AverageElapsedMsStage allowedCalls(int allowedCalls); + this.details.put(key, detailsItem); + return this; + } + + /** + * The statistics by date and group. + * @return details + */ + @javax.annotation.Nonnull + public Map> getDetails() { + return details; + } + + public void setDetails(Map> details) { + this.details = details; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface AverageElapsedMsStage { - _FinalStage averageElapsedMs(double averageElapsedMs); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - CallsUsageDtoDto build(); - - _FinalStage details(Map> details); - - _FinalStage putAllDetails(Map> details); - - _FinalStage details(String key, List value); + CallsUsageDtoDto callsUsageDtoDto = (CallsUsageDtoDto) o; + return Objects.equals(this.totalCalls, callsUsageDtoDto.totalCalls) && + Objects.equals(this.totalBytes, callsUsageDtoDto.totalBytes) && + Objects.equals(this.monthCalls, callsUsageDtoDto.monthCalls) && + Objects.equals(this.monthBytes, callsUsageDtoDto.monthBytes) && + Objects.equals(this.blockingApiCalls, callsUsageDtoDto.blockingApiCalls) && + Objects.equals(this.allowedBytes, callsUsageDtoDto.allowedBytes) && + Objects.equals(this.allowedCalls, callsUsageDtoDto.allowedCalls) && + Objects.equals(this.averageElapsedMs, callsUsageDtoDto.averageElapsedMs) && + Objects.equals(this.details, callsUsageDtoDto.details); + } + + @Override + public int hashCode() { + return Objects.hash(totalCalls, totalBytes, monthCalls, monthBytes, blockingApiCalls, allowedBytes, allowedCalls, averageElapsedMs, details); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CallsUsageDtoDto {\n"); + sb.append(" totalCalls: ").append(toIndentedString(totalCalls)).append("\n"); + sb.append(" totalBytes: ").append(toIndentedString(totalBytes)).append("\n"); + sb.append(" monthCalls: ").append(toIndentedString(monthCalls)).append("\n"); + sb.append(" monthBytes: ").append(toIndentedString(monthBytes)).append("\n"); + sb.append(" blockingApiCalls: ").append(toIndentedString(blockingApiCalls)).append("\n"); + sb.append(" allowedBytes: ").append(toIndentedString(allowedBytes)).append("\n"); + sb.append(" allowedCalls: ").append(toIndentedString(allowedCalls)).append("\n"); + sb.append(" averageElapsedMs: ").append(toIndentedString(averageElapsedMs)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements TotalCallsStage, - TotalBytesStage, - MonthCallsStage, - MonthBytesStage, - BlockingApiCallsStage, - AllowedBytesStage, - AllowedCallsStage, - AverageElapsedMsStage, - _FinalStage { - private int totalCalls; - - private int totalBytes; - - private int monthCalls; - - private int monthBytes; - - private int blockingApiCalls; - - private int allowedBytes; - - private int allowedCalls; - - private double averageElapsedMs; - - private Map> details = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(CallsUsageDtoDto other) { - totalCalls(other.getTotalCalls()); - totalBytes(other.getTotalBytes()); - monthCalls(other.getMonthCalls()); - monthBytes(other.getMonthBytes()); - blockingApiCalls(other.getBlockingApiCalls()); - allowedBytes(other.getAllowedBytes()); - allowedCalls(other.getAllowedCalls()); - averageElapsedMs(other.getAverageElapsedMs()); - details(other.getDetails()); - return this; - } - - /** - *

The total number of API calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalCalls") - public TotalBytesStage totalCalls(int totalCalls) { - this.totalCalls = totalCalls; - return this; - } - - /** - *

The total number of bytes transferred.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalBytes") - public MonthCallsStage totalBytes(int totalBytes) { - this.totalBytes = totalBytes; - return this; - } - - /** - *

The total number of API calls this month.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("monthCalls") - public MonthBytesStage monthCalls(int monthCalls) { - this.monthCalls = monthCalls; - return this; - } - - /** - *

The total number of bytes transferred this month.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("monthBytes") - public BlockingApiCallsStage monthBytes(int monthBytes) { - this.monthBytes = monthBytes; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("totalCalls"); + openapiFields.add("totalBytes"); + openapiFields.add("monthCalls"); + openapiFields.add("monthBytes"); + openapiFields.add("blockingApiCalls"); + openapiFields.add("allowedBytes"); + openapiFields.add("allowedCalls"); + openapiFields.add("averageElapsedMs"); + openapiFields.add("details"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("totalCalls"); + openapiRequiredFields.add("totalBytes"); + openapiRequiredFields.add("monthCalls"); + openapiRequiredFields.add("monthBytes"); + openapiRequiredFields.add("blockingApiCalls"); + openapiRequiredFields.add("allowedBytes"); + openapiRequiredFields.add("allowedCalls"); + openapiRequiredFields.add("averageElapsedMs"); + openapiRequiredFields.add("details"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CallsUsageDtoDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CallsUsageDtoDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CallsUsageDtoDto is not found in the empty JSON string", CallsUsageDtoDto.openapiRequiredFields.toString())); } + } - /** - *

The amount of calls that will block the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("blockingApiCalls") - public AllowedBytesStage blockingApiCalls(int blockingApiCalls) { - this.blockingApiCalls = blockingApiCalls; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CallsUsageDtoDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CallsUsageDtoDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The included API traffic.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("allowedBytes") - public AllowedCallsStage allowedBytes(int allowedBytes) { - this.allowedBytes = allowedBytes; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CallsUsageDtoDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } - /** - *

The included API calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("allowedCalls") - public AverageElapsedMsStage allowedCalls(int allowedCalls) { - this.allowedCalls = allowedCalls; - return this; - } - - /** - *

The average duration in milliseconds.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("averageElapsedMs") - public _FinalStage averageElapsedMs(double averageElapsedMs) { - this.averageElapsedMs = averageElapsedMs; - return this; - } - - /** - *

The statistics by date and group.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage details(String key, List value) { - this.details.put(key, value); - return this; - } - - /** - *

The statistics by date and group.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllDetails(Map> details) { - this.details.putAll(details); - return this; - } - - @Override - @JsonSetter(value = "details", nulls = Nulls.SKIP) - public _FinalStage details(Map> details) { - this.details.clear(); - this.details.putAll(details); - return this; - } - - @Override - public CallsUsageDtoDto build() { - return new CallsUsageDtoDto( - totalCalls, - totalBytes, - monthCalls, - monthBytes, - blockingApiCalls, - allowedBytes, - allowedCalls, - averageElapsedMs, - details); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CallsUsageDtoDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CallsUsageDtoDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CallsUsageDtoDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CallsUsageDtoDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CallsUsageDtoDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of CallsUsageDtoDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallsUsageDtoDto + * @throws IOException if the JSON string is invalid with respect to CallsUsageDtoDto + */ + public static CallsUsageDtoDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CallsUsageDtoDto.class); + } + + /** + * Convert an instance of CallsUsageDtoDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java b/src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java index 2c5d224..4c188cc 100644 --- a/src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java +++ b/src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java @@ -1,184 +1,279 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CallsUsagePerDateDto.Builder.class) -public final class CallsUsagePerDateDto { - private final String date; - - private final int totalCalls; - - private final int totalBytes; - - private final double averageElapsedMs; - - private CallsUsagePerDateDto(String date, int totalCalls, int totalBytes, double averageElapsedMs) { - this.date = date; - this.totalCalls = totalCalls; - this.totalBytes = totalBytes; - this.averageElapsedMs = averageElapsedMs; - } - - /** - * @return The date when the usage was tracked. - */ - @JsonProperty("date") - public String getDate() { - return date; - } - - /** - * @return The total number of API calls. - */ - @JsonProperty("totalCalls") - public int getTotalCalls() { - return totalCalls; - } - - /** - * @return The total number of bytes transferred. - */ - @JsonProperty("totalBytes") - public int getTotalBytes() { - return totalBytes; - } - /** - * @return The average duration in milliseconds. - */ - @JsonProperty("averageElapsedMs") - public double getAverageElapsedMs() { - return averageElapsedMs; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CallsUsagePerDateDto && equalTo((CallsUsagePerDateDto) other); - } - private boolean equalTo(CallsUsagePerDateDto other) { - return date.equals(other.date) - && totalCalls == other.totalCalls - && totalBytes == other.totalBytes - && averageElapsedMs == other.averageElapsedMs; - } - - @Override - public int hashCode() { - return Objects.hash(this.date, this.totalCalls, this.totalBytes, this.averageElapsedMs); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DateStage builder() { - return new Builder(); - } - - public interface DateStage { - TotalCallsStage date(String date); - - Builder from(CallsUsagePerDateDto other); - } +package com.squidex.api.types; - public interface TotalCallsStage { - TotalBytesStage totalCalls(int totalCalls); - } +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.LocalDate; +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.squidex.api.core.JSON; - public interface TotalBytesStage { - AverageElapsedMsStage totalBytes(int totalBytes); +/** + * CallsUsagePerDateDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CallsUsagePerDateDto { + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + private LocalDate date; + public static final String SERIALIZED_NAME_TOTAL_CALLS = "totalCalls"; + @SerializedName(SERIALIZED_NAME_TOTAL_CALLS) + private Long totalCalls; + public static final String SERIALIZED_NAME_TOTAL_BYTES = "totalBytes"; + @SerializedName(SERIALIZED_NAME_TOTAL_BYTES) + private Long totalBytes; + public static final String SERIALIZED_NAME_AVERAGE_ELAPSED_MS = "averageElapsedMs"; + @SerializedName(SERIALIZED_NAME_AVERAGE_ELAPSED_MS) + private Double averageElapsedMs; + public CallsUsagePerDateDto() { + } + public CallsUsagePerDateDto date(LocalDate date) { + this.date = date; + return this; + } + + /** + * The date when the usage was tracked. + * @return date + */ + @javax.annotation.Nonnull + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + public CallsUsagePerDateDto totalCalls(Long totalCalls) { + this.totalCalls = totalCalls; + return this; + } + + /** + * The total number of API calls. + * @return totalCalls + */ + @javax.annotation.Nonnull + public Long getTotalCalls() { + return totalCalls; + } + + public void setTotalCalls(Long totalCalls) { + this.totalCalls = totalCalls; + } + public CallsUsagePerDateDto totalBytes(Long totalBytes) { + this.totalBytes = totalBytes; + return this; + } + + /** + * The total number of bytes transferred. + * @return totalBytes + */ + @javax.annotation.Nonnull + public Long getTotalBytes() { + return totalBytes; + } + + public void setTotalBytes(Long totalBytes) { + this.totalBytes = totalBytes; + } + public CallsUsagePerDateDto averageElapsedMs(Double averageElapsedMs) { + this.averageElapsedMs = averageElapsedMs; + return this; + } + + /** + * The average duration in milliseconds. + * @return averageElapsedMs + */ + @javax.annotation.Nonnull + public Double getAverageElapsedMs() { + return averageElapsedMs; + } + + public void setAverageElapsedMs(Double averageElapsedMs) { + this.averageElapsedMs = averageElapsedMs; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface AverageElapsedMsStage { - _FinalStage averageElapsedMs(double averageElapsedMs); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - CallsUsagePerDateDto build(); + CallsUsagePerDateDto callsUsagePerDateDto = (CallsUsagePerDateDto) o; + return Objects.equals(this.date, callsUsagePerDateDto.date) && + Objects.equals(this.totalCalls, callsUsagePerDateDto.totalCalls) && + Objects.equals(this.totalBytes, callsUsagePerDateDto.totalBytes) && + Objects.equals(this.averageElapsedMs, callsUsagePerDateDto.averageElapsedMs); + } + + @Override + public int hashCode() { + return Objects.hash(date, totalCalls, totalBytes, averageElapsedMs); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CallsUsagePerDateDto {\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" totalCalls: ").append(toIndentedString(totalCalls)).append("\n"); + sb.append(" totalBytes: ").append(toIndentedString(totalBytes)).append("\n"); + sb.append(" averageElapsedMs: ").append(toIndentedString(averageElapsedMs)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements DateStage, TotalCallsStage, TotalBytesStage, AverageElapsedMsStage, _FinalStage { - private String date; - - private int totalCalls; - - private int totalBytes; - - private double averageElapsedMs; - - private Builder() {} - - @Override - public Builder from(CallsUsagePerDateDto other) { - date(other.getDate()); - totalCalls(other.getTotalCalls()); - totalBytes(other.getTotalBytes()); - averageElapsedMs(other.getAverageElapsedMs()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("date"); + openapiFields.add("totalCalls"); + openapiFields.add("totalBytes"); + openapiFields.add("averageElapsedMs"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("date"); + openapiRequiredFields.add("totalCalls"); + openapiRequiredFields.add("totalBytes"); + openapiRequiredFields.add("averageElapsedMs"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CallsUsagePerDateDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CallsUsagePerDateDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CallsUsagePerDateDto is not found in the empty JSON string", CallsUsagePerDateDto.openapiRequiredFields.toString())); } + } - /** - *

The date when the usage was tracked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("date") - public TotalCallsStage date(String date) { - this.date = date; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CallsUsagePerDateDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CallsUsagePerDateDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The total number of API calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalCalls") - public TotalBytesStage totalCalls(int totalCalls) { - this.totalCalls = totalCalls; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CallsUsagePerDateDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } - /** - *

The total number of bytes transferred.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalBytes") - public AverageElapsedMsStage totalBytes(int totalBytes) { - this.totalBytes = totalBytes; - return this; - } - - /** - *

The average duration in milliseconds.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("averageElapsedMs") - public _FinalStage averageElapsedMs(double averageElapsedMs) { - this.averageElapsedMs = averageElapsedMs; - return this; - } - - @Override - public CallsUsagePerDateDto build() { - return new CallsUsagePerDateDto(date, totalCalls, totalBytes, averageElapsedMs); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CallsUsagePerDateDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CallsUsagePerDateDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CallsUsagePerDateDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CallsUsagePerDateDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CallsUsagePerDateDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of CallsUsagePerDateDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CallsUsagePerDateDto + * @throws IOException if the JSON string is invalid with respect to CallsUsagePerDateDto + */ + public static CallsUsagePerDateDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CallsUsagePerDateDto.class); + } + + /** + * Convert an instance of CallsUsagePerDateDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ChangeCategoryDto.java b/src/main/java/com/squidex/api/types/ChangeCategoryDto.java new file mode 100644 index 0000000..f6ebe8d --- /dev/null +++ b/src/main/java/com/squidex/api/types/ChangeCategoryDto.java @@ -0,0 +1,213 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * ChangeCategoryDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ChangeCategoryDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public ChangeCategoryDto() { + } + public ChangeCategoryDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the category. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangeCategoryDto changeCategoryDto = (ChangeCategoryDto) o; + return Objects.equals(this.name, changeCategoryDto.name); + } + + 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(name); + } + + 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 ChangeCategoryDto {\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("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 ChangeCategoryDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangeCategoryDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangeCategoryDto is not found in the empty JSON string", ChangeCategoryDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangeCategoryDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangeCategoryDto` 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChangeCategoryDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangeCategoryDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangeCategoryDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangeCategoryDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangeCategoryDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChangeCategoryDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangeCategoryDto + * @throws IOException if the JSON string is invalid with respect to ChangeCategoryDto + */ + public static ChangeCategoryDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangeCategoryDto.class); + } + + /** + * Convert an instance of ChangeCategoryDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/ChangePlanDto.java b/src/main/java/com/squidex/api/types/ChangePlanDto.java index d23104f..96bad70 100644 --- a/src/main/java/com/squidex/api/types/ChangePlanDto.java +++ b/src/main/java/com/squidex/api/types/ChangePlanDto.java @@ -1,93 +1,209 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ChangePlanDto.Builder.class) -public final class ChangePlanDto { - private final String planId; - - private ChangePlanDto(String planId) { - this.planId = planId; - } - /** - * @return The new plan id. - */ - @JsonProperty("planId") - public String getPlanId() { - return planId; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ChangePlanDto && equalTo((ChangePlanDto) other); - } - private boolean equalTo(ChangePlanDto other) { - return planId.equals(other.planId); - } - - @Override - public int hashCode() { - return Objects.hash(this.planId); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.core.JSON; - public static PlanIdStage builder() { - return new Builder(); +/** + * ChangePlanDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ChangePlanDto { + public static final String SERIALIZED_NAME_PLAN_ID = "planId"; + @SerializedName(SERIALIZED_NAME_PLAN_ID) + private String planId; + public ChangePlanDto() { + } + public ChangePlanDto planId(String planId) { + this.planId = planId; + return this; + } + + /** + * The new plan id. + * @return planId + */ + @javax.annotation.Nonnull + public String getPlanId() { + return planId; + } + + public void setPlanId(String planId) { + this.planId = planId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface PlanIdStage { - _FinalStage planId(String planId); - - Builder from(ChangePlanDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - ChangePlanDto build(); + ChangePlanDto changePlanDto = (ChangePlanDto) o; + return Objects.equals(this.planId, changePlanDto.planId); + } + + @Override + public int hashCode() { + return Objects.hash(planId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ChangePlanDto {\n"); + sb.append(" planId: ").append(toIndentedString(planId)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements PlanIdStage, _FinalStage { - private String planId; - - private Builder() {} - - @Override - public Builder from(ChangePlanDto other) { - planId(other.getPlanId()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("planId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("planId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ChangePlanDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangePlanDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangePlanDto is not found in the empty JSON string", ChangePlanDto.openapiRequiredFields.toString())); } + } - /** - *

The new plan id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("planId") - public _FinalStage planId(String planId) { - this.planId = planId; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangePlanDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangePlanDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public ChangePlanDto build() { - return new ChangePlanDto(planId); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChangePlanDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("planId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `planId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("planId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ChangePlanDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangePlanDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangePlanDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangePlanDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangePlanDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ChangePlanDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangePlanDto + * @throws IOException if the JSON string is invalid with respect to ChangePlanDto + */ + public static ChangePlanDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangePlanDto.class); + } + + /** + * Convert an instance of ChangePlanDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ChangeStatusDto.java b/src/main/java/com/squidex/api/types/ChangeStatusDto.java new file mode 100644 index 0000000..2d8e820 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ChangeStatusDto.java @@ -0,0 +1,268 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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 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.squidex.api.core.JSON; + +/** + * ChangeStatusDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ChangeStatusDto { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + public static final String SERIALIZED_NAME_DUE_TIME = "dueTime"; + @SerializedName(SERIALIZED_NAME_DUE_TIME) + private OffsetDateTime dueTime; + public static final String SERIALIZED_NAME_CHECK_REFERRERS = "checkReferrers"; + @SerializedName(SERIALIZED_NAME_CHECK_REFERRERS) + private Boolean checkReferrers; + public ChangeStatusDto() { + } + public ChangeStatusDto status(String status) { + this.status = status; + return this; + } + + /** + * The new status. + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + public ChangeStatusDto dueTime(OffsetDateTime dueTime) { + this.dueTime = dueTime; + return this; + } + + /** + * The due time. + * @return dueTime + */ + @javax.annotation.Nullable + public OffsetDateTime getDueTime() { + return dueTime; + } + + public void setDueTime(OffsetDateTime dueTime) { + this.dueTime = dueTime; + } + public ChangeStatusDto checkReferrers(Boolean checkReferrers) { + this.checkReferrers = checkReferrers; + return this; + } + + /** + * True to check referrers of this content. + * @return checkReferrers + */ + @javax.annotation.Nullable + public Boolean getCheckReferrers() { + return checkReferrers; + } + + public void setCheckReferrers(Boolean checkReferrers) { + this.checkReferrers = checkReferrers; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ChangeStatusDto changeStatusDto = (ChangeStatusDto) o; + return Objects.equals(this.status, changeStatusDto.status) && + Objects.equals(this.dueTime, changeStatusDto.dueTime) && + Objects.equals(this.checkReferrers, changeStatusDto.checkReferrers); + } + + 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(status, dueTime, checkReferrers); + } + + 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 ChangeStatusDto {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" dueTime: ").append(toIndentedString(dueTime)).append("\n"); + sb.append(" checkReferrers: ").append(toIndentedString(checkReferrers)).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("status"); + openapiFields.add("dueTime"); + openapiFields.add("checkReferrers"); + + // 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 ChangeStatusDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ChangeStatusDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ChangeStatusDto is not found in the empty JSON string", ChangeStatusDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ChangeStatusDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ChangeStatusDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ChangeStatusDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!ChangeStatusDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ChangeStatusDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ChangeStatusDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ChangeStatusDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ChangeStatusDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ChangeStatusDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ChangeStatusDto + * @throws IOException if the JSON string is invalid with respect to ChangeStatusDto + */ + public static ChangeStatusDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ChangeStatusDto.class); + } + + /** + * Convert an instance of ChangeStatusDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/ClientDto.java b/src/main/java/com/squidex/api/types/ClientDto.java index 8f187fa..9c18e0f 100644 --- a/src/main/java/com/squidex/api/types/ClientDto.java +++ b/src/main/java/com/squidex/api/types/ClientDto.java @@ -1,356 +1,408 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ClientDto.Builder.class) -public final class ClientDto implements IResource { - private final Map links; - - private final String id; - - private final String secret; - - private final String name; - - private final Optional role; - - private final int apiCallsLimit; - - private final int apiTrafficLimit; - - private final boolean allowAnonymous; - - private ClientDto( - Map links, - String id, - String secret, - String name, - Optional role, - int apiCallsLimit, - int apiTrafficLimit, - boolean allowAnonymous) { - this.links = links; - this.id = id; - this.secret = secret; - this.name = name; - this.role = role; - this.apiCallsLimit = apiCallsLimit; - this.apiTrafficLimit = apiTrafficLimit; - this.allowAnonymous = allowAnonymous; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The client id. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The client secret. - */ - @JsonProperty("secret") - public String getSecret() { - return secret; - } - - /** - * @return The client name. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The role of the client. - */ - @JsonProperty("role") - public Optional getRole() { - return role; - } - - /** - * @return The number of allowed api calls per month for this client. - */ - @JsonProperty("apiCallsLimit") - public int getApiCallsLimit() { - return apiCallsLimit; - } - - /** - * @return The number of allowed api traffic bytes per month for this client. - */ - @JsonProperty("apiTrafficLimit") - public int getApiTrafficLimit() { - return apiTrafficLimit; - } - - /** - * @return True to allow anonymous access without an access token for this client. - */ - @JsonProperty("allowAnonymous") - public boolean getAllowAnonymous() { - return allowAnonymous; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ClientDto && equalTo((ClientDto) other); - } - private boolean equalTo(ClientDto other) { - return links.equals(other.links) - && id.equals(other.id) - && secret.equals(other.secret) - && name.equals(other.name) - && role.equals(other.role) - && apiCallsLimit == other.apiCallsLimit - && apiTrafficLimit == other.apiTrafficLimit - && allowAnonymous == other.allowAnonymous; - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.secret, - this.name, - this.role, - this.apiCallsLimit, - this.apiTrafficLimit, - this.allowAnonymous); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - SecretStage id(String id); +package com.squidex.api.types; - Builder from(ClientDto other); - } +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.squidex.api.types.ResourceLink; +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; - public interface SecretStage { - NameStage secret(String secret); - } +import com.squidex.api.core.JSON; - public interface NameStage { - ApiCallsLimitStage name(String name); +/** + * ClientDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ClientDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_SECRET = "secret"; + @SerializedName(SERIALIZED_NAME_SECRET) + private String secret; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_ROLE = "role"; + @SerializedName(SERIALIZED_NAME_ROLE) + private String role; + public static final String SERIALIZED_NAME_API_CALLS_LIMIT = "apiCallsLimit"; + @SerializedName(SERIALIZED_NAME_API_CALLS_LIMIT) + private Long apiCallsLimit; + public static final String SERIALIZED_NAME_API_TRAFFIC_LIMIT = "apiTrafficLimit"; + @SerializedName(SERIALIZED_NAME_API_TRAFFIC_LIMIT) + private Long apiTrafficLimit; + public static final String SERIALIZED_NAME_ALLOW_ANONYMOUS = "allowAnonymous"; + @SerializedName(SERIALIZED_NAME_ALLOW_ANONYMOUS) + private Boolean allowAnonymous; + public ClientDto() { + } + public ClientDto links(Map links) { + this.links = links; + return this; + } + + public ClientDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface ApiCallsLimitStage { - ApiTrafficLimitStage apiCallsLimit(int apiCallsLimit); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public ClientDto id(String id) { + this.id = id; + return this; + } + + /** + * The client id. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public ClientDto secret(String secret) { + this.secret = secret; + return this; + } + + /** + * The client secret. + * @return secret + */ + @javax.annotation.Nonnull + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + public ClientDto name(String name) { + this.name = name; + return this; + } + + /** + * The client name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public ClientDto role(String role) { + this.role = role; + return this; + } + + /** + * The role of the client. + * @return role + */ + @javax.annotation.Nullable + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + public ClientDto apiCallsLimit(Long apiCallsLimit) { + this.apiCallsLimit = apiCallsLimit; + return this; + } + + /** + * The number of allowed api calls per month for this client. + * @return apiCallsLimit + */ + @javax.annotation.Nonnull + public Long getApiCallsLimit() { + return apiCallsLimit; + } + + public void setApiCallsLimit(Long apiCallsLimit) { + this.apiCallsLimit = apiCallsLimit; + } + public ClientDto apiTrafficLimit(Long apiTrafficLimit) { + this.apiTrafficLimit = apiTrafficLimit; + return this; + } + + /** + * The number of allowed api traffic bytes per month for this client. + * @return apiTrafficLimit + */ + @javax.annotation.Nonnull + public Long getApiTrafficLimit() { + return apiTrafficLimit; + } + + public void setApiTrafficLimit(Long apiTrafficLimit) { + this.apiTrafficLimit = apiTrafficLimit; + } + public ClientDto allowAnonymous(Boolean allowAnonymous) { + this.allowAnonymous = allowAnonymous; + return this; + } + + /** + * True to allow anonymous access without an access token for this client. + * @return allowAnonymous + */ + @javax.annotation.Nonnull + public Boolean getAllowAnonymous() { + return allowAnonymous; + } + + public void setAllowAnonymous(Boolean allowAnonymous) { + this.allowAnonymous = allowAnonymous; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ApiTrafficLimitStage { - AllowAnonymousStage apiTrafficLimit(int apiTrafficLimit); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface AllowAnonymousStage { - _FinalStage allowAnonymous(boolean allowAnonymous); + ClientDto clientDto = (ClientDto) o; + return Objects.equals(this.links, clientDto.links) && + Objects.equals(this.id, clientDto.id) && + Objects.equals(this.secret, clientDto.secret) && + Objects.equals(this.name, clientDto.name) && + Objects.equals(this.role, clientDto.role) && + Objects.equals(this.apiCallsLimit, clientDto.apiCallsLimit) && + Objects.equals(this.apiTrafficLimit, clientDto.apiTrafficLimit) && + Objects.equals(this.allowAnonymous, clientDto.allowAnonymous); + } + + 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(links, id, secret, name, role, apiCallsLimit, apiTrafficLimit, allowAnonymous); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - ClientDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage role(Optional role); - - _FinalStage role(String role); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClientDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" secret: ").append(toIndentedString(secret)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" apiCallsLimit: ").append(toIndentedString(apiCallsLimit)).append("\n"); + sb.append(" apiTrafficLimit: ").append(toIndentedString(apiTrafficLimit)).append("\n"); + sb.append(" allowAnonymous: ").append(toIndentedString(allowAnonymous)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - SecretStage, - NameStage, - ApiCallsLimitStage, - ApiTrafficLimitStage, - AllowAnonymousStage, - _FinalStage { - private String id; - - private String secret; - - private String name; - - private int apiCallsLimit; - - private int apiTrafficLimit; - - private boolean allowAnonymous; - - private Optional role = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(ClientDto other) { - links(other.getLinks()); - id(other.getId()); - secret(other.getSecret()); - name(other.getName()); - role(other.getRole()); - apiCallsLimit(other.getApiCallsLimit()); - apiTrafficLimit(other.getApiTrafficLimit()); - allowAnonymous(other.getAllowAnonymous()); - return this; - } - - /** - *

The client id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public SecretStage id(String id) { - this.id = id; - return this; - } - - /** - *

The client secret.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("secret") - public NameStage secret(String secret) { - this.secret = secret; - return this; - } - - /** - *

The client name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public ApiCallsLimitStage name(String name) { - this.name = name; - return this; - } - - /** - *

The number of allowed api calls per month for this client.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiCallsLimit") - public ApiTrafficLimitStage apiCallsLimit(int apiCallsLimit) { - this.apiCallsLimit = apiCallsLimit; - return this; - } - - /** - *

The number of allowed api traffic bytes per month for this client.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiTrafficLimit") - public AllowAnonymousStage apiTrafficLimit(int apiTrafficLimit) { - this.apiTrafficLimit = apiTrafficLimit; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("id"); + openapiFields.add("secret"); + openapiFields.add("name"); + openapiFields.add("role"); + openapiFields.add("apiCallsLimit"); + openapiFields.add("apiTrafficLimit"); + openapiFields.add("allowAnonymous"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("secret"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("apiCallsLimit"); + openapiRequiredFields.add("apiTrafficLimit"); + openapiRequiredFields.add("allowAnonymous"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClientDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClientDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClientDto is not found in the empty JSON string", ClientDto.openapiRequiredFields.toString())); } + } - /** - *

True to allow anonymous access without an access token for this client.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("allowAnonymous") - public _FinalStage allowAnonymous(boolean allowAnonymous) { - this.allowAnonymous = allowAnonymous; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClientDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClientDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The role of the client.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage role(String role) { - this.role = Optional.of(role); - return this; - } - - @Override - @JsonSetter(value = "role", nulls = Nulls.SKIP) - public _FinalStage role(Optional role) { - this.role = role; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public ClientDto build() { - return new ClientDto(links, id, secret, name, role, apiCallsLimit, apiTrafficLimit, allowAnonymous); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClientDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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())); + } + 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("role") != null && !jsonObj.get("role").isJsonNull()) && !jsonObj.get("role").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `role` to be a primitive type in the JSON string but got `%s`", jsonObj.get("role").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClientDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClientDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClientDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClientDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ClientDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ClientDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClientDto + * @throws IOException if the JSON string is invalid with respect to ClientDto + */ + public static ClientDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClientDto.class); + } + + /** + * Convert an instance of ClientDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ClientsDto.java b/src/main/java/com/squidex/api/types/ClientsDto.java index 5c21e89..6e5c9db 100644 --- a/src/main/java/com/squidex/api/types/ClientsDto.java +++ b/src/main/java/com/squidex/api/types/ClientsDto.java @@ -1,124 +1,262 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ClientDto; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ClientsDto.Builder.class) -public final class ClientsDto implements IResource { - private final Map links; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final List items; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private ClientsDto(Map links, List items) { - this.links = links; - this.items = items; - } +import com.squidex.api.core.JSON; - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } +/** + * ClientsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ClientsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public ClientsDto() { + } + public ClientsDto links(Map links) { + this.links = links; + return this; + } - /** - * @return The clients. - */ - @JsonProperty("items") - public List getItems() { - return items; + public ClientsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } + this.links.put(key, linksItem); + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ClientsDto && equalTo((ClientsDto) other); - } + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } - private boolean equalTo(ClientsDto other) { - return links.equals(other.links) && items.equals(other.items); - } + public void setLinks(Map links) { + this.links = links; + } + public ClientsDto items(List items) { + this.items = items; + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); + public ClientsDto addItemsItem(ClientDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } + this.items.add(itemsItem); + return this; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + /** + * The clients. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClientsDto clientsDto = (ClientsDto) o; + return Objects.equals(this.links, clientsDto.links) && + Objects.equals(this.items, clientsDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, items); + } - public static Builder builder() { - return new Builder(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClientsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - private List items = new ArrayList<>(); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Builder() {} + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("items"); - public Builder from(ClientsDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + } - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ClientsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ClientsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ClientsDto is not found in the empty JSON string", ClientsDto.openapiRequiredFields.toString())); } + } - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ClientsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ClientsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ClientsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + ClientDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } - public Builder addItems(ClientDto items) { - this.items.add(items); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ClientsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ClientsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ClientsDto.class)); - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ClientsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public ClientsDto build() { - return new ClientsDto(links, items); - } + @Override + public ClientsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ClientsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ClientsDto + * @throws IOException if the JSON string is invalid with respect to ClientsDto + */ + public static ClientsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ClientsDto.class); + } + + /** + * Convert an instance of ClientsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/CommentDto.java b/src/main/java/com/squidex/api/types/CommentDto.java deleted file mode 100644 index bd6337d..0000000 --- a/src/main/java/com/squidex/api/types/CommentDto.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.time.OffsetDateTime; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CommentDto.Builder.class) -public final class CommentDto { - private final String id; - - private final OffsetDateTime time; - - private final String user; - - private final String text; - - private final Optional url; - - private CommentDto(String id, OffsetDateTime time, String user, String text, Optional url) { - this.id = id; - this.time = time; - this.user = user; - this.text = text; - this.url = url; - } - - /** - * @return The ID of the comment. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The time when the comment was created or updated last. - */ - @JsonProperty("time") - public OffsetDateTime getTime() { - return time; - } - - /** - * @return The user who created or updated the comment. - */ - @JsonProperty("user") - public String getUser() { - return user; - } - - /** - * @return The text of the comment. - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return The url where the comment is created. - */ - @JsonProperty("url") - public Optional getUrl() { - return url; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentDto && equalTo((CommentDto) other); - } - - private boolean equalTo(CommentDto other) { - return id.equals(other.id) - && time.equals(other.time) - && user.equals(other.user) - && text.equals(other.text) - && url.equals(other.url); - } - - @Override - public int hashCode() { - return Objects.hash(this.id, this.time, this.user, this.text, this.url); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - TimeStage id(String id); - - Builder from(CommentDto other); - } - - public interface TimeStage { - UserStage time(OffsetDateTime time); - } - - public interface UserStage { - TextStage user(String user); - } - - public interface TextStage { - _FinalStage text(String text); - } - - public interface _FinalStage { - CommentDto build(); - - _FinalStage url(Optional url); - - _FinalStage url(String url); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, TimeStage, UserStage, TextStage, _FinalStage { - private String id; - - private OffsetDateTime time; - - private String user; - - private String text; - - private Optional url = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CommentDto other) { - id(other.getId()); - time(other.getTime()); - user(other.getUser()); - text(other.getText()); - url(other.getUrl()); - return this; - } - - /** - *

The ID of the comment.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public TimeStage id(String id) { - this.id = id; - return this; - } - - /** - *

The time when the comment was created or updated last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("time") - public UserStage time(OffsetDateTime time) { - this.time = time; - return this; - } - - /** - *

The user who created or updated the comment.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("user") - public TextStage user(String user) { - this.user = user; - return this; - } - - /** - *

The text of the comment.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } - - /** - *

The url where the comment is created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage url(String url) { - this.url = Optional.of(url); - return this; - } - - @Override - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public _FinalStage url(Optional url) { - this.url = url; - return this; - } - - @Override - public CommentDto build() { - return new CommentDto(id, time, user, text, url); - } - } -} diff --git a/src/main/java/com/squidex/api/types/CommentRuleActionDto.java b/src/main/java/com/squidex/api/types/CommentRuleActionDto.java index adc094a..9fdfc8a 100644 --- a/src/main/java/com/squidex/api/types/CommentRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/CommentRuleActionDto.java @@ -1,130 +1,245 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CommentRuleActionDto.Builder.class) -public final class CommentRuleActionDto { - private final String text; - - private final Optional client; - - private CommentRuleActionDto(String text, Optional client) { - this.text = text; - this.client = client; - } - - /** - * @return The comment text. - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return An optional client name. - */ - @JsonProperty("client") - public Optional getClient() { - return client; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentRuleActionDto && equalTo((CommentRuleActionDto) other); - } - private boolean equalTo(CommentRuleActionDto other) { - return text.equals(other.text) && client.equals(other.client); - } +package com.squidex.api.types; - @Override - public int hashCode() { - return Objects.hash(this.text, this.client); - } +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.squidex.api.types.RuleActionDto; +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.squidex.api.core.JSON; - @Override - public String toString() { - return ObjectMappers.stringify(this); +/** + * CommentRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CommentRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + public static final String SERIALIZED_NAME_CLIENT = "client"; + @SerializedName(SERIALIZED_NAME_CLIENT) + private String client; + public CommentRuleActionDto() { + } + public CommentRuleActionDto text(String text) { + this.text = text; + return this; + } + + /** + * The comment text. + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + public CommentRuleActionDto client(String client) { + this.client = client; + return this; + } + + /** + * An optional client name. + * @return client + */ + @javax.annotation.Nullable + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public static TextStage builder() { - return new Builder(); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface TextStage { - _FinalStage text(String text); - - Builder from(CommentRuleActionDto other); + CommentRuleActionDto commentRuleActionDto = (CommentRuleActionDto) o; + return Objects.equals(this.text, commentRuleActionDto.text) && + Objects.equals(this.client, commentRuleActionDto.client) && + super.equals(o); + } + + 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(text, client, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - CommentRuleActionDto build(); - - _FinalStage client(Optional client); - - _FinalStage client(String client); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CommentRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" client: ").append(toIndentedString(client)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TextStage, _FinalStage { - private String text; - - private Optional client = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CommentRuleActionDto other) { - text(other.getText()); - client(other.getClient()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("text"); + openapiFields.add("client"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CommentRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CommentRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CommentRuleActionDto is not found in the empty JSON string", CommentRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The comment text.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CommentRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CommentRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

An optional client name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage client(String client) { - this.client = Optional.of(client); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CommentRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @Override - @JsonSetter(value = "client", nulls = Nulls.SKIP) - public _FinalStage client(Optional client) { - this.client = client; - return this; - } - - @Override - public CommentRuleActionDto build() { - return new CommentRuleActionDto(text, client); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CommentRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CommentRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CommentRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CommentRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CommentRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of CommentRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CommentRuleActionDto + * @throws IOException if the JSON string is invalid with respect to CommentRuleActionDto + */ + public static CommentRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CommentRuleActionDto.class); + } + + /** + * Convert an instance of CommentRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java b/src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java index b32c0d9..27c0903 100644 --- a/src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java +++ b/src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java @@ -1,83 +1,221 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.RuleTriggerDto; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CommentRuleTriggerDto.Builder.class) -public final class CommentRuleTriggerDto { - private final Optional condition; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private CommentRuleTriggerDto(Optional condition) { - this.condition = condition; - } +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return Javascript condition when to trigger. - */ - @JsonProperty("condition") - public Optional getCondition() { - return condition; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentRuleTriggerDto && equalTo((CommentRuleTriggerDto) other); - } +/** + * CommentRuleTriggerDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CommentRuleTriggerDto extends RuleTriggerDto { + public static final String SERIALIZED_NAME_CONDITION = "condition"; + @SerializedName(SERIALIZED_NAME_CONDITION) + private String condition; + public CommentRuleTriggerDto() { + } + public CommentRuleTriggerDto condition(String condition) { + this.condition = condition; + return this; + } - private boolean equalTo(CommentRuleTriggerDto other) { - return condition.equals(other.condition); - } + /** + * Javascript condition when to trigger. + * @return condition + */ + @javax.annotation.Nullable + public String getCondition() { + return condition; + } - @Override - public int hashCode() { - return Objects.hash(this.condition); + public void setCondition(String condition) { + this.condition = condition; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + CommentRuleTriggerDto commentRuleTriggerDto = (CommentRuleTriggerDto) o; + return Objects.equals(this.condition, commentRuleTriggerDto.condition) && + super.equals(o); + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + 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(condition, super.hashCode()); + } + + 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 CommentRuleTriggerDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" condition: ").append(toIndentedString(condition)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public static Builder builder() { - return new Builder(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional condition = Optional.empty(); - private Builder() {} + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder from(CommentRuleTriggerDto other) { - condition(other.getCondition()); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("triggerType"); + openapiFields.add("condition"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("triggerType"); + } - @JsonSetter(value = "condition", nulls = Nulls.SKIP) - public Builder condition(Optional condition) { - this.condition = condition; - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CommentRuleTriggerDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CommentRuleTriggerDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CommentRuleTriggerDto is not found in the empty JSON string", CommentRuleTriggerDto.openapiRequiredFields.toString())); } + } - public Builder condition(String condition) { - this.condition = Optional.of(condition); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CommentRuleTriggerDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CommentRuleTriggerDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public CommentRuleTriggerDto build() { - return new CommentRuleTriggerDto(condition); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CommentRuleTriggerDto.openapiRequiredFields) { + if (jsonElement.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 (!CommentRuleTriggerDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CommentRuleTriggerDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CommentRuleTriggerDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CommentRuleTriggerDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CommentRuleTriggerDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of CommentRuleTriggerDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CommentRuleTriggerDto + * @throws IOException if the JSON string is invalid with respect to CommentRuleTriggerDto + */ + public static CommentRuleTriggerDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CommentRuleTriggerDto.class); + } + + /** + * Convert an instance of CommentRuleTriggerDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/CommentsDto.java b/src/main/java/com/squidex/api/types/CommentsDto.java deleted file mode 100644 index d09c17e..0000000 --- a/src/main/java/com/squidex/api/types/CommentsDto.java +++ /dev/null @@ -1,208 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CommentsDto.Builder.class) -public final class CommentsDto { - private final Optional> createdComments; - - private final Optional> updatedComments; - - private final Optional> deletedComments; - - private final int version; - - private CommentsDto( - Optional> createdComments, - Optional> updatedComments, - Optional> deletedComments, - int version) { - this.createdComments = createdComments; - this.updatedComments = updatedComments; - this.deletedComments = deletedComments; - this.version = version; - } - - /** - * @return The created comments including the updates. - */ - @JsonProperty("createdComments") - public Optional> getCreatedComments() { - return createdComments; - } - - /** - * @return The updates comments since the last version. - */ - @JsonProperty("updatedComments") - public Optional> getUpdatedComments() { - return updatedComments; - } - - /** - * @return The deleted comments since the last version. - */ - @JsonProperty("deletedComments") - public Optional> getDeletedComments() { - return deletedComments; - } - - /** - * @return The current version. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentsDto && equalTo((CommentsDto) other); - } - - private boolean equalTo(CommentsDto other) { - return createdComments.equals(other.createdComments) - && updatedComments.equals(other.updatedComments) - && deletedComments.equals(other.deletedComments) - && version == other.version; - } - - @Override - public int hashCode() { - return Objects.hash(this.createdComments, this.updatedComments, this.deletedComments, this.version); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static VersionStage builder() { - return new Builder(); - } - - public interface VersionStage { - _FinalStage version(int version); - - Builder from(CommentsDto other); - } - - public interface _FinalStage { - CommentsDto build(); - - _FinalStage createdComments(Optional> createdComments); - - _FinalStage createdComments(List createdComments); - - _FinalStage updatedComments(Optional> updatedComments); - - _FinalStage updatedComments(List updatedComments); - - _FinalStage deletedComments(Optional> deletedComments); - - _FinalStage deletedComments(List deletedComments); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements VersionStage, _FinalStage { - private int version; - - private Optional> deletedComments = Optional.empty(); - - private Optional> updatedComments = Optional.empty(); - - private Optional> createdComments = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(CommentsDto other) { - createdComments(other.getCreatedComments()); - updatedComments(other.getUpdatedComments()); - deletedComments(other.getDeletedComments()); - version(other.getVersion()); - return this; - } - - /** - *

The current version.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The deleted comments since the last version.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage deletedComments(List deletedComments) { - this.deletedComments = Optional.of(deletedComments); - return this; - } - - @Override - @JsonSetter(value = "deletedComments", nulls = Nulls.SKIP) - public _FinalStage deletedComments(Optional> deletedComments) { - this.deletedComments = deletedComments; - return this; - } - - /** - *

The updates comments since the last version.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage updatedComments(List updatedComments) { - this.updatedComments = Optional.of(updatedComments); - return this; - } - - @Override - @JsonSetter(value = "updatedComments", nulls = Nulls.SKIP) - public _FinalStage updatedComments(Optional> updatedComments) { - this.updatedComments = updatedComments; - return this; - } - - /** - *

The created comments including the updates.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage createdComments(List createdComments) { - this.createdComments = Optional.of(createdComments); - return this; - } - - @Override - @JsonSetter(value = "createdComments", nulls = Nulls.SKIP) - public _FinalStage createdComments(Optional> createdComments) { - this.createdComments = createdComments; - return this; - } - - @Override - public CommentsDto build() { - return new CommentsDto(createdComments, updatedComments, deletedComments, version); - } - } -} diff --git a/src/main/java/com/squidex/api/types/ComponentFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ComponentFieldPropertiesDto.java index 732195b..c4b8522 100644 --- a/src/main/java/com/squidex/api/types/ComponentFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/ComponentFieldPropertiesDto.java @@ -1,84 +1,239 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.FieldPropertiesDto; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ComponentFieldPropertiesDto.Builder.class) -public final class ComponentFieldPropertiesDto { - private final Optional> schemaIds; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private ComponentFieldPropertiesDto(Optional> schemaIds) { - this.schemaIds = schemaIds; - } +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The ID of the embedded schemas. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ComponentFieldPropertiesDto && equalTo((ComponentFieldPropertiesDto) other); - } +/** + * ComponentFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ComponentFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_SCHEMA_IDS = "schemaIds"; + @SerializedName(SERIALIZED_NAME_SCHEMA_IDS) + private List schemaIds; + public ComponentFieldPropertiesDto() { + } + public ComponentFieldPropertiesDto schemaIds(List schemaIds) { + this.schemaIds = schemaIds; + return this; + } - private boolean equalTo(ComponentFieldPropertiesDto other) { - return schemaIds.equals(other.schemaIds); + public ComponentFieldPropertiesDto addSchemaIdsItem(String schemaIdsItem) { + if (this.schemaIds == null) { + this.schemaIds = new ArrayList<>(); } + this.schemaIds.add(schemaIdsItem); + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.schemaIds); + /** + * The ID of the embedded schemas. + * @return schemaIds + */ + @javax.annotation.Nullable + public List getSchemaIds() { + return schemaIds; + } + + public void setSchemaIds(List schemaIds) { + this.schemaIds = schemaIds; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + ComponentFieldPropertiesDto componentFieldPropertiesDto = (ComponentFieldPropertiesDto) o; + return Objects.equals(this.schemaIds, componentFieldPropertiesDto.schemaIds) && + super.equals(o); + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + 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(schemaIds, super.hashCode()); + } + + 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 ComponentFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" schemaIds: ").append(toIndentedString(schemaIds)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public static Builder builder() { - return new Builder(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> schemaIds = Optional.empty(); - private Builder() {} + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder from(ComponentFieldPropertiesDto other) { - schemaIds(other.getSchemaIds()); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("schemaIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public Builder schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ComponentFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ComponentFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ComponentFieldPropertiesDto is not found in the empty JSON string", ComponentFieldPropertiesDto.openapiRequiredFields.toString())); } + } - public Builder schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ComponentFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ComponentFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public ComponentFieldPropertiesDto build() { - return new ComponentFieldPropertiesDto(schemaIds); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ComponentFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.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 (!ComponentFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ComponentFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ComponentFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ComponentFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ComponentFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ComponentFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ComponentFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to ComponentFieldPropertiesDto + */ + public static ComponentFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ComponentFieldPropertiesDto.class); + } + + /** + * Convert an instance of ComponentFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java index c8c0587..9179db3 100644 --- a/src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java @@ -1,195 +1,340 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ComponentsFieldPropertiesDto.Builder.class) -public final class ComponentsFieldPropertiesDto { - private final Optional minItems; - - private final Optional maxItems; - private final Optional calculatedDefaultValue; - private final Optional> schemaIds; - - private final Optional> uniqueFields; - - private ComponentsFieldPropertiesDto( - Optional minItems, - Optional maxItems, - Optional calculatedDefaultValue, - Optional> schemaIds, - Optional> uniqueFields) { - this.minItems = minItems; - this.maxItems = maxItems; - this.calculatedDefaultValue = calculatedDefaultValue; - this.schemaIds = schemaIds; - this.uniqueFields = uniqueFields; - } - - /** - * @return The minimum allowed items for the field value. - */ - @JsonProperty("minItems") - public Optional getMinItems() { - return minItems; - } +package com.squidex.api.types; - /** - * @return The maximum allowed items for the field value. - */ - @JsonProperty("maxItems") - public Optional getMaxItems() { - return maxItems; - } +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.squidex.api.types.ArrayCalculatedDefaultValue; +import com.squidex.api.types.FieldPropertiesDto; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +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; - /** - * @return The calculated default value for the field value. - */ - @JsonProperty("calculatedDefaultValue") - public Optional getCalculatedDefaultValue() { - return calculatedDefaultValue; - } +import com.squidex.api.core.JSON; - /** - * @return The ID of the embedded schemas. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; +/** + * ComponentsFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ComponentsFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_MIN_ITEMS = "minItems"; + @SerializedName(SERIALIZED_NAME_MIN_ITEMS) + private Integer minItems; + public static final String SERIALIZED_NAME_MAX_ITEMS = "maxItems"; + @SerializedName(SERIALIZED_NAME_MAX_ITEMS) + private Integer maxItems; + public static final String SERIALIZED_NAME_CALCULATED_DEFAULT_VALUE = "calculatedDefaultValue"; + @SerializedName(SERIALIZED_NAME_CALCULATED_DEFAULT_VALUE) + private ArrayCalculatedDefaultValue calculatedDefaultValue; + public static final String SERIALIZED_NAME_SCHEMA_IDS = "schemaIds"; + @SerializedName(SERIALIZED_NAME_SCHEMA_IDS) + private List schemaIds; + public static final String SERIALIZED_NAME_UNIQUE_FIELDS = "uniqueFields"; + @SerializedName(SERIALIZED_NAME_UNIQUE_FIELDS) + private List uniqueFields; + public ComponentsFieldPropertiesDto() { + } + public ComponentsFieldPropertiesDto minItems(Integer minItems) { + this.minItems = minItems; + return this; + } + + /** + * The minimum allowed items for the field value. + * @return minItems + */ + @javax.annotation.Nullable + public Integer getMinItems() { + return minItems; + } + + public void setMinItems(Integer minItems) { + this.minItems = minItems; + } + public ComponentsFieldPropertiesDto maxItems(Integer maxItems) { + this.maxItems = maxItems; + return this; + } + + /** + * The maximum allowed items for the field value. + * @return maxItems + */ + @javax.annotation.Nullable + public Integer getMaxItems() { + return maxItems; + } + + public void setMaxItems(Integer maxItems) { + this.maxItems = maxItems; + } + public ComponentsFieldPropertiesDto calculatedDefaultValue(ArrayCalculatedDefaultValue calculatedDefaultValue) { + this.calculatedDefaultValue = calculatedDefaultValue; + return this; + } + + /** + * Get calculatedDefaultValue + * @return calculatedDefaultValue + */ + @javax.annotation.Nullable + public ArrayCalculatedDefaultValue getCalculatedDefaultValue() { + return calculatedDefaultValue; + } + + public void setCalculatedDefaultValue(ArrayCalculatedDefaultValue calculatedDefaultValue) { + this.calculatedDefaultValue = calculatedDefaultValue; + } + public ComponentsFieldPropertiesDto schemaIds(List schemaIds) { + this.schemaIds = schemaIds; + return this; + } + + public ComponentsFieldPropertiesDto addSchemaIdsItem(String schemaIdsItem) { + if (this.schemaIds == null) { + this.schemaIds = new ArrayList<>(); } - - /** - * @return The fields that must be unique. - */ - @JsonProperty("uniqueFields") - public Optional> getUniqueFields() { - return uniqueFields; + this.schemaIds.add(schemaIdsItem); + return this; + } + + /** + * The ID of the embedded schemas. + * @return schemaIds + */ + @javax.annotation.Nullable + public List getSchemaIds() { + return schemaIds; + } + + public void setSchemaIds(List schemaIds) { + this.schemaIds = schemaIds; + } + public ComponentsFieldPropertiesDto uniqueFields(List uniqueFields) { + this.uniqueFields = uniqueFields; + return this; + } + + public ComponentsFieldPropertiesDto addUniqueFieldsItem(String uniqueFieldsItem) { + if (this.uniqueFields == null) { + this.uniqueFields = new ArrayList<>(); } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ComponentsFieldPropertiesDto && equalTo((ComponentsFieldPropertiesDto) other); + this.uniqueFields.add(uniqueFieldsItem); + return this; + } + + /** + * The fields that must be unique. + * @return uniqueFields + */ + @javax.annotation.Nullable + public List getUniqueFields() { + return uniqueFields; + } + + public void setUniqueFields(List uniqueFields) { + this.uniqueFields = uniqueFields; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - private boolean equalTo(ComponentsFieldPropertiesDto other) { - return minItems.equals(other.minItems) - && maxItems.equals(other.maxItems) - && calculatedDefaultValue.equals(other.calculatedDefaultValue) - && schemaIds.equals(other.schemaIds) - && uniqueFields.equals(other.uniqueFields); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public int hashCode() { - return Objects.hash( - this.minItems, this.maxItems, this.calculatedDefaultValue, this.schemaIds, this.uniqueFields); + ComponentsFieldPropertiesDto componentsFieldPropertiesDto = (ComponentsFieldPropertiesDto) o; + return Objects.equals(this.minItems, componentsFieldPropertiesDto.minItems) && + Objects.equals(this.maxItems, componentsFieldPropertiesDto.maxItems) && + Objects.equals(this.calculatedDefaultValue, componentsFieldPropertiesDto.calculatedDefaultValue) && + Objects.equals(this.schemaIds, componentsFieldPropertiesDto.schemaIds) && + Objects.equals(this.uniqueFields, componentsFieldPropertiesDto.uniqueFields) && + super.equals(o); + } + + 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(minItems, maxItems, calculatedDefaultValue, schemaIds, uniqueFields, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ComponentsFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" minItems: ").append(toIndentedString(minItems)).append("\n"); + sb.append(" maxItems: ").append(toIndentedString(maxItems)).append("\n"); + sb.append(" calculatedDefaultValue: ").append(toIndentedString(calculatedDefaultValue)).append("\n"); + sb.append(" schemaIds: ").append(toIndentedString(schemaIds)).append("\n"); + sb.append(" uniqueFields: ").append(toIndentedString(uniqueFields)).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"; } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional minItems = Optional.empty(); - - private Optional maxItems = Optional.empty(); - - private Optional calculatedDefaultValue = Optional.empty(); - - private Optional> schemaIds = Optional.empty(); - - private Optional> uniqueFields = Optional.empty(); - - private Builder() {} - - public Builder from(ComponentsFieldPropertiesDto other) { - minItems(other.getMinItems()); - maxItems(other.getMaxItems()); - calculatedDefaultValue(other.getCalculatedDefaultValue()); - schemaIds(other.getSchemaIds()); - uniqueFields(other.getUniqueFields()); - return this; - } - - @JsonSetter(value = "minItems", nulls = Nulls.SKIP) - public Builder minItems(Optional minItems) { - this.minItems = minItems; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("minItems"); + openapiFields.add("maxItems"); + openapiFields.add("calculatedDefaultValue"); + openapiFields.add("schemaIds"); + openapiFields.add("uniqueFields"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ComponentsFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ComponentsFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ComponentsFieldPropertiesDto is not found in the empty JSON string", ComponentsFieldPropertiesDto.openapiRequiredFields.toString())); } + } - public Builder minItems(Integer minItems) { - this.minItems = Optional.of(minItems); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ComponentsFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ComponentsFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @JsonSetter(value = "maxItems", nulls = Nulls.SKIP) - public Builder maxItems(Optional maxItems) { - this.maxItems = maxItems; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ComponentsFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.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 Builder maxItems(Integer maxItems) { - this.maxItems = Optional.of(maxItems); - return this; - } - - @JsonSetter(value = "calculatedDefaultValue", nulls = Nulls.SKIP) - public Builder calculatedDefaultValue(Optional calculatedDefaultValue) { - this.calculatedDefaultValue = calculatedDefaultValue; - return this; - } - - public Builder calculatedDefaultValue(ArrayCalculatedDefaultValue calculatedDefaultValue) { - this.calculatedDefaultValue = Optional.of(calculatedDefaultValue); - return this; - } - - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public Builder schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - public Builder schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - @JsonSetter(value = "uniqueFields", nulls = Nulls.SKIP) - public Builder uniqueFields(Optional> uniqueFields) { - this.uniqueFields = uniqueFields; - return this; - } - - public Builder uniqueFields(List uniqueFields) { - this.uniqueFields = Optional.of(uniqueFields); - return this; - } - - public ComponentsFieldPropertiesDto build() { - return new ComponentsFieldPropertiesDto( - minItems, maxItems, calculatedDefaultValue, schemaIds, uniqueFields); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ComponentsFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ComponentsFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ComponentsFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ComponentsFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ComponentsFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ComponentsFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ComponentsFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to ComponentsFieldPropertiesDto + */ + public static ComponentsFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ComponentsFieldPropertiesDto.class); + } + + /** + * Convert an instance of ComponentsFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ConfigureFieldRulesDto.java b/src/main/java/com/squidex/api/types/ConfigureFieldRulesDto.java new file mode 100644 index 0000000..bd173fa --- /dev/null +++ b/src/main/java/com/squidex/api/types/ConfigureFieldRulesDto.java @@ -0,0 +1,235 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.FieldRuleDto; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +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.squidex.api.core.JSON; + +/** + * ConfigureFieldRulesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ConfigureFieldRulesDto { + public static final String SERIALIZED_NAME_FIELD_RULES = "fieldRules"; + @SerializedName(SERIALIZED_NAME_FIELD_RULES) + private List fieldRules; + public ConfigureFieldRulesDto() { + } + public ConfigureFieldRulesDto fieldRules(List fieldRules) { + this.fieldRules = fieldRules; + return this; + } + + public ConfigureFieldRulesDto addFieldRulesItem(FieldRuleDto fieldRulesItem) { + if (this.fieldRules == null) { + this.fieldRules = new ArrayList<>(); + } + this.fieldRules.add(fieldRulesItem); + return this; + } + + /** + * The field rules to configure. + * @return fieldRules + */ + @javax.annotation.Nullable + public List getFieldRules() { + return fieldRules; + } + + public void setFieldRules(List fieldRules) { + this.fieldRules = fieldRules; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigureFieldRulesDto configureFieldRulesDto = (ConfigureFieldRulesDto) o; + return Objects.equals(this.fieldRules, configureFieldRulesDto.fieldRules); + } + + 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(fieldRules); + } + + 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 ConfigureFieldRulesDto {\n"); + sb.append(" fieldRules: ").append(toIndentedString(fieldRules)).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("fieldRules"); + + // 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 ConfigureFieldRulesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConfigureFieldRulesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConfigureFieldRulesDto is not found in the empty JSON string", ConfigureFieldRulesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ConfigureFieldRulesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ConfigureFieldRulesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if (jsonObj.get("fieldRules") != null && !jsonObj.get("fieldRules").isJsonNull()) { + JsonArray jsonArrayfieldRules = jsonObj.getAsJsonArray("fieldRules"); + if (jsonArrayfieldRules != null) { + // ensure the json data is an array + if (!jsonObj.get("fieldRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldRules` to be an array in the JSON string but got `%s`", jsonObj.get("fieldRules").toString())); + } + + // validate the optional field `fieldRules` (array) + for (int i = 0; i < jsonArrayfieldRules.size(); i++) { + FieldRuleDto.validateJsonElement(jsonArrayfieldRules.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConfigureFieldRulesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConfigureFieldRulesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConfigureFieldRulesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConfigureFieldRulesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ConfigureFieldRulesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConfigureFieldRulesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConfigureFieldRulesDto + * @throws IOException if the JSON string is invalid with respect to ConfigureFieldRulesDto + */ + public static ConfigureFieldRulesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConfigureFieldRulesDto.class); + } + + /** + * Convert an instance of ConfigureFieldRulesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/ConfigureUIFieldsDto.java b/src/main/java/com/squidex/api/types/ConfigureUIFieldsDto.java new file mode 100644 index 0000000..2ce2ab4 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ConfigureUIFieldsDto.java @@ -0,0 +1,259 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.ArrayList; +import java.util.Arrays; +import java.util.List; +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.squidex.api.core.JSON; + +/** + * ConfigureUIFieldsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ConfigureUIFieldsDto { + public static final String SERIALIZED_NAME_FIELDS_IN_LISTS = "fieldsInLists"; + @SerializedName(SERIALIZED_NAME_FIELDS_IN_LISTS) + private List fieldsInLists; + public static final String SERIALIZED_NAME_FIELDS_IN_REFERENCES = "fieldsInReferences"; + @SerializedName(SERIALIZED_NAME_FIELDS_IN_REFERENCES) + private List fieldsInReferences; + public ConfigureUIFieldsDto() { + } + public ConfigureUIFieldsDto fieldsInLists(List fieldsInLists) { + this.fieldsInLists = fieldsInLists; + return this; + } + + public ConfigureUIFieldsDto addFieldsInListsItem(String fieldsInListsItem) { + if (this.fieldsInLists == null) { + this.fieldsInLists = new ArrayList<>(); + } + this.fieldsInLists.add(fieldsInListsItem); + return this; + } + + /** + * The name of fields that are used in content lists. + * @return fieldsInLists + */ + @javax.annotation.Nullable + public List getFieldsInLists() { + return fieldsInLists; + } + + public void setFieldsInLists(List fieldsInLists) { + this.fieldsInLists = fieldsInLists; + } + public ConfigureUIFieldsDto fieldsInReferences(List fieldsInReferences) { + this.fieldsInReferences = fieldsInReferences; + return this; + } + + public ConfigureUIFieldsDto addFieldsInReferencesItem(String fieldsInReferencesItem) { + if (this.fieldsInReferences == null) { + this.fieldsInReferences = new ArrayList<>(); + } + this.fieldsInReferences.add(fieldsInReferencesItem); + return this; + } + + /** + * The name of fields that are used in content references. + * @return fieldsInReferences + */ + @javax.annotation.Nullable + public List getFieldsInReferences() { + return fieldsInReferences; + } + + public void setFieldsInReferences(List fieldsInReferences) { + this.fieldsInReferences = fieldsInReferences; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ConfigureUIFieldsDto configureUIFieldsDto = (ConfigureUIFieldsDto) o; + return Objects.equals(this.fieldsInLists, configureUIFieldsDto.fieldsInLists) && + Objects.equals(this.fieldsInReferences, configureUIFieldsDto.fieldsInReferences); + } + + 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(fieldsInLists, fieldsInReferences); + } + + 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 ConfigureUIFieldsDto {\n"); + sb.append(" fieldsInLists: ").append(toIndentedString(fieldsInLists)).append("\n"); + sb.append(" fieldsInReferences: ").append(toIndentedString(fieldsInReferences)).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("fieldsInLists"); + openapiFields.add("fieldsInReferences"); + + // 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 ConfigureUIFieldsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ConfigureUIFieldsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ConfigureUIFieldsDto is not found in the empty JSON string", ConfigureUIFieldsDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ConfigureUIFieldsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ConfigureUIFieldsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("fieldsInLists") != null && !jsonObj.get("fieldsInLists").isJsonNull() && !jsonObj.get("fieldsInLists").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldsInLists` to be an array in the JSON string but got `%s`", jsonObj.get("fieldsInLists").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("fieldsInReferences") != null && !jsonObj.get("fieldsInReferences").isJsonNull() && !jsonObj.get("fieldsInReferences").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldsInReferences` to be an array in the JSON string but got `%s`", jsonObj.get("fieldsInReferences").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ConfigureUIFieldsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ConfigureUIFieldsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ConfigureUIFieldsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ConfigureUIFieldsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ConfigureUIFieldsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ConfigureUIFieldsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ConfigureUIFieldsDto + * @throws IOException if the JSON string is invalid with respect to ConfigureUIFieldsDto + */ + public static ConfigureUIFieldsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ConfigureUIFieldsDto.class); + } + + /** + * Convert an instance of ConfigureUIFieldsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java b/src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java index 2030b0b..ee62200 100644 --- a/src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java +++ b/src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java @@ -1,171 +1,287 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.RuleTriggerDto; +import com.squidex.api.types.SchemaCondition; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentChangedRuleTriggerDto.Builder.class) -public final class ContentChangedRuleTriggerDto { - private final Optional> schemas; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final Optional> referencedSchemas; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final boolean handleAll; +import com.squidex.api.core.JSON; - private ContentChangedRuleTriggerDto( - Optional> schemas, - Optional> referencedSchemas, - boolean handleAll) { - this.schemas = schemas; - this.referencedSchemas = referencedSchemas; - this.handleAll = handleAll; - } +/** + * ContentChangedRuleTriggerDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ContentChangedRuleTriggerDto extends RuleTriggerDto { + public static final String SERIALIZED_NAME_SCHEMAS = "schemas"; + @SerializedName(SERIALIZED_NAME_SCHEMAS) + private List schemas; + public static final String SERIALIZED_NAME_REFERENCED_SCHEMAS = "referencedSchemas"; + @SerializedName(SERIALIZED_NAME_REFERENCED_SCHEMAS) + private List referencedSchemas; + public static final String SERIALIZED_NAME_HANDLE_ALL = "handleAll"; + @SerializedName(SERIALIZED_NAME_HANDLE_ALL) + private Boolean handleAll; + public ContentChangedRuleTriggerDto() { + } + public ContentChangedRuleTriggerDto schemas(List schemas) { + this.schemas = schemas; + return this; + } - /** - * @return The schema settings. - */ - @JsonProperty("schemas") - public Optional> getSchemas() { - return schemas; + public ContentChangedRuleTriggerDto addSchemasItem(SchemaCondition schemasItem) { + if (this.schemas == null) { + this.schemas = new ArrayList<>(); } + this.schemas.add(schemasItem); + return this; + } - /** - * @return The schema references. - */ - @JsonProperty("referencedSchemas") - public Optional> getReferencedSchemas() { - return referencedSchemas; - } + /** + * The schema settings. + * @return schemas + */ + @javax.annotation.Nullable + public List getSchemas() { + return schemas; + } - /** - * @return Determines whether the trigger should handle all content changes events. - */ - @JsonProperty("handleAll") - public boolean getHandleAll() { - return handleAll; - } + public void setSchemas(List schemas) { + this.schemas = schemas; + } + public ContentChangedRuleTriggerDto referencedSchemas(List referencedSchemas) { + this.referencedSchemas = referencedSchemas; + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentChangedRuleTriggerDto && equalTo((ContentChangedRuleTriggerDto) other); + public ContentChangedRuleTriggerDto addReferencedSchemasItem(SchemaCondition referencedSchemasItem) { + if (this.referencedSchemas == null) { + this.referencedSchemas = new ArrayList<>(); } + this.referencedSchemas.add(referencedSchemasItem); + return this; + } - private boolean equalTo(ContentChangedRuleTriggerDto other) { - return schemas.equals(other.schemas) - && referencedSchemas.equals(other.referencedSchemas) - && handleAll == other.handleAll; - } + /** + * The schema references. + * @return referencedSchemas + */ + @javax.annotation.Nullable + public List getReferencedSchemas() { + return referencedSchemas; + } - @Override - public int hashCode() { - return Objects.hash(this.schemas, this.referencedSchemas, this.handleAll); - } + public void setReferencedSchemas(List referencedSchemas) { + this.referencedSchemas = referencedSchemas; + } + public ContentChangedRuleTriggerDto handleAll(Boolean handleAll) { + this.handleAll = handleAll; + return this; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } + /** + * Determines whether the trigger should handle all content changes events. + * @return handleAll + */ + @javax.annotation.Nonnull + public Boolean getHandleAll() { + return handleAll; + } - public static HandleAllStage builder() { - return new Builder(); - } + public void setHandleAll(Boolean handleAll) { + this.handleAll = handleAll; + } - public interface HandleAllStage { - _FinalStage handleAll(boolean handleAll); - Builder from(ContentChangedRuleTriggerDto other); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + ContentChangedRuleTriggerDto contentChangedRuleTriggerDto = (ContentChangedRuleTriggerDto) o; + return Objects.equals(this.schemas, contentChangedRuleTriggerDto.schemas) && + Objects.equals(this.referencedSchemas, contentChangedRuleTriggerDto.referencedSchemas) && + Objects.equals(this.handleAll, contentChangedRuleTriggerDto.handleAll) && + super.equals(o); + } - public interface _FinalStage { - ContentChangedRuleTriggerDto build(); + 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())); + } - _FinalStage schemas(Optional> schemas); + @Override + public int hashCode() { + return Objects.hash(schemas, referencedSchemas, handleAll, super.hashCode()); + } - _FinalStage schemas(List schemas); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - _FinalStage referencedSchemas(Optional> referencedSchemas); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContentChangedRuleTriggerDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" schemas: ").append(toIndentedString(schemas)).append("\n"); + sb.append(" referencedSchemas: ").append(toIndentedString(referencedSchemas)).append("\n"); + sb.append(" handleAll: ").append(toIndentedString(handleAll)).append("\n"); + sb.append("}"); + return sb.toString(); + } - _FinalStage referencedSchemas(List referencedSchemas); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements HandleAllStage, _FinalStage { - private boolean handleAll; - private Optional> referencedSchemas = Optional.empty(); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Optional> schemas = Optional.empty(); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("triggerType"); + openapiFields.add("schemas"); + openapiFields.add("referencedSchemas"); + openapiFields.add("handleAll"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("handleAll"); + openapiRequiredFields.add("triggerType"); + } - @Override - public Builder from(ContentChangedRuleTriggerDto other) { - schemas(other.getSchemas()); - referencedSchemas(other.getReferencedSchemas()); - handleAll(other.getHandleAll()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContentChangedRuleTriggerDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ContentChangedRuleTriggerDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ContentChangedRuleTriggerDto is not found in the empty JSON string", ContentChangedRuleTriggerDto.openapiRequiredFields.toString())); } + } - /** - *

Determines whether the trigger should handle all content changes events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("handleAll") - public _FinalStage handleAll(boolean handleAll) { - this.handleAll = handleAll; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContentChangedRuleTriggerDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContentChangedRuleTriggerDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The schema references.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage referencedSchemas(List referencedSchemas) { - this.referencedSchemas = Optional.of(referencedSchemas); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ContentChangedRuleTriggerDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @Override - @JsonSetter(value = "referencedSchemas", nulls = Nulls.SKIP) - public _FinalStage referencedSchemas(Optional> referencedSchemas) { - this.referencedSchemas = referencedSchemas; - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ContentChangedRuleTriggerDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContentChangedRuleTriggerDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ContentChangedRuleTriggerDto.class)); - /** - *

The schema settings.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schemas(List schemas) { - this.schemas = Optional.of(schemas); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ContentChangedRuleTriggerDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - @JsonSetter(value = "schemas", nulls = Nulls.SKIP) - public _FinalStage schemas(Optional> schemas) { - this.schemas = schemas; - return this; - } + @Override + public ContentChangedRuleTriggerDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } - @Override - public ContentChangedRuleTriggerDto build() { - return new ContentChangedRuleTriggerDto(schemas, referencedSchemas, handleAll); - } + }.nullSafe(); } + } + + /** + * Create an instance of ContentChangedRuleTriggerDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContentChangedRuleTriggerDto + * @throws IOException if the JSON string is invalid with respect to ContentChangedRuleTriggerDto + */ + public static ContentChangedRuleTriggerDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ContentChangedRuleTriggerDto.class); + } + + /** + * Convert an instance of ContentChangedRuleTriggerDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ContentDto.java b/src/main/java/com/squidex/api/types/ContentDto.java index ac772da..5776292 100644 --- a/src/main/java/com/squidex/api/types/ContentDto.java +++ b/src/main/java/com/squidex/api/types/ContentDto.java @@ -1,802 +1,749 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.FieldDto; +import com.squidex.api.types.ResourceLink; +import com.squidex.api.types.ScheduleJobDto; +import java.io.IOException; import java.time.OffsetDateTime; -import java.util.LinkedHashMap; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentDto.Builder.class) -public final class ContentDto implements IResource { - private final Map links; - - private final String id; - - private final String createdBy; - - private final String lastModifiedBy; - - private final Object data; - - private final Optional>> referenceData; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final String status; - - private final Optional newStatus; - - private final String statusColor; - - private final Optional newStatusColor; - - private final Optional editToken; - - private final Optional scheduleJob; - - private final String schemaId; - - private final Optional schemaName; - - private final Optional schemaDisplayName; - - private final Optional> referenceFields; - - private final boolean isDeleted; - - private final int version; - - private ContentDto( - Map links, - String id, - String createdBy, - String lastModifiedBy, - Object data, - Optional>> referenceData, - OffsetDateTime created, - OffsetDateTime lastModified, - String status, - Optional newStatus, - String statusColor, - Optional newStatusColor, - Optional editToken, - Optional scheduleJob, - String schemaId, - Optional schemaName, - Optional schemaDisplayName, - Optional> referenceFields, - boolean isDeleted, - int version) { - this.links = links; - this.id = id; - this.createdBy = createdBy; - this.lastModifiedBy = lastModifiedBy; - this.data = data; - this.referenceData = referenceData; - this.created = created; - this.lastModified = lastModified; - this.status = status; - this.newStatus = newStatus; - this.statusColor = statusColor; - this.newStatusColor = newStatusColor; - this.editToken = editToken; - this.scheduleJob = scheduleJob; - this.schemaId = schemaId; - this.schemaName = schemaName; - this.schemaDisplayName = schemaDisplayName; - this.referenceFields = referenceFields; - this.isDeleted = isDeleted; - this.version = version; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The if of the content item. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The user that has created the content item. - */ - @JsonProperty("createdBy") - public String getCreatedBy() { - return createdBy; - } - - /** - * @return The user that has updated the content item. - */ - @JsonProperty("lastModifiedBy") - public String getLastModifiedBy() { - return lastModifiedBy; - } - - @JsonProperty("data") - public Object getData() { - return data; - } - - /** - * @return The reference data for the frontend UI. - */ - @JsonProperty("referenceData") - public Optional>> getReferenceData() { - return referenceData; - } - - /** - * @return The date and time when the content item has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The date and time when the content item has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The status of the content. - */ - @JsonProperty("status") - public String getStatus() { - return status; - } - - /** - * @return The new status of the content. - */ - @JsonProperty("newStatus") - public Optional getNewStatus() { - return newStatus; - } - - /** - * @return The color of the status. - */ - @JsonProperty("statusColor") - public String getStatusColor() { - return statusColor; - } - - /** - * @return The color of the new status. - */ - @JsonProperty("newStatusColor") - public Optional getNewStatusColor() { - return newStatusColor; - } - - /** - * @return The UI token. - */ - @JsonProperty("editToken") - public Optional getEditToken() { - return editToken; - } - - /** - * @return The scheduled status. - */ - @JsonProperty("scheduleJob") - public Optional getScheduleJob() { - return scheduleJob; - } - - /** - * @return The ID of the schema. - */ - @JsonProperty("schemaId") - public String getSchemaId() { - return schemaId; - } - - /** - * @return The name of the schema. - */ - @JsonProperty("schemaName") - public Optional getSchemaName() { - return schemaName; - } - - /** - * @return The display name of the schema. - */ - @JsonProperty("schemaDisplayName") - public Optional getSchemaDisplayName() { - return schemaDisplayName; - } - - /** - * @return The reference fields. - */ - @JsonProperty("referenceFields") - public Optional> getReferenceFields() { - return referenceFields; - } - - /** - * @return Indicates whether the content is deleted. - */ - @JsonProperty("isDeleted") - public boolean getIsDeleted() { - return isDeleted; - } - - /** - * @return The version of the content. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentDto && equalTo((ContentDto) other); - } - - private boolean equalTo(ContentDto other) { - return links.equals(other.links) - && id.equals(other.id) - && createdBy.equals(other.createdBy) - && lastModifiedBy.equals(other.lastModifiedBy) - && data.equals(other.data) - && referenceData.equals(other.referenceData) - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && status.equals(other.status) - && newStatus.equals(other.newStatus) - && statusColor.equals(other.statusColor) - && newStatusColor.equals(other.newStatusColor) - && editToken.equals(other.editToken) - && scheduleJob.equals(other.scheduleJob) - && schemaId.equals(other.schemaId) - && schemaName.equals(other.schemaName) - && schemaDisplayName.equals(other.schemaDisplayName) - && referenceFields.equals(other.referenceFields) - && isDeleted == other.isDeleted - && version == other.version; - } +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; - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.createdBy, - this.lastModifiedBy, - this.data, - this.referenceData, - this.created, - this.lastModified, - this.status, - this.newStatus, - this.statusColor, - this.newStatusColor, - this.editToken, - this.scheduleJob, - this.schemaId, - this.schemaName, - this.schemaDisplayName, - this.referenceFields, - this.isDeleted, - this.version); - } +import com.squidex.api.core.JSON; +/** + * ContentDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ContentDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; + @SerializedName(SERIALIZED_NAME_CREATED_BY) + private String createdBy; + public static final String SERIALIZED_NAME_LAST_MODIFIED_BY = "lastModifiedBy"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED_BY) + private String lastModifiedBy; + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private Object data = null; + public static final String SERIALIZED_NAME_REFERENCE_DATA = "referenceData"; + @SerializedName(SERIALIZED_NAME_REFERENCE_DATA) + private Map> referenceData = new HashMap<>(); + public static final String SERIALIZED_NAME_CREATED = "created"; + @SerializedName(SERIALIZED_NAME_CREATED) + private OffsetDateTime created; + public static final String SERIALIZED_NAME_LAST_MODIFIED = "lastModified"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED) + private OffsetDateTime lastModified; + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + public static final String SERIALIZED_NAME_NEW_STATUS = "newStatus"; + @SerializedName(SERIALIZED_NAME_NEW_STATUS) + private String newStatus; + public static final String SERIALIZED_NAME_STATUS_COLOR = "statusColor"; + @SerializedName(SERIALIZED_NAME_STATUS_COLOR) + private String statusColor; + public static final String SERIALIZED_NAME_NEW_STATUS_COLOR = "newStatusColor"; + @SerializedName(SERIALIZED_NAME_NEW_STATUS_COLOR) + private String newStatusColor; + public static final String SERIALIZED_NAME_EDIT_TOKEN = "editToken"; + @SerializedName(SERIALIZED_NAME_EDIT_TOKEN) + private String editToken; + public static final String SERIALIZED_NAME_SCHEDULE_JOB = "scheduleJob"; + @SerializedName(SERIALIZED_NAME_SCHEDULE_JOB) + private ScheduleJobDto scheduleJob; + public static final String SERIALIZED_NAME_SCHEMA_ID = "schemaId"; + @SerializedName(SERIALIZED_NAME_SCHEMA_ID) + private String schemaId; + public static final String SERIALIZED_NAME_SCHEMA_NAME = "schemaName"; + @SerializedName(SERIALIZED_NAME_SCHEMA_NAME) + private String schemaName; + public static final String SERIALIZED_NAME_SCHEMA_DISPLAY_NAME = "schemaDisplayName"; + @SerializedName(SERIALIZED_NAME_SCHEMA_DISPLAY_NAME) + private String schemaDisplayName; + public static final String SERIALIZED_NAME_REFERENCE_FIELDS = "referenceFields"; + @SerializedName(SERIALIZED_NAME_REFERENCE_FIELDS) + private List referenceFields; + public static final String SERIALIZED_NAME_IS_DELETED = "isDeleted"; + @SerializedName(SERIALIZED_NAME_IS_DELETED) + private Boolean isDeleted; + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Long version; + public ContentDto() { + } + public ContentDto links(Map links) { + this.links = links; + return this; + } + + public ContentDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public ContentDto id(String id) { + this.id = id; + return this; + } + + /** + * The if of the content item. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public ContentDto createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The user that has created the content item. + * @return createdBy + */ + @javax.annotation.Nonnull + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + public ContentDto lastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * The user that has updated the content item. + * @return lastModifiedBy + */ + @javax.annotation.Nonnull + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + public ContentDto data(Object data) { + this.data = data; + return this; + } + + /** + * The data of the content item. + * @return data + */ + @javax.annotation.Nullable + public Object getData() { + return data; + } + + public void setData(Object data) { + this.data = data; + } + public ContentDto referenceData(Map> referenceData) { + this.referenceData = referenceData; + return this; + } + + public ContentDto putReferenceDataItem(String key, Map referenceDataItem) { + if (this.referenceData == null) { + this.referenceData = new HashMap<>(); + } + this.referenceData.put(key, referenceDataItem); + return this; + } + + /** + * Get referenceData + * @return referenceData + */ + @javax.annotation.Nullable + public Map> getReferenceData() { + return referenceData; + } + + public void setReferenceData(Map> referenceData) { + this.referenceData = referenceData; + } + public ContentDto created(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * The date and time when the content item has been created. + * @return created + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreated() { + return created; + } + + public void setCreated(OffsetDateTime created) { + this.created = created; + } + public ContentDto lastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * The date and time when the content item has been modified last. + * @return lastModified + */ + @javax.annotation.Nonnull + public OffsetDateTime getLastModified() { + return lastModified; + } + + public void setLastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + } + public ContentDto status(String status) { + this.status = status; + return this; + } + + /** + * The status of the content. + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + public ContentDto newStatus(String newStatus) { + this.newStatus = newStatus; + return this; + } + + /** + * The new status of the content. + * @return newStatus + */ + @javax.annotation.Nullable + public String getNewStatus() { + return newStatus; + } + + public void setNewStatus(String newStatus) { + this.newStatus = newStatus; + } + public ContentDto statusColor(String statusColor) { + this.statusColor = statusColor; + return this; + } + + /** + * The color of the status. + * @return statusColor + */ + @javax.annotation.Nonnull + public String getStatusColor() { + return statusColor; + } + + public void setStatusColor(String statusColor) { + this.statusColor = statusColor; + } + public ContentDto newStatusColor(String newStatusColor) { + this.newStatusColor = newStatusColor; + return this; + } + + /** + * The color of the new status. + * @return newStatusColor + */ + @javax.annotation.Nullable + public String getNewStatusColor() { + return newStatusColor; + } + + public void setNewStatusColor(String newStatusColor) { + this.newStatusColor = newStatusColor; + } + public ContentDto editToken(String editToken) { + this.editToken = editToken; + return this; + } + + /** + * The UI token. + * @return editToken + */ + @javax.annotation.Nullable + public String getEditToken() { + return editToken; + } + + public void setEditToken(String editToken) { + this.editToken = editToken; + } + public ContentDto scheduleJob(ScheduleJobDto scheduleJob) { + this.scheduleJob = scheduleJob; + return this; + } + + /** + * Get scheduleJob + * @return scheduleJob + */ + @javax.annotation.Nullable + public ScheduleJobDto getScheduleJob() { + return scheduleJob; + } + + public void setScheduleJob(ScheduleJobDto scheduleJob) { + this.scheduleJob = scheduleJob; + } + public ContentDto schemaId(String schemaId) { + this.schemaId = schemaId; + return this; + } + + /** + * The ID of the schema. + * @return schemaId + */ + @javax.annotation.Nonnull + public String getSchemaId() { + return schemaId; + } + + public void setSchemaId(String schemaId) { + this.schemaId = schemaId; + } + public ContentDto schemaName(String schemaName) { + this.schemaName = schemaName; + return this; + } + + /** + * The name of the schema. + * @return schemaName + */ + @javax.annotation.Nullable + public String getSchemaName() { + return schemaName; + } + + public void setSchemaName(String schemaName) { + this.schemaName = schemaName; + } + public ContentDto schemaDisplayName(String schemaDisplayName) { + this.schemaDisplayName = schemaDisplayName; + return this; + } + + /** + * The display name of the schema. + * @return schemaDisplayName + */ + @javax.annotation.Nullable + public String getSchemaDisplayName() { + return schemaDisplayName; + } + + public void setSchemaDisplayName(String schemaDisplayName) { + this.schemaDisplayName = schemaDisplayName; + } + public ContentDto referenceFields(List referenceFields) { + this.referenceFields = referenceFields; + return this; + } + + public ContentDto addReferenceFieldsItem(FieldDto referenceFieldsItem) { + if (this.referenceFields == null) { + this.referenceFields = new ArrayList<>(); + } + this.referenceFields.add(referenceFieldsItem); + return this; + } + + /** + * The reference fields. + * @return referenceFields + */ + @javax.annotation.Nullable + public List getReferenceFields() { + return referenceFields; + } + + public void setReferenceFields(List referenceFields) { + this.referenceFields = referenceFields; + } + public ContentDto isDeleted(Boolean isDeleted) { + this.isDeleted = isDeleted; + return this; + } + + /** + * Indicates whether the content is deleted. + * @return isDeleted + */ + @javax.annotation.Nonnull + public Boolean getIsDeleted() { + return isDeleted; + } + + public void setIsDeleted(Boolean isDeleted) { + this.isDeleted = isDeleted; + } + public ContentDto version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the content. + * @return version + */ + @javax.annotation.Nonnull + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ContentDto contentDto = (ContentDto) o; + return Objects.equals(this.links, contentDto.links) && + Objects.equals(this.id, contentDto.id) && + Objects.equals(this.createdBy, contentDto.createdBy) && + Objects.equals(this.lastModifiedBy, contentDto.lastModifiedBy) && + Objects.equals(this.data, contentDto.data) && + Objects.equals(this.referenceData, contentDto.referenceData) && + Objects.equals(this.created, contentDto.created) && + Objects.equals(this.lastModified, contentDto.lastModified) && + Objects.equals(this.status, contentDto.status) && + Objects.equals(this.newStatus, contentDto.newStatus) && + Objects.equals(this.statusColor, contentDto.statusColor) && + Objects.equals(this.newStatusColor, contentDto.newStatusColor) && + Objects.equals(this.editToken, contentDto.editToken) && + Objects.equals(this.scheduleJob, contentDto.scheduleJob) && + Objects.equals(this.schemaId, contentDto.schemaId) && + Objects.equals(this.schemaName, contentDto.schemaName) && + Objects.equals(this.schemaDisplayName, contentDto.schemaDisplayName) && + Objects.equals(this.referenceFields, contentDto.referenceFields) && + Objects.equals(this.isDeleted, contentDto.isDeleted) && + Objects.equals(this.version, contentDto.version); + } + + 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(links, id, createdBy, lastModifiedBy, data, referenceData, created, lastModified, status, newStatus, statusColor, newStatusColor, editToken, scheduleJob, schemaId, schemaName, schemaDisplayName, referenceFields, isDeleted, version); + } + + 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 ContentDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" lastModifiedBy: ").append(toIndentedString(lastModifiedBy)).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" referenceData: ").append(toIndentedString(referenceData)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" lastModified: ").append(toIndentedString(lastModified)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" newStatus: ").append(toIndentedString(newStatus)).append("\n"); + sb.append(" statusColor: ").append(toIndentedString(statusColor)).append("\n"); + sb.append(" newStatusColor: ").append(toIndentedString(newStatusColor)).append("\n"); + sb.append(" editToken: ").append(toIndentedString(editToken)).append("\n"); + sb.append(" scheduleJob: ").append(toIndentedString(scheduleJob)).append("\n"); + sb.append(" schemaId: ").append(toIndentedString(schemaId)).append("\n"); + sb.append(" schemaName: ").append(toIndentedString(schemaName)).append("\n"); + sb.append(" schemaDisplayName: ").append(toIndentedString(schemaDisplayName)).append("\n"); + sb.append(" referenceFields: ").append(toIndentedString(referenceFields)).append("\n"); + sb.append(" isDeleted: ").append(toIndentedString(isDeleted)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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("_links"); + openapiFields.add("id"); + openapiFields.add("createdBy"); + openapiFields.add("lastModifiedBy"); + openapiFields.add("data"); + openapiFields.add("referenceData"); + openapiFields.add("created"); + openapiFields.add("lastModified"); + openapiFields.add("status"); + openapiFields.add("newStatus"); + openapiFields.add("statusColor"); + openapiFields.add("newStatusColor"); + openapiFields.add("editToken"); + openapiFields.add("scheduleJob"); + openapiFields.add("schemaId"); + openapiFields.add("schemaName"); + openapiFields.add("schemaDisplayName"); + openapiFields.add("referenceFields"); + openapiFields.add("isDeleted"); + openapiFields.add("version"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("lastModifiedBy"); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("lastModified"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("statusColor"); + openapiRequiredFields.add("schemaId"); + openapiRequiredFields.add("isDeleted"); + openapiRequiredFields.add("version"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContentDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ContentDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ContentDto is not found in the empty JSON string", ContentDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContentDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContentDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ContentDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("createdBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); + } + if (!jsonObj.get("lastModifiedBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastModifiedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastModifiedBy").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("newStatus") != null && !jsonObj.get("newStatus").isJsonNull()) && !jsonObj.get("newStatus").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `newStatus` to be a primitive type in the JSON string but got `%s`", jsonObj.get("newStatus").toString())); + } + if (!jsonObj.get("statusColor").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `statusColor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("statusColor").toString())); + } + if ((jsonObj.get("newStatusColor") != null && !jsonObj.get("newStatusColor").isJsonNull()) && !jsonObj.get("newStatusColor").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `newStatusColor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("newStatusColor").toString())); + } + if ((jsonObj.get("editToken") != null && !jsonObj.get("editToken").isJsonNull()) && !jsonObj.get("editToken").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `editToken` to be a primitive type in the JSON string but got `%s`", jsonObj.get("editToken").toString())); + } + // validate the optional field `scheduleJob` + if (jsonObj.get("scheduleJob") != null && !jsonObj.get("scheduleJob").isJsonNull()) { + ScheduleJobDto.validateJsonElement(jsonObj.get("scheduleJob")); + } + if (!jsonObj.get("schemaId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `schemaId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("schemaId").toString())); + } + if ((jsonObj.get("schemaName") != null && !jsonObj.get("schemaName").isJsonNull()) && !jsonObj.get("schemaName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `schemaName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("schemaName").toString())); + } + if ((jsonObj.get("schemaDisplayName") != null && !jsonObj.get("schemaDisplayName").isJsonNull()) && !jsonObj.get("schemaDisplayName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `schemaDisplayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("schemaDisplayName").toString())); + } + if (jsonObj.get("referenceFields") != null && !jsonObj.get("referenceFields").isJsonNull()) { + JsonArray jsonArrayreferenceFields = jsonObj.getAsJsonArray("referenceFields"); + if (jsonArrayreferenceFields != null) { + // ensure the json data is an array + if (!jsonObj.get("referenceFields").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `referenceFields` to be an array in the JSON string but got `%s`", jsonObj.get("referenceFields").toString())); + } + + // validate the optional field `referenceFields` (array) + for (int i = 0; i < jsonArrayreferenceFields.size(); i++) { + FieldDto.validateJsonElement(jsonArrayreferenceFields.get(i)); + }; + } + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - CreatedByStage id(String id); - - Builder from(ContentDto other); - } - - public interface CreatedByStage { - LastModifiedByStage createdBy(String createdBy); - } - - public interface LastModifiedByStage { - DataStage lastModifiedBy(String lastModifiedBy); - } - - public interface DataStage { - CreatedStage data(Object data); - } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); - } - - public interface LastModifiedStage { - StatusStage lastModified(OffsetDateTime lastModified); - } - - public interface StatusStage { - StatusColorStage status(String status); - } - - public interface StatusColorStage { - SchemaIdStage statusColor(String statusColor); - } - - public interface SchemaIdStage { - IsDeletedStage schemaId(String schemaId); - } - - public interface IsDeletedStage { - VersionStage isDeleted(boolean isDeleted); - } - - public interface VersionStage { - _FinalStage version(int version); - } - - public interface _FinalStage { - ContentDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage referenceData(Optional>> referenceData); - - _FinalStage referenceData(Map> referenceData); - - _FinalStage newStatus(Optional newStatus); - - _FinalStage newStatus(String newStatus); - - _FinalStage newStatusColor(Optional newStatusColor); - - _FinalStage newStatusColor(String newStatusColor); - - _FinalStage editToken(Optional editToken); - - _FinalStage editToken(String editToken); - - _FinalStage scheduleJob(Optional scheduleJob); - - _FinalStage scheduleJob(ScheduleJobDto scheduleJob); - - _FinalStage schemaName(Optional schemaName); - - _FinalStage schemaName(String schemaName); - - _FinalStage schemaDisplayName(Optional schemaDisplayName); - - _FinalStage schemaDisplayName(String schemaDisplayName); - - _FinalStage referenceFields(Optional> referenceFields); - - _FinalStage referenceFields(List referenceFields); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - CreatedByStage, - LastModifiedByStage, - DataStage, - CreatedStage, - LastModifiedStage, - StatusStage, - StatusColorStage, - SchemaIdStage, - IsDeletedStage, - VersionStage, - _FinalStage { - private String id; - - private String createdBy; - - private String lastModifiedBy; - - private Object data; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private String status; - - private String statusColor; - - private String schemaId; - - private boolean isDeleted; - - private int version; - - private Optional> referenceFields = Optional.empty(); - - private Optional schemaDisplayName = Optional.empty(); - - private Optional schemaName = Optional.empty(); - - private Optional scheduleJob = Optional.empty(); - - private Optional editToken = Optional.empty(); - - private Optional newStatusColor = Optional.empty(); - - private Optional newStatus = Optional.empty(); - - private Optional>> referenceData = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(ContentDto other) { - links(other.getLinks()); - id(other.getId()); - createdBy(other.getCreatedBy()); - lastModifiedBy(other.getLastModifiedBy()); - data(other.getData()); - referenceData(other.getReferenceData()); - created(other.getCreated()); - lastModified(other.getLastModified()); - status(other.getStatus()); - newStatus(other.getNewStatus()); - statusColor(other.getStatusColor()); - newStatusColor(other.getNewStatusColor()); - editToken(other.getEditToken()); - scheduleJob(other.getScheduleJob()); - schemaId(other.getSchemaId()); - schemaName(other.getSchemaName()); - schemaDisplayName(other.getSchemaDisplayName()); - referenceFields(other.getReferenceFields()); - isDeleted(other.getIsDeleted()); - version(other.getVersion()); - return this; - } - - /** - *

The if of the content item.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public CreatedByStage id(String id) { - this.id = id; - return this; - } - - /** - *

The user that has created the content item.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("createdBy") - public LastModifiedByStage createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - *

The user that has updated the content item.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModifiedBy") - public DataStage lastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - return this; - } - - @Override - @JsonSetter("data") - public CreatedStage data(Object data) { - this.data = data; - return this; - } - - /** - *

The date and time when the content item has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The date and time when the content item has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public StatusStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

The status of the content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public StatusColorStage status(String status) { - this.status = status; - return this; - } - - /** - *

The color of the status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("statusColor") - public SchemaIdStage statusColor(String statusColor) { - this.statusColor = statusColor; - return this; - } - - /** - *

The ID of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("schemaId") - public IsDeletedStage schemaId(String schemaId) { - this.schemaId = schemaId; - return this; - } - - /** - *

Indicates whether the content is deleted.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isDeleted") - public VersionStage isDeleted(boolean isDeleted) { - this.isDeleted = isDeleted; - return this; - } - - /** - *

The version of the content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - /** - *

The reference fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage referenceFields(List referenceFields) { - this.referenceFields = Optional.of(referenceFields); - return this; - } - - @Override - @JsonSetter(value = "referenceFields", nulls = Nulls.SKIP) - public _FinalStage referenceFields(Optional> referenceFields) { - this.referenceFields = referenceFields; - return this; - } - - /** - *

The display name of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schemaDisplayName(String schemaDisplayName) { - this.schemaDisplayName = Optional.of(schemaDisplayName); - return this; - } - - @Override - @JsonSetter(value = "schemaDisplayName", nulls = Nulls.SKIP) - public _FinalStage schemaDisplayName(Optional schemaDisplayName) { - this.schemaDisplayName = schemaDisplayName; - return this; - } - - /** - *

The name of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schemaName(String schemaName) { - this.schemaName = Optional.of(schemaName); - return this; - } - - @Override - @JsonSetter(value = "schemaName", nulls = Nulls.SKIP) - public _FinalStage schemaName(Optional schemaName) { - this.schemaName = schemaName; - return this; - } - - /** - *

The scheduled status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage scheduleJob(ScheduleJobDto scheduleJob) { - this.scheduleJob = Optional.of(scheduleJob); - return this; - } - - @Override - @JsonSetter(value = "scheduleJob", nulls = Nulls.SKIP) - public _FinalStage scheduleJob(Optional scheduleJob) { - this.scheduleJob = scheduleJob; - return this; - } - - /** - *

The UI token.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage editToken(String editToken) { - this.editToken = Optional.of(editToken); - return this; - } - - @Override - @JsonSetter(value = "editToken", nulls = Nulls.SKIP) - public _FinalStage editToken(Optional editToken) { - this.editToken = editToken; - return this; - } - - /** - *

The color of the new status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage newStatusColor(String newStatusColor) { - this.newStatusColor = Optional.of(newStatusColor); - return this; - } - - @Override - @JsonSetter(value = "newStatusColor", nulls = Nulls.SKIP) - public _FinalStage newStatusColor(Optional newStatusColor) { - this.newStatusColor = newStatusColor; - return this; - } - - /** - *

The new status of the content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage newStatus(String newStatus) { - this.newStatus = Optional.of(newStatus); - return this; - } - - @Override - @JsonSetter(value = "newStatus", nulls = Nulls.SKIP) - public _FinalStage newStatus(Optional newStatus) { - this.newStatus = newStatus; - return this; - } - - /** - *

The reference data for the frontend UI.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage referenceData(Map> referenceData) { - this.referenceData = Optional.of(referenceData); - return this; - } - - @Override - @JsonSetter(value = "referenceData", nulls = Nulls.SKIP) - public _FinalStage referenceData(Optional>> referenceData) { - this.referenceData = referenceData; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public ContentDto build() { - return new ContentDto( - links, - id, - createdBy, - lastModifiedBy, - data, - referenceData, - created, - lastModified, - status, - newStatus, - statusColor, - newStatusColor, - editToken, - scheduleJob, - schemaId, - schemaName, - schemaDisplayName, - referenceFields, - isDeleted, - version); - } - } + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ContentDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContentDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ContentDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ContentDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ContentDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ContentDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContentDto + * @throws IOException if the JSON string is invalid with respect to ContentDto + */ + public static ContentDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ContentDto.class); + } + + /** + * Convert an instance of ContentDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ContentsDto.java b/src/main/java/com/squidex/api/types/ContentsDto.java index 43ed104..70f6e80 100644 --- a/src/main/java/com/squidex/api/types/ContentsDto.java +++ b/src/main/java/com/squidex/api/types/ContentsDto.java @@ -1,247 +1,329 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ContentDto; +import com.squidex.api.types.ResourceLink; +import com.squidex.api.types.StatusInfoDto; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContentsDto.Builder.class) -public final class ContentsDto implements IResource { - private final Map links; - - private final int total; - - private final List items; - - private final List statuses; - private ContentsDto( - Map links, int total, List items, List statuses) { - this.links = links; - this.total = total; - this.items = items; - this.statuses = statuses; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of content items. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } - - /** - * @return The content items. - */ - @JsonProperty("items") - public List getItems() { - return items; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The possible statuses. - */ - @JsonProperty("statuses") - public List getStatuses() { - return statuses; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentsDto && equalTo((ContentsDto) other); +/** + * ContentsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ContentsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + private Long total; + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public static final String SERIALIZED_NAME_STATUSES = "statuses"; + @SerializedName(SERIALIZED_NAME_STATUSES) + private List statuses = new ArrayList<>(); + public ContentsDto() { + } + public ContentsDto links(Map links) { + this.links = links; + return this; + } + + public ContentsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - private boolean equalTo(ContentsDto other) { - return links.equals(other.links) - && total == other.total - && items.equals(other.items) - && statuses.equals(other.statuses); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public ContentsDto total(Long total) { + this.total = total; + return this; + } + + /** + * The total number of content items. + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + public ContentsDto items(List items) { + this.items = items; + return this; + } + + public ContentsDto addItemsItem(ContentDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items, this.statuses); + this.items.add(itemsItem); + return this; + } + + /** + * The content items. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + public ContentsDto statuses(List statuses) { + this.statuses = statuses; + return this; + } + + public ContentsDto addStatusesItem(StatusInfoDto statusesItem) { + if (this.statuses == null) { + this.statuses = new ArrayList<>(); } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + this.statuses.add(statusesItem); + return this; + } + + /** + * The possible statuses. + * @return statuses + */ + @javax.annotation.Nonnull + public List getStatuses() { + return statuses; + } + + public void setStatuses(List statuses) { + this.statuses = statuses; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public static TotalStage builder() { - return new Builder(); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(ContentsDto other); + ContentsDto contentsDto = (ContentsDto) o; + return Objects.equals(this.links, contentsDto.links) && + Objects.equals(this.total, contentsDto.total) && + Objects.equals(this.items, contentsDto.items) && + Objects.equals(this.statuses, contentsDto.statuses); + } + + @Override + public int hashCode() { + return Objects.hash(links, total, items, statuses); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContentsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" statuses: ").append(toIndentedString(statuses)).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"; } - - public interface _FinalStage { - ContentsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(ContentDto items); - - _FinalStage addAllItems(List items); - - _FinalStage statuses(List statuses); - - _FinalStage addStatuses(StatusInfoDto statuses); - - _FinalStage addAllStatuses(List statuses); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List statuses = new ArrayList<>(); - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(ContentsDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - statuses(other.getStatuses()); - return this; - } - - /** - *

The total number of content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("total"); + openapiFields.add("items"); + openapiFields.add("statuses"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("items"); + openapiRequiredFields.add("statuses"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContentsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ContentsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ContentsDto is not found in the empty JSON string", ContentsDto.openapiRequiredFields.toString())); } + } - /** - *

The possible statuses.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllStatuses(List statuses) { - this.statuses.addAll(statuses); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContentsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContentsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The possible statuses.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addStatuses(StatusInfoDto statuses) { - this.statuses.add(statuses); - return this; - } - - @Override - @JsonSetter(value = "statuses", nulls = Nulls.SKIP) - public _FinalStage statuses(List statuses) { - this.statuses.clear(); - this.statuses.addAll(statuses); - return this; - } - - /** - *

The content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(ContentDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public ContentsDto build() { - return new ContentsDto(links, total, items, statuses); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ContentsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + ContentDto.validateJsonElement(jsonArrayitems.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("statuses").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `statuses` to be an array in the JSON string but got `%s`", jsonObj.get("statuses").toString())); + } + + JsonArray jsonArraystatuses = jsonObj.getAsJsonArray("statuses"); + // validate the required field `statuses` (array) + for (int i = 0; i < jsonArraystatuses.size(); i++) { + StatusInfoDto.validateJsonElement(jsonArraystatuses.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ContentsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContentsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ContentsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ContentsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ContentsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ContentsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContentsDto + * @throws IOException if the JSON string is invalid with respect to ContentsDto + */ + public static ContentsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ContentsDto.class); + } + + /** + * Convert an instance of ContentsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ContributorDto.java b/src/main/java/com/squidex/api/types/ContributorDto.java index 058f402..4a3eaaf 100644 --- a/src/main/java/com/squidex/api/types/ContributorDto.java +++ b/src/main/java/com/squidex/api/types/ContributorDto.java @@ -1,249 +1,336 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContributorDto.Builder.class) -public final class ContributorDto implements IResource { - private final Map links; - - private final String contributorId; - - private final String contributorName; - - private final String contributorEmail; - - private final Optional role; - - private ContributorDto( - Map links, - String contributorId, - String contributorName, - String contributorEmail, - Optional role) { - this.links = links; - this.contributorId = contributorId; - this.contributorName = contributorName; - this.contributorEmail = contributorEmail; - this.role = role; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the user that contributes to the app. - */ - @JsonProperty("contributorId") - public String getContributorId() { - return contributorId; - } - /** - * @return The display name. - */ - @JsonProperty("contributorName") - public String getContributorName() { - return contributorName; - } - - /** - * @return The email address. - */ - @JsonProperty("contributorEmail") - public String getContributorEmail() { - return contributorEmail; - } - - /** - * @return The role of the contributor. - */ - @JsonProperty("role") - public Optional getRole() { - return role; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContributorDto && equalTo((ContributorDto) other); - } - - private boolean equalTo(ContributorDto other) { - return links.equals(other.links) - && contributorId.equals(other.contributorId) - && contributorName.equals(other.contributorName) - && contributorEmail.equals(other.contributorEmail) - && role.equals(other.role); - } +package com.squidex.api.types; - @Override - public int hashCode() { - return Objects.hash(this.links, this.contributorId, this.contributorName, this.contributorEmail, this.role); - } +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.squidex.api.types.ResourceLink; +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; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +import com.squidex.api.core.JSON; - public static ContributorIdStage builder() { - return new Builder(); +/** + * ContributorDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ContributorDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_CONTRIBUTOR_ID = "contributorId"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTOR_ID) + private String contributorId; + public static final String SERIALIZED_NAME_CONTRIBUTOR_NAME = "contributorName"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTOR_NAME) + private String contributorName; + public static final String SERIALIZED_NAME_CONTRIBUTOR_EMAIL = "contributorEmail"; + @SerializedName(SERIALIZED_NAME_CONTRIBUTOR_EMAIL) + private String contributorEmail; + public static final String SERIALIZED_NAME_ROLE = "role"; + @SerializedName(SERIALIZED_NAME_ROLE) + private String role; + public ContributorDto() { + } + public ContributorDto links(Map links) { + this.links = links; + return this; + } + + public ContributorDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface ContributorIdStage { - ContributorNameStage contributorId(String contributorId); - - Builder from(ContributorDto other); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public ContributorDto contributorId(String contributorId) { + this.contributorId = contributorId; + return this; + } + + /** + * The ID of the user that contributes to the app. + * @return contributorId + */ + @javax.annotation.Nonnull + public String getContributorId() { + return contributorId; + } + + public void setContributorId(String contributorId) { + this.contributorId = contributorId; + } + public ContributorDto contributorName(String contributorName) { + this.contributorName = contributorName; + return this; + } + + /** + * The display name. + * @return contributorName + */ + @javax.annotation.Nonnull + public String getContributorName() { + return contributorName; + } + + public void setContributorName(String contributorName) { + this.contributorName = contributorName; + } + public ContributorDto contributorEmail(String contributorEmail) { + this.contributorEmail = contributorEmail; + return this; + } + + /** + * The email address. + * @return contributorEmail + */ + @javax.annotation.Nonnull + public String getContributorEmail() { + return contributorEmail; + } + + public void setContributorEmail(String contributorEmail) { + this.contributorEmail = contributorEmail; + } + public ContributorDto role(String role) { + this.role = role; + return this; + } + + /** + * The role of the contributor. + * @return role + */ + @javax.annotation.Nullable + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ContributorNameStage { - ContributorEmailStage contributorName(String contributorName); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface ContributorEmailStage { - _FinalStage contributorEmail(String contributorEmail); + ContributorDto contributorDto = (ContributorDto) o; + return Objects.equals(this.links, contributorDto.links) && + Objects.equals(this.contributorId, contributorDto.contributorId) && + Objects.equals(this.contributorName, contributorDto.contributorName) && + Objects.equals(this.contributorEmail, contributorDto.contributorEmail) && + Objects.equals(this.role, contributorDto.role); + } + + 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(links, contributorId, contributorName, contributorEmail, role); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - ContributorDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage role(Optional role); - - _FinalStage role(String role); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContributorDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" contributorId: ").append(toIndentedString(contributorId)).append("\n"); + sb.append(" contributorName: ").append(toIndentedString(contributorName)).append("\n"); + sb.append(" contributorEmail: ").append(toIndentedString(contributorEmail)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements ContributorIdStage, ContributorNameStage, ContributorEmailStage, _FinalStage { - private String contributorId; - - private String contributorName; - - private String contributorEmail; - - private Optional role = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(ContributorDto other) { - links(other.getLinks()); - contributorId(other.getContributorId()); - contributorName(other.getContributorName()); - contributorEmail(other.getContributorEmail()); - role(other.getRole()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("contributorId"); + openapiFields.add("contributorName"); + openapiFields.add("contributorEmail"); + openapiFields.add("role"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("contributorId"); + openapiRequiredFields.add("contributorName"); + openapiRequiredFields.add("contributorEmail"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContributorDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ContributorDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ContributorDto is not found in the empty JSON string", ContributorDto.openapiRequiredFields.toString())); } + } - /** - *

The ID of the user that contributes to the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("contributorId") - public ContributorNameStage contributorId(String contributorId) { - this.contributorId = contributorId; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContributorDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContributorDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The display name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("contributorName") - public ContributorEmailStage contributorName(String contributorName) { - this.contributorName = contributorName; - return this; - } - - /** - *

The email address.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("contributorEmail") - public _FinalStage contributorEmail(String contributorEmail) { - this.contributorEmail = contributorEmail; - return this; - } - - /** - *

The role of the contributor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage role(String role) { - this.role = Optional.of(role); - return this; - } - - @Override - @JsonSetter(value = "role", nulls = Nulls.SKIP) - public _FinalStage role(Optional role) { - this.role = role; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public ContributorDto build() { - return new ContributorDto(links, contributorId, contributorName, contributorEmail, role); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ContributorDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("contributorId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contributorId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contributorId").toString())); + } + if (!jsonObj.get("contributorName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contributorName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contributorName").toString())); + } + if (!jsonObj.get("contributorEmail").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contributorEmail` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contributorEmail").toString())); + } + if ((jsonObj.get("role") != null && !jsonObj.get("role").isJsonNull()) && !jsonObj.get("role").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `role` to be a primitive type in the JSON string but got `%s`", jsonObj.get("role").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ContributorDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContributorDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ContributorDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ContributorDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ContributorDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ContributorDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContributorDto + * @throws IOException if the JSON string is invalid with respect to ContributorDto + */ + public static ContributorDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ContributorDto.class); + } + + /** + * Convert an instance of ContributorDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ContributorsDto.java b/src/main/java/com/squidex/api/types/ContributorsDto.java index 894104e..235e15c 100644 --- a/src/main/java/com/squidex/api/types/ContributorsDto.java +++ b/src/main/java/com/squidex/api/types/ContributorsDto.java @@ -1,238 +1,314 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ContributorDto; +import com.squidex.api.types.ContributorsMetadata; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContributorsDto.Builder.class) -public final class ContributorsDto implements IResource { - private final Map links; - - private final List items; - - private final int maxContributors; - - private final Optional meta; - private ContributorsDto( - Map links, - List items, - int maxContributors, - Optional meta) { - this.links = links; - this.items = items; - this.maxContributors = maxContributors; - this.meta = meta; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The contributors. - */ - @JsonProperty("items") - public List getItems() { - return items; - } - - /** - * @return The maximum number of allowed contributors. - */ - @JsonProperty("maxContributors") - public int getMaxContributors() { - return maxContributors; - } - - /** - * @return The metadata to provide information about this request. - */ - @JsonProperty("_meta") - public Optional getMeta() { - return meta; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContributorsDto && equalTo((ContributorsDto) other); - } +import com.squidex.api.core.JSON; - private boolean equalTo(ContributorsDto other) { - return links.equals(other.links) - && items.equals(other.items) - && maxContributors == other.maxContributors - && meta.equals(other.meta); +/** + * ContributorsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ContributorsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public static final String SERIALIZED_NAME_MAX_CONTRIBUTORS = "maxContributors"; + @SerializedName(SERIALIZED_NAME_MAX_CONTRIBUTORS) + private Long maxContributors; + public static final String SERIALIZED_NAME_META = "_meta"; + @SerializedName(SERIALIZED_NAME_META) + private ContributorsMetadata meta; + public ContributorsDto() { + } + public ContributorsDto links(Map links) { + this.links = links; + return this; + } + + public ContributorsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.items, this.maxContributors, this.meta); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public ContributorsDto items(List items) { + this.items = items; + return this; + } + + public ContributorsDto addItemsItem(ContributorDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + this.items.add(itemsItem); + return this; + } + + /** + * The contributors. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + public ContributorsDto maxContributors(Long maxContributors) { + this.maxContributors = maxContributors; + return this; + } + + /** + * The maximum number of allowed contributors. + * @return maxContributors + */ + @javax.annotation.Nonnull + public Long getMaxContributors() { + return maxContributors; + } + + public void setMaxContributors(Long maxContributors) { + this.maxContributors = maxContributors; + } + public ContributorsDto meta(ContributorsMetadata meta) { + this.meta = meta; + return this; + } + + /** + * Get meta + * @return meta + */ + @javax.annotation.Nullable + public ContributorsMetadata getMeta() { + return meta; + } + + public void setMeta(ContributorsMetadata meta) { + this.meta = meta; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public static MaxContributorsStage builder() { - return new Builder(); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface MaxContributorsStage { - _FinalStage maxContributors(int maxContributors); - - Builder from(ContributorsDto other); + ContributorsDto contributorsDto = (ContributorsDto) o; + return Objects.equals(this.links, contributorsDto.links) && + Objects.equals(this.items, contributorsDto.items) && + Objects.equals(this.maxContributors, contributorsDto.maxContributors) && + Objects.equals(this.meta, contributorsDto.meta); + } + + @Override + public int hashCode() { + return Objects.hash(links, items, maxContributors, meta); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContributorsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" maxContributors: ").append(toIndentedString(maxContributors)).append("\n"); + sb.append(" meta: ").append(toIndentedString(meta)).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"; } - - public interface _FinalStage { - ContributorsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(ContributorDto items); - - _FinalStage addAllItems(List items); - - _FinalStage meta(Optional meta); - - _FinalStage meta(ContributorsMetadata meta); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MaxContributorsStage, _FinalStage { - private int maxContributors; - - private Optional meta = Optional.empty(); - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(ContributorsDto other) { - links(other.getLinks()); - items(other.getItems()); - maxContributors(other.getMaxContributors()); - meta(other.getMeta()); - return this; - } - - /** - *

The maximum number of allowed contributors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxContributors") - public _FinalStage maxContributors(int maxContributors) { - this.maxContributors = maxContributors; - return this; - } - - /** - *

The metadata to provide information about this request.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage meta(ContributorsMetadata meta) { - this.meta = Optional.of(meta); - return this; - } - - @Override - @JsonSetter(value = "_meta", nulls = Nulls.SKIP) - public _FinalStage meta(Optional meta) { - this.meta = meta; - return this; - } - - /** - *

The contributors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The contributors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(ContributorDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("items"); + openapiFields.add("maxContributors"); + openapiFields.add("_meta"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + openapiRequiredFields.add("maxContributors"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContributorsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ContributorsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ContributorsDto is not found in the empty JSON string", ContributorsDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContributorsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContributorsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public ContributorsDto build() { - return new ContributorsDto(links, items, maxContributors, meta); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ContributorsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + ContributorDto.validateJsonElement(jsonArrayitems.get(i)); + }; + // validate the optional field `_meta` + if (jsonObj.get("_meta") != null && !jsonObj.get("_meta").isJsonNull()) { + ContributorsMetadata.validateJsonElement(jsonObj.get("_meta")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ContributorsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContributorsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ContributorsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ContributorsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ContributorsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ContributorsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContributorsDto + * @throws IOException if the JSON string is invalid with respect to ContributorsDto + */ + public static ContributorsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ContributorsDto.class); + } + + /** + * Convert an instance of ContributorsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ContributorsMetadata.java b/src/main/java/com/squidex/api/types/ContributorsMetadata.java index 088a63a..c4236e3 100644 --- a/src/main/java/com/squidex/api/types/ContributorsMetadata.java +++ b/src/main/java/com/squidex/api/types/ContributorsMetadata.java @@ -1,93 +1,209 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ContributorsMetadata.Builder.class) -public final class ContributorsMetadata { - private final String isInvited; - - private ContributorsMetadata(String isInvited) { - this.isInvited = isInvited; - } - /** - * @return Indicates whether the user has been invited. - */ - @JsonProperty("isInvited") - public String getIsInvited() { - return isInvited; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContributorsMetadata && equalTo((ContributorsMetadata) other); - } - private boolean equalTo(ContributorsMetadata other) { - return isInvited.equals(other.isInvited); - } - - @Override - public int hashCode() { - return Objects.hash(this.isInvited); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.core.JSON; - public static IsInvitedStage builder() { - return new Builder(); +/** + * ContributorsMetadata + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ContributorsMetadata { + public static final String SERIALIZED_NAME_IS_INVITED = "isInvited"; + @SerializedName(SERIALIZED_NAME_IS_INVITED) + private String isInvited; + public ContributorsMetadata() { + } + public ContributorsMetadata isInvited(String isInvited) { + this.isInvited = isInvited; + return this; + } + + /** + * Indicates whether the user has been invited. + * @return isInvited + */ + @javax.annotation.Nonnull + public String getIsInvited() { + return isInvited; + } + + public void setIsInvited(String isInvited) { + this.isInvited = isInvited; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface IsInvitedStage { - _FinalStage isInvited(String isInvited); - - Builder from(ContributorsMetadata other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - ContributorsMetadata build(); + ContributorsMetadata contributorsMetadata = (ContributorsMetadata) o; + return Objects.equals(this.isInvited, contributorsMetadata.isInvited); + } + + @Override + public int hashCode() { + return Objects.hash(isInvited); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ContributorsMetadata {\n"); + sb.append(" isInvited: ").append(toIndentedString(isInvited)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IsInvitedStage, _FinalStage { - private String isInvited; - - private Builder() {} - - @Override - public Builder from(ContributorsMetadata other) { - isInvited(other.getIsInvited()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("isInvited"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("isInvited"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ContributorsMetadata + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ContributorsMetadata.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ContributorsMetadata is not found in the empty JSON string", ContributorsMetadata.openapiRequiredFields.toString())); } + } - /** - *

Indicates whether the user has been invited.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isInvited") - public _FinalStage isInvited(String isInvited) { - this.isInvited = isInvited; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ContributorsMetadata.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ContributorsMetadata` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public ContributorsMetadata build() { - return new ContributorsMetadata(isInvited); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ContributorsMetadata.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("isInvited").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `isInvited` to be a primitive type in the JSON string but got `%s`", jsonObj.get("isInvited").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ContributorsMetadata.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ContributorsMetadata' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ContributorsMetadata.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ContributorsMetadata value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ContributorsMetadata read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ContributorsMetadata given an JSON string + * + * @param jsonString JSON string + * @return An instance of ContributorsMetadata + * @throws IOException if the JSON string is invalid with respect to ContributorsMetadata + */ + public static ContributorsMetadata fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ContributorsMetadata.class); + } + + /** + * Convert an instance of ContributorsMetadata to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/CreateAppDto.java b/src/main/java/com/squidex/api/types/CreateAppDto.java new file mode 100644 index 0000000..ab7c955 --- /dev/null +++ b/src/main/java/com/squidex/api/types/CreateAppDto.java @@ -0,0 +1,247 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * CreateAppDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CreateAppDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_TEMPLATE = "template"; + @SerializedName(SERIALIZED_NAME_TEMPLATE) + private String template; + public CreateAppDto() { + } + public CreateAppDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the app. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public CreateAppDto template(String template) { + this.template = template; + return this; + } + + /** + * Initialize the app with the inbuilt template. + * @return template + */ + @javax.annotation.Nullable + public String getTemplate() { + return template; + } + + public void setTemplate(String template) { + this.template = template; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAppDto createAppDto = (CreateAppDto) o; + return Objects.equals(this.name, createAppDto.name) && + Objects.equals(this.template, createAppDto.template); + } + + 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(name, template); + } + + 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 CreateAppDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" template: ").append(toIndentedString(template)).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("template"); + + // 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 CreateAppDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAppDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAppDto is not found in the empty JSON string", CreateAppDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAppDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAppDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAppDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("template") != null && !jsonObj.get("template").isJsonNull()) && !jsonObj.get("template").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `template` to be a primitive type in the JSON string but got `%s`", jsonObj.get("template").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAppDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAppDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAppDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAppDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAppDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAppDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAppDto + * @throws IOException if the JSON string is invalid with respect to CreateAppDto + */ + public static CreateAppDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAppDto.class); + } + + /** + * Convert an instance of CreateAppDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/CreateAssetFolderDto.java b/src/main/java/com/squidex/api/types/CreateAssetFolderDto.java new file mode 100644 index 0000000..c47b4a0 --- /dev/null +++ b/src/main/java/com/squidex/api/types/CreateAssetFolderDto.java @@ -0,0 +1,235 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * CreateAssetFolderDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CreateAssetFolderDto { + public static final String SERIALIZED_NAME_FOLDER_NAME = "folderName"; + @SerializedName(SERIALIZED_NAME_FOLDER_NAME) + private String folderName; + public static final String SERIALIZED_NAME_PARENT_ID = "parentId"; + @SerializedName(SERIALIZED_NAME_PARENT_ID) + private String parentId; + public CreateAssetFolderDto() { + } + public CreateAssetFolderDto folderName(String folderName) { + this.folderName = folderName; + return this; + } + + /** + * The name of the folder. + * @return folderName + */ + @javax.annotation.Nonnull + public String getFolderName() { + return folderName; + } + + public void setFolderName(String folderName) { + this.folderName = folderName; + } + public CreateAssetFolderDto parentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * The ID of the parent folder. + * @return parentId + */ + @javax.annotation.Nullable + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAssetFolderDto createAssetFolderDto = (CreateAssetFolderDto) o; + return Objects.equals(this.folderName, createAssetFolderDto.folderName) && + Objects.equals(this.parentId, createAssetFolderDto.parentId); + } + + @Override + public int hashCode() { + return Objects.hash(folderName, parentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateAssetFolderDto {\n"); + sb.append(" folderName: ").append(toIndentedString(folderName)).append("\n"); + sb.append(" parentId: ").append(toIndentedString(parentId)).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("folderName"); + openapiFields.add("parentId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("folderName"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateAssetFolderDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateAssetFolderDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateAssetFolderDto is not found in the empty JSON string", CreateAssetFolderDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateAssetFolderDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateAssetFolderDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateAssetFolderDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("folderName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `folderName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("folderName").toString())); + } + if ((jsonObj.get("parentId") != null && !jsonObj.get("parentId").isJsonNull()) && !jsonObj.get("parentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateAssetFolderDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateAssetFolderDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateAssetFolderDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateAssetFolderDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateAssetFolderDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateAssetFolderDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateAssetFolderDto + * @throws IOException if the JSON string is invalid with respect to CreateAssetFolderDto + */ + public static CreateAssetFolderDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateAssetFolderDto.class); + } + + /** + * Convert an instance of CreateAssetFolderDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/CreateClientDto.java b/src/main/java/com/squidex/api/types/CreateClientDto.java new file mode 100644 index 0000000..52c029e --- /dev/null +++ b/src/main/java/com/squidex/api/types/CreateClientDto.java @@ -0,0 +1,209 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * CreateClientDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CreateClientDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public CreateClientDto() { + } + public CreateClientDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the client. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateClientDto createClientDto = (CreateClientDto) o; + return Objects.equals(this.id, createClientDto.id); + } + + @Override + public int hashCode() { + return Objects.hash(id); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateClientDto {\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("id"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + 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 CreateClientDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateClientDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateClientDto is not found in the empty JSON string", CreateClientDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateClientDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateClientDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateClientDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateClientDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateClientDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateClientDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateClientDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateClientDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateClientDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateClientDto + * @throws IOException if the JSON string is invalid with respect to CreateClientDto + */ + public static CreateClientDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateClientDto.class); + } + + /** + * Convert an instance of CreateClientDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java b/src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java index 8970ce6..b23f6b6 100644 --- a/src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java @@ -1,183 +1,282 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateContentRuleActionDto.Builder.class) -public final class CreateContentRuleActionDto { - private final String data; - - private final String schema; - - private final String client; - - private final boolean publish; - - private CreateContentRuleActionDto(String data, String schema, String client, boolean publish) { - this.data = data; - this.schema = schema; - this.client = client; - this.publish = publish; - } - - /** - * @return The content data. - */ - @JsonProperty("data") - public String getData() { - return data; - } - - /** - * @return The name of the schema. - */ - @JsonProperty("schema") - public String getSchema() { - return schema; - } - - /** - * @return An optional client name. - */ - @JsonProperty("client") - public String getClient() { - return client; - } - /** - * @return Publish the content. - */ - @JsonProperty("publish") - public boolean getPublish() { - return publish; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateContentRuleActionDto && equalTo((CreateContentRuleActionDto) other); - } - private boolean equalTo(CreateContentRuleActionDto other) { - return data.equals(other.data) - && schema.equals(other.schema) - && client.equals(other.client) - && publish == other.publish; - } - - @Override - public int hashCode() { - return Objects.hash(this.data, this.schema, this.client, this.publish); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DataStage builder() { - return new Builder(); - } - - public interface DataStage { - SchemaStage data(String data); - - Builder from(CreateContentRuleActionDto other); - } +package com.squidex.api.types; - public interface SchemaStage { - ClientStage schema(String schema); - } +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.squidex.api.types.RuleActionDto; +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.squidex.api.core.JSON; - public interface ClientStage { - PublishStage client(String client); +/** + * CreateContentRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CreateContentRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_DATA = "data"; + @SerializedName(SERIALIZED_NAME_DATA) + private String data; + public static final String SERIALIZED_NAME_SCHEMA = "schema"; + @SerializedName(SERIALIZED_NAME_SCHEMA) + private String schema; + public static final String SERIALIZED_NAME_CLIENT = "client"; + @SerializedName(SERIALIZED_NAME_CLIENT) + private String client; + public static final String SERIALIZED_NAME_PUBLISH = "publish"; + @SerializedName(SERIALIZED_NAME_PUBLISH) + private Boolean publish; + public CreateContentRuleActionDto() { + } + public CreateContentRuleActionDto data(String data) { + this.data = data; + return this; + } + + /** + * The content data. + * @return data + */ + @javax.annotation.Nonnull + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + public CreateContentRuleActionDto schema(String schema) { + this.schema = schema; + return this; + } + + /** + * The name of the schema. + * @return schema + */ + @javax.annotation.Nonnull + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + public CreateContentRuleActionDto client(String client) { + this.client = client; + return this; + } + + /** + * An optional client name. + * @return client + */ + @javax.annotation.Nonnull + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + public CreateContentRuleActionDto publish(Boolean publish) { + this.publish = publish; + return this; + } + + /** + * Publish the content. + * @return publish + */ + @javax.annotation.Nonnull + public Boolean getPublish() { + return publish; + } + + public void setPublish(Boolean publish) { + this.publish = publish; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface PublishStage { - _FinalStage publish(boolean publish); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - CreateContentRuleActionDto build(); + CreateContentRuleActionDto createContentRuleActionDto = (CreateContentRuleActionDto) o; + return Objects.equals(this.data, createContentRuleActionDto.data) && + Objects.equals(this.schema, createContentRuleActionDto.schema) && + Objects.equals(this.client, createContentRuleActionDto.client) && + Objects.equals(this.publish, createContentRuleActionDto.publish) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(data, schema, client, publish, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateContentRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" data: ").append(toIndentedString(data)).append("\n"); + sb.append(" schema: ").append(toIndentedString(schema)).append("\n"); + sb.append(" client: ").append(toIndentedString(client)).append("\n"); + sb.append(" publish: ").append(toIndentedString(publish)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DataStage, SchemaStage, ClientStage, PublishStage, _FinalStage { - private String data; - - private String schema; - - private String client; - - private boolean publish; - - private Builder() {} - - @Override - public Builder from(CreateContentRuleActionDto other) { - data(other.getData()); - schema(other.getSchema()); - client(other.getClient()); - publish(other.getPublish()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("data"); + openapiFields.add("schema"); + openapiFields.add("client"); + openapiFields.add("publish"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("data"); + openapiRequiredFields.add("schema"); + openapiRequiredFields.add("client"); + openapiRequiredFields.add("publish"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateContentRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateContentRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateContentRuleActionDto is not found in the empty JSON string", CreateContentRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The content data.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("data") - public SchemaStage data(String data) { - this.data = data; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateContentRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateContentRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The name of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("schema") - public ClientStage schema(String schema) { - this.schema = schema; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateContentRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - /** - *

An optional client name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("client") - public PublishStage client(String client) { - this.client = client; - return this; - } - - /** - *

Publish the content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("publish") - public _FinalStage publish(boolean publish) { - this.publish = publish; - return this; - } - - @Override - public CreateContentRuleActionDto build() { - return new CreateContentRuleActionDto(data, schema, client, publish); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateContentRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateContentRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateContentRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateContentRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateContentRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of CreateContentRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateContentRuleActionDto + * @throws IOException if the JSON string is invalid with respect to CreateContentRuleActionDto + */ + public static CreateContentRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateContentRuleActionDto.class); + } + + /** + * Convert an instance of CreateContentRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/CreateRuleDto.java b/src/main/java/com/squidex/api/types/CreateRuleDto.java index bb6d3d3..99d2f4b 100644 --- a/src/main/java/com/squidex/api/types/CreateRuleDto.java +++ b/src/main/java/com/squidex/api/types/CreateRuleDto.java @@ -1,122 +1,236 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CreateRuleDto.Builder.class) -public final class CreateRuleDto { - private final RuleTriggerDto trigger; - - private final RuleActionDto action; - - private CreateRuleDto(RuleTriggerDto trigger, RuleActionDto action) { - this.trigger = trigger; - this.action = action; - } - - /** - * @return The trigger properties. - */ - @JsonProperty("trigger") - public RuleTriggerDto getTrigger() { - return trigger; - } - - /** - * @return The action properties. - */ - @JsonProperty("action") - public RuleActionDto getAction() { - return action; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateRuleDto && equalTo((CreateRuleDto) other); - } - - private boolean equalTo(CreateRuleDto other) { - return trigger.equals(other.trigger) && action.equals(other.action); - } - - @Override - public int hashCode() { - return Objects.hash(this.trigger, this.action); - } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static TriggerStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface TriggerStage { - ActionStage trigger(RuleTriggerDto trigger); +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.squidex.api.types.RuleActionDto; +import com.squidex.api.types.RuleTriggerDto; +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.squidex.api.core.JSON; - Builder from(CreateRuleDto other); +/** + * CreateRuleDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CreateRuleDto { + public static final String SERIALIZED_NAME_TRIGGER = "trigger"; + @SerializedName(SERIALIZED_NAME_TRIGGER) + private RuleTriggerDto trigger; + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private RuleActionDto action; + public CreateRuleDto() { + } + public CreateRuleDto trigger(RuleTriggerDto trigger) { + this.trigger = trigger; + return this; + } + + /** + * Get trigger + * @return trigger + */ + @javax.annotation.Nonnull + public RuleTriggerDto getTrigger() { + return trigger; + } + + public void setTrigger(RuleTriggerDto trigger) { + this.trigger = trigger; + } + public CreateRuleDto action(RuleActionDto action) { + this.action = action; + return this; + } + + /** + * Get action + * @return action + */ + @javax.annotation.Nonnull + public RuleActionDto getAction() { + return action; + } + + public void setAction(RuleActionDto action) { + this.action = action; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ActionStage { - _FinalStage action(RuleActionDto action); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - CreateRuleDto build(); + CreateRuleDto createRuleDto = (CreateRuleDto) o; + return Objects.equals(this.trigger, createRuleDto.trigger) && + Objects.equals(this.action, createRuleDto.action); + } + + @Override + public int hashCode() { + return Objects.hash(trigger, action); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateRuleDto {\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TriggerStage, ActionStage, _FinalStage { - private RuleTriggerDto trigger; - - private RuleActionDto action; - - private Builder() {} - - @Override - public Builder from(CreateRuleDto other) { - trigger(other.getTrigger()); - action(other.getAction()); - return this; - } - - /** - *

The trigger properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("trigger") - public ActionStage trigger(RuleTriggerDto trigger) { - this.trigger = trigger; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("trigger"); + openapiFields.add("action"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("trigger"); + openapiRequiredFields.add("action"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateRuleDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateRuleDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateRuleDto is not found in the empty JSON string", CreateRuleDto.openapiRequiredFields.toString())); } + } - /** - *

The action properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("action") - public _FinalStage action(RuleActionDto action) { - this.action = action; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateRuleDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateRuleDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public CreateRuleDto build() { - return new CreateRuleDto(trigger, action); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateRuleDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `trigger` + RuleTriggerDto.validateJsonElement(jsonObj.get("trigger")); + // validate the required field `action` + RuleActionDto.validateJsonElement(jsonObj.get("action")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateRuleDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateRuleDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateRuleDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateRuleDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateRuleDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of CreateRuleDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateRuleDto + * @throws IOException if the JSON string is invalid with respect to CreateRuleDto + */ + public static CreateRuleDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateRuleDto.class); + } + + /** + * Convert an instance of CreateRuleDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/CreateSchemaDto.java b/src/main/java/com/squidex/api/types/CreateSchemaDto.java new file mode 100644 index 0000000..cf7f224 --- /dev/null +++ b/src/main/java/com/squidex/api/types/CreateSchemaDto.java @@ -0,0 +1,579 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.FieldRuleDto; +import com.squidex.api.types.SchemaPropertiesDto; +import com.squidex.api.types.SchemaScriptsDto; +import com.squidex.api.types.SchemaType; +import com.squidex.api.types.UpsertSchemaFieldDto; +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 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.squidex.api.core.JSON; + +/** + * CreateSchemaDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CreateSchemaDto { + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private SchemaPropertiesDto properties; + public static final String SERIALIZED_NAME_SCRIPTS = "scripts"; + @SerializedName(SERIALIZED_NAME_SCRIPTS) + private SchemaScriptsDto scripts; + public static final String SERIALIZED_NAME_FIELDS_IN_REFERENCES = "fieldsInReferences"; + @SerializedName(SERIALIZED_NAME_FIELDS_IN_REFERENCES) + private List fieldsInReferences; + public static final String SERIALIZED_NAME_FIELDS_IN_LISTS = "fieldsInLists"; + @SerializedName(SERIALIZED_NAME_FIELDS_IN_LISTS) + private List fieldsInLists; + public static final String SERIALIZED_NAME_FIELDS = "fields"; + @SerializedName(SERIALIZED_NAME_FIELDS) + private List fields; + public static final String SERIALIZED_NAME_PREVIEW_URLS = "previewUrls"; + @SerializedName(SERIALIZED_NAME_PREVIEW_URLS) + private Map previewUrls; + public static final String SERIALIZED_NAME_FIELD_RULES = "fieldRules"; + @SerializedName(SERIALIZED_NAME_FIELD_RULES) + private List fieldRules; + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + private String category; + public static final String SERIALIZED_NAME_IS_PUBLISHED = "isPublished"; + @SerializedName(SERIALIZED_NAME_IS_PUBLISHED) + private Boolean isPublished; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private SchemaType type; + public static final String SERIALIZED_NAME_IS_SINGLETON = "isSingleton"; + @Deprecated + @SerializedName(SERIALIZED_NAME_IS_SINGLETON) + private Boolean isSingleton; + public CreateSchemaDto() { + } + public CreateSchemaDto properties(SchemaPropertiesDto properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nullable + public SchemaPropertiesDto getProperties() { + return properties; + } + + public void setProperties(SchemaPropertiesDto properties) { + this.properties = properties; + } + public CreateSchemaDto scripts(SchemaScriptsDto scripts) { + this.scripts = scripts; + return this; + } + + /** + * Get scripts + * @return scripts + */ + @javax.annotation.Nullable + public SchemaScriptsDto getScripts() { + return scripts; + } + + public void setScripts(SchemaScriptsDto scripts) { + this.scripts = scripts; + } + public CreateSchemaDto fieldsInReferences(List fieldsInReferences) { + this.fieldsInReferences = fieldsInReferences; + return this; + } + + public CreateSchemaDto addFieldsInReferencesItem(String fieldsInReferencesItem) { + if (this.fieldsInReferences == null) { + this.fieldsInReferences = new ArrayList<>(); + } + this.fieldsInReferences.add(fieldsInReferencesItem); + return this; + } + + /** + * The names of the fields that should be used in references. + * @return fieldsInReferences + */ + @javax.annotation.Nullable + public List getFieldsInReferences() { + return fieldsInReferences; + } + + public void setFieldsInReferences(List fieldsInReferences) { + this.fieldsInReferences = fieldsInReferences; + } + public CreateSchemaDto fieldsInLists(List fieldsInLists) { + this.fieldsInLists = fieldsInLists; + return this; + } + + public CreateSchemaDto addFieldsInListsItem(String fieldsInListsItem) { + if (this.fieldsInLists == null) { + this.fieldsInLists = new ArrayList<>(); + } + this.fieldsInLists.add(fieldsInListsItem); + return this; + } + + /** + * The names of the fields that should be shown in lists, including meta fields. + * @return fieldsInLists + */ + @javax.annotation.Nullable + public List getFieldsInLists() { + return fieldsInLists; + } + + public void setFieldsInLists(List fieldsInLists) { + this.fieldsInLists = fieldsInLists; + } + public CreateSchemaDto fields(List fields) { + this.fields = fields; + return this; + } + + public CreateSchemaDto addFieldsItem(UpsertSchemaFieldDto fieldsItem) { + if (this.fields == null) { + this.fields = new ArrayList<>(); + } + this.fields.add(fieldsItem); + return this; + } + + /** + * Optional fields. + * @return fields + */ + @javax.annotation.Nullable + public List getFields() { + return fields; + } + + public void setFields(List fields) { + this.fields = fields; + } + public CreateSchemaDto previewUrls(Map previewUrls) { + this.previewUrls = previewUrls; + return this; + } + + public CreateSchemaDto putPreviewUrlsItem(String key, String previewUrlsItem) { + if (this.previewUrls == null) { + this.previewUrls = new HashMap<>(); + } + this.previewUrls.put(key, previewUrlsItem); + return this; + } + + /** + * The optional preview urls. + * @return previewUrls + */ + @javax.annotation.Nullable + public Map getPreviewUrls() { + return previewUrls; + } + + public void setPreviewUrls(Map previewUrls) { + this.previewUrls = previewUrls; + } + public CreateSchemaDto fieldRules(List fieldRules) { + this.fieldRules = fieldRules; + return this; + } + + public CreateSchemaDto addFieldRulesItem(FieldRuleDto fieldRulesItem) { + if (this.fieldRules == null) { + this.fieldRules = new ArrayList<>(); + } + this.fieldRules.add(fieldRulesItem); + return this; + } + + /** + * The optional field Rules. + * @return fieldRules + */ + @javax.annotation.Nullable + public List getFieldRules() { + return fieldRules; + } + + public void setFieldRules(List fieldRules) { + this.fieldRules = fieldRules; + } + public CreateSchemaDto category(String category) { + this.category = category; + return this; + } + + /** + * The category. + * @return category + */ + @javax.annotation.Nullable + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + public CreateSchemaDto isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Set it to true to autopublish the schema. + * @return isPublished + */ + @javax.annotation.Nullable + public Boolean getIsPublished() { + return isPublished; + } + + public void setIsPublished(Boolean isPublished) { + this.isPublished = isPublished; + } + public CreateSchemaDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the schema. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public CreateSchemaDto type(SchemaType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nullable + public SchemaType getType() { + return type; + } + + public void setType(SchemaType type) { + this.type = type; + } + @Deprecated + public CreateSchemaDto isSingleton(Boolean isSingleton) { + this.isSingleton = isSingleton; + return this; + } + + /** + * Set to true to allow a single content item only. + * @return isSingleton + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Boolean getIsSingleton() { + return isSingleton; + } + + @Deprecated + public void setIsSingleton(Boolean isSingleton) { + this.isSingleton = isSingleton; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateSchemaDto createSchemaDto = (CreateSchemaDto) o; + return Objects.equals(this.properties, createSchemaDto.properties) && + Objects.equals(this.scripts, createSchemaDto.scripts) && + Objects.equals(this.fieldsInReferences, createSchemaDto.fieldsInReferences) && + Objects.equals(this.fieldsInLists, createSchemaDto.fieldsInLists) && + Objects.equals(this.fields, createSchemaDto.fields) && + Objects.equals(this.previewUrls, createSchemaDto.previewUrls) && + Objects.equals(this.fieldRules, createSchemaDto.fieldRules) && + Objects.equals(this.category, createSchemaDto.category) && + Objects.equals(this.isPublished, createSchemaDto.isPublished) && + Objects.equals(this.name, createSchemaDto.name) && + Objects.equals(this.type, createSchemaDto.type) && + Objects.equals(this.isSingleton, createSchemaDto.isSingleton); + } + + 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(properties, scripts, fieldsInReferences, fieldsInLists, fields, previewUrls, fieldRules, category, isPublished, name, type, isSingleton); + } + + 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 CreateSchemaDto {\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" scripts: ").append(toIndentedString(scripts)).append("\n"); + sb.append(" fieldsInReferences: ").append(toIndentedString(fieldsInReferences)).append("\n"); + sb.append(" fieldsInLists: ").append(toIndentedString(fieldsInLists)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" previewUrls: ").append(toIndentedString(previewUrls)).append("\n"); + sb.append(" fieldRules: ").append(toIndentedString(fieldRules)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" isSingleton: ").append(toIndentedString(isSingleton)).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("properties"); + openapiFields.add("scripts"); + openapiFields.add("fieldsInReferences"); + openapiFields.add("fieldsInLists"); + openapiFields.add("fields"); + openapiFields.add("previewUrls"); + openapiFields.add("fieldRules"); + openapiFields.add("category"); + openapiFields.add("isPublished"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("isSingleton"); + + // 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 CreateSchemaDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateSchemaDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateSchemaDto is not found in the empty JSON string", CreateSchemaDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateSchemaDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateSchemaDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateSchemaDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `properties` + if (jsonObj.get("properties") != null && !jsonObj.get("properties").isJsonNull()) { + SchemaPropertiesDto.validateJsonElement(jsonObj.get("properties")); + } + // validate the optional field `scripts` + if (jsonObj.get("scripts") != null && !jsonObj.get("scripts").isJsonNull()) { + SchemaScriptsDto.validateJsonElement(jsonObj.get("scripts")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("fieldsInReferences") != null && !jsonObj.get("fieldsInReferences").isJsonNull() && !jsonObj.get("fieldsInReferences").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldsInReferences` to be an array in the JSON string but got `%s`", jsonObj.get("fieldsInReferences").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("fieldsInLists") != null && !jsonObj.get("fieldsInLists").isJsonNull() && !jsonObj.get("fieldsInLists").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldsInLists` to be an array in the JSON string but got `%s`", jsonObj.get("fieldsInLists").toString())); + } + if (jsonObj.get("fields") != null && !jsonObj.get("fields").isJsonNull()) { + JsonArray jsonArrayfields = jsonObj.getAsJsonArray("fields"); + if (jsonArrayfields != null) { + // ensure the json data is an array + if (!jsonObj.get("fields").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fields` to be an array in the JSON string but got `%s`", jsonObj.get("fields").toString())); + } + + // validate the optional field `fields` (array) + for (int i = 0; i < jsonArrayfields.size(); i++) { + UpsertSchemaFieldDto.validateJsonElement(jsonArrayfields.get(i)); + }; + } + } + if (jsonObj.get("fieldRules") != null && !jsonObj.get("fieldRules").isJsonNull()) { + JsonArray jsonArrayfieldRules = jsonObj.getAsJsonArray("fieldRules"); + if (jsonArrayfieldRules != null) { + // ensure the json data is an array + if (!jsonObj.get("fieldRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldRules` to be an array in the JSON string but got `%s`", jsonObj.get("fieldRules").toString())); + } + + // validate the optional field `fieldRules` (array) + for (int i = 0; i < jsonArrayfieldRules.size(); i++) { + FieldRuleDto.validateJsonElement(jsonArrayfieldRules.get(i)); + }; + } + } + if ((jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) && !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())); + } + 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())); + } + // validate the optional field `type` + if (jsonObj.get("type") != null && !jsonObj.get("type").isJsonNull()) { + SchemaType.validateJsonElement(jsonObj.get("type")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateSchemaDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateSchemaDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateSchemaDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateSchemaDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateSchemaDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateSchemaDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateSchemaDto + * @throws IOException if the JSON string is invalid with respect to CreateSchemaDto + */ + public static CreateSchemaDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateSchemaDto.class); + } + + /** + * Convert an instance of CreateSchemaDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/CreateTeamDto.java b/src/main/java/com/squidex/api/types/CreateTeamDto.java new file mode 100644 index 0000000..7f4b603 --- /dev/null +++ b/src/main/java/com/squidex/api/types/CreateTeamDto.java @@ -0,0 +1,209 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * CreateTeamDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CreateTeamDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public CreateTeamDto() { + } + public CreateTeamDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the team. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateTeamDto createTeamDto = (CreateTeamDto) o; + return Objects.equals(this.name, createTeamDto.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateTeamDto {\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("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 CreateTeamDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateTeamDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateTeamDto is not found in the empty JSON string", CreateTeamDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateTeamDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateTeamDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateTeamDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!CreateTeamDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateTeamDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateTeamDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateTeamDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateTeamDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateTeamDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateTeamDto + * @throws IOException if the JSON string is invalid with respect to CreateTeamDto + */ + public static CreateTeamDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateTeamDto.class); + } + + /** + * Convert an instance of CreateTeamDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/CreateUserDto.java b/src/main/java/com/squidex/api/types/CreateUserDto.java new file mode 100644 index 0000000..653aa45 --- /dev/null +++ b/src/main/java/com/squidex/api/types/CreateUserDto.java @@ -0,0 +1,303 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.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.squidex.api.core.JSON; + +/** + * CreateUserDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CreateUserDto { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + private String displayName; + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + private String password; + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); + public CreateUserDto() { + } + public CreateUserDto email(String email) { + this.email = email; + return this; + } + + /** + * The email of the user. Unique value. + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + public CreateUserDto displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The display name (usually first name and last name) of the user. + * @return displayName + */ + @javax.annotation.Nonnull + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + public CreateUserDto password(String password) { + this.password = password; + return this; + } + + /** + * The password of the user. + * @return password + */ + @javax.annotation.Nonnull + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + public CreateUserDto permissions(List permissions) { + this.permissions = permissions; + return this; + } + + public CreateUserDto addPermissionsItem(String permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } + + /** + * Additional permissions for the user. + * @return permissions + */ + @javax.annotation.Nonnull + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateUserDto createUserDto = (CreateUserDto) o; + return Objects.equals(this.email, createUserDto.email) && + Objects.equals(this.displayName, createUserDto.displayName) && + Objects.equals(this.password, createUserDto.password) && + Objects.equals(this.permissions, createUserDto.permissions); + } + + @Override + public int hashCode() { + return Objects.hash(email, displayName, password, permissions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CreateUserDto {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).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("email"); + openapiFields.add("displayName"); + openapiFields.add("password"); + openapiFields.add("permissions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("displayName"); + openapiRequiredFields.add("password"); + openapiRequiredFields.add("permissions"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CreateUserDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CreateUserDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CreateUserDto is not found in the empty JSON string", CreateUserDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CreateUserDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CreateUserDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CreateUserDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").toString())); + } + if (!jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + // ensure the required json array is present + if (jsonObj.get("permissions") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("permissions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be an array in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CreateUserDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CreateUserDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CreateUserDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CreateUserDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CreateUserDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of CreateUserDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CreateUserDto + * @throws IOException if the JSON string is invalid with respect to CreateUserDto + */ + public static CreateUserDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CreateUserDto.class); + } + + /** + * Convert an instance of CreateUserDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/CurrentStorageDto.java b/src/main/java/com/squidex/api/types/CurrentStorageDto.java index 2cf5dc4..9fc79b8 100644 --- a/src/main/java/com/squidex/api/types/CurrentStorageDto.java +++ b/src/main/java/com/squidex/api/types/CurrentStorageDto.java @@ -1,122 +1,230 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = CurrentStorageDto.Builder.class) -public final class CurrentStorageDto { - private final int size; - - private final int maxAllowed; - - private CurrentStorageDto(int size, int maxAllowed) { - this.size = size; - this.maxAllowed = maxAllowed; - } - - /** - * @return The size in bytes. - */ - @JsonProperty("size") - public int getSize() { - return size; - } - - /** - * @return The maximum allowed asset size. - */ - @JsonProperty("maxAllowed") - public int getMaxAllowed() { - return maxAllowed; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CurrentStorageDto && equalTo((CurrentStorageDto) other); - } - private boolean equalTo(CurrentStorageDto other) { - return size == other.size && maxAllowed == other.maxAllowed; - } - - @Override - public int hashCode() { - return Objects.hash(this.size, this.maxAllowed); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.core.JSON; - public static SizeStage builder() { - return new Builder(); +/** + * CurrentStorageDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class CurrentStorageDto { + public static final String SERIALIZED_NAME_SIZE = "size"; + @SerializedName(SERIALIZED_NAME_SIZE) + private Long size; + public static final String SERIALIZED_NAME_MAX_ALLOWED = "maxAllowed"; + @SerializedName(SERIALIZED_NAME_MAX_ALLOWED) + private Long maxAllowed; + public CurrentStorageDto() { + } + public CurrentStorageDto size(Long size) { + this.size = size; + return this; + } + + /** + * The size in bytes. + * @return size + */ + @javax.annotation.Nonnull + public Long getSize() { + return size; + } + + public void setSize(Long size) { + this.size = size; + } + public CurrentStorageDto maxAllowed(Long maxAllowed) { + this.maxAllowed = maxAllowed; + return this; + } + + /** + * The maximum allowed asset size. + * @return maxAllowed + */ + @javax.annotation.Nonnull + public Long getMaxAllowed() { + return maxAllowed; + } + + public void setMaxAllowed(Long maxAllowed) { + this.maxAllowed = maxAllowed; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface SizeStage { - MaxAllowedStage size(int size); - - Builder from(CurrentStorageDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface MaxAllowedStage { - _FinalStage maxAllowed(int maxAllowed); + CurrentStorageDto currentStorageDto = (CurrentStorageDto) o; + return Objects.equals(this.size, currentStorageDto.size) && + Objects.equals(this.maxAllowed, currentStorageDto.maxAllowed); + } + + @Override + public int hashCode() { + return Objects.hash(size, maxAllowed); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class CurrentStorageDto {\n"); + sb.append(" size: ").append(toIndentedString(size)).append("\n"); + sb.append(" maxAllowed: ").append(toIndentedString(maxAllowed)).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"; } - - public interface _FinalStage { - CurrentStorageDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements SizeStage, MaxAllowedStage, _FinalStage { - private int size; - - private int maxAllowed; - - private Builder() {} - - @Override - public Builder from(CurrentStorageDto other) { - size(other.getSize()); - maxAllowed(other.getMaxAllowed()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("size"); + openapiFields.add("maxAllowed"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("size"); + openapiRequiredFields.add("maxAllowed"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to CurrentStorageDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!CurrentStorageDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in CurrentStorageDto is not found in the empty JSON string", CurrentStorageDto.openapiRequiredFields.toString())); } + } - /** - *

The size in bytes.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("size") - public MaxAllowedStage size(int size) { - this.size = size; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!CurrentStorageDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `CurrentStorageDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The maximum allowed asset size.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxAllowed") - public _FinalStage maxAllowed(int maxAllowed) { - this.maxAllowed = maxAllowed; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : CurrentStorageDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } - @Override - public CurrentStorageDto build() { - return new CurrentStorageDto(size, maxAllowed); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!CurrentStorageDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'CurrentStorageDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(CurrentStorageDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, CurrentStorageDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public CurrentStorageDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of CurrentStorageDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of CurrentStorageDto + * @throws IOException if the JSON string is invalid with respect to CurrentStorageDto + */ + public static CurrentStorageDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, CurrentStorageDto.class); + } + + /** + * Convert an instance of CurrentStorageDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java b/src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java index 296699b..ff80b7b 100644 --- a/src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java +++ b/src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java @@ -1,24 +1,78 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; +/** + * + */ +@JsonAdapter(DateTimeCalculatedDefaultValue.Adapter.class) public enum DateTimeCalculatedDefaultValue { - NOW("Now"), + + NOW("Now"), + + TODAY("Today"); + + private String value; - TODAY("Today"); + DateTimeCalculatedDefaultValue(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - DateTimeCalculatedDefaultValue(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static DateTimeCalculatedDefaultValue fromValue(String value) { + for (DateTimeCalculatedDefaultValue b : DateTimeCalculatedDefaultValue.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 DateTimeCalculatedDefaultValue enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public DateTimeCalculatedDefaultValue read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DateTimeCalculatedDefaultValue.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + DateTimeCalculatedDefaultValue.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/DateTimeFieldEditor.java b/src/main/java/com/squidex/api/types/DateTimeFieldEditor.java index 6427111..eca90a9 100644 --- a/src/main/java/com/squidex/api/types/DateTimeFieldEditor.java +++ b/src/main/java/com/squidex/api/types/DateTimeFieldEditor.java @@ -1,24 +1,78 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; +/** + * + */ +@JsonAdapter(DateTimeFieldEditor.Adapter.class) public enum DateTimeFieldEditor { - DATE("Date"), + + DATE("Date"), + + DATE_TIME("DateTime"); + + private String value; - DATE_TIME("DateTime"); + DateTimeFieldEditor(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - DateTimeFieldEditor(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static DateTimeFieldEditor fromValue(String value) { + for (DateTimeFieldEditor b : DateTimeFieldEditor.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 DateTimeFieldEditor enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public DateTimeFieldEditor read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return DateTimeFieldEditor.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + DateTimeFieldEditor.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java index fbc1673..0fe1e70 100644 --- a/src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java @@ -1,256 +1,382 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.DateTimeCalculatedDefaultValue; +import com.squidex.api.types.DateTimeFieldEditor; +import com.squidex.api.types.FieldPropertiesDto; +import java.io.IOException; import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = DateTimeFieldPropertiesDto.Builder.class) -public final class DateTimeFieldPropertiesDto { - private final Optional>> defaultValues; - - private final Optional defaultValue; - - private final Optional maxValue; - - private final Optional minValue; - - private final Optional format; - - private final Optional editor; - - private final Optional calculatedDefaultValue; - - private DateTimeFieldPropertiesDto( - Optional>> defaultValues, - Optional defaultValue, - Optional maxValue, - Optional minValue, - Optional format, - Optional editor, - Optional calculatedDefaultValue) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.maxValue = maxValue; - this.minValue = minValue; - this.format = format; - this.editor = editor; - this.calculatedDefaultValue = calculatedDefaultValue; - } - - /** - * @return The language specific default value for the field value. - */ - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value for the field value. - */ - @JsonProperty("defaultValue") - public Optional getDefaultValue() { - return defaultValue; - } - - /** - * @return The maximum allowed value for the field value. - */ - @JsonProperty("maxValue") - public Optional getMaxValue() { - return maxValue; - } - - /** - * @return The minimum allowed value for the field value. - */ - @JsonProperty("minValue") - public Optional getMinValue() { - return minValue; - } - - /** - * @return The format pattern when displayed in the UI. - */ - @JsonProperty("format") - public Optional getFormat() { - return format; - } - - /** - * @return The editor that is used to manage this field. - */ - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } +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; - /** - * @return The calculated default value for the field value. - */ - @JsonProperty("calculatedDefaultValue") - public Optional getCalculatedDefaultValue() { - return calculatedDefaultValue; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DateTimeFieldPropertiesDto && equalTo((DateTimeFieldPropertiesDto) other); +/** + * DateTimeFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class DateTimeFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_DEFAULT_VALUES = "defaultValues"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUES) + private Map defaultValues = new HashMap<>(); + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private OffsetDateTime defaultValue; + public static final String SERIALIZED_NAME_MAX_VALUE = "maxValue"; + @SerializedName(SERIALIZED_NAME_MAX_VALUE) + private OffsetDateTime maxValue; + public static final String SERIALIZED_NAME_MIN_VALUE = "minValue"; + @SerializedName(SERIALIZED_NAME_MIN_VALUE) + private OffsetDateTime minValue; + public static final String SERIALIZED_NAME_FORMAT = "format"; + @SerializedName(SERIALIZED_NAME_FORMAT) + private String format; + public static final String SERIALIZED_NAME_EDITOR = "editor"; + @SerializedName(SERIALIZED_NAME_EDITOR) + private DateTimeFieldEditor editor; + public static final String SERIALIZED_NAME_CALCULATED_DEFAULT_VALUE = "calculatedDefaultValue"; + @SerializedName(SERIALIZED_NAME_CALCULATED_DEFAULT_VALUE) + private DateTimeCalculatedDefaultValue calculatedDefaultValue; + public DateTimeFieldPropertiesDto() { + } + public DateTimeFieldPropertiesDto defaultValues(Map defaultValues) { + this.defaultValues = defaultValues; + return this; + } + + public DateTimeFieldPropertiesDto putDefaultValuesItem(String key, OffsetDateTime defaultValuesItem) { + if (this.defaultValues == null) { + this.defaultValues = new HashMap<>(); } - - private boolean equalTo(DateTimeFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && maxValue.equals(other.maxValue) - && minValue.equals(other.minValue) - && format.equals(other.format) - && editor.equals(other.editor) - && calculatedDefaultValue.equals(other.calculatedDefaultValue); + this.defaultValues.put(key, defaultValuesItem); + return this; + } + + /** + * Get defaultValues + * @return defaultValues + */ + @javax.annotation.Nullable + public Map getDefaultValues() { + return defaultValues; + } + + public void setDefaultValues(Map defaultValues) { + this.defaultValues = defaultValues; + } + public DateTimeFieldPropertiesDto defaultValue(OffsetDateTime defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * The default value for the field value. + * @return defaultValue + */ + @javax.annotation.Nullable + public OffsetDateTime getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(OffsetDateTime defaultValue) { + this.defaultValue = defaultValue; + } + public DateTimeFieldPropertiesDto maxValue(OffsetDateTime maxValue) { + this.maxValue = maxValue; + return this; + } + + /** + * The maximum allowed value for the field value. + * @return maxValue + */ + @javax.annotation.Nullable + public OffsetDateTime getMaxValue() { + return maxValue; + } + + public void setMaxValue(OffsetDateTime maxValue) { + this.maxValue = maxValue; + } + public DateTimeFieldPropertiesDto minValue(OffsetDateTime minValue) { + this.minValue = minValue; + return this; + } + + /** + * The minimum allowed value for the field value. + * @return minValue + */ + @javax.annotation.Nullable + public OffsetDateTime getMinValue() { + return minValue; + } + + public void setMinValue(OffsetDateTime minValue) { + this.minValue = minValue; + } + public DateTimeFieldPropertiesDto format(String format) { + this.format = format; + return this; + } + + /** + * The format pattern when displayed in the UI. + * @return format + */ + @javax.annotation.Nullable + public String getFormat() { + return format; + } + + public void setFormat(String format) { + this.format = format; + } + public DateTimeFieldPropertiesDto editor(DateTimeFieldEditor editor) { + this.editor = editor; + return this; + } + + /** + * Get editor + * @return editor + */ + @javax.annotation.Nullable + public DateTimeFieldEditor getEditor() { + return editor; + } + + public void setEditor(DateTimeFieldEditor editor) { + this.editor = editor; + } + public DateTimeFieldPropertiesDto calculatedDefaultValue(DateTimeCalculatedDefaultValue calculatedDefaultValue) { + this.calculatedDefaultValue = calculatedDefaultValue; + return this; + } + + /** + * Get calculatedDefaultValue + * @return calculatedDefaultValue + */ + @javax.annotation.Nullable + public DateTimeCalculatedDefaultValue getCalculatedDefaultValue() { + return calculatedDefaultValue; + } + + public void setCalculatedDefaultValue(DateTimeCalculatedDefaultValue calculatedDefaultValue) { + this.calculatedDefaultValue = calculatedDefaultValue; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public int hashCode() { - return Objects.hash( - this.defaultValues, - this.defaultValue, - this.maxValue, - this.minValue, - this.format, - this.editor, - this.calculatedDefaultValue); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + DateTimeFieldPropertiesDto dateTimeFieldPropertiesDto = (DateTimeFieldPropertiesDto) o; + return Objects.equals(this.defaultValues, dateTimeFieldPropertiesDto.defaultValues) && + Objects.equals(this.defaultValue, dateTimeFieldPropertiesDto.defaultValue) && + Objects.equals(this.maxValue, dateTimeFieldPropertiesDto.maxValue) && + Objects.equals(this.minValue, dateTimeFieldPropertiesDto.minValue) && + Objects.equals(this.format, dateTimeFieldPropertiesDto.format) && + Objects.equals(this.editor, dateTimeFieldPropertiesDto.editor) && + Objects.equals(this.calculatedDefaultValue, dateTimeFieldPropertiesDto.calculatedDefaultValue) && + super.equals(o); + } + + 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(defaultValues, defaultValue, maxValue, minValue, format, editor, calculatedDefaultValue, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static Builder builder() { - return new Builder(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DateTimeFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" defaultValues: ").append(toIndentedString(defaultValues)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" maxValue: ").append(toIndentedString(maxValue)).append("\n"); + sb.append(" minValue: ").append(toIndentedString(minValue)).append("\n"); + sb.append(" format: ").append(toIndentedString(format)).append("\n"); + sb.append(" editor: ").append(toIndentedString(editor)).append("\n"); + sb.append(" calculatedDefaultValue: ").append(toIndentedString(calculatedDefaultValue)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> defaultValues = Optional.empty(); - - private Optional defaultValue = Optional.empty(); - - private Optional maxValue = Optional.empty(); - - private Optional minValue = Optional.empty(); - - private Optional format = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Optional calculatedDefaultValue = Optional.empty(); - - private Builder() {} - - public Builder from(DateTimeFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - maxValue(other.getMaxValue()); - minValue(other.getMinValue()); - format(other.getFormat()); - editor(other.getEditor()); - calculatedDefaultValue(other.getCalculatedDefaultValue()); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(OffsetDateTime defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("defaultValues"); + openapiFields.add("defaultValue"); + openapiFields.add("maxValue"); + openapiFields.add("minValue"); + openapiFields.add("format"); + openapiFields.add("editor"); + openapiFields.add("calculatedDefaultValue"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DateTimeFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DateTimeFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DateTimeFieldPropertiesDto is not found in the empty JSON string", DateTimeFieldPropertiesDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "maxValue", nulls = Nulls.SKIP) - public Builder maxValue(Optional maxValue) { - this.maxValue = maxValue; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DateTimeFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DateTimeFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder maxValue(OffsetDateTime maxValue) { - this.maxValue = Optional.of(maxValue); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DateTimeFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @JsonSetter(value = "minValue", nulls = Nulls.SKIP) - public Builder minValue(Optional minValue) { - this.minValue = minValue; - return this; - } - - public Builder minValue(OffsetDateTime minValue) { - this.minValue = Optional.of(minValue); - return this; - } - - @JsonSetter(value = "format", nulls = Nulls.SKIP) - public Builder format(Optional format) { - this.format = format; - return this; - } - - public Builder format(String format) { - this.format = Optional.of(format); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(DateTimeFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - @JsonSetter(value = "calculatedDefaultValue", nulls = Nulls.SKIP) - public Builder calculatedDefaultValue(Optional calculatedDefaultValue) { - this.calculatedDefaultValue = calculatedDefaultValue; - return this; - } - - public Builder calculatedDefaultValue(DateTimeCalculatedDefaultValue calculatedDefaultValue) { - this.calculatedDefaultValue = Optional.of(calculatedDefaultValue); - return this; - } - - public DateTimeFieldPropertiesDto build() { - return new DateTimeFieldPropertiesDto( - defaultValues, defaultValue, maxValue, minValue, format, editor, calculatedDefaultValue); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DateTimeFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DateTimeFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DateTimeFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DateTimeFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DateTimeFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of DateTimeFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DateTimeFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to DateTimeFieldPropertiesDto + */ + public static DateTimeFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DateTimeFieldPropertiesDto.class); + } + + /** + * Convert an instance of DateTimeFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/DeepDetectRuleActionDto.java b/src/main/java/com/squidex/api/types/DeepDetectRuleActionDto.java deleted file mode 100644 index ea9a944..0000000 --- a/src/main/java/com/squidex/api/types/DeepDetectRuleActionDto.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = DeepDetectRuleActionDto.Builder.class) -public final class DeepDetectRuleActionDto { - private final int minimumProbability; - - private final int maximumTags; - - private DeepDetectRuleActionDto(int minimumProbability, int maximumTags) { - this.minimumProbability = minimumProbability; - this.maximumTags = maximumTags; - } - - /** - * @return The minimum probability for objects to be recognized (0 - 100). - */ - @JsonProperty("minimumProbability") - public int getMinimumProbability() { - return minimumProbability; - } - - /** - * @return The maximum number of tags to use. - */ - @JsonProperty("maximumTags") - public int getMaximumTags() { - return maximumTags; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DeepDetectRuleActionDto && equalTo((DeepDetectRuleActionDto) other); - } - - private boolean equalTo(DeepDetectRuleActionDto other) { - return minimumProbability == other.minimumProbability && maximumTags == other.maximumTags; - } - - @Override - public int hashCode() { - return Objects.hash(this.minimumProbability, this.maximumTags); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MinimumProbabilityStage builder() { - return new Builder(); - } - - public interface MinimumProbabilityStage { - MaximumTagsStage minimumProbability(int minimumProbability); - - Builder from(DeepDetectRuleActionDto other); - } - - public interface MaximumTagsStage { - _FinalStage maximumTags(int maximumTags); - } - - public interface _FinalStage { - DeepDetectRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MinimumProbabilityStage, MaximumTagsStage, _FinalStage { - private int minimumProbability; - - private int maximumTags; - - private Builder() {} - - @Override - public Builder from(DeepDetectRuleActionDto other) { - minimumProbability(other.getMinimumProbability()); - maximumTags(other.getMaximumTags()); - return this; - } - - /** - *

The minimum probability for objects to be recognized (0 - 100).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("minimumProbability") - public MaximumTagsStage minimumProbability(int minimumProbability) { - this.minimumProbability = minimumProbability; - return this; - } - - /** - *

The maximum number of tags to use.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maximumTags") - public _FinalStage maximumTags(int maximumTags) { - this.maximumTags = maximumTags; - return this; - } - - @Override - public DeepDetectRuleActionDto build() { - return new DeepDetectRuleActionDto(minimumProbability, maximumTags); - } - } -} diff --git a/src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java b/src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java index 1f20270..1f9d65a 100644 --- a/src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java @@ -1,300 +1,364 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = DiscourseRuleActionDto.Builder.class) -public final class DiscourseRuleActionDto { - private final String url; - - private final String apiKey; - - private final String apiUsername; - - private final String text; - - private final Optional title; - - private final Optional topic; - - private final Optional category; - - private DiscourseRuleActionDto( - String url, - String apiKey, - String apiUsername, - String text, - Optional title, - Optional topic, - Optional category) { - this.url = url; - this.apiKey = apiKey; - this.apiUsername = apiUsername; - this.text = text; - this.title = title; - this.topic = topic; - this.category = category; - } - - /** - * @return The url to the discourse server. - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - /** - * @return The api key to authenticate to your discourse server. - */ - @JsonProperty("apiKey") - public String getApiKey() { - return apiKey; - } - - /** - * @return The api username to authenticate to your discourse server. - */ - @JsonProperty("apiUsername") - public String getApiUsername() { - return apiUsername; - } - - /** - * @return The text as markdown. - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return The optional title when creating new topics. - */ - @JsonProperty("title") - public Optional getTitle() { - return title; - } - - /** - * @return The optional topic id. - */ - @JsonProperty("topic") - public Optional getTopic() { - return topic; - } - - /** - * @return The optional category id. - */ - @JsonProperty("category") - public Optional getCategory() { - return category; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DiscourseRuleActionDto && equalTo((DiscourseRuleActionDto) other); - } - private boolean equalTo(DiscourseRuleActionDto other) { - return url.equals(other.url) - && apiKey.equals(other.apiKey) - && apiUsername.equals(other.apiUsername) - && text.equals(other.text) - && title.equals(other.title) - && topic.equals(other.topic) - && category.equals(other.category); - } - - @Override - public int hashCode() { - return Objects.hash(this.url, this.apiKey, this.apiUsername, this.text, this.title, this.topic, this.category); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static UrlStage builder() { - return new Builder(); - } - - public interface UrlStage { - ApiKeyStage url(String url); +package com.squidex.api.types; - Builder from(DiscourseRuleActionDto other); - } +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.squidex.api.types.RuleActionDto; +import java.io.IOException; +import java.net.URI; +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.squidex.api.core.JSON; - public interface ApiKeyStage { - ApiUsernameStage apiKey(String apiKey); +/** + * DiscourseRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class DiscourseRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private URI url; + public static final String SERIALIZED_NAME_API_KEY = "apiKey"; + @SerializedName(SERIALIZED_NAME_API_KEY) + private String apiKey; + public static final String SERIALIZED_NAME_API_USERNAME = "apiUsername"; + @SerializedName(SERIALIZED_NAME_API_USERNAME) + private String apiUsername; + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + private String title; + public static final String SERIALIZED_NAME_TOPIC = "topic"; + @SerializedName(SERIALIZED_NAME_TOPIC) + private Integer topic; + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + private Integer category; + public DiscourseRuleActionDto() { + } + public DiscourseRuleActionDto url(URI url) { + this.url = url; + return this; + } + + /** + * The url to the discourse server. + * @return url + */ + @javax.annotation.Nonnull + public URI getUrl() { + return url; + } + + public void setUrl(URI url) { + this.url = url; + } + public DiscourseRuleActionDto apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The api key to authenticate to your discourse server. + * @return apiKey + */ + @javax.annotation.Nonnull + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + public DiscourseRuleActionDto apiUsername(String apiUsername) { + this.apiUsername = apiUsername; + return this; + } + + /** + * The api username to authenticate to your discourse server. + * @return apiUsername + */ + @javax.annotation.Nonnull + public String getApiUsername() { + return apiUsername; + } + + public void setApiUsername(String apiUsername) { + this.apiUsername = apiUsername; + } + public DiscourseRuleActionDto text(String text) { + this.text = text; + return this; + } + + /** + * The text as markdown. + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + public DiscourseRuleActionDto title(String title) { + this.title = title; + return this; + } + + /** + * The optional title when creating new topics. + * @return title + */ + @javax.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + public DiscourseRuleActionDto topic(Integer topic) { + this.topic = topic; + return this; + } + + /** + * The optional topic id. + * @return topic + */ + @javax.annotation.Nullable + public Integer getTopic() { + return topic; + } + + public void setTopic(Integer topic) { + this.topic = topic; + } + public DiscourseRuleActionDto category(Integer category) { + this.category = category; + return this; + } + + /** + * The optional category id. + * @return category + */ + @javax.annotation.Nullable + public Integer getCategory() { + return category; + } + + public void setCategory(Integer category) { + this.category = category; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ApiUsernameStage { - TextStage apiUsername(String apiUsername); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface TextStage { - _FinalStage text(String text); + DiscourseRuleActionDto discourseRuleActionDto = (DiscourseRuleActionDto) o; + return Objects.equals(this.url, discourseRuleActionDto.url) && + Objects.equals(this.apiKey, discourseRuleActionDto.apiKey) && + Objects.equals(this.apiUsername, discourseRuleActionDto.apiUsername) && + Objects.equals(this.text, discourseRuleActionDto.text) && + Objects.equals(this.title, discourseRuleActionDto.title) && + Objects.equals(this.topic, discourseRuleActionDto.topic) && + Objects.equals(this.category, discourseRuleActionDto.category) && + super.equals(o); + } + + 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(url, apiKey, apiUsername, text, title, topic, category, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - DiscourseRuleActionDto build(); - - _FinalStage title(Optional title); - - _FinalStage title(String title); - - _FinalStage topic(Optional topic); - - _FinalStage topic(Integer topic); - - _FinalStage category(Optional category); - - _FinalStage category(Integer category); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class DiscourseRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" apiUsername: ").append(toIndentedString(apiUsername)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" topic: ").append(toIndentedString(topic)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UrlStage, ApiKeyStage, ApiUsernameStage, TextStage, _FinalStage { - private String url; - - private String apiKey; - - private String apiUsername; - - private String text; - - private Optional category = Optional.empty(); - - private Optional topic = Optional.empty(); - - private Optional title = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(DiscourseRuleActionDto other) { - url(other.getUrl()); - apiKey(other.getApiKey()); - apiUsername(other.getApiUsername()); - text(other.getText()); - title(other.getTitle()); - topic(other.getTopic()); - category(other.getCategory()); - return this; - } - - /** - *

The url to the discourse server.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public ApiKeyStage url(String url) { - this.url = url; - return this; - } - - /** - *

The api key to authenticate to your discourse server.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiKey") - public ApiUsernameStage apiKey(String apiKey) { - this.apiKey = apiKey; - return this; - } - - /** - *

The api username to authenticate to your discourse server.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiUsername") - public TextStage apiUsername(String apiUsername) { - this.apiUsername = apiUsername; - return this; - } - - /** - *

The text as markdown.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("url"); + openapiFields.add("apiKey"); + openapiFields.add("apiUsername"); + openapiFields.add("text"); + openapiFields.add("title"); + openapiFields.add("topic"); + openapiFields.add("category"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + openapiRequiredFields.add("apiKey"); + openapiRequiredFields.add("apiUsername"); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to DiscourseRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!DiscourseRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in DiscourseRuleActionDto is not found in the empty JSON string", DiscourseRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The optional category id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage category(Integer category) { - this.category = Optional.of(category); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!DiscourseRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `DiscourseRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public _FinalStage category(Optional category) { - this.category = category; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : DiscourseRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - /** - *

The optional topic id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage topic(Integer topic) { - this.topic = Optional.of(topic); - return this; - } - - @Override - @JsonSetter(value = "topic", nulls = Nulls.SKIP) - public _FinalStage topic(Optional topic) { - this.topic = topic; - return this; - } - - /** - *

The optional title when creating new topics.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage title(String title) { - this.title = Optional.of(title); - return this; - } - - @Override - @JsonSetter(value = "title", nulls = Nulls.SKIP) - public _FinalStage title(Optional title) { - this.title = title; - return this; - } - - @Override - public DiscourseRuleActionDto build() { - return new DiscourseRuleActionDto(url, apiKey, apiUsername, text, title, topic, category); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!DiscourseRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'DiscourseRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(DiscourseRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, DiscourseRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public DiscourseRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of DiscourseRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of DiscourseRuleActionDto + * @throws IOException if the JSON string is invalid with respect to DiscourseRuleActionDto + */ + public static DiscourseRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, DiscourseRuleActionDto.class); + } + + /** + * Convert an instance of DiscourseRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/EditorDto.java b/src/main/java/com/squidex/api/types/EditorDto.java index ffb223f..c1dc54c 100644 --- a/src/main/java/com/squidex/api/types/EditorDto.java +++ b/src/main/java/com/squidex/api/types/EditorDto.java @@ -1,122 +1,236 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = EditorDto.Builder.class) -public final class EditorDto { - private final String name; - - private final String url; - - private EditorDto(String name, String url) { - this.name = name; - this.url = url; - } - - /** - * @return The name of the editor. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The url to the editor. - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EditorDto && equalTo((EditorDto) other); - } - - private boolean equalTo(EditorDto other) { - return name.equals(other.name) && url.equals(other.url); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.url); - } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static NameStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface NameStage { - UrlStage name(String name); +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.squidex.api.core.JSON; - Builder from(EditorDto other); +/** + * EditorDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class EditorDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + public EditorDto() { + } + public EditorDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the editor. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public EditorDto url(String url) { + this.url = url; + return this; + } + + /** + * The url to the editor. + * @return url + */ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface UrlStage { - _FinalStage url(String url); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - EditorDto build(); + EditorDto editorDto = (EditorDto) o; + return Objects.equals(this.name, editorDto.name) && + Objects.equals(this.url, editorDto.url); + } + + @Override + public int hashCode() { + return Objects.hash(name, url); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EditorDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, UrlStage, _FinalStage { - private String name; - - private String url; - - private Builder() {} - - @Override - public Builder from(EditorDto other) { - name(other.getName()); - url(other.getUrl()); - return this; - } - - /** - *

The name of the editor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public UrlStage name(String name) { - this.name = name; - return this; + return o.toString().replace("\n", "\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("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EditorDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EditorDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EditorDto is not found in the empty JSON string", EditorDto.openapiRequiredFields.toString())); } + } - /** - *

The url to the editor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public _FinalStage url(String url) { - this.url = url; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EditorDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EditorDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public EditorDto build() { - return new EditorDto(name, url); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EditorDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!EditorDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EditorDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EditorDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EditorDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EditorDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of EditorDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of EditorDto + * @throws IOException if the JSON string is invalid with respect to EditorDto + */ + public static EditorDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EditorDto.class); + } + + /** + * Convert an instance of EditorDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java b/src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java index d5633d7..6c65095 100644 --- a/src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java @@ -1,275 +1,339 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ElasticSearchRuleActionDto.Builder.class) -public final class ElasticSearchRuleActionDto { - private final String host; - - private final String indexName; - - private final Optional username; - - private final Optional password; - - private final Optional document; - - private final Optional delete; - private ElasticSearchRuleActionDto( - String host, - String indexName, - Optional username, - Optional password, - Optional document, - Optional delete) { - this.host = host; - this.indexName = indexName; - this.username = username; - this.password = password; - this.document = document; - this.delete = delete; - } - - /** - * @return The url to the instance or cluster. - */ - @JsonProperty("host") - public String getHost() { - return host; - } - - /** - * @return The name of the index. - */ - @JsonProperty("indexName") - public String getIndexName() { - return indexName; - } - - /** - * @return The optional username. - */ - @JsonProperty("username") - public Optional getUsername() { - return username; - } - - /** - * @return The optional password. - */ - @JsonProperty("password") - public Optional getPassword() { - return password; - } - /** - * @return The optional custom document. - */ - @JsonProperty("document") - public Optional getDocument() { - return document; - } - - /** - * @return The condition when to delete the document. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ElasticSearchRuleActionDto && equalTo((ElasticSearchRuleActionDto) other); - } - - private boolean equalTo(ElasticSearchRuleActionDto other) { - return host.equals(other.host) - && indexName.equals(other.indexName) - && username.equals(other.username) - && password.equals(other.password) - && document.equals(other.document) - && delete.equals(other.delete); - } - - @Override - public int hashCode() { - return Objects.hash(this.host, this.indexName, this.username, this.password, this.document, this.delete); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.types.RuleActionDto; +import java.io.IOException; +import java.net.URI; +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.squidex.api.core.JSON; - public static HostStage builder() { - return new Builder(); +/** + * ElasticSearchRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ElasticSearchRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_HOST = "host"; + @SerializedName(SERIALIZED_NAME_HOST) + private URI host; + public static final String SERIALIZED_NAME_INDEX_NAME = "indexName"; + @SerializedName(SERIALIZED_NAME_INDEX_NAME) + private String indexName; + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + private String username; + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + private String password; + public static final String SERIALIZED_NAME_DOCUMENT = "document"; + @SerializedName(SERIALIZED_NAME_DOCUMENT) + private String document; + public static final String SERIALIZED_NAME_DELETE = "delete"; + @SerializedName(SERIALIZED_NAME_DELETE) + private String delete; + public ElasticSearchRuleActionDto() { + } + public ElasticSearchRuleActionDto host(URI host) { + this.host = host; + return this; + } + + /** + * The url to the instance or cluster. + * @return host + */ + @javax.annotation.Nonnull + public URI getHost() { + return host; + } + + public void setHost(URI host) { + this.host = host; + } + public ElasticSearchRuleActionDto indexName(String indexName) { + this.indexName = indexName; + return this; + } + + /** + * The name of the index. + * @return indexName + */ + @javax.annotation.Nonnull + public String getIndexName() { + return indexName; + } + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + public ElasticSearchRuleActionDto username(String username) { + this.username = username; + return this; + } + + /** + * The optional username. + * @return username + */ + @javax.annotation.Nullable + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + public ElasticSearchRuleActionDto password(String password) { + this.password = password; + return this; + } + + /** + * The optional password. + * @return password + */ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + public ElasticSearchRuleActionDto document(String document) { + this.document = document; + return this; + } + + /** + * The optional custom document. + * @return document + */ + @javax.annotation.Nullable + public String getDocument() { + return document; + } + + public void setDocument(String document) { + this.document = document; + } + public ElasticSearchRuleActionDto delete(String delete) { + this.delete = delete; + return this; + } + + /** + * The condition when to delete the document. + * @return delete + */ + @javax.annotation.Nullable + public String getDelete() { + return delete; + } + + public void setDelete(String delete) { + this.delete = delete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface HostStage { - IndexNameStage host(String host); - - Builder from(ElasticSearchRuleActionDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface IndexNameStage { - _FinalStage indexName(String indexName); + ElasticSearchRuleActionDto elasticSearchRuleActionDto = (ElasticSearchRuleActionDto) o; + return Objects.equals(this.host, elasticSearchRuleActionDto.host) && + Objects.equals(this.indexName, elasticSearchRuleActionDto.indexName) && + Objects.equals(this.username, elasticSearchRuleActionDto.username) && + Objects.equals(this.password, elasticSearchRuleActionDto.password) && + Objects.equals(this.document, elasticSearchRuleActionDto.document) && + Objects.equals(this.delete, elasticSearchRuleActionDto.delete) && + super.equals(o); + } + + 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(host, indexName, username, password, document, delete, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - ElasticSearchRuleActionDto build(); - - _FinalStage username(Optional username); - - _FinalStage username(String username); - - _FinalStage password(Optional password); - - _FinalStage password(String password); - - _FinalStage document(Optional document); - - _FinalStage document(String document); - - _FinalStage delete(Optional delete); - - _FinalStage delete(String delete); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ElasticSearchRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" host: ").append(toIndentedString(host)).append("\n"); + sb.append(" indexName: ").append(toIndentedString(indexName)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" document: ").append(toIndentedString(document)).append("\n"); + sb.append(" delete: ").append(toIndentedString(delete)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements HostStage, IndexNameStage, _FinalStage { - private String host; - - private String indexName; - - private Optional delete = Optional.empty(); - - private Optional document = Optional.empty(); - - private Optional password = Optional.empty(); - - private Optional username = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ElasticSearchRuleActionDto other) { - host(other.getHost()); - indexName(other.getIndexName()); - username(other.getUsername()); - password(other.getPassword()); - document(other.getDocument()); - delete(other.getDelete()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("host"); + openapiFields.add("indexName"); + openapiFields.add("username"); + openapiFields.add("password"); + openapiFields.add("document"); + openapiFields.add("delete"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("host"); + openapiRequiredFields.add("indexName"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ElasticSearchRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ElasticSearchRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ElasticSearchRuleActionDto is not found in the empty JSON string", ElasticSearchRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The url to the instance or cluster.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("host") - public IndexNameStage host(String host) { - this.host = host; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ElasticSearchRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ElasticSearchRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The name of the index.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("indexName") - public _FinalStage indexName(String indexName) { - this.indexName = indexName; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ElasticSearchRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - /** - *

The condition when to delete the document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - @Override - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public _FinalStage delete(Optional delete) { - this.delete = delete; - return this; - } - - /** - *

The optional custom document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage document(String document) { - this.document = Optional.of(document); - return this; - } - - @Override - @JsonSetter(value = "document", nulls = Nulls.SKIP) - public _FinalStage document(Optional document) { - this.document = document; - return this; - } - - /** - *

The optional password.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage password(String password) { - this.password = Optional.of(password); - return this; - } - - @Override - @JsonSetter(value = "password", nulls = Nulls.SKIP) - public _FinalStage password(Optional password) { - this.password = password; - return this; - } - - /** - *

The optional username.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage username(String username) { - this.username = Optional.of(username); - return this; - } - - @Override - @JsonSetter(value = "username", nulls = Nulls.SKIP) - public _FinalStage username(Optional username) { - this.username = username; - return this; - } - - @Override - public ElasticSearchRuleActionDto build() { - return new ElasticSearchRuleActionDto(host, indexName, username, password, document, delete); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ElasticSearchRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ElasticSearchRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ElasticSearchRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ElasticSearchRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ElasticSearchRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ElasticSearchRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ElasticSearchRuleActionDto + * @throws IOException if the JSON string is invalid with respect to ElasticSearchRuleActionDto + */ + public static ElasticSearchRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ElasticSearchRuleActionDto.class); + } + + /** + * Convert an instance of ElasticSearchRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/EmailRuleActionDto.java b/src/main/java/com/squidex/api/types/EmailRuleActionDto.java index d8304c5..f428aa6 100644 --- a/src/main/java/com/squidex/api/types/EmailRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/EmailRuleActionDto.java @@ -1,336 +1,378 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = EmailRuleActionDto.Builder.class) -public final class EmailRuleActionDto { - private final String serverHost; - - private final int serverPort; - - private final String serverUsername; - - private final String serverPassword; - - private final String messageFrom; - - private final String messageTo; - - private final String messageSubject; - - private final String messageBody; - - private EmailRuleActionDto( - String serverHost, - int serverPort, - String serverUsername, - String serverPassword, - String messageFrom, - String messageTo, - String messageSubject, - String messageBody) { - this.serverHost = serverHost; - this.serverPort = serverPort; - this.serverUsername = serverUsername; - this.serverPassword = serverPassword; - this.messageFrom = messageFrom; - this.messageTo = messageTo; - this.messageSubject = messageSubject; - this.messageBody = messageBody; - } - - /** - * @return The IP address or host to the SMTP server. - */ - @JsonProperty("serverHost") - public String getServerHost() { - return serverHost; - } - - /** - * @return The port to the SMTP server. - */ - @JsonProperty("serverPort") - public int getServerPort() { - return serverPort; - } - - /** - * @return The username for the SMTP server. - */ - @JsonProperty("serverUsername") - public String getServerUsername() { - return serverUsername; - } - - /** - * @return The password for the SMTP server. - */ - @JsonProperty("serverPassword") - public String getServerPassword() { - return serverPassword; - } - - /** - * @return The email sending address. - */ - @JsonProperty("messageFrom") - public String getMessageFrom() { - return messageFrom; - } - /** - * @return The email message will be sent to. - */ - @JsonProperty("messageTo") - public String getMessageTo() { - return messageTo; - } - - /** - * @return The subject line for this email message. - */ - @JsonProperty("messageSubject") - public String getMessageSubject() { - return messageSubject; - } - - /** - * @return The message body. - */ - @JsonProperty("messageBody") - public String getMessageBody() { - return messageBody; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EmailRuleActionDto && equalTo((EmailRuleActionDto) other); - } - - private boolean equalTo(EmailRuleActionDto other) { - return serverHost.equals(other.serverHost) - && serverPort == other.serverPort - && serverUsername.equals(other.serverUsername) - && serverPassword.equals(other.serverPassword) - && messageFrom.equals(other.messageFrom) - && messageTo.equals(other.messageTo) - && messageSubject.equals(other.messageSubject) - && messageBody.equals(other.messageBody); - } - - @Override - public int hashCode() { - return Objects.hash( - this.serverHost, - this.serverPort, - this.serverUsername, - this.serverPassword, - this.messageFrom, - this.messageTo, - this.messageSubject, - this.messageBody); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ServerHostStage builder() { - return new Builder(); - } - public interface ServerHostStage { - ServerPortStage serverHost(String serverHost); - - Builder from(EmailRuleActionDto other); - } - - public interface ServerPortStage { - ServerUsernameStage serverPort(int serverPort); - } - - public interface ServerUsernameStage { - ServerPasswordStage serverUsername(String serverUsername); - } - - public interface ServerPasswordStage { - MessageFromStage serverPassword(String serverPassword); - } - - public interface MessageFromStage { - MessageToStage messageFrom(String messageFrom); - } +package com.squidex.api.types; - public interface MessageToStage { - MessageSubjectStage messageTo(String messageTo); - } +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.squidex.api.types.RuleActionDto; +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.squidex.api.core.JSON; - public interface MessageSubjectStage { - MessageBodyStage messageSubject(String messageSubject); +/** + * EmailRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class EmailRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_SERVER_HOST = "serverHost"; + @SerializedName(SERIALIZED_NAME_SERVER_HOST) + private String serverHost; + public static final String SERIALIZED_NAME_SERVER_PORT = "serverPort"; + @SerializedName(SERIALIZED_NAME_SERVER_PORT) + private Integer serverPort; + public static final String SERIALIZED_NAME_SERVER_USERNAME = "serverUsername"; + @SerializedName(SERIALIZED_NAME_SERVER_USERNAME) + private String serverUsername; + public static final String SERIALIZED_NAME_SERVER_PASSWORD = "serverPassword"; + @SerializedName(SERIALIZED_NAME_SERVER_PASSWORD) + private String serverPassword; + public static final String SERIALIZED_NAME_MESSAGE_FROM = "messageFrom"; + @SerializedName(SERIALIZED_NAME_MESSAGE_FROM) + private String messageFrom; + public static final String SERIALIZED_NAME_MESSAGE_TO = "messageTo"; + @SerializedName(SERIALIZED_NAME_MESSAGE_TO) + private String messageTo; + public static final String SERIALIZED_NAME_MESSAGE_SUBJECT = "messageSubject"; + @SerializedName(SERIALIZED_NAME_MESSAGE_SUBJECT) + private String messageSubject; + public static final String SERIALIZED_NAME_MESSAGE_BODY = "messageBody"; + @SerializedName(SERIALIZED_NAME_MESSAGE_BODY) + private String messageBody; + public EmailRuleActionDto() { + } + public EmailRuleActionDto serverHost(String serverHost) { + this.serverHost = serverHost; + return this; + } + + /** + * The IP address or host to the SMTP server. + * @return serverHost + */ + @javax.annotation.Nonnull + public String getServerHost() { + return serverHost; + } + + public void setServerHost(String serverHost) { + this.serverHost = serverHost; + } + public EmailRuleActionDto serverPort(Integer serverPort) { + this.serverPort = serverPort; + return this; + } + + /** + * The port to the SMTP server. + * @return serverPort + */ + @javax.annotation.Nonnull + public Integer getServerPort() { + return serverPort; + } + + public void setServerPort(Integer serverPort) { + this.serverPort = serverPort; + } + public EmailRuleActionDto serverUsername(String serverUsername) { + this.serverUsername = serverUsername; + return this; + } + + /** + * The username for the SMTP server. + * @return serverUsername + */ + @javax.annotation.Nonnull + public String getServerUsername() { + return serverUsername; + } + + public void setServerUsername(String serverUsername) { + this.serverUsername = serverUsername; + } + public EmailRuleActionDto serverPassword(String serverPassword) { + this.serverPassword = serverPassword; + return this; + } + + /** + * The password for the SMTP server. + * @return serverPassword + */ + @javax.annotation.Nonnull + public String getServerPassword() { + return serverPassword; + } + + public void setServerPassword(String serverPassword) { + this.serverPassword = serverPassword; + } + public EmailRuleActionDto messageFrom(String messageFrom) { + this.messageFrom = messageFrom; + return this; + } + + /** + * The email sending address. + * @return messageFrom + */ + @javax.annotation.Nonnull + public String getMessageFrom() { + return messageFrom; + } + + public void setMessageFrom(String messageFrom) { + this.messageFrom = messageFrom; + } + public EmailRuleActionDto messageTo(String messageTo) { + this.messageTo = messageTo; + return this; + } + + /** + * The email message will be sent to. + * @return messageTo + */ + @javax.annotation.Nonnull + public String getMessageTo() { + return messageTo; + } + + public void setMessageTo(String messageTo) { + this.messageTo = messageTo; + } + public EmailRuleActionDto messageSubject(String messageSubject) { + this.messageSubject = messageSubject; + return this; + } + + /** + * The subject line for this email message. + * @return messageSubject + */ + @javax.annotation.Nonnull + public String getMessageSubject() { + return messageSubject; + } + + public void setMessageSubject(String messageSubject) { + this.messageSubject = messageSubject; + } + public EmailRuleActionDto messageBody(String messageBody) { + this.messageBody = messageBody; + return this; + } + + /** + * The message body. + * @return messageBody + */ + @javax.annotation.Nonnull + public String getMessageBody() { + return messageBody; + } + + public void setMessageBody(String messageBody) { + this.messageBody = messageBody; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface MessageBodyStage { - _FinalStage messageBody(String messageBody); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - EmailRuleActionDto build(); + EmailRuleActionDto emailRuleActionDto = (EmailRuleActionDto) o; + return Objects.equals(this.serverHost, emailRuleActionDto.serverHost) && + Objects.equals(this.serverPort, emailRuleActionDto.serverPort) && + Objects.equals(this.serverUsername, emailRuleActionDto.serverUsername) && + Objects.equals(this.serverPassword, emailRuleActionDto.serverPassword) && + Objects.equals(this.messageFrom, emailRuleActionDto.messageFrom) && + Objects.equals(this.messageTo, emailRuleActionDto.messageTo) && + Objects.equals(this.messageSubject, emailRuleActionDto.messageSubject) && + Objects.equals(this.messageBody, emailRuleActionDto.messageBody) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(serverHost, serverPort, serverUsername, serverPassword, messageFrom, messageTo, messageSubject, messageBody, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EmailRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" serverHost: ").append(toIndentedString(serverHost)).append("\n"); + sb.append(" serverPort: ").append(toIndentedString(serverPort)).append("\n"); + sb.append(" serverUsername: ").append(toIndentedString(serverUsername)).append("\n"); + sb.append(" serverPassword: ").append(toIndentedString(serverPassword)).append("\n"); + sb.append(" messageFrom: ").append(toIndentedString(messageFrom)).append("\n"); + sb.append(" messageTo: ").append(toIndentedString(messageTo)).append("\n"); + sb.append(" messageSubject: ").append(toIndentedString(messageSubject)).append("\n"); + sb.append(" messageBody: ").append(toIndentedString(messageBody)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements ServerHostStage, - ServerPortStage, - ServerUsernameStage, - ServerPasswordStage, - MessageFromStage, - MessageToStage, - MessageSubjectStage, - MessageBodyStage, - _FinalStage { - private String serverHost; - - private int serverPort; - - private String serverUsername; - - private String serverPassword; - - private String messageFrom; - - private String messageTo; - - private String messageSubject; - - private String messageBody; - - private Builder() {} - - @Override - public Builder from(EmailRuleActionDto other) { - serverHost(other.getServerHost()); - serverPort(other.getServerPort()); - serverUsername(other.getServerUsername()); - serverPassword(other.getServerPassword()); - messageFrom(other.getMessageFrom()); - messageTo(other.getMessageTo()); - messageSubject(other.getMessageSubject()); - messageBody(other.getMessageBody()); - return this; - } - - /** - *

The IP address or host to the SMTP server.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("serverHost") - public ServerPortStage serverHost(String serverHost) { - this.serverHost = serverHost; - return this; - } - - /** - *

The port to the SMTP server.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("serverPort") - public ServerUsernameStage serverPort(int serverPort) { - this.serverPort = serverPort; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("serverHost"); + openapiFields.add("serverPort"); + openapiFields.add("serverUsername"); + openapiFields.add("serverPassword"); + openapiFields.add("messageFrom"); + openapiFields.add("messageTo"); + openapiFields.add("messageSubject"); + openapiFields.add("messageBody"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("serverHost"); + openapiRequiredFields.add("serverPort"); + openapiRequiredFields.add("serverUsername"); + openapiRequiredFields.add("serverPassword"); + openapiRequiredFields.add("messageFrom"); + openapiRequiredFields.add("messageTo"); + openapiRequiredFields.add("messageSubject"); + openapiRequiredFields.add("messageBody"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EmailRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EmailRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EmailRuleActionDto is not found in the empty JSON string", EmailRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The username for the SMTP server.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("serverUsername") - public ServerPasswordStage serverUsername(String serverUsername) { - this.serverUsername = serverUsername; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EmailRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EmailRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The password for the SMTP server.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("serverPassword") - public MessageFromStage serverPassword(String serverPassword) { - this.serverPassword = serverPassword; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EmailRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - /** - *

The email sending address.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("messageFrom") - public MessageToStage messageFrom(String messageFrom) { - this.messageFrom = messageFrom; - return this; - } - - /** - *

The email message will be sent to.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("messageTo") - public MessageSubjectStage messageTo(String messageTo) { - this.messageTo = messageTo; - return this; - } - - /** - *

The subject line for this email message.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("messageSubject") - public MessageBodyStage messageSubject(String messageSubject) { - this.messageSubject = messageSubject; - return this; - } - - /** - *

The message body.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("messageBody") - public _FinalStage messageBody(String messageBody) { - this.messageBody = messageBody; - return this; - } - - @Override - public EmailRuleActionDto build() { - return new EmailRuleActionDto( - serverHost, - serverPort, - serverUsername, - serverPassword, - messageFrom, - messageTo, - messageSubject, - messageBody); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EmailRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EmailRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EmailRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EmailRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EmailRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of EmailRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of EmailRuleActionDto + * @throws IOException if the JSON string is invalid with respect to EmailRuleActionDto + */ + public static EmailRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EmailRuleActionDto.class); + } + + /** + * Convert an instance of EmailRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ErrorDto.java b/src/main/java/com/squidex/api/types/ErrorDto.java index 3879c21..c4014ad 100644 --- a/src/main/java/com/squidex/api/types/ErrorDto.java +++ b/src/main/java/com/squidex/api/types/ErrorDto.java @@ -1,276 +1,360 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ErrorDto.Builder.class) -public final class ErrorDto { - private final String message; - - private final Optional errorCode; - - private final Optional traceId; - - private final Optional type; - - private final Optional> details; - - private final int statusCode; - - private ErrorDto( - String message, - Optional errorCode, - Optional traceId, - Optional type, - Optional> details, - int statusCode) { - this.message = message; - this.errorCode = errorCode; - this.traceId = traceId; - this.type = type; - this.details = details; - this.statusCode = statusCode; - } - - /** - * @return Error message. - */ - @JsonProperty("message") - public String getMessage() { - return message; - } - - /** - * @return The error code. - */ - @JsonProperty("errorCode") - public Optional getErrorCode() { - return errorCode; - } - - /** - * @return The optional trace id. - */ - @JsonProperty("traceId") - public Optional getTraceId() { - return traceId; - } - /** - * @return Link to the error details. - */ - @JsonProperty("type") - public Optional getType() { - return type; - } - - /** - * @return Detailed error messages. - */ - @JsonProperty("details") - public Optional> getDetails() { - return details; - } - - /** - * @return Status code of the http response. - */ - @JsonProperty("statusCode") - public int getStatusCode() { - return statusCode; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ErrorDto && equalTo((ErrorDto) other); - } +package com.squidex.api.types; - private boolean equalTo(ErrorDto other) { - return message.equals(other.message) - && errorCode.equals(other.errorCode) - && traceId.equals(other.traceId) - && type.equals(other.type) - && details.equals(other.details) - && statusCode == other.statusCode; - } +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.ArrayList; +import java.util.Arrays; +import java.util.List; +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; - @Override - public int hashCode() { - return Objects.hash(this.message, this.errorCode, this.traceId, this.type, this.details, this.statusCode); - } +import com.squidex.api.core.JSON; - @Override - public String toString() { - return ObjectMappers.stringify(this); +/** + * ErrorDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ErrorDto { + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + public static final String SERIALIZED_NAME_ERROR_CODE = "errorCode"; + @SerializedName(SERIALIZED_NAME_ERROR_CODE) + private String errorCode; + public static final String SERIALIZED_NAME_TRACE_ID = "traceId"; + @SerializedName(SERIALIZED_NAME_TRACE_ID) + private String traceId; + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private String type; + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + private List details; + public static final String SERIALIZED_NAME_STATUS_CODE = "statusCode"; + @SerializedName(SERIALIZED_NAME_STATUS_CODE) + private Integer statusCode; + public ErrorDto() { + } + public ErrorDto message(String message) { + this.message = message; + return this; + } + + /** + * Error message. + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + public ErrorDto errorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * The error code. + * @return errorCode + */ + @javax.annotation.Nullable + public String getErrorCode() { + return errorCode; + } + + public void setErrorCode(String errorCode) { + this.errorCode = errorCode; + } + public ErrorDto traceId(String traceId) { + this.traceId = traceId; + return this; + } + + /** + * The optional trace id. + * @return traceId + */ + @javax.annotation.Nullable + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } + public ErrorDto type(String type) { + this.type = type; + return this; + } + + /** + * Link to the error details. + * @return type + */ + @javax.annotation.Nullable + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + public ErrorDto details(List details) { + this.details = details; + return this; + } + + public ErrorDto addDetailsItem(String detailsItem) { + if (this.details == null) { + this.details = new ArrayList<>(); } - - public static MessageStage builder() { - return new Builder(); + this.details.add(detailsItem); + return this; + } + + /** + * Detailed error messages. + * @return details + */ + @javax.annotation.Nullable + public List getDetails() { + return details; + } + + public void setDetails(List details) { + this.details = details; + } + public ErrorDto statusCode(Integer statusCode) { + this.statusCode = statusCode; + return this; + } + + /** + * Status code of the http response. + * @return statusCode + */ + @javax.annotation.Nonnull + public Integer getStatusCode() { + return statusCode; + } + + public void setStatusCode(Integer statusCode) { + this.statusCode = statusCode; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface MessageStage { - StatusCodeStage message(String message); - - Builder from(ErrorDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface StatusCodeStage { - _FinalStage statusCode(int statusCode); + ErrorDto errorDto = (ErrorDto) o; + return Objects.equals(this.message, errorDto.message) && + Objects.equals(this.errorCode, errorDto.errorCode) && + Objects.equals(this.traceId, errorDto.traceId) && + Objects.equals(this.type, errorDto.type) && + Objects.equals(this.details, errorDto.details) && + Objects.equals(this.statusCode, errorDto.statusCode); + } + + 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(message, errorCode, traceId, type, details, statusCode); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - ErrorDto build(); - - _FinalStage errorCode(Optional errorCode); - - _FinalStage errorCode(String errorCode); - - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage type(Optional type); - - _FinalStage type(String type); - - _FinalStage details(Optional> details); - - _FinalStage details(List details); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ErrorDto {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" errorCode: ").append(toIndentedString(errorCode)).append("\n"); + sb.append(" traceId: ").append(toIndentedString(traceId)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).append("\n"); + sb.append(" statusCode: ").append(toIndentedString(statusCode)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements MessageStage, StatusCodeStage, _FinalStage { - private String message; - - private int statusCode; - - private Optional> details = Optional.empty(); - - private Optional type = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional errorCode = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(ErrorDto other) { - message(other.getMessage()); - errorCode(other.getErrorCode()); - traceId(other.getTraceId()); - type(other.getType()); - details(other.getDetails()); - statusCode(other.getStatusCode()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("message"); + openapiFields.add("errorCode"); + openapiFields.add("traceId"); + openapiFields.add("type"); + openapiFields.add("details"); + openapiFields.add("statusCode"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("message"); + openapiRequiredFields.add("statusCode"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ErrorDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ErrorDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ErrorDto is not found in the empty JSON string", ErrorDto.openapiRequiredFields.toString())); } + } - /** - *

Error message.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("message") - public StatusCodeStage message(String message) { - this.message = message; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ErrorDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ErrorDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

Status code of the http response.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("statusCode") - public _FinalStage statusCode(int statusCode) { - this.statusCode = statusCode; - return this; - } - - /** - *

Detailed error messages.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage details(List details) { - this.details = Optional.of(details); - return this; - } - - @Override - @JsonSetter(value = "details", nulls = Nulls.SKIP) - public _FinalStage details(Optional> details) { - this.details = details; - return this; - } - - /** - *

Link to the error details.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage type(String type) { - this.type = Optional.of(type); - return this; - } - - @Override - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public _FinalStage type(Optional type) { - this.type = type; - return this; - } - - /** - *

The optional trace id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.of(traceId); - return this; - } - - @Override - @JsonSetter(value = "traceId", nulls = Nulls.SKIP) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - /** - *

The error code.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage errorCode(String errorCode) { - this.errorCode = Optional.of(errorCode); - return this; - } - - @Override - @JsonSetter(value = "errorCode", nulls = Nulls.SKIP) - public _FinalStage errorCode(Optional errorCode) { - this.errorCode = errorCode; - return this; - } - - @Override - public ErrorDto build() { - return new ErrorDto(message, errorCode, traceId, type, details, statusCode); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ErrorDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if ((jsonObj.get("errorCode") != null && !jsonObj.get("errorCode").isJsonNull()) && !jsonObj.get("errorCode").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `errorCode` to be a primitive type in the JSON string but got `%s`", jsonObj.get("errorCode").toString())); + } + if ((jsonObj.get("traceId") != null && !jsonObj.get("traceId").isJsonNull()) && !jsonObj.get("traceId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `traceId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("traceId").toString())); + } + 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())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("details") != null && !jsonObj.get("details").isJsonNull() && !jsonObj.get("details").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be an array in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ErrorDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ErrorDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ErrorDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ErrorDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ErrorDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ErrorDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ErrorDto + * @throws IOException if the JSON string is invalid with respect to ErrorDto + */ + public static ErrorDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ErrorDto.class); + } + + /** + * Convert an instance of ErrorDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/EventConsumerDto.java b/src/main/java/com/squidex/api/types/EventConsumerDto.java index 01e2b42..8f838e9 100644 --- a/src/main/java/com/squidex/api/types/EventConsumerDto.java +++ b/src/main/java/com/squidex/api/types/EventConsumerDto.java @@ -1,317 +1,380 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = EventConsumerDto.Builder.class) -public final class EventConsumerDto implements IResource { - private final Map links; - - private final boolean isStopped; - - private final boolean isResetting; - - private final int count; - - private final String name; - - private final Optional error; - private final Optional position; - - private EventConsumerDto( - Map links, - boolean isStopped, - boolean isResetting, - int count, - String name, - Optional error, - Optional position) { - this.links = links; - this.isStopped = isStopped; - this.isResetting = isResetting; - this.count = count; - this.name = name; - this.error = error; - this.position = position; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return Indicates if the event consumer has been started. - */ - @JsonProperty("isStopped") - public boolean getIsStopped() { - return isStopped; - } - - /** - * @return Indicates if the event consumer is resetting at the moment. - */ - @JsonProperty("isResetting") - public boolean getIsResetting() { - return isResetting; - } - - /** - * @return The number of handled events. - */ - @JsonProperty("count") - public int getCount() { - return count; - } - /** - * @return The name of the event consumer. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The error details if the event consumer has been stopped after a failure. - */ - @JsonProperty("error") - public Optional getError() { - return error; - } - - /** - * @return The position within the vent stream. - */ - @JsonProperty("position") - public Optional getPosition() { - return position; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EventConsumerDto && equalTo((EventConsumerDto) other); - } - - private boolean equalTo(EventConsumerDto other) { - return links.equals(other.links) - && isStopped == other.isStopped - && isResetting == other.isResetting - && count == other.count - && name.equals(other.name) - && error.equals(other.error) - && position.equals(other.position); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, this.isStopped, this.isResetting, this.count, this.name, this.error, this.position); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +package com.squidex.api.types; - public static IsStoppedStage builder() { - return new Builder(); - } +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.squidex.api.types.ResourceLink; +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; - public interface IsStoppedStage { - IsResettingStage isStopped(boolean isStopped); +import com.squidex.api.core.JSON; - Builder from(EventConsumerDto other); +/** + * EventConsumerDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class EventConsumerDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_IS_STOPPED = "isStopped"; + @SerializedName(SERIALIZED_NAME_IS_STOPPED) + private Boolean isStopped; + public static final String SERIALIZED_NAME_IS_RESETTING = "isResetting"; + @SerializedName(SERIALIZED_NAME_IS_RESETTING) + private Boolean isResetting; + public static final String SERIALIZED_NAME_COUNT = "count"; + @SerializedName(SERIALIZED_NAME_COUNT) + private Integer count; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + private String error; + public static final String SERIALIZED_NAME_POSITION = "position"; + @SerializedName(SERIALIZED_NAME_POSITION) + private String position; + public EventConsumerDto() { + } + public EventConsumerDto links(Map links) { + this.links = links; + return this; + } + + public EventConsumerDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface IsResettingStage { - CountStage isResetting(boolean isResetting); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public EventConsumerDto isStopped(Boolean isStopped) { + this.isStopped = isStopped; + return this; + } + + /** + * Indicates if the event consumer has been started. + * @return isStopped + */ + @javax.annotation.Nonnull + public Boolean getIsStopped() { + return isStopped; + } + + public void setIsStopped(Boolean isStopped) { + this.isStopped = isStopped; + } + public EventConsumerDto isResetting(Boolean isResetting) { + this.isResetting = isResetting; + return this; + } + + /** + * Indicates if the event consumer is resetting at the moment. + * @return isResetting + */ + @javax.annotation.Nonnull + public Boolean getIsResetting() { + return isResetting; + } + + public void setIsResetting(Boolean isResetting) { + this.isResetting = isResetting; + } + public EventConsumerDto count(Integer count) { + this.count = count; + return this; + } + + /** + * The number of handled events. + * @return count + */ + @javax.annotation.Nonnull + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + public EventConsumerDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the event consumer. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public EventConsumerDto error(String error) { + this.error = error; + return this; + } + + /** + * The error details if the event consumer has been stopped after a failure. + * @return error + */ + @javax.annotation.Nullable + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } + public EventConsumerDto position(String position) { + this.position = position; + return this; + } + + /** + * The position within the vent stream. + * @return position + */ + @javax.annotation.Nullable + public String getPosition() { + return position; + } + + public void setPosition(String position) { + this.position = position; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface CountStage { - NameStage count(int count); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface NameStage { - _FinalStage name(String name); + EventConsumerDto eventConsumerDto = (EventConsumerDto) o; + return Objects.equals(this.links, eventConsumerDto.links) && + Objects.equals(this.isStopped, eventConsumerDto.isStopped) && + Objects.equals(this.isResetting, eventConsumerDto.isResetting) && + Objects.equals(this.count, eventConsumerDto.count) && + Objects.equals(this.name, eventConsumerDto.name) && + Objects.equals(this.error, eventConsumerDto.error) && + Objects.equals(this.position, eventConsumerDto.position); + } + + 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(links, isStopped, isResetting, count, name, error, position); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - EventConsumerDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage error(Optional error); - - _FinalStage error(String error); - - _FinalStage position(Optional position); - - _FinalStage position(String position); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventConsumerDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" isStopped: ").append(toIndentedString(isStopped)).append("\n"); + sb.append(" isResetting: ").append(toIndentedString(isResetting)).append("\n"); + sb.append(" count: ").append(toIndentedString(count)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" position: ").append(toIndentedString(position)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IsStoppedStage, IsResettingStage, CountStage, NameStage, _FinalStage { - private boolean isStopped; - - private boolean isResetting; - - private int count; - - private String name; - - private Optional position = Optional.empty(); - - private Optional error = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(EventConsumerDto other) { - links(other.getLinks()); - isStopped(other.getIsStopped()); - isResetting(other.getIsResetting()); - count(other.getCount()); - name(other.getName()); - error(other.getError()); - position(other.getPosition()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("isStopped"); + openapiFields.add("isResetting"); + openapiFields.add("count"); + openapiFields.add("name"); + openapiFields.add("error"); + openapiFields.add("position"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("isStopped"); + openapiRequiredFields.add("isResetting"); + openapiRequiredFields.add("count"); + 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 EventConsumerDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventConsumerDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EventConsumerDto is not found in the empty JSON string", EventConsumerDto.openapiRequiredFields.toString())); } + } - /** - *

Indicates if the event consumer has been started.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isStopped") - public IsResettingStage isStopped(boolean isStopped) { - this.isStopped = isStopped; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EventConsumerDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EventConsumerDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

Indicates if the event consumer is resetting at the moment.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isResetting") - public CountStage isResetting(boolean isResetting) { - this.isResetting = isResetting; - return this; - } - - /** - *

The number of handled events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("count") - public NameStage count(int count) { - this.count = count; - return this; - } - - /** - *

The name of the event consumer.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public _FinalStage name(String name) { - this.name = name; - return this; - } - - /** - *

The position within the vent stream.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage position(String position) { - this.position = Optional.of(position); - return this; - } - - @Override - @JsonSetter(value = "position", nulls = Nulls.SKIP) - public _FinalStage position(Optional position) { - this.position = position; - return this; - } - - /** - *

The error details if the event consumer has been stopped after a failure.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage error(String error) { - this.error = Optional.of(error); - return this; - } - - @Override - @JsonSetter(value = "error", nulls = Nulls.SKIP) - public _FinalStage error(Optional error) { - this.error = error; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public EventConsumerDto build() { - return new EventConsumerDto(links, isStopped, isResetting, count, name, error, position); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventConsumerDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("error") != null && !jsonObj.get("error").isJsonNull()) && !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())); + } + if ((jsonObj.get("position") != null && !jsonObj.get("position").isJsonNull()) && !jsonObj.get("position").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `position` to be a primitive type in the JSON string but got `%s`", jsonObj.get("position").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EventConsumerDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventConsumerDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventConsumerDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventConsumerDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public EventConsumerDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of EventConsumerDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventConsumerDto + * @throws IOException if the JSON string is invalid with respect to EventConsumerDto + */ + public static EventConsumerDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventConsumerDto.class); + } + + /** + * Convert an instance of EventConsumerDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/EventConsumersDto.java b/src/main/java/com/squidex/api/types/EventConsumersDto.java index 06405e9..c9bd601 100644 --- a/src/main/java/com/squidex/api/types/EventConsumersDto.java +++ b/src/main/java/com/squidex/api/types/EventConsumersDto.java @@ -1,124 +1,262 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.EventConsumerDto; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = EventConsumersDto.Builder.class) -public final class EventConsumersDto implements IResource { - private final Map links; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final List items; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private EventConsumersDto(Map links, List items) { - this.links = links; - this.items = items; - } +import com.squidex.api.core.JSON; - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } +/** + * EventConsumersDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class EventConsumersDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public EventConsumersDto() { + } + public EventConsumersDto links(Map links) { + this.links = links; + return this; + } - /** - * @return The event consumers. - */ - @JsonProperty("items") - public List getItems() { - return items; + public EventConsumersDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } + this.links.put(key, linksItem); + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EventConsumersDto && equalTo((EventConsumersDto) other); - } + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } - private boolean equalTo(EventConsumersDto other) { - return links.equals(other.links) && items.equals(other.items); - } + public void setLinks(Map links) { + this.links = links; + } + public EventConsumersDto items(List items) { + this.items = items; + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); + public EventConsumersDto addItemsItem(EventConsumerDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } + this.items.add(itemsItem); + return this; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + /** + * The event consumers. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + EventConsumersDto eventConsumersDto = (EventConsumersDto) o; + return Objects.equals(this.links, eventConsumersDto.links) && + Objects.equals(this.items, eventConsumersDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, items); + } - public static Builder builder() { - return new Builder(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EventConsumersDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - private List items = new ArrayList<>(); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Builder() {} + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("items"); - public Builder from(EventConsumersDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + } - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to EventConsumersDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!EventConsumersDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in EventConsumersDto is not found in the empty JSON string", EventConsumersDto.openapiRequiredFields.toString())); } + } - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!EventConsumersDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `EventConsumersDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : EventConsumersDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + EventConsumerDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } - public Builder addItems(EventConsumerDto items) { - this.items.add(items); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!EventConsumersDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'EventConsumersDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(EventConsumersDto.class)); - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, EventConsumersDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public EventConsumersDto build() { - return new EventConsumersDto(links, items); - } + @Override + public EventConsumersDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of EventConsumersDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of EventConsumersDto + * @throws IOException if the JSON string is invalid with respect to EventConsumersDto + */ + public static EventConsumersDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, EventConsumersDto.class); + } + + /** + * Convert an instance of EventConsumersDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/FastlyRuleActionDto.java b/src/main/java/com/squidex/api/types/FastlyRuleActionDto.java index 4d8aa28..4f7670a 100644 --- a/src/main/java/com/squidex/api/types/FastlyRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/FastlyRuleActionDto.java @@ -1,122 +1,234 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = FastlyRuleActionDto.Builder.class) -public final class FastlyRuleActionDto { - private final String apiKey; - - private final String serviceId; - - private FastlyRuleActionDto(String apiKey, String serviceId) { - this.apiKey = apiKey; - this.serviceId = serviceId; - } - - /** - * @return The API key to grant access to Squidex. - */ - @JsonProperty("apiKey") - public String getApiKey() { - return apiKey; - } - - /** - * @return The ID of the fastly service. - */ - @JsonProperty("serviceId") - public String getServiceId() { - return serviceId; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FastlyRuleActionDto && equalTo((FastlyRuleActionDto) other); - } - private boolean equalTo(FastlyRuleActionDto other) { - return apiKey.equals(other.apiKey) && serviceId.equals(other.serviceId); - } - - @Override - public int hashCode() { - return Objects.hash(this.apiKey, this.serviceId); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.types.RuleActionDto; +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.squidex.api.core.JSON; - public static ApiKeyStage builder() { - return new Builder(); +/** + * FastlyRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class FastlyRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_API_KEY = "apiKey"; + @SerializedName(SERIALIZED_NAME_API_KEY) + private String apiKey; + public static final String SERIALIZED_NAME_SERVICE_ID = "serviceId"; + @SerializedName(SERIALIZED_NAME_SERVICE_ID) + private String serviceId; + public FastlyRuleActionDto() { + } + public FastlyRuleActionDto apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The API key to grant access to Squidex. + * @return apiKey + */ + @javax.annotation.Nonnull + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + public FastlyRuleActionDto serviceId(String serviceId) { + this.serviceId = serviceId; + return this; + } + + /** + * The ID of the fastly service. + * @return serviceId + */ + @javax.annotation.Nonnull + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ApiKeyStage { - ServiceIdStage apiKey(String apiKey); - - Builder from(FastlyRuleActionDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface ServiceIdStage { - _FinalStage serviceId(String serviceId); + FastlyRuleActionDto fastlyRuleActionDto = (FastlyRuleActionDto) o; + return Objects.equals(this.apiKey, fastlyRuleActionDto.apiKey) && + Objects.equals(this.serviceId, fastlyRuleActionDto.serviceId) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(apiKey, serviceId, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FastlyRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" serviceId: ").append(toIndentedString(serviceId)).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"; } - - public interface _FinalStage { - FastlyRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ApiKeyStage, ServiceIdStage, _FinalStage { - private String apiKey; - - private String serviceId; - - private Builder() {} - - @Override - public Builder from(FastlyRuleActionDto other) { - apiKey(other.getApiKey()); - serviceId(other.getServiceId()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("apiKey"); + openapiFields.add("serviceId"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("apiKey"); + openapiRequiredFields.add("serviceId"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FastlyRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FastlyRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FastlyRuleActionDto is not found in the empty JSON string", FastlyRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The API key to grant access to Squidex.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiKey") - public ServiceIdStage apiKey(String apiKey) { - this.apiKey = apiKey; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FastlyRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FastlyRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The ID of the fastly service.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("serviceId") - public _FinalStage serviceId(String serviceId) { - this.serviceId = serviceId; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FastlyRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @Override - public FastlyRuleActionDto build() { - return new FastlyRuleActionDto(apiKey, serviceId); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FastlyRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FastlyRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FastlyRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FastlyRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FastlyRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of FastlyRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of FastlyRuleActionDto + * @throws IOException if the JSON string is invalid with respect to FastlyRuleActionDto + */ + public static FastlyRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FastlyRuleActionDto.class); + } + + /** + * Convert an instance of FastlyRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/FeatureDto.java b/src/main/java/com/squidex/api/types/FeatureDto.java index 54244a8..34cd024 100644 --- a/src/main/java/com/squidex/api/types/FeatureDto.java +++ b/src/main/java/com/squidex/api/types/FeatureDto.java @@ -1,122 +1,236 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = FeatureDto.Builder.class) -public final class FeatureDto { - private final String name; - - private final String text; - - private FeatureDto(String name, String text) { - this.name = name; - this.text = text; - } - - /** - * @return The name of the feature. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The description text. - */ - @JsonProperty("text") - public String getText() { - return text; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FeatureDto && equalTo((FeatureDto) other); - } - - private boolean equalTo(FeatureDto other) { - return name.equals(other.name) && text.equals(other.text); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.text); - } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static NameStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface NameStage { - TextStage name(String name); +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.squidex.api.core.JSON; - Builder from(FeatureDto other); +/** + * FeatureDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class FeatureDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + public FeatureDto() { + } + public FeatureDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the feature. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public FeatureDto text(String text) { + this.text = text; + return this; + } + + /** + * The description text. + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface TextStage { - _FinalStage text(String text); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - FeatureDto build(); + FeatureDto featureDto = (FeatureDto) o; + return Objects.equals(this.name, featureDto.name) && + Objects.equals(this.text, featureDto.text); + } + + @Override + public int hashCode() { + return Objects.hash(name, text); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeatureDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, TextStage, _FinalStage { - private String name; - - private String text; - - private Builder() {} - - @Override - public Builder from(FeatureDto other) { - name(other.getName()); - text(other.getText()); - return this; - } - - /** - *

The name of the feature.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public TextStage name(String name) { - this.name = name; - return this; + return o.toString().replace("\n", "\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("text"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("text"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FeatureDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FeatureDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FeatureDto is not found in the empty JSON string", FeatureDto.openapiRequiredFields.toString())); } + } - /** - *

The description text.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FeatureDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FeatureDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public FeatureDto build() { - return new FeatureDto(name, text); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FeatureDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FeatureDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FeatureDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FeatureDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FeatureDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FeatureDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of FeatureDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of FeatureDto + * @throws IOException if the JSON string is invalid with respect to FeatureDto + */ + public static FeatureDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FeatureDto.class); + } + + /** + * Convert an instance of FeatureDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/FeaturesDto.java b/src/main/java/com/squidex/api/types/FeaturesDto.java index 4f91c26..c5fc3bf 100644 --- a/src/main/java/com/squidex/api/types/FeaturesDto.java +++ b/src/main/java/com/squidex/api/types/FeaturesDto.java @@ -1,144 +1,251 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.FeatureDto; +import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = FeaturesDto.Builder.class) -public final class FeaturesDto { - private final List features; - - private final int version; - - private FeaturesDto(List features, int version) { - this.features = features; - this.version = version; - } - - /** - * @return The latest features. - */ - @JsonProperty("features") - public List getFeatures() { - return features; - } - /** - * @return The recent version. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FeaturesDto && equalTo((FeaturesDto) other); - } - - private boolean equalTo(FeaturesDto other) { - return features.equals(other.features) && version == other.version; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - @Override - public int hashCode() { - return Objects.hash(this.features, this.version); - } +import com.squidex.api.core.JSON; - @Override - public String toString() { - return ObjectMappers.stringify(this); +/** + * FeaturesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class FeaturesDto { + public static final String SERIALIZED_NAME_FEATURES = "features"; + @SerializedName(SERIALIZED_NAME_FEATURES) + private List features = new ArrayList<>(); + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Integer version; + public FeaturesDto() { + } + public FeaturesDto features(List features) { + this.features = features; + return this; + } + + public FeaturesDto addFeaturesItem(FeatureDto featuresItem) { + if (this.features == null) { + this.features = new ArrayList<>(); } - - public static VersionStage builder() { - return new Builder(); + this.features.add(featuresItem); + return this; + } + + /** + * The latest features. + * @return features + */ + @javax.annotation.Nonnull + public List getFeatures() { + return features; + } + + public void setFeatures(List features) { + this.features = features; + } + public FeaturesDto version(Integer version) { + this.version = version; + return this; + } + + /** + * The recent version. + * @return version + */ + @javax.annotation.Nonnull + public Integer getVersion() { + return version; + } + + public void setVersion(Integer version) { + this.version = version; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface VersionStage { - _FinalStage version(int version); - - Builder from(FeaturesDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - FeaturesDto build(); - - _FinalStage features(List features); - - _FinalStage addFeatures(FeatureDto features); - - _FinalStage addAllFeatures(List features); + FeaturesDto featuresDto = (FeaturesDto) o; + return Objects.equals(this.features, featuresDto.features) && + Objects.equals(this.version, featuresDto.version); + } + + @Override + public int hashCode() { + return Objects.hash(features, version); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FeaturesDto {\n"); + sb.append(" features: ").append(toIndentedString(features)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements VersionStage, _FinalStage { - private int version; - - private List features = new ArrayList<>(); - - private Builder() {} - - @Override - public Builder from(FeaturesDto other) { - features(other.getFeatures()); - version(other.getVersion()); - return this; - } - - /** - *

The recent version.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("features"); + openapiFields.add("version"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("features"); + openapiRequiredFields.add("version"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FeaturesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FeaturesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FeaturesDto is not found in the empty JSON string", FeaturesDto.openapiRequiredFields.toString())); } + } - /** - *

The latest features.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFeatures(List features) { - this.features.addAll(features); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FeaturesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FeaturesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The latest features.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFeatures(FeatureDto features) { - this.features.add(features); - return this; - } - - @Override - @JsonSetter(value = "features", nulls = Nulls.SKIP) - public _FinalStage features(List features) { - this.features.clear(); - this.features.addAll(features); - return this; - } - - @Override - public FeaturesDto build() { - return new FeaturesDto(features, version); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FeaturesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("features").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `features` to be an array in the JSON string but got `%s`", jsonObj.get("features").toString())); + } + + JsonArray jsonArrayfeatures = jsonObj.getAsJsonArray("features"); + // validate the required field `features` (array) + for (int i = 0; i < jsonArrayfeatures.size(); i++) { + FeatureDto.validateJsonElement(jsonArrayfeatures.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FeaturesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FeaturesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FeaturesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FeaturesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FeaturesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of FeaturesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of FeaturesDto + * @throws IOException if the JSON string is invalid with respect to FeaturesDto + */ + public static FeaturesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FeaturesDto.class); + } + + /** + * Convert an instance of FeaturesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/FieldDto.java b/src/main/java/com/squidex/api/types/FieldDto.java index 48cc92c..9532a2f 100644 --- a/src/main/java/com/squidex/api/types/FieldDto.java +++ b/src/main/java/com/squidex/api/types/FieldDto.java @@ -1,390 +1,454 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; +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.squidex.api.types.FieldPropertiesDto; +import com.squidex.api.types.NestedFieldDto; +import com.squidex.api.types.ResourceLink; +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.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = FieldDto.Builder.class) -public final class FieldDto implements IResource { - private final Map links; - - private final int fieldId; - - private final String name; - - private final boolean isHidden; - - private final boolean isLocked; - - private final boolean isDisabled; - - private final String partitioning; - - private final FieldPropertiesDto properties; - - private final Optional> nested; - - private FieldDto( - Map links, - int fieldId, - String name, - boolean isHidden, - boolean isLocked, - boolean isDisabled, - String partitioning, - FieldPropertiesDto properties, - Optional> nested) { - this.links = links; - this.fieldId = fieldId; - this.name = name; - this.isHidden = isHidden; - this.isLocked = isLocked; - this.isDisabled = isDisabled; - this.partitioning = partitioning; - this.properties = properties; - this.nested = nested; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the field. - */ - @JsonProperty("fieldId") - public int getFieldId() { - return fieldId; - } - - /** - * @return The name of the field. Must be unique within the schema. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Defines if the field is hidden. - */ - @JsonProperty("isHidden") - public boolean getIsHidden() { - return isHidden; - } - - /** - * @return Defines if the field is locked. - */ - @JsonProperty("isLocked") - public boolean getIsLocked() { - return isLocked; - } - - /** - * @return Defines if the field is disabled. - */ - @JsonProperty("isDisabled") - public boolean getIsDisabled() { - return isDisabled; - } - - /** - * @return Defines the partitioning of the field. - */ - @JsonProperty("partitioning") - public String getPartitioning() { - return partitioning; - } - - /** - * @return The field properties. - */ - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - /** - * @return The nested fields. - */ - @JsonProperty("nested") - public Optional> getNested() { - return nested; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FieldDto && equalTo((FieldDto) other); - } - - private boolean equalTo(FieldDto other) { - return links.equals(other.links) - && fieldId == other.fieldId - && name.equals(other.name) - && isHidden == other.isHidden - && isLocked == other.isLocked - && isDisabled == other.isDisabled - && partitioning.equals(other.partitioning) - && properties.equals(other.properties) - && nested.equals(other.nested); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.fieldId, - this.name, - this.isHidden, - this.isLocked, - this.isDisabled, - this.partitioning, - this.properties, - this.nested); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static FieldIdStage builder() { - return new Builder(); - } - - public interface FieldIdStage { - NameStage fieldId(int fieldId); +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; - Builder from(FieldDto other); - } +import com.squidex.api.core.JSON; - public interface NameStage { - IsHiddenStage name(String name); +/** + * FieldDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class FieldDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_FIELD_ID = "fieldId"; + @SerializedName(SERIALIZED_NAME_FIELD_ID) + private Long fieldId; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_IS_HIDDEN = "isHidden"; + @SerializedName(SERIALIZED_NAME_IS_HIDDEN) + private Boolean isHidden; + public static final String SERIALIZED_NAME_IS_LOCKED = "isLocked"; + @SerializedName(SERIALIZED_NAME_IS_LOCKED) + private Boolean isLocked; + public static final String SERIALIZED_NAME_IS_DISABLED = "isDisabled"; + @SerializedName(SERIALIZED_NAME_IS_DISABLED) + private Boolean isDisabled; + public static final String SERIALIZED_NAME_PARTITIONING = "partitioning"; + @SerializedName(SERIALIZED_NAME_PARTITIONING) + private String partitioning; + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private FieldPropertiesDto properties; + public static final String SERIALIZED_NAME_NESTED = "nested"; + @SerializedName(SERIALIZED_NAME_NESTED) + private List nested; + public FieldDto() { + } + public FieldDto links(Map links) { + this.links = links; + return this; + } + + public FieldDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface IsHiddenStage { - IsLockedStage isHidden(boolean isHidden); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public FieldDto fieldId(Long fieldId) { + this.fieldId = fieldId; + return this; + } + + /** + * The ID of the field. + * @return fieldId + */ + @javax.annotation.Nonnull + public Long getFieldId() { + return fieldId; + } + + public void setFieldId(Long fieldId) { + this.fieldId = fieldId; + } + public FieldDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the field. Must be unique within the schema. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public FieldDto isHidden(Boolean isHidden) { + this.isHidden = isHidden; + return this; + } + + /** + * Defines if the field is hidden. + * @return isHidden + */ + @javax.annotation.Nonnull + public Boolean getIsHidden() { + return isHidden; + } + + public void setIsHidden(Boolean isHidden) { + this.isHidden = isHidden; + } + public FieldDto isLocked(Boolean isLocked) { + this.isLocked = isLocked; + return this; + } + + /** + * Defines if the field is locked. + * @return isLocked + */ + @javax.annotation.Nonnull + public Boolean getIsLocked() { + return isLocked; + } + + public void setIsLocked(Boolean isLocked) { + this.isLocked = isLocked; + } + public FieldDto isDisabled(Boolean isDisabled) { + this.isDisabled = isDisabled; + return this; + } + + /** + * Defines if the field is disabled. + * @return isDisabled + */ + @javax.annotation.Nonnull + public Boolean getIsDisabled() { + return isDisabled; + } + + public void setIsDisabled(Boolean isDisabled) { + this.isDisabled = isDisabled; + } + public FieldDto partitioning(String partitioning) { + this.partitioning = partitioning; + return this; + } + + /** + * Defines the partitioning of the field. + * @return partitioning + */ + @javax.annotation.Nonnull + public String getPartitioning() { + return partitioning; + } + + public void setPartitioning(String partitioning) { + this.partitioning = partitioning; + } + public FieldDto properties(FieldPropertiesDto properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nonnull + public FieldPropertiesDto getProperties() { + return properties; + } + + public void setProperties(FieldPropertiesDto properties) { + this.properties = properties; + } + public FieldDto nested(List nested) { + this.nested = nested; + return this; + } + + public FieldDto addNestedItem(NestedFieldDto nestedItem) { + if (this.nested == null) { + this.nested = new ArrayList<>(); } - - public interface IsLockedStage { - IsDisabledStage isLocked(boolean isLocked); + this.nested.add(nestedItem); + return this; + } + + /** + * The nested fields. + * @return nested + */ + @javax.annotation.Nullable + public List getNested() { + return nested; + } + + public void setNested(List nested) { + this.nested = nested; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface IsDisabledStage { - PartitioningStage isDisabled(boolean isDisabled); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface PartitioningStage { - PropertiesStage partitioning(String partitioning); + FieldDto fieldDto = (FieldDto) o; + return Objects.equals(this.links, fieldDto.links) && + Objects.equals(this.fieldId, fieldDto.fieldId) && + Objects.equals(this.name, fieldDto.name) && + Objects.equals(this.isHidden, fieldDto.isHidden) && + Objects.equals(this.isLocked, fieldDto.isLocked) && + Objects.equals(this.isDisabled, fieldDto.isDisabled) && + Objects.equals(this.partitioning, fieldDto.partitioning) && + Objects.equals(this.properties, fieldDto.properties) && + Objects.equals(this.nested, fieldDto.nested); + } + + 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(links, fieldId, name, isHidden, isLocked, isDisabled, partitioning, properties, nested); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FieldDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" fieldId: ").append(toIndentedString(fieldId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" isHidden: ").append(toIndentedString(isHidden)).append("\n"); + sb.append(" isLocked: ").append(toIndentedString(isLocked)).append("\n"); + sb.append(" isDisabled: ").append(toIndentedString(isDisabled)).append("\n"); + sb.append(" partitioning: ").append(toIndentedString(partitioning)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" nested: ").append(toIndentedString(nested)).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"; } - - public interface _FinalStage { - FieldDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage nested(Optional> nested); - - _FinalStage nested(List nested); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements FieldIdStage, - NameStage, - IsHiddenStage, - IsLockedStage, - IsDisabledStage, - PartitioningStage, - PropertiesStage, - _FinalStage { - private int fieldId; - - private String name; - - private boolean isHidden; - - private boolean isLocked; - - private boolean isDisabled; - - private String partitioning; - - private FieldPropertiesDto properties; - - private Optional> nested = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(FieldDto other) { - links(other.getLinks()); - fieldId(other.getFieldId()); - name(other.getName()); - isHidden(other.getIsHidden()); - isLocked(other.getIsLocked()); - isDisabled(other.getIsDisabled()); - partitioning(other.getPartitioning()); - properties(other.getProperties()); - nested(other.getNested()); - return this; - } - - /** - *

The ID of the field.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fieldId") - public NameStage fieldId(int fieldId) { - this.fieldId = fieldId; - return this; - } - - /** - *

The name of the field. Must be unique within the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public IsHiddenStage name(String name) { - this.name = name; - return this; - } - - /** - *

Defines if the field is hidden.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isHidden") - public IsLockedStage isHidden(boolean isHidden) { - this.isHidden = isHidden; - return this; - } - - /** - *

Defines if the field is locked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isLocked") - public IsDisabledStage isLocked(boolean isLocked) { - this.isLocked = isLocked; - return this; - } - - /** - *

Defines if the field is disabled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isDisabled") - public PartitioningStage isDisabled(boolean isDisabled) { - this.isDisabled = isDisabled; - return this; - } - - /** - *

Defines the partitioning of the field.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("partitioning") - public PropertiesStage partitioning(String partitioning) { - this.partitioning = partitioning; - return this; - } - - /** - *

The field properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; - } - - /** - *

The nested fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage nested(List nested) { - this.nested = Optional.of(nested); - return this; - } - - @Override - @JsonSetter(value = "nested", nulls = Nulls.SKIP) - public _FinalStage nested(Optional> nested) { - this.nested = nested; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("fieldId"); + openapiFields.add("name"); + openapiFields.add("isHidden"); + openapiFields.add("isLocked"); + openapiFields.add("isDisabled"); + openapiFields.add("partitioning"); + openapiFields.add("properties"); + openapiFields.add("nested"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("fieldId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("isHidden"); + openapiRequiredFields.add("isLocked"); + openapiRequiredFields.add("isDisabled"); + openapiRequiredFields.add("partitioning"); + openapiRequiredFields.add("properties"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FieldDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FieldDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FieldDto is not found in the empty JSON string", FieldDto.openapiRequiredFields.toString())); } + } - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FieldDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FieldDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FieldDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + } + 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("partitioning").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `partitioning` to be a primitive type in the JSON string but got `%s`", jsonObj.get("partitioning").toString())); + } + // validate the required field `properties` + FieldPropertiesDto.validateJsonElement(jsonObj.get("properties")); + if (jsonObj.get("nested") != null && !jsonObj.get("nested").isJsonNull()) { + JsonArray jsonArraynested = jsonObj.getAsJsonArray("nested"); + if (jsonArraynested != null) { + // ensure the json data is an array + if (!jsonObj.get("nested").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `nested` to be an array in the JSON string but got `%s`", jsonObj.get("nested").toString())); + } + + // validate the optional field `nested` (array) + for (int i = 0; i < jsonArraynested.size(); i++) { + NestedFieldDto.validateJsonElement(jsonArraynested.get(i)); + }; } + } + } - @Override - public FieldDto build() { - return new FieldDto(links, fieldId, name, isHidden, isLocked, isDisabled, partitioning, properties, nested); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FieldDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FieldDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FieldDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FieldDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public FieldDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of FieldDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of FieldDto + * @throws IOException if the JSON string is invalid with respect to FieldDto + */ + public static FieldDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FieldDto.class); + } + + /** + * Convert an instance of FieldDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/FieldPropertiesDto.java b/src/main/java/com/squidex/api/types/FieldPropertiesDto.java index eb9d930..14dc2df 100644 --- a/src/main/java/com/squidex/api/types/FieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/FieldPropertiesDto.java @@ -1,818 +1,395 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import java.util.Objects; -import java.util.Optional; - -public final class FieldPropertiesDto { - private final Value value; - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - private FieldPropertiesDto(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static FieldPropertiesDto array(ArrayFieldPropertiesDto value) { - return new FieldPropertiesDto(new ArrayValue(value)); - } - - public static FieldPropertiesDto assets(AssetsFieldPropertiesDto value) { - return new FieldPropertiesDto(new AssetsValue(value)); - } - - public static FieldPropertiesDto boolean_(BooleanFieldPropertiesDto value) { - return new FieldPropertiesDto(new BooleanValue(value)); - } - - public static FieldPropertiesDto component(ComponentFieldPropertiesDto value) { - return new FieldPropertiesDto(new ComponentValue(value)); - } - - public static FieldPropertiesDto components(ComponentsFieldPropertiesDto value) { - return new FieldPropertiesDto(new ComponentsValue(value)); - } - - public static FieldPropertiesDto dateTime(DateTimeFieldPropertiesDto value) { - return new FieldPropertiesDto(new DateTimeValue(value)); - } - - public static FieldPropertiesDto geolocation(GeolocationFieldPropertiesDto value) { - return new FieldPropertiesDto(new GeolocationValue(value)); - } - - public static FieldPropertiesDto json(JsonFieldPropertiesDto value) { - return new FieldPropertiesDto(new JsonValue(value)); - } - - public static FieldPropertiesDto number(NumberFieldPropertiesDto value) { - return new FieldPropertiesDto(new NumberValue(value)); - } - - public static FieldPropertiesDto references(ReferencesFieldPropertiesDto value) { - return new FieldPropertiesDto(new ReferencesValue(value)); - } - - public static FieldPropertiesDto string(StringFieldPropertiesDto value) { - return new FieldPropertiesDto(new StringValue(value)); - } - - public static FieldPropertiesDto tags(TagsFieldPropertiesDto value) { - return new FieldPropertiesDto(new TagsValue(value)); - } - - public static FieldPropertiesDto ui(UiFieldPropertiesDto value) { - return new FieldPropertiesDto(new UiValue(value)); - } - - public boolean isArray() { - return value instanceof ArrayValue; - } - - public boolean isAssets() { - return value instanceof AssetsValue; - } - - public boolean isBoolean() { - return value instanceof BooleanValue; - } - - public boolean isComponent() { - return value instanceof ComponentValue; - } - - public boolean isComponents() { - return value instanceof ComponentsValue; - } - - public boolean isDateTime() { - return value instanceof DateTimeValue; - } - - public boolean isGeolocation() { - return value instanceof GeolocationValue; - } - - public boolean isJson() { - return value instanceof JsonValue; - } - - public boolean isNumber() { - return value instanceof NumberValue; - } - - public boolean isReferences() { - return value instanceof ReferencesValue; - } - - public boolean isString() { - return value instanceof StringValue; - } - - public boolean isTags() { - return value instanceof TagsValue; - } - - public boolean isUi() { - return value instanceof UiValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - public Optional getArray() { - if (isArray()) { - return Optional.of(((ArrayValue) value).value); - } - return Optional.empty(); - } - - public Optional getAssets() { - if (isAssets()) { - return Optional.of(((AssetsValue) value).value); - } - return Optional.empty(); - } - - public Optional getBoolean() { - if (isBoolean()) { - return Optional.of(((BooleanValue) value).value); - } - return Optional.empty(); - } - - public Optional getComponent() { - if (isComponent()) { - return Optional.of(((ComponentValue) value).value); - } - return Optional.empty(); - } - public Optional getComponents() { - if (isComponents()) { - return Optional.of(((ComponentsValue) value).value); - } - return Optional.empty(); - } - - public Optional getDateTime() { - if (isDateTime()) { - return Optional.of(((DateTimeValue) value).value); - } - return Optional.empty(); - } - - public Optional getGeolocation() { - if (isGeolocation()) { - return Optional.of(((GeolocationValue) value).value); - } - return Optional.empty(); - } - - public Optional getJson() { - if (isJson()) { - return Optional.of(((JsonValue) value).value); - } - return Optional.empty(); - } - - public Optional getNumber() { - if (isNumber()) { - return Optional.of(((NumberValue) value).value); - } - return Optional.empty(); - } - - public Optional getReferences() { - if (isReferences()) { - return Optional.of(((ReferencesValue) value).value); - } - return Optional.empty(); - } - - public Optional getString() { - if (isString()) { - return Optional.of(((StringValue) value).value); - } - return Optional.empty(); - } - - public Optional getTags() { - if (isTags()) { - return Optional.of(((TagsValue) value).value); - } - return Optional.empty(); - } - - public Optional getUi() { - if (isUi()) { - return Optional.of(((UiValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @com.fasterxml.jackson.annotation.JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitArray(ArrayFieldPropertiesDto array); - - T visitAssets(AssetsFieldPropertiesDto assets); - - T visitBoolean(BooleanFieldPropertiesDto boolean_); - - T visitComponent(ComponentFieldPropertiesDto component); - - T visitComponents(ComponentsFieldPropertiesDto components); - - T visitDateTime(DateTimeFieldPropertiesDto dateTime); - - T visitGeolocation(GeolocationFieldPropertiesDto geolocation); - - T visitJson(JsonFieldPropertiesDto json); - - T visitNumber(NumberFieldPropertiesDto number); - - T visitReferences(ReferencesFieldPropertiesDto references); - - T visitString(StringFieldPropertiesDto string); - - T visitTags(TagsFieldPropertiesDto tags); - - T visitUi(UiFieldPropertiesDto ui); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "fieldType", visible = true, defaultImpl = _UnknownValue.class) - @JsonSubTypes({ - @JsonSubTypes.Type(ArrayValue.class), - @JsonSubTypes.Type(AssetsValue.class), - @JsonSubTypes.Type(BooleanValue.class), - @JsonSubTypes.Type(ComponentValue.class), - @JsonSubTypes.Type(ComponentsValue.class), - @JsonSubTypes.Type(DateTimeValue.class), - @JsonSubTypes.Type(GeolocationValue.class), - @JsonSubTypes.Type(JsonValue.class), - @JsonSubTypes.Type(NumberValue.class), - @JsonSubTypes.Type(ReferencesValue.class), - @JsonSubTypes.Type(StringValue.class), - @JsonSubTypes.Type(TagsValue.class), - @JsonSubTypes.Type(UiValue.class) - }) - @JsonIgnoreProperties(ignoreUnknown = true) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("Array") - private static final class ArrayValue implements Value { - @JsonUnwrapped - private ArrayFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ArrayValue() {} - - private ArrayValue(ArrayFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitArray(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ArrayValue && equalTo((ArrayValue) other); - } - - private boolean equalTo(ArrayValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Assets") - private static final class AssetsValue implements Value { - @JsonUnwrapped - private AssetsFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AssetsValue() {} - - private AssetsValue(AssetsFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitAssets(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetsValue && equalTo((AssetsValue) other); - } - - private boolean equalTo(AssetsValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Boolean") - private static final class BooleanValue implements Value { - @JsonUnwrapped - private BooleanFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private BooleanValue() {} - - private BooleanValue(BooleanFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitBoolean(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BooleanValue && equalTo((BooleanValue) other); - } - - private boolean equalTo(BooleanValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Component") - private static final class ComponentValue implements Value { - @JsonUnwrapped - private ComponentFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ComponentValue() {} - - private ComponentValue(ComponentFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitComponent(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ComponentValue && equalTo((ComponentValue) other); - } - - private boolean equalTo(ComponentValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Components") - private static final class ComponentsValue implements Value { - @JsonUnwrapped - private ComponentsFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ComponentsValue() {} - - private ComponentsValue(ComponentsFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitComponents(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ComponentsValue && equalTo((ComponentsValue) other); - } - - private boolean equalTo(ComponentsValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("DateTime") - private static final class DateTimeValue implements Value { - @JsonUnwrapped - private DateTimeFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private DateTimeValue() {} - - private DateTimeValue(DateTimeFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitDateTime(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DateTimeValue && equalTo((DateTimeValue) other); - } - - private boolean equalTo(DateTimeValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Geolocation") - private static final class GeolocationValue implements Value { - @JsonUnwrapped - private GeolocationFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private GeolocationValue() {} - - private GeolocationValue(GeolocationFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitGeolocation(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GeolocationValue && equalTo((GeolocationValue) other); - } - - private boolean equalTo(GeolocationValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Json") - private static final class JsonValue implements Value { - @JsonUnwrapped - private JsonFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private JsonValue() {} - - private JsonValue(JsonFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitJson(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof JsonValue && equalTo((JsonValue) other); - } - - private boolean equalTo(JsonValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Number") - private static final class NumberValue implements Value { - @JsonUnwrapped - private NumberFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private NumberValue() {} - - private NumberValue(NumberFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitNumber(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NumberValue && equalTo((NumberValue) other); - } - - private boolean equalTo(NumberValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("References") - private static final class ReferencesValue implements Value { - @JsonUnwrapped - private ReferencesFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ReferencesValue() {} - - private ReferencesValue(ReferencesFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitReferences(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReferencesValue && equalTo((ReferencesValue) other); - } - - private boolean equalTo(ReferencesValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("String") - private static final class StringValue implements Value { - @JsonUnwrapped - private StringFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private StringValue() {} - - private StringValue(StringFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitString(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof StringValue && equalTo((StringValue) other); - } - - private boolean equalTo(StringValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Tags") - private static final class TagsValue implements Value { - @JsonUnwrapped - private TagsFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private TagsValue() {} - - private TagsValue(TagsFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitTags(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TagsValue && equalTo((TagsValue) other); - } - - private boolean equalTo(TagsValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("UI") - private static final class UiValue implements Value { - @JsonUnwrapped - private UiFieldPropertiesDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private UiValue() {} - - private UiValue(UiFieldPropertiesDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitUi(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UiValue && equalTo((UiValue) other); - } - - private boolean equalTo(UiValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "FieldPropertiesDto{" + "value: " + value + "}"; - } - } - - private static final class _UnknownValue implements Value { - private String type; - - @com.fasterxml.jackson.annotation.JsonValue - private Object value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private _UnknownValue(@JsonProperty("value") Object value) {} - - @Override - public T visit(Visitor visitor) { - return visitor._visitUnknown(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof _UnknownValue && equalTo((_UnknownValue) other); - } - - private boolean equalTo(_UnknownValue other) { - return type.equals(other.type) && value.equals(other.value); - } +package com.squidex.api.types; - @Override - public int hashCode() { - return Objects.hash(this.type, this.value); - } +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.ArrayList; +import java.util.Arrays; +import java.util.List; +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.squidex.api.core.JSON; - @Override - public String toString() { - return "FieldPropertiesDto{" + "type: " + type + ", value: " + value + "}"; - } - } +/** + * FieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class FieldPropertiesDto { + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + private String label; + public static final String SERIALIZED_NAME_HINTS = "hints"; + @SerializedName(SERIALIZED_NAME_HINTS) + private String hints; + public static final String SERIALIZED_NAME_PLACEHOLDER = "placeholder"; + @SerializedName(SERIALIZED_NAME_PLACEHOLDER) + private String placeholder; + public static final String SERIALIZED_NAME_IS_REQUIRED = "isRequired"; + @SerializedName(SERIALIZED_NAME_IS_REQUIRED) + private Boolean isRequired; + public static final String SERIALIZED_NAME_IS_REQUIRED_ON_PUBLISH = "isRequiredOnPublish"; + @SerializedName(SERIALIZED_NAME_IS_REQUIRED_ON_PUBLISH) + private Boolean isRequiredOnPublish; + public static final String SERIALIZED_NAME_IS_HALF_WIDTH = "isHalfWidth"; + @SerializedName(SERIALIZED_NAME_IS_HALF_WIDTH) + private Boolean isHalfWidth; + public static final String SERIALIZED_NAME_EDITOR_URL = "editorUrl"; + @SerializedName(SERIALIZED_NAME_EDITOR_URL) + private String editorUrl; + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private List tags; + public FieldPropertiesDto() { + } + public FieldPropertiesDto label(String label) { + this.label = label; + return this; + } + + /** + * Optional label for the editor. + * @return label + */ + @javax.annotation.Nullable + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + public FieldPropertiesDto hints(String hints) { + this.hints = hints; + return this; + } + + /** + * Hints to describe the field. + * @return hints + */ + @javax.annotation.Nullable + public String getHints() { + return hints; + } + + public void setHints(String hints) { + this.hints = hints; + } + public FieldPropertiesDto placeholder(String placeholder) { + this.placeholder = placeholder; + return this; + } + + /** + * Placeholder to show when no value has been entered. + * @return placeholder + */ + @javax.annotation.Nullable + public String getPlaceholder() { + return placeholder; + } + + public void setPlaceholder(String placeholder) { + this.placeholder = placeholder; + } + public FieldPropertiesDto isRequired(Boolean isRequired) { + this.isRequired = isRequired; + return this; + } + + /** + * Indicates if the field is required. + * @return isRequired + */ + @javax.annotation.Nullable + public Boolean getIsRequired() { + return isRequired; + } + + public void setIsRequired(Boolean isRequired) { + this.isRequired = isRequired; + } + public FieldPropertiesDto isRequiredOnPublish(Boolean isRequiredOnPublish) { + this.isRequiredOnPublish = isRequiredOnPublish; + return this; + } + + /** + * Indicates if the field is required when publishing. + * @return isRequiredOnPublish + */ + @javax.annotation.Nullable + public Boolean getIsRequiredOnPublish() { + return isRequiredOnPublish; + } + + public void setIsRequiredOnPublish(Boolean isRequiredOnPublish) { + this.isRequiredOnPublish = isRequiredOnPublish; + } + public FieldPropertiesDto isHalfWidth(Boolean isHalfWidth) { + this.isHalfWidth = isHalfWidth; + return this; + } + + /** + * Indicates if the field should be rendered with half width only. + * @return isHalfWidth + */ + @javax.annotation.Nullable + public Boolean getIsHalfWidth() { + return isHalfWidth; + } + + public void setIsHalfWidth(Boolean isHalfWidth) { + this.isHalfWidth = isHalfWidth; + } + public FieldPropertiesDto editorUrl(String editorUrl) { + this.editorUrl = editorUrl; + return this; + } + + /** + * Optional url to the editor. + * @return editorUrl + */ + @javax.annotation.Nullable + public String getEditorUrl() { + return editorUrl; + } + + public void setEditorUrl(String editorUrl) { + this.editorUrl = editorUrl; + } + public FieldPropertiesDto tags(List tags) { + this.tags = tags; + return this; + } + + public FieldPropertiesDto addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Tags for automation processes. + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FieldPropertiesDto fieldPropertiesDto = (FieldPropertiesDto) o; + return Objects.equals(this.label, fieldPropertiesDto.label) && + Objects.equals(this.hints, fieldPropertiesDto.hints) && + Objects.equals(this.placeholder, fieldPropertiesDto.placeholder) && + Objects.equals(this.isRequired, fieldPropertiesDto.isRequired) && + Objects.equals(this.isRequiredOnPublish, fieldPropertiesDto.isRequiredOnPublish) && + Objects.equals(this.isHalfWidth, fieldPropertiesDto.isHalfWidth) && + Objects.equals(this.editorUrl, fieldPropertiesDto.editorUrl) && + Objects.equals(this.tags, fieldPropertiesDto.tags) && + true; + } + + 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(label, hints, placeholder, isRequired, isRequiredOnPublish, isHalfWidth, editorUrl, tags, true); + } + + 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 FieldPropertiesDto {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" hints: ").append(toIndentedString(hints)).append("\n"); + sb.append(" placeholder: ").append(toIndentedString(placeholder)).append("\n"); + sb.append(" isRequired: ").append(toIndentedString(isRequired)).append("\n"); + sb.append(" isRequiredOnPublish: ").append(toIndentedString(isRequiredOnPublish)).append("\n"); + sb.append(" isHalfWidth: ").append(toIndentedString(isHalfWidth)).append("\n"); + sb.append(" editorUrl: ").append(toIndentedString(editorUrl)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).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("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FieldPropertiesDto is not found in the empty JSON string", FieldPropertiesDto.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("fieldType").getAsString(); + switch (discriminatorValue) { + case "Array": + ArrayFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "Assets": + AssetsFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "Boolean": + BooleanFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "Component": + ComponentFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "Components": + ComponentsFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "DateTime": + DateTimeFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "Geolocation": + GeolocationFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "Json": + JsonFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "Number": + NumberFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "References": + ReferencesFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "RichText": + RichTextFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "String": + StringFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "Tags": + TagsFieldPropertiesDto.validateJsonElement(jsonElement); + break; + case "UI": + UIFieldPropertiesDto.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `fieldType` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of FieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of FieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to FieldPropertiesDto + */ + public static FieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FieldPropertiesDto.class); + } + + /** + * Convert an instance of FieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/FieldRuleAction.java b/src/main/java/com/squidex/api/types/FieldRuleAction.java index f723dbb..0db2158 100644 --- a/src/main/java/com/squidex/api/types/FieldRuleAction.java +++ b/src/main/java/com/squidex/api/types/FieldRuleAction.java @@ -1,26 +1,80 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(FieldRuleAction.Adapter.class) public enum FieldRuleAction { - DISABLE("Disable"), + + DISABLE("Disable"), + + HIDE("Hide"), + + REQUIRE("Require"); - HIDE("Hide"), + private String value; - REQUIRE("Require"); + FieldRuleAction(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - FieldRuleAction(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static FieldRuleAction fromValue(String value) { + for (FieldRuleAction b : FieldRuleAction.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 FieldRuleAction enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public FieldRuleAction read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return FieldRuleAction.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + FieldRuleAction.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/FieldRuleDto.java b/src/main/java/com/squidex/api/types/FieldRuleDto.java index 58024b9..9cadf40 100644 --- a/src/main/java/com/squidex/api/types/FieldRuleDto.java +++ b/src/main/java/com/squidex/api/types/FieldRuleDto.java @@ -1,159 +1,274 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.FieldRuleAction; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = FieldRuleDto.Builder.class) -public final class FieldRuleDto { - private final FieldRuleAction action; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final String field; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final Optional condition; +import com.squidex.api.core.JSON; - private FieldRuleDto(FieldRuleAction action, String field, Optional condition) { - this.action = action; - this.field = field; - this.condition = condition; - } +/** + * FieldRuleDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class FieldRuleDto { + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private FieldRuleAction action; + public static final String SERIALIZED_NAME_FIELD = "field"; + @SerializedName(SERIALIZED_NAME_FIELD) + private String field; + public static final String SERIALIZED_NAME_CONDITION = "condition"; + @SerializedName(SERIALIZED_NAME_CONDITION) + private String condition; + public FieldRuleDto() { + } + public FieldRuleDto action(FieldRuleAction action) { + this.action = action; + return this; + } - /** - * @return The action to perform when the condition is met. - */ - @JsonProperty("action") - public FieldRuleAction getAction() { - return action; - } + /** + * Get action + * @return action + */ + @javax.annotation.Nonnull + public FieldRuleAction getAction() { + return action; + } - /** - * @return The field to update. - */ - @JsonProperty("field") - public String getField() { - return field; - } + public void setAction(FieldRuleAction action) { + this.action = action; + } + public FieldRuleDto field(String field) { + this.field = field; + return this; + } - /** - * @return The condition. - */ - @JsonProperty("condition") - public Optional getCondition() { - return condition; - } + /** + * The field to update. + * @return field + */ + @javax.annotation.Nonnull + public String getField() { + return field; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FieldRuleDto && equalTo((FieldRuleDto) other); - } + public void setField(String field) { + this.field = field; + } + public FieldRuleDto condition(String condition) { + this.condition = condition; + return this; + } - private boolean equalTo(FieldRuleDto other) { - return action.equals(other.action) && field.equals(other.field) && condition.equals(other.condition); - } + /** + * The condition. + * @return condition + */ + @javax.annotation.Nullable + public String getCondition() { + return condition; + } - @Override - public int hashCode() { - return Objects.hash(this.action, this.field, this.condition); - } + public void setCondition(String condition) { + this.condition = condition; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static ActionStage builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + FieldRuleDto fieldRuleDto = (FieldRuleDto) o; + return Objects.equals(this.action, fieldRuleDto.action) && + Objects.equals(this.field, fieldRuleDto.field) && + Objects.equals(this.condition, fieldRuleDto.condition); + } - public interface ActionStage { - FieldStage action(FieldRuleAction action); + 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())); + } - Builder from(FieldRuleDto other); - } + @Override + public int hashCode() { + return Objects.hash(action, field, condition); + } - public interface FieldStage { - _FinalStage field(String field); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - public interface _FinalStage { - FieldRuleDto build(); - - _FinalStage condition(Optional condition); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FieldRuleDto {\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" field: ").append(toIndentedString(field)).append("\n"); + sb.append(" condition: ").append(toIndentedString(condition)).append("\n"); + sb.append("}"); + return sb.toString(); + } - _FinalStage condition(String condition); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ActionStage, FieldStage, _FinalStage { - private FieldRuleAction action; - private String field; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Optional condition = Optional.empty(); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("action"); + openapiFields.add("field"); + openapiFields.add("condition"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("action"); + openapiRequiredFields.add("field"); + } - @Override - public Builder from(FieldRuleDto other) { - action(other.getAction()); - field(other.getField()); - condition(other.getCondition()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to FieldRuleDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!FieldRuleDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in FieldRuleDto is not found in the empty JSON string", FieldRuleDto.openapiRequiredFields.toString())); } + } - /** - *

The action to perform when the condition is met.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("action") - public FieldStage action(FieldRuleAction action) { - this.action = action; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!FieldRuleDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `FieldRuleDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The field to update.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("field") - public _FinalStage field(String field) { - this.field = field; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : FieldRuleDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `action` + FieldRuleAction.validateJsonElement(jsonObj.get("action")); + if (!jsonObj.get("field").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `field` to be a primitive type in the JSON string but got `%s`", jsonObj.get("field").toString())); + } + if ((jsonObj.get("condition") != null && !jsonObj.get("condition").isJsonNull()) && !jsonObj.get("condition").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `condition` to be a primitive type in the JSON string but got `%s`", jsonObj.get("condition").toString())); + } + } - /** - *

The condition.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage condition(String condition) { - this.condition = Optional.of(condition); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!FieldRuleDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'FieldRuleDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(FieldRuleDto.class)); - @Override - @JsonSetter(value = "condition", nulls = Nulls.SKIP) - public _FinalStage condition(Optional condition) { - this.condition = condition; - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, FieldRuleDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public FieldRuleDto build() { - return new FieldRuleDto(action, field, condition); - } + @Override + public FieldRuleDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of FieldRuleDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of FieldRuleDto + * @throws IOException if the JSON string is invalid with respect to FieldRuleDto + */ + public static FieldRuleDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, FieldRuleDto.class); + } + + /** + * Convert an instance of FieldRuleDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/GeolocationFieldEditor.java b/src/main/java/com/squidex/api/types/GeolocationFieldEditor.java new file mode 100644 index 0000000..e5c3ecd --- /dev/null +++ b/src/main/java/com/squidex/api/types/GeolocationFieldEditor.java @@ -0,0 +1,76 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(GeolocationFieldEditor.Adapter.class) +public enum GeolocationFieldEditor { + + MAP("Map"); + + private String value; + + GeolocationFieldEditor(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static GeolocationFieldEditor fromValue(String value) { + for (GeolocationFieldEditor b : GeolocationFieldEditor.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 GeolocationFieldEditor enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public GeolocationFieldEditor read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return GeolocationFieldEditor.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + GeolocationFieldEditor.fromValue(value); + } +} + diff --git a/src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java index be30a0b..4b010c8 100644 --- a/src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java @@ -1,83 +1,232 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.FieldPropertiesDto; +import com.squidex.api.types.GeolocationFieldEditor; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = GeolocationFieldPropertiesDto.Builder.class) -public final class GeolocationFieldPropertiesDto { - private final Optional editor; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private GeolocationFieldPropertiesDto(Optional editor) { - this.editor = editor; - } +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The editor that is used to manage this field. - */ - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GeolocationFieldPropertiesDto && equalTo((GeolocationFieldPropertiesDto) other); - } +/** + * GeolocationFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class GeolocationFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_EDITOR = "editor"; + @SerializedName(SERIALIZED_NAME_EDITOR) + private GeolocationFieldEditor editor; + public GeolocationFieldPropertiesDto() { + } + public GeolocationFieldPropertiesDto editor(GeolocationFieldEditor editor) { + this.editor = editor; + return this; + } - private boolean equalTo(GeolocationFieldPropertiesDto other) { - return editor.equals(other.editor); - } + /** + * Get editor + * @return editor + */ + @javax.annotation.Nullable + public GeolocationFieldEditor getEditor() { + return editor; + } - @Override - public int hashCode() { - return Objects.hash(this.editor); + public void setEditor(GeolocationFieldEditor editor) { + this.editor = editor; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + GeolocationFieldPropertiesDto geolocationFieldPropertiesDto = (GeolocationFieldPropertiesDto) o; + return Objects.equals(this.editor, geolocationFieldPropertiesDto.editor) && + super.equals(o); + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + 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(editor, super.hashCode()); + } + + 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 GeolocationFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" editor: ").append(toIndentedString(editor)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public static Builder builder() { - return new Builder(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional editor = Optional.empty(); - private Builder() {} + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder from(GeolocationFieldPropertiesDto other) { - editor(other.getEditor()); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("editor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to GeolocationFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!GeolocationFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in GeolocationFieldPropertiesDto is not found in the empty JSON string", GeolocationFieldPropertiesDto.openapiRequiredFields.toString())); } + } - public Builder editor(String editor) { - this.editor = Optional.of(editor); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!GeolocationFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `GeolocationFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public GeolocationFieldPropertiesDto build() { - return new GeolocationFieldPropertiesDto(editor); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : GeolocationFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.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 (!GeolocationFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'GeolocationFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(GeolocationFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, GeolocationFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public GeolocationFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of GeolocationFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of GeolocationFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to GeolocationFieldPropertiesDto + */ + public static GeolocationFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, GeolocationFieldPropertiesDto.class); + } + + /** + * Convert an instance of GeolocationFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/HistoryEventDto.java b/src/main/java/com/squidex/api/types/HistoryEventDto.java index 3ece2b7..7799331 100644 --- a/src/main/java/com/squidex/api/types/HistoryEventDto.java +++ b/src/main/java/com/squidex/api/types/HistoryEventDto.java @@ -1,246 +1,339 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.time.OffsetDateTime; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = HistoryEventDto.Builder.class) -public final class HistoryEventDto { - private final String message; - - private final String eventType; - - private final String actor; - - private final String eventId; - - private final OffsetDateTime created; - - private final int version; - - private HistoryEventDto( - String message, String eventType, String actor, String eventId, OffsetDateTime created, int version) { - this.message = message; - this.eventType = eventType; - this.actor = actor; - this.eventId = eventId; - this.created = created; - this.version = version; - } - - /** - * @return The message for the event. - */ - @JsonProperty("message") - public String getMessage() { - return message; - } - - /** - * @return The type of the original event. - */ - @JsonProperty("eventType") - public String getEventType() { - return eventType; - } - - /** - * @return The user who called the action. - */ - @JsonProperty("actor") - public String getActor() { - return actor; - } - - /** - * @return Gets a unique id for the event. - */ - @JsonProperty("eventId") - public String getEventId() { - return eventId; - } - - /** - * @return The time when the event happened. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The version identifier. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof HistoryEventDto && equalTo((HistoryEventDto) other); - } - - private boolean equalTo(HistoryEventDto other) { - return message.equals(other.message) - && eventType.equals(other.eventType) - && actor.equals(other.actor) - && eventId.equals(other.eventId) - && created.equals(other.created) - && version == other.version; - } - - @Override - public int hashCode() { - return Objects.hash(this.message, this.eventType, this.actor, this.eventId, this.created, this.version); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MessageStage builder() { - return new Builder(); - } - public interface MessageStage { - EventTypeStage message(String message); - - Builder from(HistoryEventDto other); - } - public interface EventTypeStage { - ActorStage eventType(String eventType); - } - - public interface ActorStage { - EventIdStage actor(String actor); - } +package com.squidex.api.types; - public interface EventIdStage { - CreatedStage eventId(String eventId); - } +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.squidex.api.core.JSON; - public interface CreatedStage { - VersionStage created(OffsetDateTime created); +/** + * HistoryEventDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class HistoryEventDto { + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + public static final String SERIALIZED_NAME_EVENT_TYPE = "eventType"; + @SerializedName(SERIALIZED_NAME_EVENT_TYPE) + private String eventType; + public static final String SERIALIZED_NAME_ACTOR = "actor"; + @SerializedName(SERIALIZED_NAME_ACTOR) + private String actor; + public static final String SERIALIZED_NAME_EVENT_ID = "eventId"; + @SerializedName(SERIALIZED_NAME_EVENT_ID) + private String eventId; + public static final String SERIALIZED_NAME_CREATED = "created"; + @SerializedName(SERIALIZED_NAME_CREATED) + private OffsetDateTime created; + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Long version; + public HistoryEventDto() { + } + public HistoryEventDto message(String message) { + this.message = message; + return this; + } + + /** + * The message for the event. + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + public HistoryEventDto eventType(String eventType) { + this.eventType = eventType; + return this; + } + + /** + * The type of the original event. + * @return eventType + */ + @javax.annotation.Nonnull + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + public HistoryEventDto actor(String actor) { + this.actor = actor; + return this; + } + + /** + * The user who called the action. + * @return actor + */ + @javax.annotation.Nonnull + public String getActor() { + return actor; + } + + public void setActor(String actor) { + this.actor = actor; + } + public HistoryEventDto eventId(String eventId) { + this.eventId = eventId; + return this; + } + + /** + * Gets a unique id for the event. + * @return eventId + */ + @javax.annotation.Nonnull + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + public HistoryEventDto created(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * The time when the event happened. + * @return created + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreated() { + return created; + } + + public void setCreated(OffsetDateTime created) { + this.created = created; + } + public HistoryEventDto version(Long version) { + this.version = version; + return this; + } + + /** + * The version identifier. + * @return version + */ + @javax.annotation.Nonnull + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface VersionStage { - _FinalStage version(int version); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - HistoryEventDto build(); + HistoryEventDto historyEventDto = (HistoryEventDto) o; + return Objects.equals(this.message, historyEventDto.message) && + Objects.equals(this.eventType, historyEventDto.eventType) && + Objects.equals(this.actor, historyEventDto.actor) && + Objects.equals(this.eventId, historyEventDto.eventId) && + Objects.equals(this.created, historyEventDto.created) && + Objects.equals(this.version, historyEventDto.version); + } + + @Override + public int hashCode() { + return Objects.hash(message, eventType, actor, eventId, created, version); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HistoryEventDto {\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append(" eventType: ").append(toIndentedString(eventType)).append("\n"); + sb.append(" actor: ").append(toIndentedString(actor)).append("\n"); + sb.append(" eventId: ").append(toIndentedString(eventId)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements MessageStage, EventTypeStage, ActorStage, EventIdStage, CreatedStage, VersionStage, _FinalStage { - private String message; - - private String eventType; - - private String actor; - - private String eventId; - - private OffsetDateTime created; - - private int version; - - private Builder() {} - - @Override - public Builder from(HistoryEventDto other) { - message(other.getMessage()); - eventType(other.getEventType()); - actor(other.getActor()); - eventId(other.getEventId()); - created(other.getCreated()); - version(other.getVersion()); - return this; - } - - /** - *

The message for the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("message") - public EventTypeStage message(String message) { - this.message = message; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("message"); + openapiFields.add("eventType"); + openapiFields.add("actor"); + openapiFields.add("eventId"); + openapiFields.add("created"); + openapiFields.add("version"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("message"); + openapiRequiredFields.add("eventType"); + openapiRequiredFields.add("actor"); + openapiRequiredFields.add("eventId"); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("version"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to HistoryEventDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!HistoryEventDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in HistoryEventDto is not found in the empty JSON string", HistoryEventDto.openapiRequiredFields.toString())); } + } - /** - *

The type of the original event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("eventType") - public ActorStage eventType(String eventType) { - this.eventType = eventType; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!HistoryEventDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `HistoryEventDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The user who called the action.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("actor") - public EventIdStage actor(String actor) { - this.actor = actor; - return this; - } - - /** - *

Gets a unique id for the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("eventId") - public CreatedStage eventId(String eventId) { - this.eventId = eventId; - return this; - } - - /** - *

The time when the event happened.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public VersionStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The version identifier.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public _FinalStage version(int version) { - this.version = version; - return this; - } - - @Override - public HistoryEventDto build() { - return new HistoryEventDto(message, eventType, actor, eventId, created, version); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : HistoryEventDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + if (!jsonObj.get("eventType").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventType` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventType").toString())); + } + if (!jsonObj.get("actor").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `actor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actor").toString())); + } + if (!jsonObj.get("eventId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!HistoryEventDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'HistoryEventDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(HistoryEventDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, HistoryEventDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public HistoryEventDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of HistoryEventDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of HistoryEventDto + * @throws IOException if the JSON string is invalid with respect to HistoryEventDto + */ + public static HistoryEventDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, HistoryEventDto.class); + } + + /** + * Convert an instance of HistoryEventDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/IResource.java b/src/main/java/com/squidex/api/types/IResource.java deleted file mode 100644 index f00fd6a..0000000 --- a/src/main/java/com/squidex/api/types/IResource.java +++ /dev/null @@ -1,10 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.types; - -import java.util.Map; - -public interface IResource { - Map getLinks(); -} diff --git a/src/main/java/com/squidex/api/types/IUpsertSchemaDto.java b/src/main/java/com/squidex/api/types/IUpsertSchemaDto.java deleted file mode 100644 index 5bc07d0..0000000 --- a/src/main/java/com/squidex/api/types/IUpsertSchemaDto.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.types; - -import java.util.List; -import java.util.Map; -import java.util.Optional; - -public interface IUpsertSchemaDto { - Optional getProperties(); - - Optional getScripts(); - - Optional> getFieldsInReferences(); - - Optional> getFieldsInLists(); - - Optional> getFields(); - - Optional>> getPreviewUrls(); - - Optional> getFieldRules(); - - Optional getCategory(); - - Optional getIsPublished(); -} diff --git a/src/main/java/com/squidex/api/types/ImageFormat.java b/src/main/java/com/squidex/api/types/ImageFormat.java index 0bca149..4ce129e 100644 --- a/src/main/java/com/squidex/api/types/ImageFormat.java +++ b/src/main/java/com/squidex/api/types/ImageFormat.java @@ -1,36 +1,90 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; -public enum ImageFormat { - AVIF("AVIF"), +package com.squidex.api.types; - BMP("BMP"), +import java.util.Objects; +import com.google.gson.annotations.SerializedName; - GIF("GIF"), +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; - JPEG("JPEG"), +/** + * + */ +@JsonAdapter(ImageFormat.Adapter.class) +public enum ImageFormat { + + AVIF("AVIF"), + + BMP("BMP"), + + GIF("GIF"), + + JPEG("JPEG"), + + PNG("PNG"), + + TGA("TGA"), + + TIFF("TIFF"), + + WEBP("WEBP"); - PNG("PNG"), + private String value; - TGA("TGA"), + ImageFormat(String value) { + this.value = value; + } - TIFF("TIFF"), + public String getValue() { + return value; + } - WEBP("WEBP"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static ImageFormat fromValue(String value) { + for (ImageFormat b : ImageFormat.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - ImageFormat(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ImageFormat enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public ImageFormat read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ImageFormat.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ImageFormat.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/ImportContentsDto.java b/src/main/java/com/squidex/api/types/ImportContentsDto.java new file mode 100644 index 0000000..9a2c600 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ImportContentsDto.java @@ -0,0 +1,297 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.ArrayList; +import java.util.Arrays; +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.squidex.api.core.JSON; + +/** + * ImportContentsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ImportContentsDto { + public static final String SERIALIZED_NAME_DATAS = "datas"; + @SerializedName(SERIALIZED_NAME_DATAS) + private List>> datas = new ArrayList<>(); + public static final String SERIALIZED_NAME_PUBLISH = "publish"; + @Deprecated + @SerializedName(SERIALIZED_NAME_PUBLISH) + private Boolean publish; + public static final String SERIALIZED_NAME_DO_NOT_SCRIPT = "doNotScript"; + @SerializedName(SERIALIZED_NAME_DO_NOT_SCRIPT) + private Boolean doNotScript; + public static final String SERIALIZED_NAME_OPTIMIZE_VALIDATION = "optimizeValidation"; + @SerializedName(SERIALIZED_NAME_OPTIMIZE_VALIDATION) + private Boolean optimizeValidation; + public ImportContentsDto() { + } + public ImportContentsDto datas(List>> datas) { + this.datas = datas; + return this; + } + + public ImportContentsDto addDatasItem(Map> datasItem) { + if (this.datas == null) { + this.datas = new ArrayList<>(); + } + this.datas.add(datasItem); + return this; + } + + /** + * The data to import. + * @return datas + */ + @javax.annotation.Nonnull + public List>> getDatas() { + return datas; + } + + public void setDatas(List>> datas) { + this.datas = datas; + } + @Deprecated + public ImportContentsDto publish(Boolean publish) { + this.publish = publish; + return this; + } + + /** + * True to automatically publish the content. + * @return publish + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public Boolean getPublish() { + return publish; + } + + @Deprecated + public void setPublish(Boolean publish) { + this.publish = publish; + } + public ImportContentsDto doNotScript(Boolean doNotScript) { + this.doNotScript = doNotScript; + return this; + } + + /** + * True to turn off scripting for faster inserts. Default: true. + * @return doNotScript + */ + @javax.annotation.Nullable + public Boolean getDoNotScript() { + return doNotScript; + } + + public void setDoNotScript(Boolean doNotScript) { + this.doNotScript = doNotScript; + } + public ImportContentsDto optimizeValidation(Boolean optimizeValidation) { + this.optimizeValidation = optimizeValidation; + return this; + } + + /** + * True to turn off costly validation: Unique checks, asset checks and reference checks. Default: true. + * @return optimizeValidation + */ + @javax.annotation.Nullable + public Boolean getOptimizeValidation() { + return optimizeValidation; + } + + public void setOptimizeValidation(Boolean optimizeValidation) { + this.optimizeValidation = optimizeValidation; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ImportContentsDto importContentsDto = (ImportContentsDto) o; + return Objects.equals(this.datas, importContentsDto.datas) && + Objects.equals(this.publish, importContentsDto.publish) && + Objects.equals(this.doNotScript, importContentsDto.doNotScript) && + Objects.equals(this.optimizeValidation, importContentsDto.optimizeValidation); + } + + @Override + public int hashCode() { + return Objects.hash(datas, publish, doNotScript, optimizeValidation); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ImportContentsDto {\n"); + sb.append(" datas: ").append(toIndentedString(datas)).append("\n"); + sb.append(" publish: ").append(toIndentedString(publish)).append("\n"); + sb.append(" doNotScript: ").append(toIndentedString(doNotScript)).append("\n"); + sb.append(" optimizeValidation: ").append(toIndentedString(optimizeValidation)).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("datas"); + openapiFields.add("publish"); + openapiFields.add("doNotScript"); + openapiFields.add("optimizeValidation"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("datas"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ImportContentsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ImportContentsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ImportContentsDto is not found in the empty JSON string", ImportContentsDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ImportContentsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ImportContentsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ImportContentsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 required json array is present + if (jsonObj.get("datas") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("datas").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `datas` to be an array in the JSON string but got `%s`", jsonObj.get("datas").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ImportContentsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ImportContentsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ImportContentsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ImportContentsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ImportContentsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of ImportContentsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ImportContentsDto + * @throws IOException if the JSON string is invalid with respect to ImportContentsDto + */ + public static ImportContentsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ImportContentsDto.class); + } + + /** + * Convert an instance of ImportContentsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/JobDto.java b/src/main/java/com/squidex/api/types/JobDto.java new file mode 100644 index 0000000..3f2b6f0 --- /dev/null +++ b/src/main/java/com/squidex/api/types/JobDto.java @@ -0,0 +1,486 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.JobLogMessageDto; +import com.squidex.api.types.JobStatus; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; +import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +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.squidex.api.core.JSON; + +/** + * JobDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class JobDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_STARTED = "started"; + @SerializedName(SERIALIZED_NAME_STARTED) + private OffsetDateTime started; + public static final String SERIALIZED_NAME_STOPPED = "stopped"; + @SerializedName(SERIALIZED_NAME_STOPPED) + private OffsetDateTime stopped; + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private JobStatus status; + public static final String SERIALIZED_NAME_TASK_NAME = "taskName"; + @SerializedName(SERIALIZED_NAME_TASK_NAME) + private String taskName; + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + public static final String SERIALIZED_NAME_TASK_ARGUMENTS = "taskArguments"; + @SerializedName(SERIALIZED_NAME_TASK_ARGUMENTS) + private Map taskArguments = new HashMap<>(); + public static final String SERIALIZED_NAME_LOG = "log"; + @SerializedName(SERIALIZED_NAME_LOG) + private List log = new ArrayList<>(); + public static final String SERIALIZED_NAME_CAN_DOWNLOAD = "canDownload"; + @SerializedName(SERIALIZED_NAME_CAN_DOWNLOAD) + private Boolean canDownload; + public JobDto() { + } + public JobDto links(Map links) { + this.links = links; + return this; + } + + public JobDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public JobDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the job. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public JobDto started(OffsetDateTime started) { + this.started = started; + return this; + } + + /** + * The time when the job has been started. + * @return started + */ + @javax.annotation.Nonnull + public OffsetDateTime getStarted() { + return started; + } + + public void setStarted(OffsetDateTime started) { + this.started = started; + } + public JobDto stopped(OffsetDateTime stopped) { + this.stopped = stopped; + return this; + } + + /** + * The time when the job has been stopped. + * @return stopped + */ + @javax.annotation.Nullable + public OffsetDateTime getStopped() { + return stopped; + } + + public void setStopped(OffsetDateTime stopped) { + this.stopped = stopped; + } + public JobDto status(JobStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public JobStatus getStatus() { + return status; + } + + public void setStatus(JobStatus status) { + this.status = status; + } + public JobDto taskName(String taskName) { + this.taskName = taskName; + return this; + } + + /** + * The name of the task. + * @return taskName + */ + @javax.annotation.Nonnull + public String getTaskName() { + return taskName; + } + + public void setTaskName(String taskName) { + this.taskName = taskName; + } + public JobDto description(String description) { + this.description = description; + return this; + } + + /** + * The description of the job. + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public JobDto taskArguments(Map taskArguments) { + this.taskArguments = taskArguments; + return this; + } + + public JobDto putTaskArgumentsItem(String key, String taskArgumentsItem) { + if (this.taskArguments == null) { + this.taskArguments = new HashMap<>(); + } + this.taskArguments.put(key, taskArgumentsItem); + return this; + } + + /** + * The arguments for the job. + * @return taskArguments + */ + @javax.annotation.Nonnull + public Map getTaskArguments() { + return taskArguments; + } + + public void setTaskArguments(Map taskArguments) { + this.taskArguments = taskArguments; + } + public JobDto log(List log) { + this.log = log; + return this; + } + + public JobDto addLogItem(JobLogMessageDto logItem) { + if (this.log == null) { + this.log = new ArrayList<>(); + } + this.log.add(logItem); + return this; + } + + /** + * The list of log items. + * @return log + */ + @javax.annotation.Nonnull + public List getLog() { + return log; + } + + public void setLog(List log) { + this.log = log; + } + public JobDto canDownload(Boolean canDownload) { + this.canDownload = canDownload; + return this; + } + + /** + * Indicates whether the job can be downloaded. + * @return canDownload + */ + @javax.annotation.Nonnull + public Boolean getCanDownload() { + return canDownload; + } + + public void setCanDownload(Boolean canDownload) { + this.canDownload = canDownload; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + JobDto jobDto = (JobDto) o; + return Objects.equals(this.links, jobDto.links) && + Objects.equals(this.id, jobDto.id) && + Objects.equals(this.started, jobDto.started) && + Objects.equals(this.stopped, jobDto.stopped) && + Objects.equals(this.status, jobDto.status) && + Objects.equals(this.taskName, jobDto.taskName) && + Objects.equals(this.description, jobDto.description) && + Objects.equals(this.taskArguments, jobDto.taskArguments) && + Objects.equals(this.log, jobDto.log) && + Objects.equals(this.canDownload, jobDto.canDownload); + } + + 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(links, id, started, stopped, status, taskName, description, taskArguments, log, canDownload); + } + + 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 JobDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" started: ").append(toIndentedString(started)).append("\n"); + sb.append(" stopped: ").append(toIndentedString(stopped)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" taskName: ").append(toIndentedString(taskName)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" taskArguments: ").append(toIndentedString(taskArguments)).append("\n"); + sb.append(" log: ").append(toIndentedString(log)).append("\n"); + sb.append(" canDownload: ").append(toIndentedString(canDownload)).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("_links"); + openapiFields.add("id"); + openapiFields.add("started"); + openapiFields.add("stopped"); + openapiFields.add("status"); + openapiFields.add("taskName"); + openapiFields.add("description"); + openapiFields.add("taskArguments"); + openapiFields.add("log"); + openapiFields.add("canDownload"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("started"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("taskName"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("taskArguments"); + openapiRequiredFields.add("log"); + openapiRequiredFields.add("canDownload"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to JobDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!JobDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in JobDto is not found in the empty JSON string", JobDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!JobDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `JobDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : JobDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + // validate the required field `status` + JobStatus.validateJsonElement(jsonObj.get("status")); + if (!jsonObj.get("taskName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `taskName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("taskName").toString())); + } + if (!jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("log").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `log` to be an array in the JSON string but got `%s`", jsonObj.get("log").toString())); + } + + JsonArray jsonArraylog = jsonObj.getAsJsonArray("log"); + // validate the required field `log` (array) + for (int i = 0; i < jsonArraylog.size(); i++) { + JobLogMessageDto.validateJsonElement(jsonArraylog.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!JobDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'JobDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(JobDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, JobDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public JobDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of JobDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of JobDto + * @throws IOException if the JSON string is invalid with respect to JobDto + */ + public static JobDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, JobDto.class); + } + + /** + * Convert an instance of JobDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/JobLogMessageDto.java b/src/main/java/com/squidex/api/types/JobLogMessageDto.java new file mode 100644 index 0000000..70ac5d0 --- /dev/null +++ b/src/main/java/com/squidex/api/types/JobLogMessageDto.java @@ -0,0 +1,234 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * JobLogMessageDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class JobLogMessageDto { + public static final String SERIALIZED_NAME_TIMESTAMP = "timestamp"; + @SerializedName(SERIALIZED_NAME_TIMESTAMP) + private OffsetDateTime timestamp; + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + public JobLogMessageDto() { + } + public JobLogMessageDto timestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * The timestamp. + * @return timestamp + */ + @javax.annotation.Nonnull + public OffsetDateTime getTimestamp() { + return timestamp; + } + + public void setTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + } + public JobLogMessageDto message(String message) { + this.message = message; + return this; + } + + /** + * The log message. + * @return message + */ + @javax.annotation.Nonnull + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + JobLogMessageDto jobLogMessageDto = (JobLogMessageDto) o; + return Objects.equals(this.timestamp, jobLogMessageDto.timestamp) && + Objects.equals(this.message, jobLogMessageDto.message); + } + + @Override + public int hashCode() { + return Objects.hash(timestamp, message); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class JobLogMessageDto {\n"); + sb.append(" timestamp: ").append(toIndentedString(timestamp)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).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("timestamp"); + openapiFields.add("message"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("timestamp"); + openapiRequiredFields.add("message"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to JobLogMessageDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!JobLogMessageDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in JobLogMessageDto is not found in the empty JSON string", JobLogMessageDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!JobLogMessageDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `JobLogMessageDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : JobLogMessageDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!JobLogMessageDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'JobLogMessageDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(JobLogMessageDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, JobLogMessageDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public JobLogMessageDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of JobLogMessageDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of JobLogMessageDto + * @throws IOException if the JSON string is invalid with respect to JobLogMessageDto + */ + public static JobLogMessageDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, JobLogMessageDto.class); + } + + /** + * Convert an instance of JobLogMessageDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/JobStatus.java b/src/main/java/com/squidex/api/types/JobStatus.java index 422cf7e..36d0648 100644 --- a/src/main/java/com/squidex/api/types/JobStatus.java +++ b/src/main/java/com/squidex/api/types/JobStatus.java @@ -1,28 +1,84 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(JobStatus.Adapter.class) public enum JobStatus { - CREATED("Created"), + + CREATED("Created"), + + STARTED("Started"), + + COMPLETED("Completed"), + + CANCELLED("Cancelled"), + + FAILED("Failed"); - STARTED("Started"), + private String value; - COMPLETED("Completed"), + JobStatus(String value) { + this.value = value; + } - FAILED("Failed"); + public String getValue() { + return value; + } - private final String value; + @Override + public String toString() { + return String.valueOf(value); + } - JobStatus(String value) { - this.value = value; + public static JobStatus fromValue(String value) { + for (JobStatus b : JobStatus.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - @JsonValue + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return this.value; + public void write(final JsonWriter jsonWriter, final JobStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } + + @Override + public JobStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return JobStatus.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + JobStatus.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/JobsDto.java b/src/main/java/com/squidex/api/types/JobsDto.java new file mode 100644 index 0000000..ae05fd1 --- /dev/null +++ b/src/main/java/com/squidex/api/types/JobsDto.java @@ -0,0 +1,262 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.JobDto; +import com.squidex.api.types.ResourceLink; +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.squidex.api.core.JSON; + +/** + * JobsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class JobsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public JobsDto() { + } + public JobsDto links(Map links) { + this.links = links; + return this; + } + + public JobsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public JobsDto items(List items) { + this.items = items; + return this; + } + + public JobsDto addItemsItem(JobDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); + } + this.items.add(itemsItem); + return this; + } + + /** + * The jobs. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + JobsDto jobsDto = (JobsDto) o; + return Objects.equals(this.links, jobsDto.links) && + Objects.equals(this.items, jobsDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class JobsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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("_links"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to JobsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!JobsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in JobsDto is not found in the empty JSON string", JobsDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!JobsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `JobsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : JobsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + JobDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!JobsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'JobsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(JobsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, JobsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public JobsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of JobsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of JobsDto + * @throws IOException if the JSON string is invalid with respect to JobsDto + */ + public static JobsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, JobsDto.class); + } + + /** + * Convert an instance of JobsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java index 6ba5aa2..2f1c1fd 100644 --- a/src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java @@ -1,83 +1,231 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.FieldPropertiesDto; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = JsonFieldPropertiesDto.Builder.class) -public final class JsonFieldPropertiesDto { - private final Optional graphQlSchema; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private JsonFieldPropertiesDto(Optional graphQlSchema) { - this.graphQlSchema = graphQlSchema; - } +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The GraphQL schema. - */ - @JsonProperty("graphQLSchema") - public Optional getGraphQlSchema() { - return graphQlSchema; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof JsonFieldPropertiesDto && equalTo((JsonFieldPropertiesDto) other); - } +/** + * JsonFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class JsonFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_GRAPH_Q_L_SCHEMA = "graphQLSchema"; + @SerializedName(SERIALIZED_NAME_GRAPH_Q_L_SCHEMA) + private String graphQLSchema; + public JsonFieldPropertiesDto() { + } + public JsonFieldPropertiesDto graphQLSchema(String graphQLSchema) { + this.graphQLSchema = graphQLSchema; + return this; + } - private boolean equalTo(JsonFieldPropertiesDto other) { - return graphQlSchema.equals(other.graphQlSchema); - } + /** + * The GraphQL schema. + * @return graphQLSchema + */ + @javax.annotation.Nullable + public String getGraphQLSchema() { + return graphQLSchema; + } - @Override - public int hashCode() { - return Objects.hash(this.graphQlSchema); + public void setGraphQLSchema(String graphQLSchema) { + this.graphQLSchema = graphQLSchema; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + JsonFieldPropertiesDto jsonFieldPropertiesDto = (JsonFieldPropertiesDto) o; + return Objects.equals(this.graphQLSchema, jsonFieldPropertiesDto.graphQLSchema) && + super.equals(o); + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + 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(graphQLSchema, super.hashCode()); + } + + 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 JsonFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" graphQLSchema: ").append(toIndentedString(graphQLSchema)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public static Builder builder() { - return new Builder(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional graphQlSchema = Optional.empty(); - private Builder() {} + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder from(JsonFieldPropertiesDto other) { - graphQlSchema(other.getGraphQlSchema()); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("graphQLSchema"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } - @JsonSetter(value = "graphQLSchema", nulls = Nulls.SKIP) - public Builder graphQlSchema(Optional graphQlSchema) { - this.graphQlSchema = graphQlSchema; - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to JsonFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!JsonFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in JsonFieldPropertiesDto is not found in the empty JSON string", JsonFieldPropertiesDto.openapiRequiredFields.toString())); } + } - public Builder graphQlSchema(String graphQlSchema) { - this.graphQlSchema = Optional.of(graphQlSchema); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!JsonFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `JsonFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public JsonFieldPropertiesDto build() { - return new JsonFieldPropertiesDto(graphQlSchema); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : JsonFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.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 (!JsonFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'JsonFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(JsonFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, JsonFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public JsonFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of JsonFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of JsonFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to JsonFieldPropertiesDto + */ + public static JsonFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, JsonFieldPropertiesDto.class); + } + + /** + * Convert an instance of JsonFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/LanguageDto.java b/src/main/java/com/squidex/api/types/LanguageDto.java index d52cb52..06f0f6f 100644 --- a/src/main/java/com/squidex/api/types/LanguageDto.java +++ b/src/main/java/com/squidex/api/types/LanguageDto.java @@ -1,153 +1,263 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; 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; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = LanguageDto.Builder.class) -public final class LanguageDto { - private final String iso2Code; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final String englishName; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final String nativeName; +import com.squidex.api.core.JSON; - private LanguageDto(String iso2Code, String englishName, String nativeName) { - this.iso2Code = iso2Code; - this.englishName = englishName; - this.nativeName = nativeName; - } +/** + * LanguageDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class LanguageDto { + public static final String SERIALIZED_NAME_ISO2_CODE = "iso2Code"; + @SerializedName(SERIALIZED_NAME_ISO2_CODE) + private String iso2Code; + public static final String SERIALIZED_NAME_ENGLISH_NAME = "englishName"; + @SerializedName(SERIALIZED_NAME_ENGLISH_NAME) + private String englishName; + public static final String SERIALIZED_NAME_NATIVE_NAME = "nativeName"; + @SerializedName(SERIALIZED_NAME_NATIVE_NAME) + private String nativeName; + public LanguageDto() { + } + public LanguageDto iso2Code(String iso2Code) { + this.iso2Code = iso2Code; + return this; + } - /** - * @return The iso code of the language. - */ - @JsonProperty("iso2Code") - public String getIso2Code() { - return iso2Code; - } + /** + * The iso code of the language. + * @return iso2Code + */ + @javax.annotation.Nonnull + public String getIso2Code() { + return iso2Code; + } - /** - * @return The english name of the language. - */ - @JsonProperty("englishName") - public String getEnglishName() { - return englishName; - } + public void setIso2Code(String iso2Code) { + this.iso2Code = iso2Code; + } + public LanguageDto englishName(String englishName) { + this.englishName = englishName; + return this; + } - /** - * @return The native name of the language. - */ - @JsonProperty("nativeName") - public String getNativeName() { - return nativeName; - } + /** + * The english name of the language. + * @return englishName + */ + @javax.annotation.Nonnull + public String getEnglishName() { + return englishName; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof LanguageDto && equalTo((LanguageDto) other); - } + public void setEnglishName(String englishName) { + this.englishName = englishName; + } + public LanguageDto nativeName(String nativeName) { + this.nativeName = nativeName; + return this; + } - private boolean equalTo(LanguageDto other) { - return iso2Code.equals(other.iso2Code) - && englishName.equals(other.englishName) - && nativeName.equals(other.nativeName); - } + /** + * The native name of the language. + * @return nativeName + */ + @javax.annotation.Nonnull + public String getNativeName() { + return nativeName; + } - @Override - public int hashCode() { - return Objects.hash(this.iso2Code, this.englishName, this.nativeName); - } + public void setNativeName(String nativeName) { + this.nativeName = nativeName; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static Iso2CodeStage builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface Iso2CodeStage { - EnglishNameStage iso2Code(String iso2Code); - - Builder from(LanguageDto other); + if (o == null || getClass() != o.getClass()) { + return false; } + LanguageDto languageDto = (LanguageDto) o; + return Objects.equals(this.iso2Code, languageDto.iso2Code) && + Objects.equals(this.englishName, languageDto.englishName) && + Objects.equals(this.nativeName, languageDto.nativeName); + } - public interface EnglishNameStage { - NativeNameStage englishName(String englishName); - } + @Override + public int hashCode() { + return Objects.hash(iso2Code, englishName, nativeName); + } - public interface NativeNameStage { - _FinalStage nativeName(String nativeName); - } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class LanguageDto {\n"); + sb.append(" iso2Code: ").append(toIndentedString(iso2Code)).append("\n"); + sb.append(" englishName: ").append(toIndentedString(englishName)).append("\n"); + sb.append(" nativeName: ").append(toIndentedString(nativeName)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public interface _FinalStage { - LanguageDto build(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements Iso2CodeStage, EnglishNameStage, NativeNameStage, _FinalStage { - private String iso2Code; - private String englishName; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private String nativeName; + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("iso2Code"); + openapiFields.add("englishName"); + openapiFields.add("nativeName"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("iso2Code"); + openapiRequiredFields.add("englishName"); + openapiRequiredFields.add("nativeName"); + } - @Override - public Builder from(LanguageDto other) { - iso2Code(other.getIso2Code()); - englishName(other.getEnglishName()); - nativeName(other.getNativeName()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LanguageDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LanguageDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LanguageDto is not found in the empty JSON string", LanguageDto.openapiRequiredFields.toString())); } + } - /** - *

The iso code of the language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("iso2Code") - public EnglishNameStage iso2Code(String iso2Code) { - this.iso2Code = iso2Code; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LanguageDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LanguageDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The english name of the language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("englishName") - public NativeNameStage englishName(String englishName) { - this.englishName = englishName; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : LanguageDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("iso2Code").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `iso2Code` to be a primitive type in the JSON string but got `%s`", jsonObj.get("iso2Code").toString())); + } + if (!jsonObj.get("englishName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `englishName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("englishName").toString())); + } + if (!jsonObj.get("nativeName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `nativeName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("nativeName").toString())); + } + } - /** - *

The native name of the language.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("nativeName") - public _FinalStage nativeName(String nativeName) { - this.nativeName = nativeName; - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!LanguageDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LanguageDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LanguageDto.class)); - @Override - public LanguageDto build() { - return new LanguageDto(iso2Code, englishName, nativeName); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LanguageDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LanguageDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of LanguageDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of LanguageDto + * @throws IOException if the JSON string is invalid with respect to LanguageDto + */ + public static LanguageDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LanguageDto.class); + } + + /** + * Convert an instance of LanguageDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/LogDownloadDto.java b/src/main/java/com/squidex/api/types/LogDownloadDto.java index e68f4c6..e12423a 100644 --- a/src/main/java/com/squidex/api/types/LogDownloadDto.java +++ b/src/main/java/com/squidex/api/types/LogDownloadDto.java @@ -1,83 +1,213 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = LogDownloadDto.Builder.class) -public final class LogDownloadDto { - private final Optional downloadUrl; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private LogDownloadDto(Optional downloadUrl) { - this.downloadUrl = downloadUrl; - } +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The url to download the log. - */ - @JsonProperty("downloadUrl") - public Optional getDownloadUrl() { - return downloadUrl; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof LogDownloadDto && equalTo((LogDownloadDto) other); - } +/** + * LogDownloadDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class LogDownloadDto { + public static final String SERIALIZED_NAME_DOWNLOAD_URL = "downloadUrl"; + @SerializedName(SERIALIZED_NAME_DOWNLOAD_URL) + private String downloadUrl; + public LogDownloadDto() { + } + public LogDownloadDto downloadUrl(String downloadUrl) { + this.downloadUrl = downloadUrl; + return this; + } - private boolean equalTo(LogDownloadDto other) { - return downloadUrl.equals(other.downloadUrl); - } + /** + * The url to download the log. + * @return downloadUrl + */ + @javax.annotation.Nullable + public String getDownloadUrl() { + return downloadUrl; + } - @Override - public int hashCode() { - return Objects.hash(this.downloadUrl); + public void setDownloadUrl(String downloadUrl) { + this.downloadUrl = downloadUrl; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + LogDownloadDto logDownloadDto = (LogDownloadDto) o; + return Objects.equals(this.downloadUrl, logDownloadDto.downloadUrl); + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + 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(downloadUrl); + } + + 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 LogDownloadDto {\n"); + sb.append(" downloadUrl: ").append(toIndentedString(downloadUrl)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public static Builder builder() { - return new Builder(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional downloadUrl = Optional.empty(); - private Builder() {} + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder from(LogDownloadDto other) { - downloadUrl(other.getDownloadUrl()); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("downloadUrl"); - @JsonSetter(value = "downloadUrl", nulls = Nulls.SKIP) - public Builder downloadUrl(Optional downloadUrl) { - this.downloadUrl = downloadUrl; - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - public Builder downloadUrl(String downloadUrl) { - this.downloadUrl = Optional.of(downloadUrl); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to LogDownloadDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!LogDownloadDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in LogDownloadDto is not found in the empty JSON string", LogDownloadDto.openapiRequiredFields.toString())); } + } - public LogDownloadDto build() { - return new LogDownloadDto(downloadUrl); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!LogDownloadDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `LogDownloadDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("downloadUrl") != null && !jsonObj.get("downloadUrl").isJsonNull()) && !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 (!LogDownloadDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'LogDownloadDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(LogDownloadDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, LogDownloadDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public LogDownloadDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of LogDownloadDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of LogDownloadDto + * @throws IOException if the JSON string is invalid with respect to LogDownloadDto + */ + public static LogDownloadDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, LogDownloadDto.class); + } + + /** + * Convert an instance of LogDownloadDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java b/src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java index 5d874b4..7862470 100644 --- a/src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java +++ b/src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java @@ -1,21 +1,185 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.RuleTriggerDto; +import java.io.IOException; +import java.util.Arrays; -public final class ManualRuleTriggerDto { - private ManualRuleTriggerDto() {} +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ManualRuleTriggerDto; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.squidex.api.core.JSON; + +/** + * ManualRuleTriggerDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ManualRuleTriggerDto extends RuleTriggerDto { + public ManualRuleTriggerDto() { + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + return super.equals(o); + } + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ManualRuleTriggerDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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("triggerType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("triggerType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ManualRuleTriggerDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ManualRuleTriggerDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ManualRuleTriggerDto is not found in the empty JSON string", ManualRuleTriggerDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ManualRuleTriggerDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ManualRuleTriggerDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ManualRuleTriggerDto.openapiRequiredFields) { + if (jsonElement.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 String toString() { - return ObjectMappers.stringify(this); + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ManualRuleTriggerDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ManualRuleTriggerDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ManualRuleTriggerDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ManualRuleTriggerDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ManualRuleTriggerDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ManualRuleTriggerDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ManualRuleTriggerDto + * @throws IOException if the JSON string is invalid with respect to ManualRuleTriggerDto + */ + public static ManualRuleTriggerDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ManualRuleTriggerDto.class); + } + + /** + * Convert an instance of ManualRuleTriggerDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/MediumRuleActionDto.java b/src/main/java/com/squidex/api/types/MediumRuleActionDto.java index 5398867..e6ab761 100644 --- a/src/main/java/com/squidex/api/types/MediumRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/MediumRuleActionDto.java @@ -1,307 +1,363 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = MediumRuleActionDto.Builder.class) -public final class MediumRuleActionDto { - private final String accessToken; - - private final String title; - - private final String content; - - private final Optional canonicalUrl; - - private final Optional tags; - - private final Optional publicationId; - - private final boolean isHtml; - - private MediumRuleActionDto( - String accessToken, - String title, - String content, - Optional canonicalUrl, - Optional tags, - Optional publicationId, - boolean isHtml) { - this.accessToken = accessToken; - this.title = title; - this.content = content; - this.canonicalUrl = canonicalUrl; - this.tags = tags; - this.publicationId = publicationId; - this.isHtml = isHtml; - } - - /** - * @return The self issued access token. - */ - @JsonProperty("accessToken") - public String getAccessToken() { - return accessToken; - } - - /** - * @return The title, used for the url. - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * @return The content, either html or markdown. - */ - @JsonProperty("content") - public String getContent() { - return content; - } - - /** - * @return The original home of this content, if it was originally published elsewhere. - */ - @JsonProperty("canonicalUrl") - public Optional getCanonicalUrl() { - return canonicalUrl; - } - - /** - * @return The optional comma separated list of tags. - */ - @JsonProperty("tags") - public Optional getTags() { - return tags; - } - - /** - * @return Optional publication id. - */ - @JsonProperty("publicationId") - public Optional getPublicationId() { - return publicationId; - } - - /** - * @return Indicates whether the content is markdown or html. - */ - @JsonProperty("isHtml") - public boolean getIsHtml() { - return isHtml; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MediumRuleActionDto && equalTo((MediumRuleActionDto) other); - } - private boolean equalTo(MediumRuleActionDto other) { - return accessToken.equals(other.accessToken) - && title.equals(other.title) - && content.equals(other.content) - && canonicalUrl.equals(other.canonicalUrl) - && tags.equals(other.tags) - && publicationId.equals(other.publicationId) - && isHtml == other.isHtml; - } - - @Override - public int hashCode() { - return Objects.hash( - this.accessToken, - this.title, - this.content, - this.canonicalUrl, - this.tags, - this.publicationId, - this.isHtml); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static AccessTokenStage builder() { - return new Builder(); - } - - public interface AccessTokenStage { - TitleStage accessToken(String accessToken); +package com.squidex.api.types; - Builder from(MediumRuleActionDto other); - } +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.squidex.api.types.RuleActionDto; +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.squidex.api.core.JSON; - public interface TitleStage { - ContentStage title(String title); +/** + * MediumRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class MediumRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_ACCESS_TOKEN = "accessToken"; + @SerializedName(SERIALIZED_NAME_ACCESS_TOKEN) + private String accessToken; + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + private String title; + public static final String SERIALIZED_NAME_CONTENT = "content"; + @SerializedName(SERIALIZED_NAME_CONTENT) + private String content; + public static final String SERIALIZED_NAME_CANONICAL_URL = "canonicalUrl"; + @SerializedName(SERIALIZED_NAME_CANONICAL_URL) + private String canonicalUrl; + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private String tags; + public static final String SERIALIZED_NAME_PUBLICATION_ID = "publicationId"; + @SerializedName(SERIALIZED_NAME_PUBLICATION_ID) + private String publicationId; + public static final String SERIALIZED_NAME_IS_HTML = "isHtml"; + @SerializedName(SERIALIZED_NAME_IS_HTML) + private Boolean isHtml; + public MediumRuleActionDto() { + } + public MediumRuleActionDto accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } + + /** + * The self issued access token. + * @return accessToken + */ + @javax.annotation.Nonnull + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + public MediumRuleActionDto title(String title) { + this.title = title; + return this; + } + + /** + * The title, used for the url. + * @return title + */ + @javax.annotation.Nonnull + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + public MediumRuleActionDto content(String content) { + this.content = content; + return this; + } + + /** + * The content, either html or markdown. + * @return content + */ + @javax.annotation.Nonnull + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + public MediumRuleActionDto canonicalUrl(String canonicalUrl) { + this.canonicalUrl = canonicalUrl; + return this; + } + + /** + * The original home of this content, if it was originally published elsewhere. + * @return canonicalUrl + */ + @javax.annotation.Nullable + public String getCanonicalUrl() { + return canonicalUrl; + } + + public void setCanonicalUrl(String canonicalUrl) { + this.canonicalUrl = canonicalUrl; + } + public MediumRuleActionDto tags(String tags) { + this.tags = tags; + return this; + } + + /** + * The optional comma separated list of tags. + * @return tags + */ + @javax.annotation.Nullable + public String getTags() { + return tags; + } + + public void setTags(String tags) { + this.tags = tags; + } + public MediumRuleActionDto publicationId(String publicationId) { + this.publicationId = publicationId; + return this; + } + + /** + * Optional publication id. + * @return publicationId + */ + @javax.annotation.Nullable + public String getPublicationId() { + return publicationId; + } + + public void setPublicationId(String publicationId) { + this.publicationId = publicationId; + } + public MediumRuleActionDto isHtml(Boolean isHtml) { + this.isHtml = isHtml; + return this; + } + + /** + * Indicates whether the content is markdown or html. + * @return isHtml + */ + @javax.annotation.Nonnull + public Boolean getIsHtml() { + return isHtml; + } + + public void setIsHtml(Boolean isHtml) { + this.isHtml = isHtml; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ContentStage { - IsHtmlStage content(String content); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface IsHtmlStage { - _FinalStage isHtml(boolean isHtml); + MediumRuleActionDto mediumRuleActionDto = (MediumRuleActionDto) o; + return Objects.equals(this.accessToken, mediumRuleActionDto.accessToken) && + Objects.equals(this.title, mediumRuleActionDto.title) && + Objects.equals(this.content, mediumRuleActionDto.content) && + Objects.equals(this.canonicalUrl, mediumRuleActionDto.canonicalUrl) && + Objects.equals(this.tags, mediumRuleActionDto.tags) && + Objects.equals(this.publicationId, mediumRuleActionDto.publicationId) && + Objects.equals(this.isHtml, mediumRuleActionDto.isHtml) && + super.equals(o); + } + + 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(accessToken, title, content, canonicalUrl, tags, publicationId, isHtml, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - MediumRuleActionDto build(); - - _FinalStage canonicalUrl(Optional canonicalUrl); - - _FinalStage canonicalUrl(String canonicalUrl); - - _FinalStage tags(Optional tags); - - _FinalStage tags(String tags); - - _FinalStage publicationId(Optional publicationId); - - _FinalStage publicationId(String publicationId); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MediumRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" content: ").append(toIndentedString(content)).append("\n"); + sb.append(" canonicalUrl: ").append(toIndentedString(canonicalUrl)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); + sb.append(" publicationId: ").append(toIndentedString(publicationId)).append("\n"); + sb.append(" isHtml: ").append(toIndentedString(isHtml)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AccessTokenStage, TitleStage, ContentStage, IsHtmlStage, _FinalStage { - private String accessToken; - - private String title; - - private String content; - - private boolean isHtml; - - private Optional publicationId = Optional.empty(); - - private Optional tags = Optional.empty(); - - private Optional canonicalUrl = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(MediumRuleActionDto other) { - accessToken(other.getAccessToken()); - title(other.getTitle()); - content(other.getContent()); - canonicalUrl(other.getCanonicalUrl()); - tags(other.getTags()); - publicationId(other.getPublicationId()); - isHtml(other.getIsHtml()); - return this; - } - - /** - *

The self issued access token.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("accessToken") - public TitleStage accessToken(String accessToken) { - this.accessToken = accessToken; - return this; - } - - /** - *

The title, used for the url.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("title") - public ContentStage title(String title) { - this.title = title; - return this; - } - - /** - *

The content, either html or markdown.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("content") - public IsHtmlStage content(String content) { - this.content = content; - return this; - } - - /** - *

Indicates whether the content is markdown or html.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isHtml") - public _FinalStage isHtml(boolean isHtml) { - this.isHtml = isHtml; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("accessToken"); + openapiFields.add("title"); + openapiFields.add("content"); + openapiFields.add("canonicalUrl"); + openapiFields.add("tags"); + openapiFields.add("publicationId"); + openapiFields.add("isHtml"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("accessToken"); + openapiRequiredFields.add("title"); + openapiRequiredFields.add("content"); + openapiRequiredFields.add("isHtml"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to MediumRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MediumRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MediumRuleActionDto is not found in the empty JSON string", MediumRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

Optional publication id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage publicationId(String publicationId) { - this.publicationId = Optional.of(publicationId); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MediumRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MediumRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - @JsonSetter(value = "publicationId", nulls = Nulls.SKIP) - public _FinalStage publicationId(Optional publicationId) { - this.publicationId = publicationId; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : MediumRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - /** - *

The optional comma separated list of tags.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage tags(String tags) { - this.tags = Optional.of(tags); - return this; - } - - @Override - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public _FinalStage tags(Optional tags) { - this.tags = tags; - return this; - } - - /** - *

The original home of this content, if it was originally published elsewhere.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage canonicalUrl(String canonicalUrl) { - this.canonicalUrl = Optional.of(canonicalUrl); - return this; - } - - @Override - @JsonSetter(value = "canonicalUrl", nulls = Nulls.SKIP) - public _FinalStage canonicalUrl(Optional canonicalUrl) { - this.canonicalUrl = canonicalUrl; - return this; - } - - @Override - public MediumRuleActionDto build() { - return new MediumRuleActionDto(accessToken, title, content, canonicalUrl, tags, publicationId, isHtml); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MediumRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MediumRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MediumRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MediumRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MediumRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of MediumRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of MediumRuleActionDto + * @throws IOException if the JSON string is invalid with respect to MediumRuleActionDto + */ + public static MediumRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MediumRuleActionDto.class); + } + + /** + * Convert an instance of MediumRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/MoveAssetDto.java b/src/main/java/com/squidex/api/types/MoveAssetDto.java new file mode 100644 index 0000000..b3a60d6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/MoveAssetDto.java @@ -0,0 +1,201 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * MoveAssetDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class MoveAssetDto { + public static final String SERIALIZED_NAME_PARENT_ID = "parentId"; + @SerializedName(SERIALIZED_NAME_PARENT_ID) + private String parentId; + public MoveAssetDto() { + } + public MoveAssetDto parentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * The parent folder id. + * @return parentId + */ + @javax.annotation.Nullable + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MoveAssetDto moveAssetDto = (MoveAssetDto) o; + return Objects.equals(this.parentId, moveAssetDto.parentId); + } + + @Override + public int hashCode() { + return Objects.hash(parentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MoveAssetDto {\n"); + sb.append(" parentId: ").append(toIndentedString(parentId)).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("parentId"); + + // 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 MoveAssetDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MoveAssetDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MoveAssetDto is not found in the empty JSON string", MoveAssetDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MoveAssetDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MoveAssetDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("parentId") != null && !jsonObj.get("parentId").isJsonNull()) && !jsonObj.get("parentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MoveAssetDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MoveAssetDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MoveAssetDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MoveAssetDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MoveAssetDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MoveAssetDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of MoveAssetDto + * @throws IOException if the JSON string is invalid with respect to MoveAssetDto + */ + public static MoveAssetDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MoveAssetDto.class); + } + + /** + * Convert an instance of MoveAssetDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/MoveAssetFolderDto.java b/src/main/java/com/squidex/api/types/MoveAssetFolderDto.java new file mode 100644 index 0000000..dd605a5 --- /dev/null +++ b/src/main/java/com/squidex/api/types/MoveAssetFolderDto.java @@ -0,0 +1,201 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * MoveAssetFolderDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class MoveAssetFolderDto { + public static final String SERIALIZED_NAME_PARENT_ID = "parentId"; + @SerializedName(SERIALIZED_NAME_PARENT_ID) + private String parentId; + public MoveAssetFolderDto() { + } + public MoveAssetFolderDto parentId(String parentId) { + this.parentId = parentId; + return this; + } + + /** + * The parent folder id. + * @return parentId + */ + @javax.annotation.Nullable + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MoveAssetFolderDto moveAssetFolderDto = (MoveAssetFolderDto) o; + return Objects.equals(this.parentId, moveAssetFolderDto.parentId); + } + + @Override + public int hashCode() { + return Objects.hash(parentId); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MoveAssetFolderDto {\n"); + sb.append(" parentId: ").append(toIndentedString(parentId)).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("parentId"); + + // 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 MoveAssetFolderDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!MoveAssetFolderDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in MoveAssetFolderDto is not found in the empty JSON string", MoveAssetFolderDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!MoveAssetFolderDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `MoveAssetFolderDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("parentId") != null && !jsonObj.get("parentId").isJsonNull()) && !jsonObj.get("parentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!MoveAssetFolderDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'MoveAssetFolderDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(MoveAssetFolderDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, MoveAssetFolderDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public MoveAssetFolderDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of MoveAssetFolderDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of MoveAssetFolderDto + * @throws IOException if the JSON string is invalid with respect to MoveAssetFolderDto + */ + public static MoveAssetFolderDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, MoveAssetFolderDto.class); + } + + /** + * Convert an instance of MoveAssetFolderDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/NestedFieldDto.java b/src/main/java/com/squidex/api/types/NestedFieldDto.java index 26571c3..b1f8faa 100644 --- a/src/main/java/com/squidex/api/types/NestedFieldDto.java +++ b/src/main/java/com/squidex/api/types/NestedFieldDto.java @@ -1,311 +1,367 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = NestedFieldDto.Builder.class) -public final class NestedFieldDto implements IResource { - private final Map links; - - private final int fieldId; - - private final String name; - - private final boolean isHidden; - - private final boolean isLocked; - - private final boolean isDisabled; - - private final FieldPropertiesDto properties; - - private NestedFieldDto( - Map links, - int fieldId, - String name, - boolean isHidden, - boolean isLocked, - boolean isDisabled, - FieldPropertiesDto properties) { - this.links = links; - this.fieldId = fieldId; - this.name = name; - this.isHidden = isHidden; - this.isLocked = isLocked; - this.isDisabled = isDisabled; - this.properties = properties; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the field. - */ - @JsonProperty("fieldId") - public int getFieldId() { - return fieldId; - } - - /** - * @return The name of the field. Must be unique within the schema. - */ - @JsonProperty("name") - public String getName() { - return name; - } - /** - * @return Defines if the field is hidden. - */ - @JsonProperty("isHidden") - public boolean getIsHidden() { - return isHidden; - } - - /** - * @return Defines if the field is locked. - */ - @JsonProperty("isLocked") - public boolean getIsLocked() { - return isLocked; - } - - /** - * @return Defines if the field is disabled. - */ - @JsonProperty("isDisabled") - public boolean getIsDisabled() { - return isDisabled; - } - - /** - * @return The field properties. - */ - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NestedFieldDto && equalTo((NestedFieldDto) other); - } - - private boolean equalTo(NestedFieldDto other) { - return links.equals(other.links) - && fieldId == other.fieldId - && name.equals(other.name) - && isHidden == other.isHidden - && isLocked == other.isLocked - && isDisabled == other.isDisabled - && properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, this.fieldId, this.name, this.isHidden, this.isLocked, this.isDisabled, this.properties); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static FieldIdStage builder() { - return new Builder(); - } - public interface FieldIdStage { - NameStage fieldId(int fieldId); +package com.squidex.api.types; - Builder from(NestedFieldDto other); - } +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.squidex.api.types.FieldPropertiesDto; +import com.squidex.api.types.ResourceLink; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; - public interface NameStage { - IsHiddenStage name(String name); - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - public interface IsHiddenStage { - IsLockedStage isHidden(boolean isHidden); - } +import com.squidex.api.core.JSON; - public interface IsLockedStage { - IsDisabledStage isLocked(boolean isLocked); +/** + * NestedFieldDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class NestedFieldDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_FIELD_ID = "fieldId"; + @SerializedName(SERIALIZED_NAME_FIELD_ID) + private Long fieldId; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_IS_HIDDEN = "isHidden"; + @SerializedName(SERIALIZED_NAME_IS_HIDDEN) + private Boolean isHidden; + public static final String SERIALIZED_NAME_IS_LOCKED = "isLocked"; + @SerializedName(SERIALIZED_NAME_IS_LOCKED) + private Boolean isLocked; + public static final String SERIALIZED_NAME_IS_DISABLED = "isDisabled"; + @SerializedName(SERIALIZED_NAME_IS_DISABLED) + private Boolean isDisabled; + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private FieldPropertiesDto properties; + public NestedFieldDto() { + } + public NestedFieldDto links(Map links) { + this.links = links; + return this; + } + + public NestedFieldDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface IsDisabledStage { - PropertiesStage isDisabled(boolean isDisabled); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public NestedFieldDto fieldId(Long fieldId) { + this.fieldId = fieldId; + return this; + } + + /** + * The ID of the field. + * @return fieldId + */ + @javax.annotation.Nonnull + public Long getFieldId() { + return fieldId; + } + + public void setFieldId(Long fieldId) { + this.fieldId = fieldId; + } + public NestedFieldDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the field. Must be unique within the schema. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public NestedFieldDto isHidden(Boolean isHidden) { + this.isHidden = isHidden; + return this; + } + + /** + * Defines if the field is hidden. + * @return isHidden + */ + @javax.annotation.Nonnull + public Boolean getIsHidden() { + return isHidden; + } + + public void setIsHidden(Boolean isHidden) { + this.isHidden = isHidden; + } + public NestedFieldDto isLocked(Boolean isLocked) { + this.isLocked = isLocked; + return this; + } + + /** + * Defines if the field is locked. + * @return isLocked + */ + @javax.annotation.Nonnull + public Boolean getIsLocked() { + return isLocked; + } + + public void setIsLocked(Boolean isLocked) { + this.isLocked = isLocked; + } + public NestedFieldDto isDisabled(Boolean isDisabled) { + this.isDisabled = isDisabled; + return this; + } + + /** + * Defines if the field is disabled. + * @return isDisabled + */ + @javax.annotation.Nonnull + public Boolean getIsDisabled() { + return isDisabled; + } + + public void setIsDisabled(Boolean isDisabled) { + this.isDisabled = isDisabled; + } + public NestedFieldDto properties(FieldPropertiesDto properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nonnull + public FieldPropertiesDto getProperties() { + return properties; + } + + public void setProperties(FieldPropertiesDto properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - NestedFieldDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); + NestedFieldDto nestedFieldDto = (NestedFieldDto) o; + return Objects.equals(this.links, nestedFieldDto.links) && + Objects.equals(this.fieldId, nestedFieldDto.fieldId) && + Objects.equals(this.name, nestedFieldDto.name) && + Objects.equals(this.isHidden, nestedFieldDto.isHidden) && + Objects.equals(this.isLocked, nestedFieldDto.isLocked) && + Objects.equals(this.isDisabled, nestedFieldDto.isDisabled) && + Objects.equals(this.properties, nestedFieldDto.properties); + } + + @Override + public int hashCode() { + return Objects.hash(links, fieldId, name, isHidden, isLocked, isDisabled, properties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NestedFieldDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" fieldId: ").append(toIndentedString(fieldId)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" isHidden: ").append(toIndentedString(isHidden)).append("\n"); + sb.append(" isLocked: ").append(toIndentedString(isLocked)).append("\n"); + sb.append(" isDisabled: ").append(toIndentedString(isDisabled)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements FieldIdStage, - NameStage, - IsHiddenStage, - IsLockedStage, - IsDisabledStage, - PropertiesStage, - _FinalStage { - private int fieldId; - - private String name; - - private boolean isHidden; - - private boolean isLocked; - - private boolean isDisabled; - - private FieldPropertiesDto properties; - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(NestedFieldDto other) { - links(other.getLinks()); - fieldId(other.getFieldId()); - name(other.getName()); - isHidden(other.getIsHidden()); - isLocked(other.getIsLocked()); - isDisabled(other.getIsDisabled()); - properties(other.getProperties()); - return this; - } - - /** - *

The ID of the field.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("fieldId") - public NameStage fieldId(int fieldId) { - this.fieldId = fieldId; - return this; - } - - /** - *

The name of the field. Must be unique within the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public IsHiddenStage name(String name) { - this.name = name; - return this; - } - - /** - *

Defines if the field is hidden.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isHidden") - public IsLockedStage isHidden(boolean isHidden) { - this.isHidden = isHidden; - return this; - } - - /** - *

Defines if the field is locked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isLocked") - public IsDisabledStage isLocked(boolean isLocked) { - this.isLocked = isLocked; - return this; - } - - /** - *

Defines if the field is disabled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isDisabled") - public PropertiesStage isDisabled(boolean isDisabled) { - this.isDisabled = isDisabled; - return this; - } - - /** - *

The field properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("fieldId"); + openapiFields.add("name"); + openapiFields.add("isHidden"); + openapiFields.add("isLocked"); + openapiFields.add("isDisabled"); + openapiFields.add("properties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("fieldId"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("isHidden"); + openapiRequiredFields.add("isLocked"); + openapiRequiredFields.add("isDisabled"); + openapiRequiredFields.add("properties"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NestedFieldDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NestedFieldDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NestedFieldDto is not found in the empty JSON string", NestedFieldDto.openapiRequiredFields.toString())); } + } - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NestedFieldDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NestedFieldDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public NestedFieldDto build() { - return new NestedFieldDto(links, fieldId, name, isHidden, isLocked, isDisabled, properties); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NestedFieldDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + // validate the required field `properties` + FieldPropertiesDto.validateJsonElement(jsonObj.get("properties")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NestedFieldDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NestedFieldDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NestedFieldDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NestedFieldDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NestedFieldDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of NestedFieldDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of NestedFieldDto + * @throws IOException if the JSON string is invalid with respect to NestedFieldDto + */ + public static NestedFieldDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NestedFieldDto.class); + } + + /** + * Convert an instance of NestedFieldDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/NotificationRuleActionDto.java b/src/main/java/com/squidex/api/types/NotificationRuleActionDto.java index e6b6b7d..83dec7f 100644 --- a/src/main/java/com/squidex/api/types/NotificationRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/NotificationRuleActionDto.java @@ -1,197 +1,292 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = NotificationRuleActionDto.Builder.class) -public final class NotificationRuleActionDto { - private final String user; - - private final String text; - - private final Optional url; - private final Optional client; - private NotificationRuleActionDto(String user, String text, Optional url, Optional client) { - this.user = user; - this.text = text; - this.url = url; - this.client = client; - } - - /** - * @return The user id or email. - */ - @JsonProperty("user") - public String getUser() { - return user; - } - - /** - * @return The text to send. - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return The optional url to attach to the notification. - */ - @JsonProperty("url") - public Optional getUrl() { - return url; - } - - /** - * @return An optional client name. - */ - @JsonProperty("client") - public Optional getClient() { - return client; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NotificationRuleActionDto && equalTo((NotificationRuleActionDto) other); - } - - private boolean equalTo(NotificationRuleActionDto other) { - return user.equals(other.user) - && text.equals(other.text) - && url.equals(other.url) - && client.equals(other.client); - } - - @Override - public int hashCode() { - return Objects.hash(this.user, this.text, this.url, this.client); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.types.RuleActionDto; +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.squidex.api.core.JSON; - public static UserStage builder() { - return new Builder(); +/** + * NotificationRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class NotificationRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_USER = "user"; + @SerializedName(SERIALIZED_NAME_USER) + private String user; + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + public static final String SERIALIZED_NAME_CLIENT = "client"; + @SerializedName(SERIALIZED_NAME_CLIENT) + private String client; + public NotificationRuleActionDto() { + } + public NotificationRuleActionDto user(String user) { + this.user = user; + return this; + } + + /** + * The user id or email. + * @return user + */ + @javax.annotation.Nonnull + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + public NotificationRuleActionDto text(String text) { + this.text = text; + return this; + } + + /** + * The text to send. + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + public NotificationRuleActionDto url(String url) { + this.url = url; + return this; + } + + /** + * The optional url to attach to the notification. + * @return url + */ + @javax.annotation.Nullable + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + public NotificationRuleActionDto client(String client) { + this.client = client; + return this; + } + + /** + * An optional client name. + * @return client + */ + @javax.annotation.Nullable + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface UserStage { - TextStage user(String user); - - Builder from(NotificationRuleActionDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface TextStage { - _FinalStage text(String text); + NotificationRuleActionDto notificationRuleActionDto = (NotificationRuleActionDto) o; + return Objects.equals(this.user, notificationRuleActionDto.user) && + Objects.equals(this.text, notificationRuleActionDto.text) && + Objects.equals(this.url, notificationRuleActionDto.url) && + Objects.equals(this.client, notificationRuleActionDto.client) && + super.equals(o); + } + + 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(user, text, url, client, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - NotificationRuleActionDto build(); - - _FinalStage url(Optional url); - - _FinalStage url(String url); - - _FinalStage client(Optional client); - - _FinalStage client(String client); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NotificationRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" user: ").append(toIndentedString(user)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" client: ").append(toIndentedString(client)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UserStage, TextStage, _FinalStage { - private String user; - - private String text; - - private Optional client = Optional.empty(); - - private Optional url = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(NotificationRuleActionDto other) { - user(other.getUser()); - text(other.getText()); - url(other.getUrl()); - client(other.getClient()); - return this; - } - - /** - *

The user id or email.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("user") - public TextStage user(String user) { - this.user = user; - return this; - } - - /** - *

The text to send.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("user"); + openapiFields.add("text"); + openapiFields.add("url"); + openapiFields.add("client"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("user"); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NotificationRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NotificationRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NotificationRuleActionDto is not found in the empty JSON string", NotificationRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

An optional client name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage client(String client) { - this.client = Optional.of(client); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NotificationRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NotificationRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - @JsonSetter(value = "client", nulls = Nulls.SKIP) - public _FinalStage client(Optional client) { - this.client = client; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NotificationRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - /** - *

The optional url to attach to the notification.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage url(String url) { - this.url = Optional.of(url); - return this; - } - - @Override - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public _FinalStage url(Optional url) { - this.url = url; - return this; - } - - @Override - public NotificationRuleActionDto build() { - return new NotificationRuleActionDto(user, text, url, client); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NotificationRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NotificationRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NotificationRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NotificationRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NotificationRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of NotificationRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of NotificationRuleActionDto + * @throws IOException if the JSON string is invalid with respect to NotificationRuleActionDto + */ + public static NotificationRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NotificationRuleActionDto.class); + } + + /** + * Convert an instance of NotificationRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/NumberFieldEditor.java b/src/main/java/com/squidex/api/types/NumberFieldEditor.java index b67a91a..ad27488 100644 --- a/src/main/java/com/squidex/api/types/NumberFieldEditor.java +++ b/src/main/java/com/squidex/api/types/NumberFieldEditor.java @@ -1,28 +1,82 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(NumberFieldEditor.Adapter.class) public enum NumberFieldEditor { - INPUT("Input"), + + INPUT("Input"), + + RADIO("Radio"), + + DROPDOWN("Dropdown"), + + STARS("Stars"); - RADIO("Radio"), + private String value; - DROPDOWN("Dropdown"), + NumberFieldEditor(String value) { + this.value = value; + } - STARS("Stars"); + public String getValue() { + return value; + } - private final String value; + @Override + public String toString() { + return String.valueOf(value); + } - NumberFieldEditor(String value) { - this.value = value; + public static NumberFieldEditor fromValue(String value) { + for (NumberFieldEditor b : NumberFieldEditor.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - @JsonValue + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return this.value; + public void write(final JsonWriter jsonWriter, final NumberFieldEditor enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } + + @Override + public NumberFieldEditor read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return NumberFieldEditor.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + NumberFieldEditor.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java index d3241fb..a58cdcc 100644 --- a/src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java @@ -1,284 +1,411 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.FieldPropertiesDto; +import com.squidex.api.types.NumberFieldEditor; +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.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = NumberFieldPropertiesDto.Builder.class) -public final class NumberFieldPropertiesDto { - private final Optional>> defaultValues; - - private final Optional defaultValue; - - private final Optional maxValue; - - private final Optional minValue; - - private final Optional> allowedValues; - - private final Optional isUnique; - - private final Optional inlineEditable; - - private final Optional editor; - - private NumberFieldPropertiesDto( - Optional>> defaultValues, - Optional defaultValue, - Optional maxValue, - Optional minValue, - Optional> allowedValues, - Optional isUnique, - Optional inlineEditable, - Optional editor) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.maxValue = maxValue; - this.minValue = minValue; - this.allowedValues = allowedValues; - this.isUnique = isUnique; - this.inlineEditable = inlineEditable; - this.editor = editor; - } - - /** - * @return The language specific default value for the field value. - */ - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value for the field value. - */ - @JsonProperty("defaultValue") - public Optional getDefaultValue() { - return defaultValue; - } - - /** - * @return The maximum allowed value for the field value. - */ - @JsonProperty("maxValue") - public Optional getMaxValue() { - return maxValue; - } - - /** - * @return The minimum allowed value for the field value. - */ - @JsonProperty("minValue") - public Optional getMinValue() { - return minValue; - } - - /** - * @return The allowed values for the field value. - */ - @JsonProperty("allowedValues") - public Optional> getAllowedValues() { - return allowedValues; - } - - /** - * @return Indicates if the field value must be unique. Ignored for nested fields and localized fields. - */ - @JsonProperty("isUnique") - public Optional getIsUnique() { - return isUnique; - } +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; - /** - * @return Indicates that the inline editor is enabled for this field. - */ - @JsonProperty("inlineEditable") - public Optional getInlineEditable() { - return inlineEditable; - } +import com.squidex.api.core.JSON; - /** - * @return The editor that is used to manage this field. - */ - @JsonProperty("editor") - public Optional getEditor() { - return editor; +/** + * NumberFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class NumberFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_DEFAULT_VALUES = "defaultValues"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUES) + private Map defaultValues = new HashMap<>(); + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private Double defaultValue; + public static final String SERIALIZED_NAME_MAX_VALUE = "maxValue"; + @SerializedName(SERIALIZED_NAME_MAX_VALUE) + private Double maxValue; + public static final String SERIALIZED_NAME_MIN_VALUE = "minValue"; + @SerializedName(SERIALIZED_NAME_MIN_VALUE) + private Double minValue; + public static final String SERIALIZED_NAME_ALLOWED_VALUES = "allowedValues"; + @SerializedName(SERIALIZED_NAME_ALLOWED_VALUES) + private List allowedValues; + public static final String SERIALIZED_NAME_IS_UNIQUE = "isUnique"; + @SerializedName(SERIALIZED_NAME_IS_UNIQUE) + private Boolean isUnique; + public static final String SERIALIZED_NAME_INLINE_EDITABLE = "inlineEditable"; + @SerializedName(SERIALIZED_NAME_INLINE_EDITABLE) + private Boolean inlineEditable; + public static final String SERIALIZED_NAME_EDITOR = "editor"; + @SerializedName(SERIALIZED_NAME_EDITOR) + private NumberFieldEditor editor; + public NumberFieldPropertiesDto() { + } + public NumberFieldPropertiesDto defaultValues(Map defaultValues) { + this.defaultValues = defaultValues; + return this; + } + + public NumberFieldPropertiesDto putDefaultValuesItem(String key, Double defaultValuesItem) { + if (this.defaultValues == null) { + this.defaultValues = new HashMap<>(); } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NumberFieldPropertiesDto && equalTo((NumberFieldPropertiesDto) other); + this.defaultValues.put(key, defaultValuesItem); + return this; + } + + /** + * Get defaultValues + * @return defaultValues + */ + @javax.annotation.Nullable + public Map getDefaultValues() { + return defaultValues; + } + + public void setDefaultValues(Map defaultValues) { + this.defaultValues = defaultValues; + } + public NumberFieldPropertiesDto defaultValue(Double defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * The default value for the field value. + * @return defaultValue + */ + @javax.annotation.Nullable + public Double getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(Double defaultValue) { + this.defaultValue = defaultValue; + } + public NumberFieldPropertiesDto maxValue(Double maxValue) { + this.maxValue = maxValue; + return this; + } + + /** + * The maximum allowed value for the field value. + * @return maxValue + */ + @javax.annotation.Nullable + public Double getMaxValue() { + return maxValue; + } + + public void setMaxValue(Double maxValue) { + this.maxValue = maxValue; + } + public NumberFieldPropertiesDto minValue(Double minValue) { + this.minValue = minValue; + return this; + } + + /** + * The minimum allowed value for the field value. + * @return minValue + */ + @javax.annotation.Nullable + public Double getMinValue() { + return minValue; + } + + public void setMinValue(Double minValue) { + this.minValue = minValue; + } + public NumberFieldPropertiesDto allowedValues(List allowedValues) { + this.allowedValues = allowedValues; + return this; + } + + public NumberFieldPropertiesDto addAllowedValuesItem(Double allowedValuesItem) { + if (this.allowedValues == null) { + this.allowedValues = new ArrayList<>(); } - - private boolean equalTo(NumberFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && maxValue.equals(other.maxValue) - && minValue.equals(other.minValue) - && allowedValues.equals(other.allowedValues) - && isUnique.equals(other.isUnique) - && inlineEditable.equals(other.inlineEditable) - && editor.equals(other.editor); + this.allowedValues.add(allowedValuesItem); + return this; + } + + /** + * The allowed values for the field value. + * @return allowedValues + */ + @javax.annotation.Nullable + public List getAllowedValues() { + return allowedValues; + } + + public void setAllowedValues(List allowedValues) { + this.allowedValues = allowedValues; + } + public NumberFieldPropertiesDto isUnique(Boolean isUnique) { + this.isUnique = isUnique; + return this; + } + + /** + * Indicates if the field value must be unique. Ignored for nested fields and localized fields. + * @return isUnique + */ + @javax.annotation.Nullable + public Boolean getIsUnique() { + return isUnique; + } + + public void setIsUnique(Boolean isUnique) { + this.isUnique = isUnique; + } + public NumberFieldPropertiesDto inlineEditable(Boolean inlineEditable) { + this.inlineEditable = inlineEditable; + return this; + } + + /** + * Indicates that the inline editor is enabled for this field. + * @return inlineEditable + */ + @javax.annotation.Nullable + public Boolean getInlineEditable() { + return inlineEditable; + } + + public void setInlineEditable(Boolean inlineEditable) { + this.inlineEditable = inlineEditable; + } + public NumberFieldPropertiesDto editor(NumberFieldEditor editor) { + this.editor = editor; + return this; + } + + /** + * Get editor + * @return editor + */ + @javax.annotation.Nullable + public NumberFieldEditor getEditor() { + return editor; + } + + public void setEditor(NumberFieldEditor editor) { + this.editor = editor; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public int hashCode() { - return Objects.hash( - this.defaultValues, - this.defaultValue, - this.maxValue, - this.minValue, - this.allowedValues, - this.isUnique, - this.inlineEditable, - this.editor); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + NumberFieldPropertiesDto numberFieldPropertiesDto = (NumberFieldPropertiesDto) o; + return Objects.equals(this.defaultValues, numberFieldPropertiesDto.defaultValues) && + Objects.equals(this.defaultValue, numberFieldPropertiesDto.defaultValue) && + Objects.equals(this.maxValue, numberFieldPropertiesDto.maxValue) && + Objects.equals(this.minValue, numberFieldPropertiesDto.minValue) && + Objects.equals(this.allowedValues, numberFieldPropertiesDto.allowedValues) && + Objects.equals(this.isUnique, numberFieldPropertiesDto.isUnique) && + Objects.equals(this.inlineEditable, numberFieldPropertiesDto.inlineEditable) && + Objects.equals(this.editor, numberFieldPropertiesDto.editor) && + super.equals(o); + } + + 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(defaultValues, defaultValue, maxValue, minValue, allowedValues, isUnique, inlineEditable, editor, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static Builder builder() { - return new Builder(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" defaultValues: ").append(toIndentedString(defaultValues)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" maxValue: ").append(toIndentedString(maxValue)).append("\n"); + sb.append(" minValue: ").append(toIndentedString(minValue)).append("\n"); + sb.append(" allowedValues: ").append(toIndentedString(allowedValues)).append("\n"); + sb.append(" isUnique: ").append(toIndentedString(isUnique)).append("\n"); + sb.append(" inlineEditable: ").append(toIndentedString(inlineEditable)).append("\n"); + sb.append(" editor: ").append(toIndentedString(editor)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> defaultValues = Optional.empty(); - - private Optional defaultValue = Optional.empty(); - - private Optional maxValue = Optional.empty(); - - private Optional minValue = Optional.empty(); - - private Optional> allowedValues = Optional.empty(); - - private Optional isUnique = Optional.empty(); - - private Optional inlineEditable = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Builder() {} - - public Builder from(NumberFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - maxValue(other.getMaxValue()); - minValue(other.getMinValue()); - allowedValues(other.getAllowedValues()); - isUnique(other.getIsUnique()); - inlineEditable(other.getInlineEditable()); - editor(other.getEditor()); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(Double defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "maxValue", nulls = Nulls.SKIP) - public Builder maxValue(Optional maxValue) { - this.maxValue = maxValue; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("defaultValues"); + openapiFields.add("defaultValue"); + openapiFields.add("maxValue"); + openapiFields.add("minValue"); + openapiFields.add("allowedValues"); + openapiFields.add("isUnique"); + openapiFields.add("inlineEditable"); + openapiFields.add("editor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to NumberFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!NumberFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in NumberFieldPropertiesDto is not found in the empty JSON string", NumberFieldPropertiesDto.openapiRequiredFields.toString())); } + } - public Builder maxValue(Double maxValue) { - this.maxValue = Optional.of(maxValue); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!NumberFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `NumberFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @JsonSetter(value = "minValue", nulls = Nulls.SKIP) - public Builder minValue(Optional minValue) { - this.minValue = minValue; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : NumberFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.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 Builder minValue(Double minValue) { - this.minValue = Optional.of(minValue); - return this; - } - - @JsonSetter(value = "allowedValues", nulls = Nulls.SKIP) - public Builder allowedValues(Optional> allowedValues) { - this.allowedValues = allowedValues; - return this; - } - - public Builder allowedValues(List allowedValues) { - this.allowedValues = Optional.of(allowedValues); - return this; - } - - @JsonSetter(value = "isUnique", nulls = Nulls.SKIP) - public Builder isUnique(Optional isUnique) { - this.isUnique = isUnique; - return this; - } - - public Builder isUnique(Boolean isUnique) { - this.isUnique = Optional.of(isUnique); - return this; - } - - @JsonSetter(value = "inlineEditable", nulls = Nulls.SKIP) - public Builder inlineEditable(Optional inlineEditable) { - this.inlineEditable = inlineEditable; - return this; - } - - public Builder inlineEditable(Boolean inlineEditable) { - this.inlineEditable = Optional.of(inlineEditable); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(NumberFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - public NumberFieldPropertiesDto build() { - return new NumberFieldPropertiesDto( - defaultValues, defaultValue, maxValue, minValue, allowedValues, isUnique, inlineEditable, editor); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!NumberFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'NumberFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(NumberFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, NumberFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public NumberFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of NumberFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of NumberFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to NumberFieldPropertiesDto + */ + public static NumberFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, NumberFieldPropertiesDto.class); + } + + /** + * Convert an instance of NumberFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java b/src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java index 5eae756..bb81613 100644 --- a/src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java @@ -1,275 +1,339 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = OpenSearchRuleActionDto.Builder.class) -public final class OpenSearchRuleActionDto { - private final String host; - - private final String indexName; - - private final Optional username; - - private final Optional password; - - private final Optional document; - - private final Optional delete; - private OpenSearchRuleActionDto( - String host, - String indexName, - Optional username, - Optional password, - Optional document, - Optional delete) { - this.host = host; - this.indexName = indexName; - this.username = username; - this.password = password; - this.document = document; - this.delete = delete; - } - - /** - * @return The url to the instance or cluster. - */ - @JsonProperty("host") - public String getHost() { - return host; - } - - /** - * @return The name of the index. - */ - @JsonProperty("indexName") - public String getIndexName() { - return indexName; - } - - /** - * @return The optional username. - */ - @JsonProperty("username") - public Optional getUsername() { - return username; - } - - /** - * @return The optional password. - */ - @JsonProperty("password") - public Optional getPassword() { - return password; - } - /** - * @return The optional custom document. - */ - @JsonProperty("document") - public Optional getDocument() { - return document; - } - - /** - * @return The condition when to delete the document. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OpenSearchRuleActionDto && equalTo((OpenSearchRuleActionDto) other); - } - - private boolean equalTo(OpenSearchRuleActionDto other) { - return host.equals(other.host) - && indexName.equals(other.indexName) - && username.equals(other.username) - && password.equals(other.password) - && document.equals(other.document) - && delete.equals(other.delete); - } - - @Override - public int hashCode() { - return Objects.hash(this.host, this.indexName, this.username, this.password, this.document, this.delete); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.types.RuleActionDto; +import java.io.IOException; +import java.net.URI; +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.squidex.api.core.JSON; - public static HostStage builder() { - return new Builder(); +/** + * OpenSearchRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class OpenSearchRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_HOST = "host"; + @SerializedName(SERIALIZED_NAME_HOST) + private URI host; + public static final String SERIALIZED_NAME_INDEX_NAME = "indexName"; + @SerializedName(SERIALIZED_NAME_INDEX_NAME) + private String indexName; + public static final String SERIALIZED_NAME_USERNAME = "username"; + @SerializedName(SERIALIZED_NAME_USERNAME) + private String username; + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + private String password; + public static final String SERIALIZED_NAME_DOCUMENT = "document"; + @SerializedName(SERIALIZED_NAME_DOCUMENT) + private String document; + public static final String SERIALIZED_NAME_DELETE = "delete"; + @SerializedName(SERIALIZED_NAME_DELETE) + private String delete; + public OpenSearchRuleActionDto() { + } + public OpenSearchRuleActionDto host(URI host) { + this.host = host; + return this; + } + + /** + * The url to the instance or cluster. + * @return host + */ + @javax.annotation.Nonnull + public URI getHost() { + return host; + } + + public void setHost(URI host) { + this.host = host; + } + public OpenSearchRuleActionDto indexName(String indexName) { + this.indexName = indexName; + return this; + } + + /** + * The name of the index. + * @return indexName + */ + @javax.annotation.Nonnull + public String getIndexName() { + return indexName; + } + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + public OpenSearchRuleActionDto username(String username) { + this.username = username; + return this; + } + + /** + * The optional username. + * @return username + */ + @javax.annotation.Nullable + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + public OpenSearchRuleActionDto password(String password) { + this.password = password; + return this; + } + + /** + * The optional password. + * @return password + */ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + public OpenSearchRuleActionDto document(String document) { + this.document = document; + return this; + } + + /** + * The optional custom document. + * @return document + */ + @javax.annotation.Nullable + public String getDocument() { + return document; + } + + public void setDocument(String document) { + this.document = document; + } + public OpenSearchRuleActionDto delete(String delete) { + this.delete = delete; + return this; + } + + /** + * The condition when to delete the document. + * @return delete + */ + @javax.annotation.Nullable + public String getDelete() { + return delete; + } + + public void setDelete(String delete) { + this.delete = delete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface HostStage { - IndexNameStage host(String host); - - Builder from(OpenSearchRuleActionDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface IndexNameStage { - _FinalStage indexName(String indexName); + OpenSearchRuleActionDto openSearchRuleActionDto = (OpenSearchRuleActionDto) o; + return Objects.equals(this.host, openSearchRuleActionDto.host) && + Objects.equals(this.indexName, openSearchRuleActionDto.indexName) && + Objects.equals(this.username, openSearchRuleActionDto.username) && + Objects.equals(this.password, openSearchRuleActionDto.password) && + Objects.equals(this.document, openSearchRuleActionDto.document) && + Objects.equals(this.delete, openSearchRuleActionDto.delete) && + super.equals(o); + } + + 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(host, indexName, username, password, document, delete, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - OpenSearchRuleActionDto build(); - - _FinalStage username(Optional username); - - _FinalStage username(String username); - - _FinalStage password(Optional password); - - _FinalStage password(String password); - - _FinalStage document(Optional document); - - _FinalStage document(String document); - - _FinalStage delete(Optional delete); - - _FinalStage delete(String delete); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OpenSearchRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" host: ").append(toIndentedString(host)).append("\n"); + sb.append(" indexName: ").append(toIndentedString(indexName)).append("\n"); + sb.append(" username: ").append(toIndentedString(username)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" document: ").append(toIndentedString(document)).append("\n"); + sb.append(" delete: ").append(toIndentedString(delete)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements HostStage, IndexNameStage, _FinalStage { - private String host; - - private String indexName; - - private Optional delete = Optional.empty(); - - private Optional document = Optional.empty(); - - private Optional password = Optional.empty(); - - private Optional username = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(OpenSearchRuleActionDto other) { - host(other.getHost()); - indexName(other.getIndexName()); - username(other.getUsername()); - password(other.getPassword()); - document(other.getDocument()); - delete(other.getDelete()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("host"); + openapiFields.add("indexName"); + openapiFields.add("username"); + openapiFields.add("password"); + openapiFields.add("document"); + openapiFields.add("delete"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("host"); + openapiRequiredFields.add("indexName"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to OpenSearchRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!OpenSearchRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in OpenSearchRuleActionDto is not found in the empty JSON string", OpenSearchRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The url to the instance or cluster.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("host") - public IndexNameStage host(String host) { - this.host = host; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!OpenSearchRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `OpenSearchRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The name of the index.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("indexName") - public _FinalStage indexName(String indexName) { - this.indexName = indexName; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : OpenSearchRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - /** - *

The condition when to delete the document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - @Override - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public _FinalStage delete(Optional delete) { - this.delete = delete; - return this; - } - - /** - *

The optional custom document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage document(String document) { - this.document = Optional.of(document); - return this; - } - - @Override - @JsonSetter(value = "document", nulls = Nulls.SKIP) - public _FinalStage document(Optional document) { - this.document = document; - return this; - } - - /** - *

The optional password.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage password(String password) { - this.password = Optional.of(password); - return this; - } - - @Override - @JsonSetter(value = "password", nulls = Nulls.SKIP) - public _FinalStage password(Optional password) { - this.password = password; - return this; - } - - /** - *

The optional username.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage username(String username) { - this.username = Optional.of(username); - return this; - } - - @Override - @JsonSetter(value = "username", nulls = Nulls.SKIP) - public _FinalStage username(Optional username) { - this.username = username; - return this; - } - - @Override - public OpenSearchRuleActionDto build() { - return new OpenSearchRuleActionDto(host, indexName, username, password, document, delete); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!OpenSearchRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'OpenSearchRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(OpenSearchRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, OpenSearchRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public OpenSearchRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of OpenSearchRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of OpenSearchRuleActionDto + * @throws IOException if the JSON string is invalid with respect to OpenSearchRuleActionDto + */ + public static OpenSearchRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, OpenSearchRuleActionDto.class); + } + + /** + * Convert an instance of OpenSearchRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/PatternDto.java b/src/main/java/com/squidex/api/types/PatternDto.java index 6d165c6..2960bc6 100644 --- a/src/main/java/com/squidex/api/types/PatternDto.java +++ b/src/main/java/com/squidex/api/types/PatternDto.java @@ -1,159 +1,274 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = PatternDto.Builder.class) -public final class PatternDto { - private final String name; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final String regex; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final Optional message; +import com.squidex.api.core.JSON; - private PatternDto(String name, String regex, Optional message) { - this.name = name; - this.regex = regex; - this.message = message; - } +/** + * PatternDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class PatternDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_REGEX = "regex"; + @SerializedName(SERIALIZED_NAME_REGEX) + private String regex; + public static final String SERIALIZED_NAME_MESSAGE = "message"; + @SerializedName(SERIALIZED_NAME_MESSAGE) + private String message; + public PatternDto() { + } + public PatternDto name(String name) { + this.name = name; + return this; + } - /** - * @return The name of the suggestion. - */ - @JsonProperty("name") - public String getName() { - return name; - } + /** + * The name of the suggestion. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } - /** - * @return The regex pattern. - */ - @JsonProperty("regex") - public String getRegex() { - return regex; - } + public void setName(String name) { + this.name = name; + } + public PatternDto regex(String regex) { + this.regex = regex; + return this; + } - /** - * @return The regex message. - */ - @JsonProperty("message") - public Optional getMessage() { - return message; - } + /** + * The regex pattern. + * @return regex + */ + @javax.annotation.Nonnull + public String getRegex() { + return regex; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PatternDto && equalTo((PatternDto) other); - } + public void setRegex(String regex) { + this.regex = regex; + } + public PatternDto message(String message) { + this.message = message; + return this; + } - private boolean equalTo(PatternDto other) { - return name.equals(other.name) && regex.equals(other.regex) && message.equals(other.message); - } + /** + * The regex message. + * @return message + */ + @javax.annotation.Nullable + public String getMessage() { + return message; + } - @Override - public int hashCode() { - return Objects.hash(this.name, this.regex, this.message); - } + public void setMessage(String message) { + this.message = message; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static NameStage builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + PatternDto patternDto = (PatternDto) o; + return Objects.equals(this.name, patternDto.name) && + Objects.equals(this.regex, patternDto.regex) && + Objects.equals(this.message, patternDto.message); + } - public interface NameStage { - RegexStage name(String name); + 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())); + } - Builder from(PatternDto other); - } + @Override + public int hashCode() { + return Objects.hash(name, regex, message); + } - public interface RegexStage { - _FinalStage regex(String regex); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - public interface _FinalStage { - PatternDto build(); - - _FinalStage message(Optional message); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PatternDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" regex: ").append(toIndentedString(regex)).append("\n"); + sb.append(" message: ").append(toIndentedString(message)).append("\n"); + sb.append("}"); + return sb.toString(); + } - _FinalStage message(String message); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, RegexStage, _FinalStage { - private String name; - private String regex; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Optional message = Optional.empty(); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("name"); + openapiFields.add("regex"); + openapiFields.add("message"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("regex"); + } - @Override - public Builder from(PatternDto other) { - name(other.getName()); - regex(other.getRegex()); - message(other.getMessage()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PatternDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PatternDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PatternDto is not found in the empty JSON string", PatternDto.openapiRequiredFields.toString())); } + } - /** - *

The name of the suggestion.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public RegexStage name(String name) { - this.name = name; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PatternDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PatternDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The regex pattern.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("regex") - public _FinalStage regex(String regex) { - this.regex = regex; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PatternDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("regex").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `regex` to be a primitive type in the JSON string but got `%s`", jsonObj.get("regex").toString())); + } + if ((jsonObj.get("message") != null && !jsonObj.get("message").isJsonNull()) && !jsonObj.get("message").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `message` to be a primitive type in the JSON string but got `%s`", jsonObj.get("message").toString())); + } + } - /** - *

The regex message.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage message(String message) { - this.message = Optional.of(message); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PatternDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PatternDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PatternDto.class)); - @Override - @JsonSetter(value = "message", nulls = Nulls.SKIP) - public _FinalStage message(Optional message) { - this.message = message; - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PatternDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public PatternDto build() { - return new PatternDto(name, regex, message); - } + @Override + public PatternDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of PatternDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PatternDto + * @throws IOException if the JSON string is invalid with respect to PatternDto + */ + public static PatternDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PatternDto.class); + } + + /** + * Convert an instance of PatternDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/PlanChangedDto.java b/src/main/java/com/squidex/api/types/PlanChangedDto.java index f6572db..08b9cba 100644 --- a/src/main/java/com/squidex/api/types/PlanChangedDto.java +++ b/src/main/java/com/squidex/api/types/PlanChangedDto.java @@ -1,83 +1,213 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = PlanChangedDto.Builder.class) -public final class PlanChangedDto { - private final Optional redirectUri; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private PlanChangedDto(Optional redirectUri) { - this.redirectUri = redirectUri; - } +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return Optional redirect uri. - */ - @JsonProperty("redirectUri") - public Optional getRedirectUri() { - return redirectUri; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PlanChangedDto && equalTo((PlanChangedDto) other); - } +/** + * PlanChangedDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class PlanChangedDto { + public static final String SERIALIZED_NAME_REDIRECT_URI = "redirectUri"; + @SerializedName(SERIALIZED_NAME_REDIRECT_URI) + private String redirectUri; + public PlanChangedDto() { + } + public PlanChangedDto redirectUri(String redirectUri) { + this.redirectUri = redirectUri; + return this; + } - private boolean equalTo(PlanChangedDto other) { - return redirectUri.equals(other.redirectUri); - } + /** + * Optional redirect uri. + * @return redirectUri + */ + @javax.annotation.Nullable + public String getRedirectUri() { + return redirectUri; + } - @Override - public int hashCode() { - return Objects.hash(this.redirectUri); + public void setRedirectUri(String redirectUri) { + this.redirectUri = redirectUri; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + PlanChangedDto planChangedDto = (PlanChangedDto) o; + return Objects.equals(this.redirectUri, planChangedDto.redirectUri); + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + 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(redirectUri); + } + + 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 PlanChangedDto {\n"); + sb.append(" redirectUri: ").append(toIndentedString(redirectUri)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public static Builder builder() { - return new Builder(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional redirectUri = Optional.empty(); - private Builder() {} + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder from(PlanChangedDto other) { - redirectUri(other.getRedirectUri()); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("redirectUri"); - @JsonSetter(value = "redirectUri", nulls = Nulls.SKIP) - public Builder redirectUri(Optional redirectUri) { - this.redirectUri = redirectUri; - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - public Builder redirectUri(String redirectUri) { - this.redirectUri = Optional.of(redirectUri); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PlanChangedDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PlanChangedDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PlanChangedDto is not found in the empty JSON string", PlanChangedDto.openapiRequiredFields.toString())); } + } - public PlanChangedDto build() { - return new PlanChangedDto(redirectUri); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PlanChangedDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PlanChangedDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("redirectUri") != null && !jsonObj.get("redirectUri").isJsonNull()) && !jsonObj.get("redirectUri").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `redirectUri` to be a primitive type in the JSON string but got `%s`", jsonObj.get("redirectUri").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PlanChangedDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PlanChangedDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PlanChangedDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PlanChangedDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PlanChangedDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of PlanChangedDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PlanChangedDto + * @throws IOException if the JSON string is invalid with respect to PlanChangedDto + */ + public static PlanChangedDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PlanChangedDto.class); + } + + /** + * Convert an instance of PlanChangedDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/PlanDto.java b/src/main/java/com/squidex/api/types/PlanDto.java index 3388dd4..52cb7d0 100644 --- a/src/main/java/com/squidex/api/types/PlanDto.java +++ b/src/main/java/com/squidex/api/types/PlanDto.java @@ -1,460 +1,475 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = PlanDto.Builder.class) -public final class PlanDto { - private final String id; - - private final String name; - - private final String costs; - - private final Optional confirmText; - - private final Optional yearlyConfirmText; - - private final Optional yearlyCosts; - - private final Optional yearlyId; - - private final int maxApiBytes; - - private final int maxApiCalls; - - private final int maxAssetSize; - - private final int maxContributors; - - private PlanDto( - String id, - String name, - String costs, - Optional confirmText, - Optional yearlyConfirmText, - Optional yearlyCosts, - Optional yearlyId, - int maxApiBytes, - int maxApiCalls, - int maxAssetSize, - int maxContributors) { - this.id = id; - this.name = name; - this.costs = costs; - this.confirmText = confirmText; - this.yearlyConfirmText = yearlyConfirmText; - this.yearlyCosts = yearlyCosts; - this.yearlyId = yearlyId; - this.maxApiBytes = maxApiBytes; - this.maxApiCalls = maxApiCalls; - this.maxAssetSize = maxAssetSize; - this.maxContributors = maxContributors; - } - - /** - * @return The ID of the plan. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The name of the plan. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The monthly costs of the plan. - */ - @JsonProperty("costs") - public String getCosts() { - return costs; - } - - /** - * @return An optional confirm text for the monthly subscription. - */ - @JsonProperty("confirmText") - public Optional getConfirmText() { - return confirmText; - } - - /** - * @return An optional confirm text for the yearly subscription. - */ - @JsonProperty("yearlyConfirmText") - public Optional getYearlyConfirmText() { - return yearlyConfirmText; - } - - /** - * @return The yearly costs of the plan. - */ - @JsonProperty("yearlyCosts") - public Optional getYearlyCosts() { - return yearlyCosts; - } - /** - * @return The yearly ID of the plan. - */ - @JsonProperty("yearlyId") - public Optional getYearlyId() { - return yearlyId; - } - - /** - * @return The maximum number of API traffic. - */ - @JsonProperty("maxApiBytes") - public int getMaxApiBytes() { - return maxApiBytes; - } - - /** - * @return The maximum number of API calls. - */ - @JsonProperty("maxApiCalls") - public int getMaxApiCalls() { - return maxApiCalls; - } - - /** - * @return The maximum allowed asset size. - */ - @JsonProperty("maxAssetSize") - public int getMaxAssetSize() { - return maxAssetSize; - } - /** - * @return The maximum number of contributors. - */ - @JsonProperty("maxContributors") - public int getMaxContributors() { - return maxContributors; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PlanDto && equalTo((PlanDto) other); - } - - private boolean equalTo(PlanDto other) { - return id.equals(other.id) - && name.equals(other.name) - && costs.equals(other.costs) - && confirmText.equals(other.confirmText) - && yearlyConfirmText.equals(other.yearlyConfirmText) - && yearlyCosts.equals(other.yearlyCosts) - && yearlyId.equals(other.yearlyId) - && maxApiBytes == other.maxApiBytes - && maxApiCalls == other.maxApiCalls - && maxAssetSize == other.maxAssetSize - && maxContributors == other.maxContributors; - } - - @Override - public int hashCode() { - return Objects.hash( - this.id, - this.name, - this.costs, - this.confirmText, - this.yearlyConfirmText, - this.yearlyCosts, - this.yearlyId, - this.maxApiBytes, - this.maxApiCalls, - this.maxAssetSize, - this.maxContributors); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - NameStage id(String id); - - Builder from(PlanDto other); - } - - public interface NameStage { - CostsStage name(String name); - } - - public interface CostsStage { - MaxApiBytesStage costs(String costs); - } +package com.squidex.api.types; - public interface MaxApiBytesStage { - MaxApiCallsStage maxApiBytes(int maxApiBytes); - } +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.squidex.api.core.JSON; - public interface MaxApiCallsStage { - MaxAssetSizeStage maxApiCalls(int maxApiCalls); +/** + * PlanDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class PlanDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_COSTS = "costs"; + @SerializedName(SERIALIZED_NAME_COSTS) + private String costs; + public static final String SERIALIZED_NAME_CONFIRM_TEXT = "confirmText"; + @SerializedName(SERIALIZED_NAME_CONFIRM_TEXT) + private String confirmText; + public static final String SERIALIZED_NAME_YEARLY_CONFIRM_TEXT = "yearlyConfirmText"; + @SerializedName(SERIALIZED_NAME_YEARLY_CONFIRM_TEXT) + private String yearlyConfirmText; + public static final String SERIALIZED_NAME_YEARLY_COSTS = "yearlyCosts"; + @SerializedName(SERIALIZED_NAME_YEARLY_COSTS) + private String yearlyCosts; + public static final String SERIALIZED_NAME_YEARLY_ID = "yearlyId"; + @SerializedName(SERIALIZED_NAME_YEARLY_ID) + private String yearlyId; + public static final String SERIALIZED_NAME_MAX_API_BYTES = "maxApiBytes"; + @SerializedName(SERIALIZED_NAME_MAX_API_BYTES) + private Long maxApiBytes; + public static final String SERIALIZED_NAME_MAX_API_CALLS = "maxApiCalls"; + @SerializedName(SERIALIZED_NAME_MAX_API_CALLS) + private Long maxApiCalls; + public static final String SERIALIZED_NAME_MAX_ASSET_SIZE = "maxAssetSize"; + @SerializedName(SERIALIZED_NAME_MAX_ASSET_SIZE) + private Long maxAssetSize; + public static final String SERIALIZED_NAME_MAX_CONTRIBUTORS = "maxContributors"; + @SerializedName(SERIALIZED_NAME_MAX_CONTRIBUTORS) + private Integer maxContributors; + public PlanDto() { + } + public PlanDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the plan. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public PlanDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the plan. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public PlanDto costs(String costs) { + this.costs = costs; + return this; + } + + /** + * The monthly costs of the plan. + * @return costs + */ + @javax.annotation.Nonnull + public String getCosts() { + return costs; + } + + public void setCosts(String costs) { + this.costs = costs; + } + public PlanDto confirmText(String confirmText) { + this.confirmText = confirmText; + return this; + } + + /** + * An optional confirm text for the monthly subscription. + * @return confirmText + */ + @javax.annotation.Nullable + public String getConfirmText() { + return confirmText; + } + + public void setConfirmText(String confirmText) { + this.confirmText = confirmText; + } + public PlanDto yearlyConfirmText(String yearlyConfirmText) { + this.yearlyConfirmText = yearlyConfirmText; + return this; + } + + /** + * An optional confirm text for the yearly subscription. + * @return yearlyConfirmText + */ + @javax.annotation.Nullable + public String getYearlyConfirmText() { + return yearlyConfirmText; + } + + public void setYearlyConfirmText(String yearlyConfirmText) { + this.yearlyConfirmText = yearlyConfirmText; + } + public PlanDto yearlyCosts(String yearlyCosts) { + this.yearlyCosts = yearlyCosts; + return this; + } + + /** + * The yearly costs of the plan. + * @return yearlyCosts + */ + @javax.annotation.Nullable + public String getYearlyCosts() { + return yearlyCosts; + } + + public void setYearlyCosts(String yearlyCosts) { + this.yearlyCosts = yearlyCosts; + } + public PlanDto yearlyId(String yearlyId) { + this.yearlyId = yearlyId; + return this; + } + + /** + * The yearly ID of the plan. + * @return yearlyId + */ + @javax.annotation.Nullable + public String getYearlyId() { + return yearlyId; + } + + public void setYearlyId(String yearlyId) { + this.yearlyId = yearlyId; + } + public PlanDto maxApiBytes(Long maxApiBytes) { + this.maxApiBytes = maxApiBytes; + return this; + } + + /** + * The maximum number of API traffic. + * @return maxApiBytes + */ + @javax.annotation.Nonnull + public Long getMaxApiBytes() { + return maxApiBytes; + } + + public void setMaxApiBytes(Long maxApiBytes) { + this.maxApiBytes = maxApiBytes; + } + public PlanDto maxApiCalls(Long maxApiCalls) { + this.maxApiCalls = maxApiCalls; + return this; + } + + /** + * The maximum number of API calls. + * @return maxApiCalls + */ + @javax.annotation.Nonnull + public Long getMaxApiCalls() { + return maxApiCalls; + } + + public void setMaxApiCalls(Long maxApiCalls) { + this.maxApiCalls = maxApiCalls; + } + public PlanDto maxAssetSize(Long maxAssetSize) { + this.maxAssetSize = maxAssetSize; + return this; + } + + /** + * The maximum allowed asset size. + * @return maxAssetSize + */ + @javax.annotation.Nonnull + public Long getMaxAssetSize() { + return maxAssetSize; + } + + public void setMaxAssetSize(Long maxAssetSize) { + this.maxAssetSize = maxAssetSize; + } + public PlanDto maxContributors(Integer maxContributors) { + this.maxContributors = maxContributors; + return this; + } + + /** + * The maximum number of contributors. + * @return maxContributors + */ + @javax.annotation.Nonnull + public Integer getMaxContributors() { + return maxContributors; + } + + public void setMaxContributors(Integer maxContributors) { + this.maxContributors = maxContributors; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface MaxAssetSizeStage { - MaxContributorsStage maxAssetSize(int maxAssetSize); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface MaxContributorsStage { - _FinalStage maxContributors(int maxContributors); + PlanDto planDto = (PlanDto) o; + return Objects.equals(this.id, planDto.id) && + Objects.equals(this.name, planDto.name) && + Objects.equals(this.costs, planDto.costs) && + Objects.equals(this.confirmText, planDto.confirmText) && + Objects.equals(this.yearlyConfirmText, planDto.yearlyConfirmText) && + Objects.equals(this.yearlyCosts, planDto.yearlyCosts) && + Objects.equals(this.yearlyId, planDto.yearlyId) && + Objects.equals(this.maxApiBytes, planDto.maxApiBytes) && + Objects.equals(this.maxApiCalls, planDto.maxApiCalls) && + Objects.equals(this.maxAssetSize, planDto.maxAssetSize) && + Objects.equals(this.maxContributors, planDto.maxContributors); + } + + 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(id, name, costs, confirmText, yearlyConfirmText, yearlyCosts, yearlyId, maxApiBytes, maxApiCalls, maxAssetSize, maxContributors); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - PlanDto build(); - - _FinalStage confirmText(Optional confirmText); - - _FinalStage confirmText(String confirmText); - - _FinalStage yearlyConfirmText(Optional yearlyConfirmText); - - _FinalStage yearlyConfirmText(String yearlyConfirmText); - - _FinalStage yearlyCosts(Optional yearlyCosts); - - _FinalStage yearlyCosts(String yearlyCosts); - - _FinalStage yearlyId(Optional yearlyId); - - _FinalStage yearlyId(String yearlyId); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PlanDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" costs: ").append(toIndentedString(costs)).append("\n"); + sb.append(" confirmText: ").append(toIndentedString(confirmText)).append("\n"); + sb.append(" yearlyConfirmText: ").append(toIndentedString(yearlyConfirmText)).append("\n"); + sb.append(" yearlyCosts: ").append(toIndentedString(yearlyCosts)).append("\n"); + sb.append(" yearlyId: ").append(toIndentedString(yearlyId)).append("\n"); + sb.append(" maxApiBytes: ").append(toIndentedString(maxApiBytes)).append("\n"); + sb.append(" maxApiCalls: ").append(toIndentedString(maxApiCalls)).append("\n"); + sb.append(" maxAssetSize: ").append(toIndentedString(maxAssetSize)).append("\n"); + sb.append(" maxContributors: ").append(toIndentedString(maxContributors)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - NameStage, - CostsStage, - MaxApiBytesStage, - MaxApiCallsStage, - MaxAssetSizeStage, - MaxContributorsStage, - _FinalStage { - private String id; - - private String name; - - private String costs; - - private int maxApiBytes; - - private int maxApiCalls; - - private int maxAssetSize; - - private int maxContributors; - - private Optional yearlyId = Optional.empty(); - - private Optional yearlyCosts = Optional.empty(); - - private Optional yearlyConfirmText = Optional.empty(); - - private Optional confirmText = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(PlanDto other) { - id(other.getId()); - name(other.getName()); - costs(other.getCosts()); - confirmText(other.getConfirmText()); - yearlyConfirmText(other.getYearlyConfirmText()); - yearlyCosts(other.getYearlyCosts()); - yearlyId(other.getYearlyId()); - maxApiBytes(other.getMaxApiBytes()); - maxApiCalls(other.getMaxApiCalls()); - maxAssetSize(other.getMaxAssetSize()); - maxContributors(other.getMaxContributors()); - return this; + return o.toString().replace("\n", "\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("name"); + openapiFields.add("costs"); + openapiFields.add("confirmText"); + openapiFields.add("yearlyConfirmText"); + openapiFields.add("yearlyCosts"); + openapiFields.add("yearlyId"); + openapiFields.add("maxApiBytes"); + openapiFields.add("maxApiCalls"); + openapiFields.add("maxAssetSize"); + openapiFields.add("maxContributors"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("costs"); + openapiRequiredFields.add("maxApiBytes"); + openapiRequiredFields.add("maxApiCalls"); + openapiRequiredFields.add("maxAssetSize"); + openapiRequiredFields.add("maxContributors"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PlanDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PlanDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PlanDto is not found in the empty JSON string", PlanDto.openapiRequiredFields.toString())); } + } - /** - *

The ID of the plan.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public NameStage id(String id) { - this.id = id; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PlanDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PlanDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The name of the plan.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public CostsStage name(String name) { - this.name = name; - return this; - } - - /** - *

The monthly costs of the plan.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("costs") - public MaxApiBytesStage costs(String costs) { - this.costs = costs; - return this; - } - - /** - *

The maximum number of API traffic.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxApiBytes") - public MaxApiCallsStage maxApiBytes(int maxApiBytes) { - this.maxApiBytes = maxApiBytes; - return this; - } - - /** - *

The maximum number of API calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxApiCalls") - public MaxAssetSizeStage maxApiCalls(int maxApiCalls) { - this.maxApiCalls = maxApiCalls; - return this; - } - - /** - *

The maximum allowed asset size.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxAssetSize") - public MaxContributorsStage maxAssetSize(int maxAssetSize) { - this.maxAssetSize = maxAssetSize; - return this; - } - - /** - *

The maximum number of contributors.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("maxContributors") - public _FinalStage maxContributors(int maxContributors) { - this.maxContributors = maxContributors; - return this; - } - - /** - *

The yearly ID of the plan.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage yearlyId(String yearlyId) { - this.yearlyId = Optional.of(yearlyId); - return this; - } - - @Override - @JsonSetter(value = "yearlyId", nulls = Nulls.SKIP) - public _FinalStage yearlyId(Optional yearlyId) { - this.yearlyId = yearlyId; - return this; - } - - /** - *

The yearly costs of the plan.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage yearlyCosts(String yearlyCosts) { - this.yearlyCosts = Optional.of(yearlyCosts); - return this; - } - - @Override - @JsonSetter(value = "yearlyCosts", nulls = Nulls.SKIP) - public _FinalStage yearlyCosts(Optional yearlyCosts) { - this.yearlyCosts = yearlyCosts; - return this; - } - - /** - *

An optional confirm text for the yearly subscription.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage yearlyConfirmText(String yearlyConfirmText) { - this.yearlyConfirmText = Optional.of(yearlyConfirmText); - return this; - } - - @Override - @JsonSetter(value = "yearlyConfirmText", nulls = Nulls.SKIP) - public _FinalStage yearlyConfirmText(Optional yearlyConfirmText) { - this.yearlyConfirmText = yearlyConfirmText; - return this; - } - - /** - *

An optional confirm text for the monthly subscription.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage confirmText(String confirmText) { - this.confirmText = Optional.of(confirmText); - return this; - } - - @Override - @JsonSetter(value = "confirmText", nulls = Nulls.SKIP) - public _FinalStage confirmText(Optional confirmText) { - this.confirmText = confirmText; - return this; - } - - @Override - public PlanDto build() { - return new PlanDto( - id, - name, - costs, - confirmText, - yearlyConfirmText, - yearlyCosts, - yearlyId, - maxApiBytes, - maxApiCalls, - maxAssetSize, - maxContributors); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PlanDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("costs").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `costs` to be a primitive type in the JSON string but got `%s`", jsonObj.get("costs").toString())); + } + if ((jsonObj.get("confirmText") != null && !jsonObj.get("confirmText").isJsonNull()) && !jsonObj.get("confirmText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `confirmText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("confirmText").toString())); + } + if ((jsonObj.get("yearlyConfirmText") != null && !jsonObj.get("yearlyConfirmText").isJsonNull()) && !jsonObj.get("yearlyConfirmText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `yearlyConfirmText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("yearlyConfirmText").toString())); + } + if ((jsonObj.get("yearlyCosts") != null && !jsonObj.get("yearlyCosts").isJsonNull()) && !jsonObj.get("yearlyCosts").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `yearlyCosts` to be a primitive type in the JSON string but got `%s`", jsonObj.get("yearlyCosts").toString())); + } + if ((jsonObj.get("yearlyId") != null && !jsonObj.get("yearlyId").isJsonNull()) && !jsonObj.get("yearlyId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `yearlyId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("yearlyId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PlanDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PlanDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PlanDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PlanDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PlanDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of PlanDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PlanDto + * @throws IOException if the JSON string is invalid with respect to PlanDto + */ + public static PlanDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PlanDto.class); + } + + /** + * Convert an instance of PlanDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/PlansDto.java b/src/main/java/com/squidex/api/types/PlansDto.java index bd02f22..40e794a 100644 --- a/src/main/java/com/squidex/api/types/PlansDto.java +++ b/src/main/java/com/squidex/api/types/PlansDto.java @@ -1,297 +1,373 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.PlanDto; +import com.squidex.api.types.PlansLockedReason; +import com.squidex.api.types.ReferralInfo; +import java.io.IOException; +import java.net.URI; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = PlansDto.Builder.class) -public final class PlansDto { - private final List plans; - - private final Optional currentPlanId; - - private final Optional planOwner; - - private final Optional portalLink; - - private final Optional referral; - - private final PlansLockedReason locked; - - private PlansDto( - List plans, - Optional currentPlanId, - Optional planOwner, - Optional portalLink, - Optional referral, - PlansLockedReason locked) { - this.plans = plans; - this.currentPlanId = currentPlanId; - this.planOwner = planOwner; - this.portalLink = portalLink; - this.referral = referral; - this.locked = locked; - } - - /** - * @return The available plans. - */ - @JsonProperty("plans") - public List getPlans() { - return plans; - } - - /** - * @return The current plan id. - */ - @JsonProperty("currentPlanId") - public Optional getCurrentPlanId() { - return currentPlanId; - } - - /** - * @return The plan owner. - */ - @JsonProperty("planOwner") - public Optional getPlanOwner() { - return planOwner; - } - - /** - * @return The link to the management portal. - */ - @JsonProperty("portalLink") - public Optional getPortalLink() { - return portalLink; - } - - /** - * @return The referral management. - */ - @JsonProperty("referral") - public Optional getReferral() { - return referral; - } - - /** - * @return The reason why the plan cannot be changed. - */ - @JsonProperty("locked") - public PlansLockedReason getLocked() { - return locked; - } +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; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PlansDto && equalTo((PlansDto) other); - } +import com.squidex.api.core.JSON; - private boolean equalTo(PlansDto other) { - return plans.equals(other.plans) - && currentPlanId.equals(other.currentPlanId) - && planOwner.equals(other.planOwner) - && portalLink.equals(other.portalLink) - && referral.equals(other.referral) - && locked.equals(other.locked); +/** + * PlansDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class PlansDto { + public static final String SERIALIZED_NAME_PLANS = "plans"; + @SerializedName(SERIALIZED_NAME_PLANS) + private List plans = new ArrayList<>(); + public static final String SERIALIZED_NAME_CURRENT_PLAN_ID = "currentPlanId"; + @SerializedName(SERIALIZED_NAME_CURRENT_PLAN_ID) + private String currentPlanId; + public static final String SERIALIZED_NAME_PLAN_OWNER = "planOwner"; + @SerializedName(SERIALIZED_NAME_PLAN_OWNER) + private String planOwner; + public static final String SERIALIZED_NAME_PORTAL_LINK = "portalLink"; + @SerializedName(SERIALIZED_NAME_PORTAL_LINK) + private URI portalLink; + public static final String SERIALIZED_NAME_REFERRAL = "referral"; + @SerializedName(SERIALIZED_NAME_REFERRAL) + private ReferralInfo referral; + public static final String SERIALIZED_NAME_LOCKED = "locked"; + @SerializedName(SERIALIZED_NAME_LOCKED) + private PlansLockedReason locked; + public PlansDto() { + } + public PlansDto plans(List plans) { + this.plans = plans; + return this; + } + + public PlansDto addPlansItem(PlanDto plansItem) { + if (this.plans == null) { + this.plans = new ArrayList<>(); } - - @Override - public int hashCode() { - return Objects.hash( - this.plans, this.currentPlanId, this.planOwner, this.portalLink, this.referral, this.locked); + this.plans.add(plansItem); + return this; + } + + /** + * The available plans. + * @return plans + */ + @javax.annotation.Nonnull + public List getPlans() { + return plans; + } + + public void setPlans(List plans) { + this.plans = plans; + } + public PlansDto currentPlanId(String currentPlanId) { + this.currentPlanId = currentPlanId; + return this; + } + + /** + * The current plan id. + * @return currentPlanId + */ + @javax.annotation.Nullable + public String getCurrentPlanId() { + return currentPlanId; + } + + public void setCurrentPlanId(String currentPlanId) { + this.currentPlanId = currentPlanId; + } + public PlansDto planOwner(String planOwner) { + this.planOwner = planOwner; + return this; + } + + /** + * The plan owner. + * @return planOwner + */ + @javax.annotation.Nullable + public String getPlanOwner() { + return planOwner; + } + + public void setPlanOwner(String planOwner) { + this.planOwner = planOwner; + } + public PlansDto portalLink(URI portalLink) { + this.portalLink = portalLink; + return this; + } + + /** + * The link to the management portal. + * @return portalLink + */ + @javax.annotation.Nullable + public URI getPortalLink() { + return portalLink; + } + + public void setPortalLink(URI portalLink) { + this.portalLink = portalLink; + } + public PlansDto referral(ReferralInfo referral) { + this.referral = referral; + return this; + } + + /** + * Get referral + * @return referral + */ + @javax.annotation.Nullable + public ReferralInfo getReferral() { + return referral; + } + + public void setReferral(ReferralInfo referral) { + this.referral = referral; + } + public PlansDto locked(PlansLockedReason locked) { + this.locked = locked; + return this; + } + + /** + * Get locked + * @return locked + */ + @javax.annotation.Nonnull + public PlansLockedReason getLocked() { + return locked; + } + + public void setLocked(PlansLockedReason locked) { + this.locked = locked; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static LockedStage builder() { - return new Builder(); + PlansDto plansDto = (PlansDto) o; + return Objects.equals(this.plans, plansDto.plans) && + Objects.equals(this.currentPlanId, plansDto.currentPlanId) && + Objects.equals(this.planOwner, plansDto.planOwner) && + Objects.equals(this.portalLink, plansDto.portalLink) && + Objects.equals(this.referral, plansDto.referral) && + Objects.equals(this.locked, plansDto.locked); + } + + 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(plans, currentPlanId, planOwner, portalLink, referral, locked); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface LockedStage { - _FinalStage locked(PlansLockedReason locked); - - Builder from(PlansDto other); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PlansDto {\n"); + sb.append(" plans: ").append(toIndentedString(plans)).append("\n"); + sb.append(" currentPlanId: ").append(toIndentedString(currentPlanId)).append("\n"); + sb.append(" planOwner: ").append(toIndentedString(planOwner)).append("\n"); + sb.append(" portalLink: ").append(toIndentedString(portalLink)).append("\n"); + sb.append(" referral: ").append(toIndentedString(referral)).append("\n"); + sb.append(" locked: ").append(toIndentedString(locked)).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"; } - - public interface _FinalStage { - PlansDto build(); - - _FinalStage plans(List plans); - - _FinalStage addPlans(PlanDto plans); - - _FinalStage addAllPlans(List plans); - - _FinalStage currentPlanId(Optional currentPlanId); - - _FinalStage currentPlanId(String currentPlanId); - - _FinalStage planOwner(Optional planOwner); - - _FinalStage planOwner(String planOwner); - - _FinalStage portalLink(Optional portalLink); - - _FinalStage portalLink(String portalLink); - - _FinalStage referral(Optional referral); - - _FinalStage referral(ReferralInfo referral); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements LockedStage, _FinalStage { - private PlansLockedReason locked; - - private Optional referral = Optional.empty(); - - private Optional portalLink = Optional.empty(); - - private Optional planOwner = Optional.empty(); - - private Optional currentPlanId = Optional.empty(); - - private List plans = new ArrayList<>(); - - private Builder() {} - - @Override - public Builder from(PlansDto other) { - plans(other.getPlans()); - currentPlanId(other.getCurrentPlanId()); - planOwner(other.getPlanOwner()); - portalLink(other.getPortalLink()); - referral(other.getReferral()); - locked(other.getLocked()); - return this; - } - - /** - *

The reason why the plan cannot be changed.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("locked") - public _FinalStage locked(PlansLockedReason locked) { - this.locked = locked; - return this; - } - - /** - *

The referral management.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage referral(ReferralInfo referral) { - this.referral = Optional.of(referral); - return this; - } - - @Override - @JsonSetter(value = "referral", nulls = Nulls.SKIP) - public _FinalStage referral(Optional referral) { - this.referral = referral; - return this; - } - - /** - *

The link to the management portal.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage portalLink(String portalLink) { - this.portalLink = Optional.of(portalLink); - return this; - } - - @Override - @JsonSetter(value = "portalLink", nulls = Nulls.SKIP) - public _FinalStage portalLink(Optional portalLink) { - this.portalLink = portalLink; - return this; - } - - /** - *

The plan owner.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage planOwner(String planOwner) { - this.planOwner = Optional.of(planOwner); - return this; - } - - @Override - @JsonSetter(value = "planOwner", nulls = Nulls.SKIP) - public _FinalStage planOwner(Optional planOwner) { - this.planOwner = planOwner; - return this; - } - - /** - *

The current plan id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage currentPlanId(String currentPlanId) { - this.currentPlanId = Optional.of(currentPlanId); - return this; - } - - @Override - @JsonSetter(value = "currentPlanId", nulls = Nulls.SKIP) - public _FinalStage currentPlanId(Optional currentPlanId) { - this.currentPlanId = currentPlanId; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("plans"); + openapiFields.add("currentPlanId"); + openapiFields.add("planOwner"); + openapiFields.add("portalLink"); + openapiFields.add("referral"); + openapiFields.add("locked"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("plans"); + openapiRequiredFields.add("locked"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PlansDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PlansDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PlansDto is not found in the empty JSON string", PlansDto.openapiRequiredFields.toString())); } + } - /** - *

The available plans.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPlans(List plans) { - this.plans.addAll(plans); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PlansDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PlansDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The available plans.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPlans(PlanDto plans) { - this.plans.add(plans); - return this; - } - - @Override - @JsonSetter(value = "plans", nulls = Nulls.SKIP) - public _FinalStage plans(List plans) { - this.plans.clear(); - this.plans.addAll(plans); - return this; - } - - @Override - public PlansDto build() { - return new PlansDto(plans, currentPlanId, planOwner, portalLink, referral, locked); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PlansDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("plans").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `plans` to be an array in the JSON string but got `%s`", jsonObj.get("plans").toString())); + } + + JsonArray jsonArrayplans = jsonObj.getAsJsonArray("plans"); + // validate the required field `plans` (array) + for (int i = 0; i < jsonArrayplans.size(); i++) { + PlanDto.validateJsonElement(jsonArrayplans.get(i)); + }; + if ((jsonObj.get("currentPlanId") != null && !jsonObj.get("currentPlanId").isJsonNull()) && !jsonObj.get("currentPlanId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `currentPlanId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("currentPlanId").toString())); + } + if ((jsonObj.get("planOwner") != null && !jsonObj.get("planOwner").isJsonNull()) && !jsonObj.get("planOwner").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `planOwner` to be a primitive type in the JSON string but got `%s`", jsonObj.get("planOwner").toString())); + } + if ((jsonObj.get("portalLink") != null && !jsonObj.get("portalLink").isJsonNull()) && !jsonObj.get("portalLink").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `portalLink` to be a primitive type in the JSON string but got `%s`", jsonObj.get("portalLink").toString())); + } + // validate the optional field `referral` + if (jsonObj.get("referral") != null && !jsonObj.get("referral").isJsonNull()) { + ReferralInfo.validateJsonElement(jsonObj.get("referral")); + } + // validate the required field `locked` + PlansLockedReason.validateJsonElement(jsonObj.get("locked")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PlansDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PlansDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PlansDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PlansDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PlansDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of PlansDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PlansDto + * @throws IOException if the JSON string is invalid with respect to PlansDto + */ + public static PlansDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PlansDto.class); + } + + /** + * Convert an instance of PlansDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/PlansLockedReason.java b/src/main/java/com/squidex/api/types/PlansLockedReason.java index e3f47b0..248d826 100644 --- a/src/main/java/com/squidex/api/types/PlansLockedReason.java +++ b/src/main/java/com/squidex/api/types/PlansLockedReason.java @@ -1,28 +1,82 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(PlansLockedReason.Adapter.class) public enum PlansLockedReason { - NONE("None"), + + NONE("None"), + + NOT_OWNER("NotOwner"), + + NO_PERMISSION("NoPermission"), + + MANAGED_BY_TEAM("ManagedByTeam"); - NOT_OWNER("NotOwner"), + private String value; - NO_PERMISSION("NoPermission"), + PlansLockedReason(String value) { + this.value = value; + } - MANAGED_BY_TEAM("ManagedByTeam"); + public String getValue() { + return value; + } - private final String value; + @Override + public String toString() { + return String.valueOf(value); + } - PlansLockedReason(String value) { - this.value = value; + public static PlansLockedReason fromValue(String value) { + for (PlansLockedReason b : PlansLockedReason.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - @JsonValue + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return this.value; + public void write(final JsonWriter jsonWriter, final PlansLockedReason enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } + + @Override + public PlansLockedReason read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return PlansLockedReason.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + PlansLockedReason.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java b/src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java index 233e6c3..f008507 100644 --- a/src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java @@ -1,122 +1,234 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = PrerenderRuleActionDto.Builder.class) -public final class PrerenderRuleActionDto { - private final String token; - - private final String url; - - private PrerenderRuleActionDto(String token, String url) { - this.token = token; - this.url = url; - } - - /** - * @return The prerender token from your account. - */ - @JsonProperty("token") - public String getToken() { - return token; - } - - /** - * @return The url to recache. - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PrerenderRuleActionDto && equalTo((PrerenderRuleActionDto) other); - } - private boolean equalTo(PrerenderRuleActionDto other) { - return token.equals(other.token) && url.equals(other.url); - } - - @Override - public int hashCode() { - return Objects.hash(this.token, this.url); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.types.RuleActionDto; +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.squidex.api.core.JSON; - public static TokenStage builder() { - return new Builder(); +/** + * PrerenderRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class PrerenderRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_TOKEN = "token"; + @SerializedName(SERIALIZED_NAME_TOKEN) + private String token; + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private String url; + public PrerenderRuleActionDto() { + } + public PrerenderRuleActionDto token(String token) { + this.token = token; + return this; + } + + /** + * The prerender token from your account. + * @return token + */ + @javax.annotation.Nonnull + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + public PrerenderRuleActionDto url(String url) { + this.url = url; + return this; + } + + /** + * The url to recache. + * @return url + */ + @javax.annotation.Nonnull + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface TokenStage { - UrlStage token(String token); - - Builder from(PrerenderRuleActionDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface UrlStage { - _FinalStage url(String url); + PrerenderRuleActionDto prerenderRuleActionDto = (PrerenderRuleActionDto) o; + return Objects.equals(this.token, prerenderRuleActionDto.token) && + Objects.equals(this.url, prerenderRuleActionDto.url) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(token, url, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class PrerenderRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" token: ").append(toIndentedString(token)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).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"; } - - public interface _FinalStage { - PrerenderRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TokenStage, UrlStage, _FinalStage { - private String token; - - private String url; - - private Builder() {} - - @Override - public Builder from(PrerenderRuleActionDto other) { - token(other.getToken()); - url(other.getUrl()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("token"); + openapiFields.add("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("token"); + openapiRequiredFields.add("url"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to PrerenderRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!PrerenderRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in PrerenderRuleActionDto is not found in the empty JSON string", PrerenderRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The prerender token from your account.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("token") - public UrlStage token(String token) { - this.token = token; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!PrerenderRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `PrerenderRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The url to recache.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public _FinalStage url(String url) { - this.url = url; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : PrerenderRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @Override - public PrerenderRuleActionDto build() { - return new PrerenderRuleActionDto(token, url); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!PrerenderRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'PrerenderRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(PrerenderRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, PrerenderRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public PrerenderRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of PrerenderRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of PrerenderRuleActionDto + * @throws IOException if the JSON string is invalid with respect to PrerenderRuleActionDto + */ + public static PrerenderRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, PrerenderRuleActionDto.class); + } + + /** + * Convert an instance of PrerenderRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/QueryDto.java b/src/main/java/com/squidex/api/types/QueryDto.java index 9846798..095777d 100644 --- a/src/main/java/com/squidex/api/types/QueryDto.java +++ b/src/main/java/com/squidex/api/types/QueryDto.java @@ -1,160 +1,299 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = QueryDto.Builder.class) -public final class QueryDto { - private final Optional> ids; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final Optional oData; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final Optional q; +import com.squidex.api.core.JSON; - private final Optional parentId; +/** + * QueryDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class QueryDto { + public static final String SERIALIZED_NAME_IDS = "ids"; + @SerializedName(SERIALIZED_NAME_IDS) + private List ids; + public static final String SERIALIZED_NAME_O_DATA = "oData"; + @SerializedName(SERIALIZED_NAME_O_DATA) + private String oData; + public static final String SERIALIZED_NAME_Q = "q"; + @SerializedName(SERIALIZED_NAME_Q) + private Object q = null; + public static final String SERIALIZED_NAME_PARENT_ID = "parentId"; + @SerializedName(SERIALIZED_NAME_PARENT_ID) + private String parentId; + public QueryDto() { + } + public QueryDto ids(List ids) { + this.ids = ids; + return this; + } - private QueryDto( - Optional> ids, Optional oData, Optional q, Optional parentId) { - this.ids = ids; - this.oData = oData; - this.q = q; - this.parentId = parentId; + public QueryDto addIdsItem(String idsItem) { + if (this.ids == null) { + this.ids = new ArrayList<>(); } + this.ids.add(idsItem); + return this; + } - /** - * @return The optional list of ids to query. - */ - @JsonProperty("ids") - public Optional> getIds() { - return ids; - } + /** + * The optional list of ids to query. + * @return ids + */ + @javax.annotation.Nullable + public List getIds() { + return ids; + } - /** - * @return The optional odata query. - */ - @JsonProperty("oData") - public Optional getOData() { - return oData; - } + public void setIds(List ids) { + this.ids = ids; + } + public QueryDto oData(String oData) { + this.oData = oData; + return this; + } - @JsonProperty("q") - public Optional getQ() { - return q; - } + /** + * The optional odata query. + * @return oData + */ + @javax.annotation.Nullable + public String getoData() { + return oData; + } - /** - * @return The parent id (for assets). - */ - @JsonProperty("parentId") - public Optional getParentId() { - return parentId; - } + public void setoData(String oData) { + this.oData = oData; + } + public QueryDto q(Object q) { + this.q = q; + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof QueryDto && equalTo((QueryDto) other); - } + /** + * The optional json query. + * @return q + */ + @javax.annotation.Nullable + public Object getQ() { + return q; + } - private boolean equalTo(QueryDto other) { - return ids.equals(other.ids) - && oData.equals(other.oData) - && q.equals(other.q) - && parentId.equals(other.parentId); - } + public void setQ(Object q) { + this.q = q; + } + public QueryDto parentId(String parentId) { + this.parentId = parentId; + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.ids, this.oData, this.q, this.parentId); - } + /** + * The parent id (for assets). + * @return parentId + */ + @javax.annotation.Nullable + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static Builder builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryDto queryDto = (QueryDto) o; + return Objects.equals(this.ids, queryDto.ids) && + Objects.equals(this.oData, queryDto.oData) && + Objects.equals(this.q, queryDto.q) && + Objects.equals(this.parentId, queryDto.parentId); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> ids = Optional.empty(); + 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())); + } - private Optional oData = Optional.empty(); + @Override + public int hashCode() { + return Objects.hash(ids, oData, q, parentId); + } - private Optional q = Optional.empty(); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - private Optional parentId = Optional.empty(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryDto {\n"); + sb.append(" ids: ").append(toIndentedString(ids)).append("\n"); + sb.append(" oData: ").append(toIndentedString(oData)).append("\n"); + sb.append(" q: ").append(toIndentedString(q)).append("\n"); + sb.append(" parentId: ").append(toIndentedString(parentId)).append("\n"); + sb.append("}"); + return sb.toString(); + } - private Builder() {} + /** + * 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 Builder from(QueryDto other) { - ids(other.getIds()); - oData(other.getOData()); - q(other.getQ()); - parentId(other.getParentId()); - return this; - } - @JsonSetter(value = "ids", nulls = Nulls.SKIP) - public Builder ids(Optional> ids) { - this.ids = ids; - return this; - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder ids(List ids) { - this.ids = Optional.of(ids); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("ids"); + openapiFields.add("oData"); + openapiFields.add("q"); + openapiFields.add("parentId"); - @JsonSetter(value = "oData", nulls = Nulls.SKIP) - public Builder oData(Optional oData) { - this.oData = oData; - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + } - public Builder oData(String oData) { - this.oData = Optional.of(oData); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueryDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueryDto is not found in the empty JSON string", QueryDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "q", nulls = Nulls.SKIP) - public Builder q(Optional q) { - this.q = q; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueryDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueryDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("ids") != null && !jsonObj.get("ids").isJsonNull() && !jsonObj.get("ids").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `ids` to be an array in the JSON string but got `%s`", jsonObj.get("ids").toString())); + } + if ((jsonObj.get("oData") != null && !jsonObj.get("oData").isJsonNull()) && !jsonObj.get("oData").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `oData` to be a primitive type in the JSON string but got `%s`", jsonObj.get("oData").toString())); + } + if ((jsonObj.get("parentId") != null && !jsonObj.get("parentId").isJsonNull()) && !jsonObj.get("parentId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `parentId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("parentId").toString())); + } + } - public Builder q(Object q) { - this.q = Optional.of(q); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueryDto.class)); - @JsonSetter(value = "parentId", nulls = Nulls.SKIP) - public Builder parentId(Optional parentId) { - this.parentId = parentId; - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public Builder parentId(String parentId) { - this.parentId = Optional.of(parentId); - return this; - } + @Override + public QueryDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } - public QueryDto build() { - return new QueryDto(ids, oData, q, parentId); - } + }.nullSafe(); } + } + + /** + * Create an instance of QueryDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryDto + * @throws IOException if the JSON string is invalid with respect to QueryDto + */ + public static QueryDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryDto.class); + } + + /** + * Convert an instance of QueryDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/QueryJsonDto.java b/src/main/java/com/squidex/api/types/QueryJsonDto.java index 8575844..7bd2b57 100644 --- a/src/main/java/com/squidex/api/types/QueryJsonDto.java +++ b/src/main/java/com/squidex/api/types/QueryJsonDto.java @@ -1,252 +1,387 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = QueryJsonDto.Builder.class) -public final class QueryJsonDto { - private final Optional filter; - - private final Optional fullText; - - private final int skip; - - private final int take; - - private final int random; - - private final int top; - - private final Optional> sort; - - private QueryJsonDto( - Optional filter, - Optional fullText, - int skip, - int take, - int random, - int top, - Optional> sort) { - this.filter = filter; - this.fullText = fullText; - this.skip = skip; - this.take = take; - this.random = random; - this.top = top; - this.sort = sort; - } - - @JsonProperty("filter") - public Optional getFilter() { - return filter; - } - - @JsonProperty("fullText") - public Optional getFullText() { - return fullText; - } - - @JsonProperty("skip") - public int getSkip() { - return skip; - } - @JsonProperty("take") - public int getTake() { - return take; - } - - @JsonProperty("random") - public int getRandom() { - return random; - } - - @JsonProperty("top") - public int getTop() { - return top; - } - - @JsonProperty("sort") - public Optional> getSort() { - return sort; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof QueryJsonDto && equalTo((QueryJsonDto) other); - } - private boolean equalTo(QueryJsonDto other) { - return filter.equals(other.filter) - && fullText.equals(other.fullText) - && skip == other.skip - && take == other.take - && random == other.random - && top == other.top - && sort.equals(other.sort); - } - - @Override - public int hashCode() { - return Objects.hash(this.filter, this.fullText, this.skip, this.take, this.random, this.top, this.sort); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +package com.squidex.api.types; - public static SkipStage builder() { - return new Builder(); - } +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.squidex.api.types.SortNode; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +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; - public interface SkipStage { - TakeStage skip(int skip); +import com.squidex.api.core.JSON; - Builder from(QueryJsonDto other); +/** + * QueryJsonDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class QueryJsonDto { + public static final String SERIALIZED_NAME_FILTER = "filter"; + @SerializedName(SERIALIZED_NAME_FILTER) + private Object filter = null; + public static final String SERIALIZED_NAME_FULL_TEXT = "fullText"; + @SerializedName(SERIALIZED_NAME_FULL_TEXT) + private String fullText; + public static final String SERIALIZED_NAME_SKIP = "skip"; + @SerializedName(SERIALIZED_NAME_SKIP) + private Long skip; + public static final String SERIALIZED_NAME_TAKE = "take"; + @SerializedName(SERIALIZED_NAME_TAKE) + private Long take; + public static final String SERIALIZED_NAME_RANDOM = "random"; + @SerializedName(SERIALIZED_NAME_RANDOM) + private Long random; + public static final String SERIALIZED_NAME_TOP = "top"; + @SerializedName(SERIALIZED_NAME_TOP) + private Long top; + public static final String SERIALIZED_NAME_SORT = "sort"; + @SerializedName(SERIALIZED_NAME_SORT) + private List sort; + public QueryJsonDto() { + } + public QueryJsonDto filter(Object filter) { + this.filter = filter; + return this; + } + + /** + * Get filter + * @return filter + */ + @javax.annotation.Nullable + public Object getFilter() { + return filter; + } + + public void setFilter(Object filter) { + this.filter = filter; + } + public QueryJsonDto fullText(String fullText) { + this.fullText = fullText; + return this; + } + + /** + * Get fullText + * @return fullText + */ + @javax.annotation.Nullable + public String getFullText() { + return fullText; + } + + public void setFullText(String fullText) { + this.fullText = fullText; + } + public QueryJsonDto skip(Long skip) { + this.skip = skip; + return this; + } + + /** + * Get skip + * @return skip + */ + @javax.annotation.Nonnull + public Long getSkip() { + return skip; + } + + public void setSkip(Long skip) { + this.skip = skip; + } + public QueryJsonDto take(Long take) { + this.take = take; + return this; + } + + /** + * Get take + * @return take + */ + @javax.annotation.Nonnull + public Long getTake() { + return take; + } + + public void setTake(Long take) { + this.take = take; + } + public QueryJsonDto random(Long random) { + this.random = random; + return this; + } + + /** + * Get random + * @return random + */ + @javax.annotation.Nonnull + public Long getRandom() { + return random; + } + + public void setRandom(Long random) { + this.random = random; + } + public QueryJsonDto top(Long top) { + this.top = top; + return this; + } + + /** + * Get top + * @return top + */ + @javax.annotation.Nonnull + public Long getTop() { + return top; + } + + public void setTop(Long top) { + this.top = top; + } + public QueryJsonDto sort(List sort) { + this.sort = sort; + return this; + } + + public QueryJsonDto addSortItem(SortNode sortItem) { + if (this.sort == null) { + this.sort = new ArrayList<>(); } - - public interface TakeStage { - RandomStage take(int take); + this.sort.add(sortItem); + return this; + } + + /** + * Get sort + * @return sort + */ + @javax.annotation.Nullable + public List getSort() { + return sort; + } + + public void setSort(List sort) { + this.sort = sort; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface RandomStage { - TopStage random(int random); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface TopStage { - _FinalStage top(int top); + QueryJsonDto queryJsonDto = (QueryJsonDto) o; + return Objects.equals(this.filter, queryJsonDto.filter) && + Objects.equals(this.fullText, queryJsonDto.fullText) && + Objects.equals(this.skip, queryJsonDto.skip) && + Objects.equals(this.take, queryJsonDto.take) && + Objects.equals(this.random, queryJsonDto.random) && + Objects.equals(this.top, queryJsonDto.top) && + Objects.equals(this.sort, queryJsonDto.sort); + } + + 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(filter, fullText, skip, take, random, top, sort); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - QueryJsonDto build(); - - _FinalStage filter(Optional filter); - - _FinalStage filter(Object filter); - - _FinalStage fullText(Optional fullText); - - _FinalStage fullText(String fullText); - - _FinalStage sort(Optional> sort); - - _FinalStage sort(List sort); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class QueryJsonDto {\n"); + sb.append(" filter: ").append(toIndentedString(filter)).append("\n"); + sb.append(" fullText: ").append(toIndentedString(fullText)).append("\n"); + sb.append(" skip: ").append(toIndentedString(skip)).append("\n"); + sb.append(" take: ").append(toIndentedString(take)).append("\n"); + sb.append(" random: ").append(toIndentedString(random)).append("\n"); + sb.append(" top: ").append(toIndentedString(top)).append("\n"); + sb.append(" sort: ").append(toIndentedString(sort)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements SkipStage, TakeStage, RandomStage, TopStage, _FinalStage { - private int skip; - - private int take; - - private int random; - - private int top; - - private Optional> sort = Optional.empty(); - - private Optional fullText = Optional.empty(); - - private Optional filter = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(QueryJsonDto other) { - filter(other.getFilter()); - fullText(other.getFullText()); - skip(other.getSkip()); - take(other.getTake()); - random(other.getRandom()); - top(other.getTop()); - sort(other.getSort()); - return this; - } - - @Override - @JsonSetter("skip") - public TakeStage skip(int skip) { - this.skip = skip; - return this; - } - - @Override - @JsonSetter("take") - public RandomStage take(int take) { - this.take = take; - return this; - } - - @Override - @JsonSetter("random") - public TopStage random(int random) { - this.random = random; - return this; - } - - @Override - @JsonSetter("top") - public _FinalStage top(int top) { - this.top = top; - return this; - } - - @Override - public _FinalStage sort(List sort) { - this.sort = Optional.of(sort); - return this; - } - - @Override - @JsonSetter(value = "sort", nulls = Nulls.SKIP) - public _FinalStage sort(Optional> sort) { - this.sort = sort; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("filter"); + openapiFields.add("fullText"); + openapiFields.add("skip"); + openapiFields.add("take"); + openapiFields.add("random"); + openapiFields.add("top"); + openapiFields.add("sort"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("skip"); + openapiRequiredFields.add("take"); + openapiRequiredFields.add("random"); + openapiRequiredFields.add("top"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to QueryJsonDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!QueryJsonDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in QueryJsonDto is not found in the empty JSON string", QueryJsonDto.openapiRequiredFields.toString())); } + } - @Override - public _FinalStage fullText(String fullText) { - this.fullText = Optional.of(fullText); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!QueryJsonDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `QueryJsonDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - @JsonSetter(value = "fullText", nulls = Nulls.SKIP) - public _FinalStage fullText(Optional fullText) { - this.fullText = fullText; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : QueryJsonDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } - - @Override - public _FinalStage filter(Object filter) { - this.filter = Optional.of(filter); - return this; - } - - @Override - @JsonSetter(value = "filter", nulls = Nulls.SKIP) - public _FinalStage filter(Optional filter) { - this.filter = filter; - return this; + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("fullText") != null && !jsonObj.get("fullText").isJsonNull()) && !jsonObj.get("fullText").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `fullText` to be a primitive type in the JSON string but got `%s`", jsonObj.get("fullText").toString())); + } + if (jsonObj.get("sort") != null && !jsonObj.get("sort").isJsonNull()) { + JsonArray jsonArraysort = jsonObj.getAsJsonArray("sort"); + if (jsonArraysort != null) { + // ensure the json data is an array + if (!jsonObj.get("sort").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `sort` to be an array in the JSON string but got `%s`", jsonObj.get("sort").toString())); + } + + // validate the optional field `sort` (array) + for (int i = 0; i < jsonArraysort.size(); i++) { + SortNode.validateJsonElement(jsonArraysort.get(i)); + }; } + } + } - @Override - public QueryJsonDto build() { - return new QueryJsonDto(filter, fullText, skip, take, random, top, sort); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!QueryJsonDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'QueryJsonDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(QueryJsonDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, QueryJsonDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public QueryJsonDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of QueryJsonDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of QueryJsonDto + * @throws IOException if the JSON string is invalid with respect to QueryJsonDto + */ + public static QueryJsonDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, QueryJsonDto.class); + } + + /** + * Convert an instance of QueryJsonDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ReferencesFieldEditor.java b/src/main/java/com/squidex/api/types/ReferencesFieldEditor.java index 42d790b..8dcbd37 100644 --- a/src/main/java/com/squidex/api/types/ReferencesFieldEditor.java +++ b/src/main/java/com/squidex/api/types/ReferencesFieldEditor.java @@ -1,30 +1,86 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(ReferencesFieldEditor.Adapter.class) public enum ReferencesFieldEditor { - LIST("List"), + + LIST("List"), + + DROPDOWN("Dropdown"), + + TAGS("Tags"), + + CHECKBOXES("Checkboxes"), + + INPUT("Input"), + + RADIO("Radio"); - DROPDOWN("Dropdown"), + private String value; - TAGS("Tags"), + ReferencesFieldEditor(String value) { + this.value = value; + } - CHECKBOXES("Checkboxes"), + public String getValue() { + return value; + } - INPUT("Input"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static ReferencesFieldEditor fromValue(String value) { + for (ReferencesFieldEditor b : ReferencesFieldEditor.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - ReferencesFieldEditor(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ReferencesFieldEditor enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public ReferencesFieldEditor read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ReferencesFieldEditor.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ReferencesFieldEditor.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java index 52922af..f40ec87 100644 --- a/src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java @@ -1,349 +1,465 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.FieldPropertiesDto; +import com.squidex.api.types.ReferencesFieldEditor; +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.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ReferencesFieldPropertiesDto.Builder.class) -public final class ReferencesFieldPropertiesDto { - private final Optional>> defaultValues; - - private final Optional> defaultValue; - - private final Optional minItems; - - private final Optional maxItems; - - private final Optional allowDuplicates; - - private final Optional resolveReference; - - private final Optional mustBePublished; - - private final Optional query; - - private final Optional editor; - - private final Optional> schemaIds; - - private ReferencesFieldPropertiesDto( - Optional>> defaultValues, - Optional> defaultValue, - Optional minItems, - Optional maxItems, - Optional allowDuplicates, - Optional resolveReference, - Optional mustBePublished, - Optional query, - Optional editor, - Optional> schemaIds) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.minItems = minItems; - this.maxItems = maxItems; - this.allowDuplicates = allowDuplicates; - this.resolveReference = resolveReference; - this.mustBePublished = mustBePublished; - this.query = query; - this.editor = editor; - this.schemaIds = schemaIds; - } - - /** - * @return The language specific default value as a list of content ids. - */ - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value as a list of content ids. - */ - @JsonProperty("defaultValue") - public Optional> getDefaultValue() { - return defaultValue; - } - - /** - * @return The minimum allowed items for the field value. - */ - @JsonProperty("minItems") - public Optional getMinItems() { - return minItems; - } - - /** - * @return The maximum allowed items for the field value. - */ - @JsonProperty("maxItems") - public Optional getMaxItems() { - return maxItems; - } - - /** - * @return True, if duplicate values are allowed. - */ - @JsonProperty("allowDuplicates") - public Optional getAllowDuplicates() { - return allowDuplicates; - } - - /** - * @return True to resolve references in the content list. - */ - @JsonProperty("resolveReference") - public Optional getResolveReference() { - return resolveReference; - } - - /** - * @return True when all references must be published. - */ - @JsonProperty("mustBePublished") - public Optional getMustBePublished() { - return mustBePublished; - } +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; - /** - * @return The initial query that is applied in the UI. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } +import com.squidex.api.core.JSON; - /** - * @return The editor that is used to manage this field. - */ - @JsonProperty("editor") - public Optional getEditor() { - return editor; +/** + * ReferencesFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ReferencesFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_DEFAULT_VALUES = "defaultValues"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUES) + private Map> defaultValues = new HashMap<>(); + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private List defaultValue; + public static final String SERIALIZED_NAME_MIN_ITEMS = "minItems"; + @SerializedName(SERIALIZED_NAME_MIN_ITEMS) + private Integer minItems; + public static final String SERIALIZED_NAME_MAX_ITEMS = "maxItems"; + @SerializedName(SERIALIZED_NAME_MAX_ITEMS) + private Integer maxItems; + public static final String SERIALIZED_NAME_ALLOW_DUPLICATES = "allowDuplicates"; + @SerializedName(SERIALIZED_NAME_ALLOW_DUPLICATES) + private Boolean allowDuplicates; + public static final String SERIALIZED_NAME_RESOLVE_REFERENCE = "resolveReference"; + @SerializedName(SERIALIZED_NAME_RESOLVE_REFERENCE) + private Boolean resolveReference; + public static final String SERIALIZED_NAME_MUST_BE_PUBLISHED = "mustBePublished"; + @SerializedName(SERIALIZED_NAME_MUST_BE_PUBLISHED) + private Boolean mustBePublished; + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + public static final String SERIALIZED_NAME_EDITOR = "editor"; + @SerializedName(SERIALIZED_NAME_EDITOR) + private ReferencesFieldEditor editor; + public static final String SERIALIZED_NAME_SCHEMA_IDS = "schemaIds"; + @SerializedName(SERIALIZED_NAME_SCHEMA_IDS) + private List schemaIds; + public ReferencesFieldPropertiesDto() { + } + public ReferencesFieldPropertiesDto defaultValues(Map> defaultValues) { + this.defaultValues = defaultValues; + return this; + } + + public ReferencesFieldPropertiesDto putDefaultValuesItem(String key, List defaultValuesItem) { + if (this.defaultValues == null) { + this.defaultValues = new HashMap<>(); } - - /** - * @return The ID of the referenced schemas. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; + this.defaultValues.put(key, defaultValuesItem); + return this; + } + + /** + * Get defaultValues + * @return defaultValues + */ + @javax.annotation.Nullable + public Map> getDefaultValues() { + return defaultValues; + } + + public void setDefaultValues(Map> defaultValues) { + this.defaultValues = defaultValues; + } + public ReferencesFieldPropertiesDto defaultValue(List defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + public ReferencesFieldPropertiesDto addDefaultValueItem(String defaultValueItem) { + if (this.defaultValue == null) { + this.defaultValue = new ArrayList<>(); } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReferencesFieldPropertiesDto && equalTo((ReferencesFieldPropertiesDto) other); + this.defaultValue.add(defaultValueItem); + return this; + } + + /** + * The default value as a list of content ids. + * @return defaultValue + */ + @javax.annotation.Nullable + public List getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(List defaultValue) { + this.defaultValue = defaultValue; + } + public ReferencesFieldPropertiesDto minItems(Integer minItems) { + this.minItems = minItems; + return this; + } + + /** + * The minimum allowed items for the field value. + * @return minItems + */ + @javax.annotation.Nullable + public Integer getMinItems() { + return minItems; + } + + public void setMinItems(Integer minItems) { + this.minItems = minItems; + } + public ReferencesFieldPropertiesDto maxItems(Integer maxItems) { + this.maxItems = maxItems; + return this; + } + + /** + * The maximum allowed items for the field value. + * @return maxItems + */ + @javax.annotation.Nullable + public Integer getMaxItems() { + return maxItems; + } + + public void setMaxItems(Integer maxItems) { + this.maxItems = maxItems; + } + public ReferencesFieldPropertiesDto allowDuplicates(Boolean allowDuplicates) { + this.allowDuplicates = allowDuplicates; + return this; + } + + /** + * True, if duplicate values are allowed. + * @return allowDuplicates + */ + @javax.annotation.Nullable + public Boolean getAllowDuplicates() { + return allowDuplicates; + } + + public void setAllowDuplicates(Boolean allowDuplicates) { + this.allowDuplicates = allowDuplicates; + } + public ReferencesFieldPropertiesDto resolveReference(Boolean resolveReference) { + this.resolveReference = resolveReference; + return this; + } + + /** + * True to resolve references in the content list. + * @return resolveReference + */ + @javax.annotation.Nullable + public Boolean getResolveReference() { + return resolveReference; + } + + public void setResolveReference(Boolean resolveReference) { + this.resolveReference = resolveReference; + } + public ReferencesFieldPropertiesDto mustBePublished(Boolean mustBePublished) { + this.mustBePublished = mustBePublished; + return this; + } + + /** + * True when all references must be published. + * @return mustBePublished + */ + @javax.annotation.Nullable + public Boolean getMustBePublished() { + return mustBePublished; + } + + public void setMustBePublished(Boolean mustBePublished) { + this.mustBePublished = mustBePublished; + } + public ReferencesFieldPropertiesDto query(String query) { + this.query = query; + return this; + } + + /** + * The initial query that is applied in the UI. + * @return query + */ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + public ReferencesFieldPropertiesDto editor(ReferencesFieldEditor editor) { + this.editor = editor; + return this; + } + + /** + * Get editor + * @return editor + */ + @javax.annotation.Nullable + public ReferencesFieldEditor getEditor() { + return editor; + } + + public void setEditor(ReferencesFieldEditor editor) { + this.editor = editor; + } + public ReferencesFieldPropertiesDto schemaIds(List schemaIds) { + this.schemaIds = schemaIds; + return this; + } + + public ReferencesFieldPropertiesDto addSchemaIdsItem(String schemaIdsItem) { + if (this.schemaIds == null) { + this.schemaIds = new ArrayList<>(); } - - private boolean equalTo(ReferencesFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && minItems.equals(other.minItems) - && maxItems.equals(other.maxItems) - && allowDuplicates.equals(other.allowDuplicates) - && resolveReference.equals(other.resolveReference) - && mustBePublished.equals(other.mustBePublished) - && query.equals(other.query) - && editor.equals(other.editor) - && schemaIds.equals(other.schemaIds); + this.schemaIds.add(schemaIdsItem); + return this; + } + + /** + * The ID of the referenced schemas. + * @return schemaIds + */ + @javax.annotation.Nullable + public List getSchemaIds() { + return schemaIds; + } + + public void setSchemaIds(List schemaIds) { + this.schemaIds = schemaIds; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public int hashCode() { - return Objects.hash( - this.defaultValues, - this.defaultValue, - this.minItems, - this.maxItems, - this.allowDuplicates, - this.resolveReference, - this.mustBePublished, - this.query, - this.editor, - this.schemaIds); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + ReferencesFieldPropertiesDto referencesFieldPropertiesDto = (ReferencesFieldPropertiesDto) o; + return Objects.equals(this.defaultValues, referencesFieldPropertiesDto.defaultValues) && + Objects.equals(this.defaultValue, referencesFieldPropertiesDto.defaultValue) && + Objects.equals(this.minItems, referencesFieldPropertiesDto.minItems) && + Objects.equals(this.maxItems, referencesFieldPropertiesDto.maxItems) && + Objects.equals(this.allowDuplicates, referencesFieldPropertiesDto.allowDuplicates) && + Objects.equals(this.resolveReference, referencesFieldPropertiesDto.resolveReference) && + Objects.equals(this.mustBePublished, referencesFieldPropertiesDto.mustBePublished) && + Objects.equals(this.query, referencesFieldPropertiesDto.query) && + Objects.equals(this.editor, referencesFieldPropertiesDto.editor) && + Objects.equals(this.schemaIds, referencesFieldPropertiesDto.schemaIds) && + super.equals(o); + } + + 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(defaultValues, defaultValue, minItems, maxItems, allowDuplicates, resolveReference, mustBePublished, query, editor, schemaIds, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static Builder builder() { - return new Builder(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferencesFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" defaultValues: ").append(toIndentedString(defaultValues)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" minItems: ").append(toIndentedString(minItems)).append("\n"); + sb.append(" maxItems: ").append(toIndentedString(maxItems)).append("\n"); + sb.append(" allowDuplicates: ").append(toIndentedString(allowDuplicates)).append("\n"); + sb.append(" resolveReference: ").append(toIndentedString(resolveReference)).append("\n"); + sb.append(" mustBePublished: ").append(toIndentedString(mustBePublished)).append("\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" editor: ").append(toIndentedString(editor)).append("\n"); + sb.append(" schemaIds: ").append(toIndentedString(schemaIds)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> defaultValues = Optional.empty(); - - private Optional> defaultValue = Optional.empty(); - - private Optional minItems = Optional.empty(); - - private Optional maxItems = Optional.empty(); - - private Optional allowDuplicates = Optional.empty(); - - private Optional resolveReference = Optional.empty(); - - private Optional mustBePublished = Optional.empty(); - - private Optional query = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Optional> schemaIds = Optional.empty(); - - private Builder() {} - - public Builder from(ReferencesFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - minItems(other.getMinItems()); - maxItems(other.getMaxItems()); - allowDuplicates(other.getAllowDuplicates()); - resolveReference(other.getResolveReference()); - mustBePublished(other.getMustBePublished()); - query(other.getQuery()); - editor(other.getEditor()); - schemaIds(other.getSchemaIds()); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional> defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(List defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "minItems", nulls = Nulls.SKIP) - public Builder minItems(Optional minItems) { - this.minItems = minItems; - return this; - } - - public Builder minItems(Integer minItems) { - this.minItems = Optional.of(minItems); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("defaultValues"); + openapiFields.add("defaultValue"); + openapiFields.add("minItems"); + openapiFields.add("maxItems"); + openapiFields.add("allowDuplicates"); + openapiFields.add("resolveReference"); + openapiFields.add("mustBePublished"); + openapiFields.add("query"); + openapiFields.add("editor"); + openapiFields.add("schemaIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReferencesFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferencesFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReferencesFieldPropertiesDto is not found in the empty JSON string", ReferencesFieldPropertiesDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "maxItems", nulls = Nulls.SKIP) - public Builder maxItems(Optional maxItems) { - this.maxItems = maxItems; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReferencesFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReferencesFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder maxItems(Integer maxItems) { - this.maxItems = Optional.of(maxItems); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReferencesFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @JsonSetter(value = "allowDuplicates", nulls = Nulls.SKIP) - public Builder allowDuplicates(Optional allowDuplicates) { - this.allowDuplicates = allowDuplicates; - return this; - } - - public Builder allowDuplicates(Boolean allowDuplicates) { - this.allowDuplicates = Optional.of(allowDuplicates); - return this; - } - - @JsonSetter(value = "resolveReference", nulls = Nulls.SKIP) - public Builder resolveReference(Optional resolveReference) { - this.resolveReference = resolveReference; - return this; - } - - public Builder resolveReference(Boolean resolveReference) { - this.resolveReference = Optional.of(resolveReference); - return this; - } - - @JsonSetter(value = "mustBePublished", nulls = Nulls.SKIP) - public Builder mustBePublished(Optional mustBePublished) { - this.mustBePublished = mustBePublished; - return this; - } - - public Builder mustBePublished(Boolean mustBePublished) { - this.mustBePublished = Optional.of(mustBePublished); - return this; - } - - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(ReferencesFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public Builder schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - public Builder schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - public ReferencesFieldPropertiesDto build() { - return new ReferencesFieldPropertiesDto( - defaultValues, - defaultValue, - minItems, - maxItems, - allowDuplicates, - resolveReference, - mustBePublished, - query, - editor, - schemaIds); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferencesFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferencesFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReferencesFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferencesFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferencesFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ReferencesFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferencesFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to ReferencesFieldPropertiesDto + */ + public static ReferencesFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferencesFieldPropertiesDto.class); + } + + /** + * Convert an instance of ReferencesFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ReferralInfo.java b/src/main/java/com/squidex/api/types/ReferralInfo.java index 2c7ba36..115576a 100644 --- a/src/main/java/com/squidex/api/types/ReferralInfo.java +++ b/src/main/java/com/squidex/api/types/ReferralInfo.java @@ -1,130 +1,263 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; 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; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ReferralInfo.Builder.class) -public final class ReferralInfo { - private final String code; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final String earned; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final String condition; +import com.squidex.api.core.JSON; - private ReferralInfo(String code, String earned, String condition) { - this.code = code; - this.earned = earned; - this.condition = condition; - } +/** + * ReferralInfo + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ReferralInfo { + public static final String SERIALIZED_NAME_CODE = "code"; + @SerializedName(SERIALIZED_NAME_CODE) + private String code; + public static final String SERIALIZED_NAME_EARNED = "earned"; + @SerializedName(SERIALIZED_NAME_EARNED) + private String earned; + public static final String SERIALIZED_NAME_CONDITION = "condition"; + @SerializedName(SERIALIZED_NAME_CONDITION) + private String condition; + public ReferralInfo() { + } + public ReferralInfo code(String code) { + this.code = code; + return this; + } - @JsonProperty("code") - public String getCode() { - return code; - } + /** + * Get code + * @return code + */ + @javax.annotation.Nonnull + public String getCode() { + return code; + } - @JsonProperty("earned") - public String getEarned() { - return earned; - } + public void setCode(String code) { + this.code = code; + } + public ReferralInfo earned(String earned) { + this.earned = earned; + return this; + } - @JsonProperty("condition") - public String getCondition() { - return condition; - } + /** + * Get earned + * @return earned + */ + @javax.annotation.Nonnull + public String getEarned() { + return earned; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReferralInfo && equalTo((ReferralInfo) other); - } + public void setEarned(String earned) { + this.earned = earned; + } + public ReferralInfo condition(String condition) { + this.condition = condition; + return this; + } - private boolean equalTo(ReferralInfo other) { - return code.equals(other.code) && earned.equals(other.earned) && condition.equals(other.condition); - } + /** + * Get condition + * @return condition + */ + @javax.annotation.Nonnull + public String getCondition() { + return condition; + } - @Override - public int hashCode() { - return Objects.hash(this.code, this.earned, this.condition); - } + public void setCondition(String condition) { + this.condition = condition; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static CodeStage builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface CodeStage { - EarnedStage code(String code); - - Builder from(ReferralInfo other); + if (o == null || getClass() != o.getClass()) { + return false; } + ReferralInfo referralInfo = (ReferralInfo) o; + return Objects.equals(this.code, referralInfo.code) && + Objects.equals(this.earned, referralInfo.earned) && + Objects.equals(this.condition, referralInfo.condition); + } - public interface EarnedStage { - ConditionStage earned(String earned); - } + @Override + public int hashCode() { + return Objects.hash(code, earned, condition); + } - public interface ConditionStage { - _FinalStage condition(String condition); - } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReferralInfo {\n"); + sb.append(" code: ").append(toIndentedString(code)).append("\n"); + sb.append(" earned: ").append(toIndentedString(earned)).append("\n"); + sb.append(" condition: ").append(toIndentedString(condition)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public interface _FinalStage { - ReferralInfo build(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements CodeStage, EarnedStage, ConditionStage, _FinalStage { - private String code; - private String earned; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private String condition; + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("code"); + openapiFields.add("earned"); + openapiFields.add("condition"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("code"); + openapiRequiredFields.add("earned"); + openapiRequiredFields.add("condition"); + } - @Override - public Builder from(ReferralInfo other) { - code(other.getCode()); - earned(other.getEarned()); - condition(other.getCondition()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReferralInfo + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReferralInfo.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReferralInfo is not found in the empty JSON string", ReferralInfo.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter("code") - public EarnedStage code(String code) { - this.code = code; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReferralInfo.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReferralInfo` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - @JsonSetter("earned") - public ConditionStage earned(String earned) { - this.earned = earned; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReferralInfo.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("earned").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `earned` to be a primitive type in the JSON string but got `%s`", jsonObj.get("earned").toString())); + } + if (!jsonObj.get("condition").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `condition` to be a primitive type in the JSON string but got `%s`", jsonObj.get("condition").toString())); + } + } - @Override - @JsonSetter("condition") - public _FinalStage condition(String condition) { - this.condition = condition; - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReferralInfo.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReferralInfo' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReferralInfo.class)); - @Override - public ReferralInfo build() { - return new ReferralInfo(code, earned, condition); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReferralInfo value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReferralInfo read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ReferralInfo given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReferralInfo + * @throws IOException if the JSON string is invalid with respect to ReferralInfo + */ + public static ReferralInfo fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReferralInfo.class); + } + + /** + * Convert an instance of ReferralInfo to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RenameAssetFolderDto.java b/src/main/java/com/squidex/api/types/RenameAssetFolderDto.java new file mode 100644 index 0000000..459deb7 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RenameAssetFolderDto.java @@ -0,0 +1,209 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * RenameAssetFolderDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RenameAssetFolderDto { + public static final String SERIALIZED_NAME_FOLDER_NAME = "folderName"; + @SerializedName(SERIALIZED_NAME_FOLDER_NAME) + private String folderName; + public RenameAssetFolderDto() { + } + public RenameAssetFolderDto folderName(String folderName) { + this.folderName = folderName; + return this; + } + + /** + * The name of the folder. + * @return folderName + */ + @javax.annotation.Nonnull + public String getFolderName() { + return folderName; + } + + public void setFolderName(String folderName) { + this.folderName = folderName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenameAssetFolderDto renameAssetFolderDto = (RenameAssetFolderDto) o; + return Objects.equals(this.folderName, renameAssetFolderDto.folderName); + } + + @Override + public int hashCode() { + return Objects.hash(folderName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenameAssetFolderDto {\n"); + sb.append(" folderName: ").append(toIndentedString(folderName)).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("folderName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("folderName"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RenameAssetFolderDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RenameAssetFolderDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RenameAssetFolderDto is not found in the empty JSON string", RenameAssetFolderDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RenameAssetFolderDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RenameAssetFolderDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RenameAssetFolderDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("folderName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `folderName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("folderName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RenameAssetFolderDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RenameAssetFolderDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RenameAssetFolderDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RenameAssetFolderDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RenameAssetFolderDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RenameAssetFolderDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RenameAssetFolderDto + * @throws IOException if the JSON string is invalid with respect to RenameAssetFolderDto + */ + public static RenameAssetFolderDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RenameAssetFolderDto.class); + } + + /** + * Convert an instance of RenameAssetFolderDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/RenameTagDto.java b/src/main/java/com/squidex/api/types/RenameTagDto.java new file mode 100644 index 0000000..c48e873 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RenameTagDto.java @@ -0,0 +1,209 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * RenameTagDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RenameTagDto { + public static final String SERIALIZED_NAME_TAG_NAME = "tagName"; + @SerializedName(SERIALIZED_NAME_TAG_NAME) + private String tagName; + public RenameTagDto() { + } + public RenameTagDto tagName(String tagName) { + this.tagName = tagName; + return this; + } + + /** + * The new name for the tag. + * @return tagName + */ + @javax.annotation.Nonnull + public String getTagName() { + return tagName; + } + + public void setTagName(String tagName) { + this.tagName = tagName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RenameTagDto renameTagDto = (RenameTagDto) o; + return Objects.equals(this.tagName, renameTagDto.tagName); + } + + @Override + public int hashCode() { + return Objects.hash(tagName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RenameTagDto {\n"); + sb.append(" tagName: ").append(toIndentedString(tagName)).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("tagName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("tagName"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RenameTagDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RenameTagDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RenameTagDto is not found in the empty JSON string", RenameTagDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RenameTagDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RenameTagDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RenameTagDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("tagName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `tagName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("tagName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RenameTagDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RenameTagDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RenameTagDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RenameTagDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RenameTagDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RenameTagDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RenameTagDto + * @throws IOException if the JSON string is invalid with respect to RenameTagDto + */ + public static RenameTagDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RenameTagDto.class); + } + + /** + * Convert an instance of RenameTagDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/ReorderFieldsDto.java b/src/main/java/com/squidex/api/types/ReorderFieldsDto.java index 0c68924..75de745 100644 --- a/src/main/java/com/squidex/api/types/ReorderFieldsDto.java +++ b/src/main/java/com/squidex/api/types/ReorderFieldsDto.java @@ -1,90 +1,222 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.ArrayList; +import java.util.Arrays; import java.util.List; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ReorderFieldsDto.Builder.class) -public final class ReorderFieldsDto { - private final List fieldIds; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private ReorderFieldsDto(List fieldIds) { - this.fieldIds = fieldIds; - } +import com.squidex.api.core.JSON; - /** - * @return The field ids in the target order. - */ - @JsonProperty("fieldIds") - public List getFieldIds() { - return fieldIds; +/** + * ReorderFieldsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ReorderFieldsDto { + public static final String SERIALIZED_NAME_FIELD_IDS = "fieldIds"; + @SerializedName(SERIALIZED_NAME_FIELD_IDS) + private List fieldIds = new ArrayList<>(); + public ReorderFieldsDto() { + } + public ReorderFieldsDto fieldIds(List fieldIds) { + this.fieldIds = fieldIds; + return this; + } + + public ReorderFieldsDto addFieldIdsItem(Long fieldIdsItem) { + if (this.fieldIds == null) { + this.fieldIds = new ArrayList<>(); } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ReorderFieldsDto && equalTo((ReorderFieldsDto) other); + this.fieldIds.add(fieldIdsItem); + return this; + } + + /** + * The field ids in the target order. + * @return fieldIds + */ + @javax.annotation.Nonnull + public List getFieldIds() { + return fieldIds; + } + + public void setFieldIds(List fieldIds) { + this.fieldIds = fieldIds; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - private boolean equalTo(ReorderFieldsDto other) { - return fieldIds.equals(other.fieldIds); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public int hashCode() { - return Objects.hash(this.fieldIds); + ReorderFieldsDto reorderFieldsDto = (ReorderFieldsDto) o; + return Objects.equals(this.fieldIds, reorderFieldsDto.fieldIds); + } + + @Override + public int hashCode() { + return Objects.hash(fieldIds); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReorderFieldsDto {\n"); + sb.append(" fieldIds: ").append(toIndentedString(fieldIds)).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"; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private List fieldIds = new ArrayList<>(); - - private Builder() {} - - public Builder from(ReorderFieldsDto other) { - fieldIds(other.getFieldIds()); - return this; - } - - @JsonSetter(value = "fieldIds", nulls = Nulls.SKIP) - public Builder fieldIds(List fieldIds) { - this.fieldIds.clear(); - this.fieldIds.addAll(fieldIds); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("fieldIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldIds"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ReorderFieldsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ReorderFieldsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ReorderFieldsDto is not found in the empty JSON string", ReorderFieldsDto.openapiRequiredFields.toString())); } + } - public Builder addFieldIds(Integer fieldIds) { - this.fieldIds.add(fieldIds); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ReorderFieldsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ReorderFieldsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder addAllFieldIds(List fieldIds) { - this.fieldIds.addAll(fieldIds); - return this; - } - - public ReorderFieldsDto build() { - return new ReorderFieldsDto(fieldIds); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ReorderFieldsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 required json array is present + if (jsonObj.get("fieldIds") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("fieldIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldIds` to be an array in the JSON string but got `%s`", jsonObj.get("fieldIds").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ReorderFieldsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ReorderFieldsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ReorderFieldsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ReorderFieldsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ReorderFieldsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ReorderFieldsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ReorderFieldsDto + * @throws IOException if the JSON string is invalid with respect to ReorderFieldsDto + */ + public static ReorderFieldsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ReorderFieldsDto.class); + } + + /** + * Convert an instance of ReorderFieldsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ResizeMode.java b/src/main/java/com/squidex/api/types/ResizeMode.java index 8e685b5..ffaced4 100644 --- a/src/main/java/com/squidex/api/types/ResizeMode.java +++ b/src/main/java/com/squidex/api/types/ResizeMode.java @@ -1,34 +1,88 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; -public enum ResizeMode { - CROP("Crop"), +package com.squidex.api.types; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; - CROP_UPSIZE("CropUpsize"), +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; - PAD("Pad"), +/** + * + */ +@JsonAdapter(ResizeMode.Adapter.class) +public enum ResizeMode { + + CROP("Crop"), + + CROP_UPSIZE("CropUpsize"), + + PAD("Pad"), + + BOX_PAD("BoxPad"), + + MAX("Max"), + + MIN("Min"), + + STRETCH("Stretch"); - BOX_PAD("BoxPad"), + private String value; - MAX("Max"), + ResizeMode(String value) { + this.value = value; + } - MIN("Min"), + public String getValue() { + return value; + } - STRETCH("Stretch"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static ResizeMode fromValue(String value) { + for (ResizeMode b : ResizeMode.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - ResizeMode(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final ResizeMode enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public ResizeMode read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return ResizeMode.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + ResizeMode.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/Resource.java b/src/main/java/com/squidex/api/types/Resource.java index c390d63..a80366d 100644 --- a/src/main/java/com/squidex/api/types/Resource.java +++ b/src/main/java/com/squidex/api/types/Resource.java @@ -1,91 +1,217 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = Resource.Builder.class) -public final class Resource implements IResource { - private final Map links; +package com.squidex.api.types; - private Resource(Map links) { - this.links = links; - } +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.squidex.api.types.ResourceLink; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Resource && equalTo((Resource) other); - } +import com.squidex.api.core.JSON; - private boolean equalTo(Resource other) { - return links.equals(other.links); +/** + * Resource + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class Resource { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public Resource() { + } + public Resource links(Map links) { + this.links = links; + return this; + } + + public Resource putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - @Override - public int hashCode() { - return Objects.hash(this.links); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static Builder builder() { - return new Builder(); + Resource resource = (Resource) o; + return Objects.equals(this.links, resource.links); + } + + @Override + public int hashCode() { + return Objects.hash(links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Resource {\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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(Resource other) { - links(other.getLinks()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + 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 Resource + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!Resource.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in Resource is not found in the empty JSON string", Resource.openapiRequiredFields.toString())); } + } - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!Resource.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `Resource` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : Resource.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 Resource build() { - return new Resource(links); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!Resource.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'Resource' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(Resource.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, Resource value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public Resource read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of Resource given an JSON string + * + * @param jsonString JSON string + * @return An instance of Resource + * @throws IOException if the JSON string is invalid with respect to Resource + */ + public static Resource fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, Resource.class); + } + + /** + * Convert an instance of Resource to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ResourceLink.java b/src/main/java/com/squidex/api/types/ResourceLink.java index e78e9d5..884cd91 100644 --- a/src/main/java/com/squidex/api/types/ResourceLink.java +++ b/src/main/java/com/squidex/api/types/ResourceLink.java @@ -1,159 +1,274 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ResourceLink.Builder.class) -public final class ResourceLink { - private final String href; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final String method; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final Optional metadata; +import com.squidex.api.core.JSON; - private ResourceLink(String href, String method, Optional metadata) { - this.href = href; - this.method = method; - this.metadata = metadata; - } +/** + * ResourceLink + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ResourceLink { + public static final String SERIALIZED_NAME_HREF = "href"; + @SerializedName(SERIALIZED_NAME_HREF) + private String href; + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + private String method; + public static final String SERIALIZED_NAME_METADATA = "metadata"; + @SerializedName(SERIALIZED_NAME_METADATA) + private String metadata; + public ResourceLink() { + } + public ResourceLink href(String href) { + this.href = href; + return this; + } - /** - * @return The link url. - */ - @JsonProperty("href") - public String getHref() { - return href; - } + /** + * The link url. + * @return href + */ + @javax.annotation.Nonnull + public String getHref() { + return href; + } - /** - * @return The link method. - */ - @JsonProperty("method") - public String getMethod() { - return method; - } + public void setHref(String href) { + this.href = href; + } + public ResourceLink method(String method) { + this.method = method; + return this; + } - /** - * @return Additional data about the link. - */ - @JsonProperty("metadata") - public Optional getMetadata() { - return metadata; - } + /** + * The link method. + * @return method + */ + @javax.annotation.Nonnull + public String getMethod() { + return method; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ResourceLink && equalTo((ResourceLink) other); - } + public void setMethod(String method) { + this.method = method; + } + public ResourceLink metadata(String metadata) { + this.metadata = metadata; + return this; + } - private boolean equalTo(ResourceLink other) { - return href.equals(other.href) && method.equals(other.method) && metadata.equals(other.metadata); - } + /** + * Additional data about the link. + * @return metadata + */ + @javax.annotation.Nullable + public String getMetadata() { + return metadata; + } - @Override - public int hashCode() { - return Objects.hash(this.href, this.method, this.metadata); - } + public void setMetadata(String metadata) { + this.metadata = metadata; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static HrefStage builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + ResourceLink resourceLink = (ResourceLink) o; + return Objects.equals(this.href, resourceLink.href) && + Objects.equals(this.method, resourceLink.method) && + Objects.equals(this.metadata, resourceLink.metadata); + } - public interface HrefStage { - MethodStage href(String href); + 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())); + } - Builder from(ResourceLink other); - } + @Override + public int hashCode() { + return Objects.hash(href, method, metadata); + } - public interface MethodStage { - _FinalStage method(String method); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - public interface _FinalStage { - ResourceLink build(); - - _FinalStage metadata(Optional metadata); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResourceLink {\n"); + sb.append(" href: ").append(toIndentedString(href)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append("}"); + return sb.toString(); + } - _FinalStage metadata(String metadata); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements HrefStage, MethodStage, _FinalStage { - private String href; - private String method; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Optional metadata = Optional.empty(); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("href"); + openapiFields.add("method"); + openapiFields.add("metadata"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("href"); + openapiRequiredFields.add("method"); + } - @Override - public Builder from(ResourceLink other) { - href(other.getHref()); - method(other.getMethod()); - metadata(other.getMetadata()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ResourceLink + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResourceLink.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResourceLink is not found in the empty JSON string", ResourceLink.openapiRequiredFields.toString())); } + } - /** - *

The link url.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("href") - public MethodStage href(String href) { - this.href = href; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResourceLink.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResourceLink` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The link method.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("method") - public _FinalStage method(String method) { - this.method = method; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ResourceLink.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + if (!jsonObj.get("method").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `method` to be a primitive type in the JSON string but got `%s`", jsonObj.get("method").toString())); + } + if ((jsonObj.get("metadata") != null && !jsonObj.get("metadata").isJsonNull()) && !jsonObj.get("metadata").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `metadata` to be a primitive type in the JSON string but got `%s`", jsonObj.get("metadata").toString())); + } + } - /** - *

Additional data about the link.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage metadata(String metadata) { - this.metadata = Optional.of(metadata); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResourceLink.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResourceLink' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResourceLink.class)); - @Override - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResourceLink value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public ResourceLink build() { - return new ResourceLink(href, method, metadata); - } + @Override + public ResourceLink read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ResourceLink given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResourceLink + * @throws IOException if the JSON string is invalid with respect to ResourceLink + */ + public static ResourceLink fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResourceLink.class); + } + + /** + * Convert an instance of ResourceLink to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ResourcesDto.java b/src/main/java/com/squidex/api/types/ResourcesDto.java index 68b3eec..d94e28a 100644 --- a/src/main/java/com/squidex/api/types/ResourcesDto.java +++ b/src/main/java/com/squidex/api/types/ResourcesDto.java @@ -1,91 +1,217 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ResourcesDto.Builder.class) -public final class ResourcesDto implements IResource { - private final Map links; +package com.squidex.api.types; - private ResourcesDto(Map links) { - this.links = links; - } +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.squidex.api.types.ResourceLink; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ResourcesDto && equalTo((ResourcesDto) other); - } +import com.squidex.api.core.JSON; - private boolean equalTo(ResourcesDto other) { - return links.equals(other.links); +/** + * ResourcesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ResourcesDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public ResourcesDto() { + } + public ResourcesDto links(Map links) { + this.links = links; + return this; + } + + public ResourcesDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - @Override - public int hashCode() { - return Objects.hash(this.links); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static Builder builder() { - return new Builder(); + ResourcesDto resourcesDto = (ResourcesDto) o; + return Objects.equals(this.links, resourcesDto.links); + } + + @Override + public int hashCode() { + return Objects.hash(links); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ResourcesDto {\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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - public Builder from(ResourcesDto other) { - links(other.getLinks()); - return this; - } - - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + 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 ResourcesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ResourcesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ResourcesDto is not found in the empty JSON string", ResourcesDto.openapiRequiredFields.toString())); } + } - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ResourcesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ResourcesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ResourcesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 ResourcesDto build() { - return new ResourcesDto(links); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ResourcesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ResourcesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ResourcesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ResourcesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ResourcesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ResourcesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ResourcesDto + * @throws IOException if the JSON string is invalid with respect to ResourcesDto + */ + public static ResourcesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ResourcesDto.class); + } + + /** + * Convert an instance of ResourcesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RestoreJobDto.java b/src/main/java/com/squidex/api/types/RestoreJobDto.java index 5e5c11e..e65f119 100644 --- a/src/main/java/com/squidex/api/types/RestoreJobDto.java +++ b/src/main/java/com/squidex/api/types/RestoreJobDto.java @@ -1,244 +1,337 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.JobStatus; +import java.io.IOException; +import java.net.URI; import java.time.OffsetDateTime; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RestoreJobDto.Builder.class) -public final class RestoreJobDto { - private final String url; - - private final List log; - - private final OffsetDateTime started; - - private final Optional stopped; - - private final JobStatus status; - - private RestoreJobDto( - String url, List log, OffsetDateTime started, Optional stopped, JobStatus status) { - this.url = url; - this.log = log; - this.started = started; - this.stopped = stopped; - this.status = status; - } - - /** - * @return The uri to load from. - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - /** - * @return The status log. - */ - @JsonProperty("log") - public List getLog() { - return log; - } - - /** - * @return The time when the job has been started. - */ - @JsonProperty("started") - public OffsetDateTime getStarted() { - return started; - } - - /** - * @return The time when the job has been stopped. - */ - @JsonProperty("stopped") - public Optional getStopped() { - return stopped; - } - - /** - * @return The status of the operation. - */ - @JsonProperty("status") - public JobStatus getStatus() { - return status; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RestoreJobDto && equalTo((RestoreJobDto) other); - } - - private boolean equalTo(RestoreJobDto other) { - return url.equals(other.url) - && log.equals(other.log) - && started.equals(other.started) - && stopped.equals(other.stopped) - && status.equals(other.status); - } - - @Override - public int hashCode() { - return Objects.hash(this.url, this.log, this.started, this.stopped, this.status); - } +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; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +import com.squidex.api.core.JSON; - public static UrlStage builder() { - return new Builder(); +/** + * RestoreJobDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RestoreJobDto { + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private URI url; + public static final String SERIALIZED_NAME_LOG = "log"; + @SerializedName(SERIALIZED_NAME_LOG) + private List log = new ArrayList<>(); + public static final String SERIALIZED_NAME_STARTED = "started"; + @SerializedName(SERIALIZED_NAME_STARTED) + private OffsetDateTime started; + public static final String SERIALIZED_NAME_STOPPED = "stopped"; + @SerializedName(SERIALIZED_NAME_STOPPED) + private OffsetDateTime stopped; + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private JobStatus status; + public RestoreJobDto() { + } + public RestoreJobDto url(URI url) { + this.url = url; + return this; + } + + /** + * The uri to load from. + * @return url + */ + @javax.annotation.Nonnull + public URI getUrl() { + return url; + } + + public void setUrl(URI url) { + this.url = url; + } + public RestoreJobDto log(List log) { + this.log = log; + return this; + } + + public RestoreJobDto addLogItem(String logItem) { + if (this.log == null) { + this.log = new ArrayList<>(); } - - public interface UrlStage { - StartedStage url(String url); - - Builder from(RestoreJobDto other); + this.log.add(logItem); + return this; + } + + /** + * The status log. + * @return log + */ + @javax.annotation.Nonnull + public List getLog() { + return log; + } + + public void setLog(List log) { + this.log = log; + } + public RestoreJobDto started(OffsetDateTime started) { + this.started = started; + return this; + } + + /** + * The time when the job has been started. + * @return started + */ + @javax.annotation.Nonnull + public OffsetDateTime getStarted() { + return started; + } + + public void setStarted(OffsetDateTime started) { + this.started = started; + } + public RestoreJobDto stopped(OffsetDateTime stopped) { + this.stopped = stopped; + return this; + } + + /** + * The time when the job has been stopped. + * @return stopped + */ + @javax.annotation.Nullable + public OffsetDateTime getStopped() { + return stopped; + } + + public void setStopped(OffsetDateTime stopped) { + this.stopped = stopped; + } + public RestoreJobDto status(JobStatus status) { + this.status = status; + return this; + } + + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public JobStatus getStatus() { + return status; + } + + public void setStatus(JobStatus status) { + this.status = status; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface StartedStage { - StatusStage started(OffsetDateTime started); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface StatusStage { - _FinalStage status(JobStatus status); + RestoreJobDto restoreJobDto = (RestoreJobDto) o; + return Objects.equals(this.url, restoreJobDto.url) && + Objects.equals(this.log, restoreJobDto.log) && + Objects.equals(this.started, restoreJobDto.started) && + Objects.equals(this.stopped, restoreJobDto.stopped) && + Objects.equals(this.status, restoreJobDto.status); + } + + 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(url, log, started, stopped, status); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - RestoreJobDto build(); - - _FinalStage log(List log); - - _FinalStage addLog(String log); - - _FinalStage addAllLog(List log); - - _FinalStage stopped(Optional stopped); - - _FinalStage stopped(OffsetDateTime stopped); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RestoreJobDto {\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" log: ").append(toIndentedString(log)).append("\n"); + sb.append(" started: ").append(toIndentedString(started)).append("\n"); + sb.append(" stopped: ").append(toIndentedString(stopped)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UrlStage, StartedStage, StatusStage, _FinalStage { - private String url; - - private OffsetDateTime started; - - private JobStatus status; - - private Optional stopped = Optional.empty(); - - private List log = new ArrayList<>(); - - private Builder() {} - - @Override - public Builder from(RestoreJobDto other) { - url(other.getUrl()); - log(other.getLog()); - started(other.getStarted()); - stopped(other.getStopped()); - status(other.getStatus()); - return this; - } - - /** - *

The uri to load from.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public StartedStage url(String url) { - this.url = url; - return this; - } - - /** - *

The time when the job has been started.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("started") - public StatusStage started(OffsetDateTime started) { - this.started = started; - return this; - } - - /** - *

The status of the operation.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public _FinalStage status(JobStatus status) { - this.status = status; - return this; - } - - /** - *

The time when the job has been stopped.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage stopped(OffsetDateTime stopped) { - this.stopped = Optional.of(stopped); - return this; - } - - @Override - @JsonSetter(value = "stopped", nulls = Nulls.SKIP) - public _FinalStage stopped(Optional stopped) { - this.stopped = stopped; - return this; - } - - /** - *

The status log.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllLog(List log) { - this.log.addAll(log); - return this; - } - - /** - *

The status log.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addLog(String log) { - this.log.add(log); - return this; + return o.toString().replace("\n", "\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("log"); + openapiFields.add("started"); + openapiFields.add("stopped"); + openapiFields.add("status"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + openapiRequiredFields.add("log"); + openapiRequiredFields.add("started"); + 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 RestoreJobDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RestoreJobDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RestoreJobDto is not found in the empty JSON string", RestoreJobDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "log", nulls = Nulls.SKIP) - public _FinalStage log(List log) { - this.log.clear(); - this.log.addAll(log); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RestoreJobDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RestoreJobDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public RestoreJobDto build() { - return new RestoreJobDto(url, log, started, stopped, status); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RestoreJobDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("log") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("log").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `log` to be an array in the JSON string but got `%s`", jsonObj.get("log").toString())); + } + // validate the required field `status` + JobStatus.validateJsonElement(jsonObj.get("status")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RestoreJobDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RestoreJobDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RestoreJobDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RestoreJobDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RestoreJobDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of RestoreJobDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RestoreJobDto + * @throws IOException if the JSON string is invalid with respect to RestoreJobDto + */ + public static RestoreJobDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RestoreJobDto.class); + } + + /** + * Convert an instance of RestoreJobDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RestoreRequestDto.java b/src/main/java/com/squidex/api/types/RestoreRequestDto.java new file mode 100644 index 0000000..babd8b6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RestoreRequestDto.java @@ -0,0 +1,248 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.net.URI; +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.squidex.api.core.JSON; + +/** + * RestoreRequestDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RestoreRequestDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private URI url; + public RestoreRequestDto() { + } + public RestoreRequestDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the app. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public RestoreRequestDto url(URI url) { + this.url = url; + return this; + } + + /** + * The url to the restore file. + * @return url + */ + @javax.annotation.Nonnull + public URI getUrl() { + return url; + } + + public void setUrl(URI url) { + this.url = url; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RestoreRequestDto restoreRequestDto = (RestoreRequestDto) o; + return Objects.equals(this.name, restoreRequestDto.name) && + Objects.equals(this.url, restoreRequestDto.url); + } + + 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(name, url); + } + + 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 RestoreRequestDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).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("url"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RestoreRequestDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RestoreRequestDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RestoreRequestDto is not found in the empty JSON string", RestoreRequestDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RestoreRequestDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RestoreRequestDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RestoreRequestDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!RestoreRequestDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RestoreRequestDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RestoreRequestDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RestoreRequestDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RestoreRequestDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RestoreRequestDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RestoreRequestDto + * @throws IOException if the JSON string is invalid with respect to RestoreRequestDto + */ + public static RestoreRequestDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RestoreRequestDto.class); + } + + /** + * Convert an instance of RestoreRequestDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/RichTextFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/RichTextFieldPropertiesDto.java new file mode 100644 index 0000000..a0d7626 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RichTextFieldPropertiesDto.java @@ -0,0 +1,431 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.FieldPropertiesDto; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +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.squidex.api.core.JSON; + +/** + * RichTextFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RichTextFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_FOLDER_ID = "folderId"; + @SerializedName(SERIALIZED_NAME_FOLDER_ID) + private String folderId; + public static final String SERIALIZED_NAME_MIN_LENGTH = "minLength"; + @SerializedName(SERIALIZED_NAME_MIN_LENGTH) + private Integer minLength; + public static final String SERIALIZED_NAME_MAX_LENGTH = "maxLength"; + @SerializedName(SERIALIZED_NAME_MAX_LENGTH) + private Integer maxLength; + public static final String SERIALIZED_NAME_MIN_CHARACTERS = "minCharacters"; + @SerializedName(SERIALIZED_NAME_MIN_CHARACTERS) + private Integer minCharacters; + public static final String SERIALIZED_NAME_MAX_CHARACTERS = "maxCharacters"; + @SerializedName(SERIALIZED_NAME_MAX_CHARACTERS) + private Integer maxCharacters; + public static final String SERIALIZED_NAME_MIN_WORDS = "minWords"; + @SerializedName(SERIALIZED_NAME_MIN_WORDS) + private Integer minWords; + public static final String SERIALIZED_NAME_MAX_WORDS = "maxWords"; + @SerializedName(SERIALIZED_NAME_MAX_WORDS) + private Integer maxWords; + public static final String SERIALIZED_NAME_CLASS_NAMES = "classNames"; + @SerializedName(SERIALIZED_NAME_CLASS_NAMES) + private List classNames; + public static final String SERIALIZED_NAME_SCHEMA_IDS = "schemaIds"; + @SerializedName(SERIALIZED_NAME_SCHEMA_IDS) + private List schemaIds; + public RichTextFieldPropertiesDto() { + } + public RichTextFieldPropertiesDto folderId(String folderId) { + this.folderId = folderId; + return this; + } + + /** + * The initial id to the folder when the control supports file uploads. + * @return folderId + */ + @javax.annotation.Nullable + public String getFolderId() { + return folderId; + } + + public void setFolderId(String folderId) { + this.folderId = folderId; + } + public RichTextFieldPropertiesDto minLength(Integer minLength) { + this.minLength = minLength; + return this; + } + + /** + * The minimum allowed length for the field value. + * @return minLength + */ + @javax.annotation.Nullable + public Integer getMinLength() { + return minLength; + } + + public void setMinLength(Integer minLength) { + this.minLength = minLength; + } + public RichTextFieldPropertiesDto maxLength(Integer maxLength) { + this.maxLength = maxLength; + return this; + } + + /** + * The maximum allowed length for the field value. + * @return maxLength + */ + @javax.annotation.Nullable + public Integer getMaxLength() { + return maxLength; + } + + public void setMaxLength(Integer maxLength) { + this.maxLength = maxLength; + } + public RichTextFieldPropertiesDto minCharacters(Integer minCharacters) { + this.minCharacters = minCharacters; + return this; + } + + /** + * The minimum allowed of normal characters for the field value. + * @return minCharacters + */ + @javax.annotation.Nullable + public Integer getMinCharacters() { + return minCharacters; + } + + public void setMinCharacters(Integer minCharacters) { + this.minCharacters = minCharacters; + } + public RichTextFieldPropertiesDto maxCharacters(Integer maxCharacters) { + this.maxCharacters = maxCharacters; + return this; + } + + /** + * The maximum allowed of normal characters for the field value. + * @return maxCharacters + */ + @javax.annotation.Nullable + public Integer getMaxCharacters() { + return maxCharacters; + } + + public void setMaxCharacters(Integer maxCharacters) { + this.maxCharacters = maxCharacters; + } + public RichTextFieldPropertiesDto minWords(Integer minWords) { + this.minWords = minWords; + return this; + } + + /** + * The minimum allowed number of words for the field value. + * @return minWords + */ + @javax.annotation.Nullable + public Integer getMinWords() { + return minWords; + } + + public void setMinWords(Integer minWords) { + this.minWords = minWords; + } + public RichTextFieldPropertiesDto maxWords(Integer maxWords) { + this.maxWords = maxWords; + return this; + } + + /** + * The maximum allowed number of words for the field value. + * @return maxWords + */ + @javax.annotation.Nullable + public Integer getMaxWords() { + return maxWords; + } + + public void setMaxWords(Integer maxWords) { + this.maxWords = maxWords; + } + public RichTextFieldPropertiesDto classNames(List classNames) { + this.classNames = classNames; + return this; + } + + public RichTextFieldPropertiesDto addClassNamesItem(String classNamesItem) { + if (this.classNames == null) { + this.classNames = new ArrayList<>(); + } + this.classNames.add(classNamesItem); + return this; + } + + /** + * The class names for the editor. + * @return classNames + */ + @javax.annotation.Nullable + public List getClassNames() { + return classNames; + } + + public void setClassNames(List classNames) { + this.classNames = classNames; + } + public RichTextFieldPropertiesDto schemaIds(List schemaIds) { + this.schemaIds = schemaIds; + return this; + } + + public RichTextFieldPropertiesDto addSchemaIdsItem(String schemaIdsItem) { + if (this.schemaIds == null) { + this.schemaIds = new ArrayList<>(); + } + this.schemaIds.add(schemaIdsItem); + return this; + } + + /** + * The allowed schema ids that can be embedded. + * @return schemaIds + */ + @javax.annotation.Nullable + public List getSchemaIds() { + return schemaIds; + } + + public void setSchemaIds(List schemaIds) { + this.schemaIds = schemaIds; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RichTextFieldPropertiesDto richTextFieldPropertiesDto = (RichTextFieldPropertiesDto) o; + return Objects.equals(this.folderId, richTextFieldPropertiesDto.folderId) && + Objects.equals(this.minLength, richTextFieldPropertiesDto.minLength) && + Objects.equals(this.maxLength, richTextFieldPropertiesDto.maxLength) && + Objects.equals(this.minCharacters, richTextFieldPropertiesDto.minCharacters) && + Objects.equals(this.maxCharacters, richTextFieldPropertiesDto.maxCharacters) && + Objects.equals(this.minWords, richTextFieldPropertiesDto.minWords) && + Objects.equals(this.maxWords, richTextFieldPropertiesDto.maxWords) && + Objects.equals(this.classNames, richTextFieldPropertiesDto.classNames) && + Objects.equals(this.schemaIds, richTextFieldPropertiesDto.schemaIds) && + super.equals(o); + } + + 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(folderId, minLength, maxLength, minCharacters, maxCharacters, minWords, maxWords, classNames, schemaIds, super.hashCode()); + } + + 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 RichTextFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" folderId: ").append(toIndentedString(folderId)).append("\n"); + sb.append(" minLength: ").append(toIndentedString(minLength)).append("\n"); + sb.append(" maxLength: ").append(toIndentedString(maxLength)).append("\n"); + sb.append(" minCharacters: ").append(toIndentedString(minCharacters)).append("\n"); + sb.append(" maxCharacters: ").append(toIndentedString(maxCharacters)).append("\n"); + sb.append(" minWords: ").append(toIndentedString(minWords)).append("\n"); + sb.append(" maxWords: ").append(toIndentedString(maxWords)).append("\n"); + sb.append(" classNames: ").append(toIndentedString(classNames)).append("\n"); + sb.append(" schemaIds: ").append(toIndentedString(schemaIds)).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("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("folderId"); + openapiFields.add("minLength"); + openapiFields.add("maxLength"); + openapiFields.add("minCharacters"); + openapiFields.add("maxCharacters"); + openapiFields.add("minWords"); + openapiFields.add("maxWords"); + openapiFields.add("classNames"); + openapiFields.add("schemaIds"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RichTextFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RichTextFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RichTextFieldPropertiesDto is not found in the empty JSON string", RichTextFieldPropertiesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RichTextFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RichTextFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RichTextFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.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 (!RichTextFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RichTextFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RichTextFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RichTextFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RichTextFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RichTextFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RichTextFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to RichTextFieldPropertiesDto + */ + public static RichTextFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RichTextFieldPropertiesDto.class); + } + + /** + * Convert an instance of RichTextFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/RoleDto.java b/src/main/java/com/squidex/api/types/RoleDto.java index 058a2fb..e24977c 100644 --- a/src/main/java/com/squidex/api/types/RoleDto.java +++ b/src/main/java/com/squidex/api/types/RoleDto.java @@ -1,351 +1,388 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RoleDto.Builder.class) -public final class RoleDto implements IResource { - private final Map links; - - private final String name; - - private final int numClients; - - private final int numContributors; - - private final boolean isDefaultRole; - - private final List permissions; - - private final Map properties; - - private RoleDto( - Map links, - String name, - int numClients, - int numContributors, - boolean isDefaultRole, - List permissions, - Map properties) { - this.links = links; - this.name = name; - this.numClients = numClients; - this.numContributors = numContributors; - this.isDefaultRole = isDefaultRole; - this.permissions = permissions; - this.properties = properties; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The role name. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The number of clients with this role. - */ - @JsonProperty("numClients") - public int getNumClients() { - return numClients; - } - - /** - * @return The number of contributors with this role. - */ - @JsonProperty("numContributors") - public int getNumContributors() { - return numContributors; - } - /** - * @return Indicates if the role is an builtin default role. - */ - @JsonProperty("isDefaultRole") - public boolean getIsDefaultRole() { - return isDefaultRole; - } - - /** - * @return Associated list of permissions. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - /** - * @return Associated list of UI properties. - */ - @JsonProperty("properties") - public Map getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RoleDto && equalTo((RoleDto) other); - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private boolean equalTo(RoleDto other) { - return links.equals(other.links) - && name.equals(other.name) - && numClients == other.numClients - && numContributors == other.numContributors - && isDefaultRole == other.isDefaultRole - && permissions.equals(other.permissions) - && properties.equals(other.properties); - } +import com.squidex.api.core.JSON; - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.name, - this.numClients, - this.numContributors, - this.isDefaultRole, - this.permissions, - this.properties); +/** + * RoleDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RoleDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_NUM_CLIENTS = "numClients"; + @SerializedName(SERIALIZED_NAME_NUM_CLIENTS) + private Integer numClients; + public static final String SERIALIZED_NAME_NUM_CONTRIBUTORS = "numContributors"; + @SerializedName(SERIALIZED_NAME_NUM_CONTRIBUTORS) + private Integer numContributors; + public static final String SERIALIZED_NAME_IS_DEFAULT_ROLE = "isDefaultRole"; + @SerializedName(SERIALIZED_NAME_IS_DEFAULT_ROLE) + private Boolean isDefaultRole; + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private Map properties = new HashMap<>(); + public RoleDto() { + } + public RoleDto links(Map links) { + this.links = links; + return this; + } + + public RoleDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public RoleDto name(String name) { + this.name = name; + return this; + } + + /** + * The role name. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public RoleDto numClients(Integer numClients) { + this.numClients = numClients; + return this; + } + + /** + * The number of clients with this role. + * @return numClients + */ + @javax.annotation.Nonnull + public Integer getNumClients() { + return numClients; + } + + public void setNumClients(Integer numClients) { + this.numClients = numClients; + } + public RoleDto numContributors(Integer numContributors) { + this.numContributors = numContributors; + return this; + } + + /** + * The number of contributors with this role. + * @return numContributors + */ + @javax.annotation.Nonnull + public Integer getNumContributors() { + return numContributors; + } + + public void setNumContributors(Integer numContributors) { + this.numContributors = numContributors; + } + public RoleDto isDefaultRole(Boolean isDefaultRole) { + this.isDefaultRole = isDefaultRole; + return this; + } + + /** + * Indicates if the role is an builtin default role. + * @return isDefaultRole + */ + @javax.annotation.Nonnull + public Boolean getIsDefaultRole() { + return isDefaultRole; + } + + public void setIsDefaultRole(Boolean isDefaultRole) { + this.isDefaultRole = isDefaultRole; + } + public RoleDto permissions(List permissions) { + this.permissions = permissions; + return this; + } + + public RoleDto addPermissionsItem(String permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); } - - public static NameStage builder() { - return new Builder(); + this.permissions.add(permissionsItem); + return this; + } + + /** + * Associated list of permissions. + * @return permissions + */ + @javax.annotation.Nonnull + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + public RoleDto properties(Map properties) { + this.properties = properties; + return this; + } + + public RoleDto putPropertiesItem(String key, Object propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); } - - public interface NameStage { - NumClientsStage name(String name); - - Builder from(RoleDto other); + this.properties.put(key, propertiesItem); + return this; + } + + /** + * Associated list of UI properties. + * @return properties + */ + @javax.annotation.Nonnull + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface NumClientsStage { - NumContributorsStage numClients(int numClients); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface NumContributorsStage { - IsDefaultRoleStage numContributors(int numContributors); - } - - public interface IsDefaultRoleStage { - _FinalStage isDefaultRole(boolean isDefaultRole); + RoleDto roleDto = (RoleDto) o; + return Objects.equals(this.links, roleDto.links) && + Objects.equals(this.name, roleDto.name) && + Objects.equals(this.numClients, roleDto.numClients) && + Objects.equals(this.numContributors, roleDto.numContributors) && + Objects.equals(this.isDefaultRole, roleDto.isDefaultRole) && + Objects.equals(this.permissions, roleDto.permissions) && + Objects.equals(this.properties, roleDto.properties); + } + + @Override + public int hashCode() { + return Objects.hash(links, name, numClients, numContributors, isDefaultRole, permissions, properties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RoleDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" numClients: ").append(toIndentedString(numClients)).append("\n"); + sb.append(" numContributors: ").append(toIndentedString(numContributors)).append("\n"); + sb.append(" isDefaultRole: ").append(toIndentedString(isDefaultRole)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).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"; } - - public interface _FinalStage { - RoleDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage permissions(List permissions); - - _FinalStage addPermissions(String permissions); - - _FinalStage addAllPermissions(List permissions); - - _FinalStage properties(Map properties); - - _FinalStage putAllProperties(Map properties); - - _FinalStage properties(String key, Object value); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements NameStage, NumClientsStage, NumContributorsStage, IsDefaultRoleStage, _FinalStage { - private String name; - - private int numClients; - - private int numContributors; - - private boolean isDefaultRole; - - private Map properties = new LinkedHashMap<>(); - - private List permissions = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(RoleDto other) { - links(other.getLinks()); - name(other.getName()); - numClients(other.getNumClients()); - numContributors(other.getNumContributors()); - isDefaultRole(other.getIsDefaultRole()); - permissions(other.getPermissions()); - properties(other.getProperties()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("name"); + openapiFields.add("numClients"); + openapiFields.add("numContributors"); + openapiFields.add("isDefaultRole"); + openapiFields.add("permissions"); + openapiFields.add("properties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("numClients"); + openapiRequiredFields.add("numContributors"); + openapiRequiredFields.add("isDefaultRole"); + openapiRequiredFields.add("permissions"); + openapiRequiredFields.add("properties"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RoleDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RoleDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RoleDto is not found in the empty JSON string", RoleDto.openapiRequiredFields.toString())); } + } - /** - *

The role name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public NumClientsStage name(String name) { - this.name = name; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RoleDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RoleDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The number of clients with this role.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("numClients") - public NumContributorsStage numClients(int numClients) { - this.numClients = numClients; - return this; - } - - /** - *

The number of contributors with this role.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("numContributors") - public IsDefaultRoleStage numContributors(int numContributors) { - this.numContributors = numContributors; - return this; - } - - /** - *

Indicates if the role is an builtin default role.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isDefaultRole") - public _FinalStage isDefaultRole(boolean isDefaultRole) { - this.isDefaultRole = isDefaultRole; - return this; - } - - /** - *

Associated list of UI properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage properties(String key, Object value) { - this.properties.put(key, value); - return this; - } - - /** - *

Associated list of UI properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllProperties(Map properties) { - this.properties.putAll(properties); - return this; - } - - @Override - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public _FinalStage properties(Map properties) { - this.properties.clear(); - this.properties.putAll(properties); - return this; - } - - /** - *

Associated list of permissions.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - /** - *

Associated list of permissions.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - @Override - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public _FinalStage permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public RoleDto build() { - return new RoleDto(links, name, numClients, numContributors, isDefaultRole, permissions, properties); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RoleDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 required json array is present + if (jsonObj.get("permissions") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("permissions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be an array in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RoleDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RoleDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RoleDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RoleDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RoleDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of RoleDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RoleDto + * @throws IOException if the JSON string is invalid with respect to RoleDto + */ + public static RoleDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RoleDto.class); + } + + /** + * Convert an instance of RoleDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RolesDto.java b/src/main/java/com/squidex/api/types/RolesDto.java index a434605..598d390 100644 --- a/src/main/java/com/squidex/api/types/RolesDto.java +++ b/src/main/java/com/squidex/api/types/RolesDto.java @@ -1,124 +1,262 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.RoleDto; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RolesDto.Builder.class) -public final class RolesDto implements IResource { - private final Map links; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final List items; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private RolesDto(Map links, List items) { - this.links = links; - this.items = items; - } +import com.squidex.api.core.JSON; - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } +/** + * RolesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RolesDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public RolesDto() { + } + public RolesDto links(Map links) { + this.links = links; + return this; + } - /** - * @return The roles. - */ - @JsonProperty("items") - public List getItems() { - return items; + public RolesDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } + this.links.put(key, linksItem); + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RolesDto && equalTo((RolesDto) other); - } + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } - private boolean equalTo(RolesDto other) { - return links.equals(other.links) && items.equals(other.items); - } + public void setLinks(Map links) { + this.links = links; + } + public RolesDto items(List items) { + this.items = items; + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); + public RolesDto addItemsItem(RoleDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } + this.items.add(itemsItem); + return this; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + /** + * The roles. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + RolesDto rolesDto = (RolesDto) o; + return Objects.equals(this.links, rolesDto.links) && + Objects.equals(this.items, rolesDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, items); + } - public static Builder builder() { - return new Builder(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RolesDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - private List items = new ArrayList<>(); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Builder() {} + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("items"); - public Builder from(RolesDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + } - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RolesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RolesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RolesDto is not found in the empty JSON string", RolesDto.openapiRequiredFields.toString())); } + } - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RolesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RolesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RolesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + RoleDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } - public Builder addItems(RoleDto items) { - this.items.add(items); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RolesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RolesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RolesDto.class)); - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RolesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public RolesDto build() { - return new RolesDto(links, items); - } + @Override + public RolesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of RolesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RolesDto + * @throws IOException if the JSON string is invalid with respect to RolesDto + */ + public static RolesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RolesDto.class); + } + + /** + * Convert an instance of RolesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RuleActionDto.java b/src/main/java/com/squidex/api/types/RuleActionDto.java index ca106dc..bf8b05e 100644 --- a/src/main/java/com/squidex/api/types/RuleActionDto.java +++ b/src/main/java/com/squidex/api/types/RuleActionDto.java @@ -1,1159 +1,201 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import com.fasterxml.jackson.annotation.JsonValue; -import java.util.Objects; -import java.util.Optional; - -public final class RuleActionDto { - private final Value value; - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - private RuleActionDto(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static RuleActionDto algolia(AlgoliaRuleActionDto value) { - return new RuleActionDto(new AlgoliaValue(value)); - } - - public static RuleActionDto azureQueue(AzureQueueRuleActionDto value) { - return new RuleActionDto(new AzureQueueValue(value)); - } - - public static RuleActionDto comment(CommentRuleActionDto value) { - return new RuleActionDto(new CommentValue(value)); - } - - public static RuleActionDto createContent(CreateContentRuleActionDto value) { - return new RuleActionDto(new CreateContentValue(value)); - } - - public static RuleActionDto deepDetect(DeepDetectRuleActionDto value) { - return new RuleActionDto(new DeepDetectValue(value)); - } - - public static RuleActionDto discourse(DiscourseRuleActionDto value) { - return new RuleActionDto(new DiscourseValue(value)); - } - - public static RuleActionDto elasticSearch(ElasticSearchRuleActionDto value) { - return new RuleActionDto(new ElasticSearchValue(value)); - } - - public static RuleActionDto email(EmailRuleActionDto value) { - return new RuleActionDto(new EmailValue(value)); - } - - public static RuleActionDto fastly(FastlyRuleActionDto value) { - return new RuleActionDto(new FastlyValue(value)); - } - - public static RuleActionDto medium(MediumRuleActionDto value) { - return new RuleActionDto(new MediumValue(value)); - } - - public static RuleActionDto notification(NotificationRuleActionDto value) { - return new RuleActionDto(new NotificationValue(value)); - } - - public static RuleActionDto openSearch(OpenSearchRuleActionDto value) { - return new RuleActionDto(new OpenSearchValue(value)); - } - - public static RuleActionDto prerender(PrerenderRuleActionDto value) { - return new RuleActionDto(new PrerenderValue(value)); - } - - public static RuleActionDto script(ScriptRuleActionDto value) { - return new RuleActionDto(new ScriptValue(value)); - } - - public static RuleActionDto signalR(SignalRRuleActionDto value) { - return new RuleActionDto(new SignalRValue(value)); - } - - public static RuleActionDto slack(SlackRuleActionDto value) { - return new RuleActionDto(new SlackValue(value)); - } - - public static RuleActionDto tweet(TweetRuleActionDto value) { - return new RuleActionDto(new TweetValue(value)); - } - - public static RuleActionDto typesense(TypesenseRuleActionDto value) { - return new RuleActionDto(new TypesenseValue(value)); - } - - public static RuleActionDto webhook(WebhookRuleActionDto value) { - return new RuleActionDto(new WebhookValue(value)); - } - - public boolean isAlgolia() { - return value instanceof AlgoliaValue; - } - - public boolean isAzureQueue() { - return value instanceof AzureQueueValue; - } - - public boolean isComment() { - return value instanceof CommentValue; - } - - public boolean isCreateContent() { - return value instanceof CreateContentValue; - } - - public boolean isDeepDetect() { - return value instanceof DeepDetectValue; - } - - public boolean isDiscourse() { - return value instanceof DiscourseValue; - } - - public boolean isElasticSearch() { - return value instanceof ElasticSearchValue; - } - - public boolean isEmail() { - return value instanceof EmailValue; - } - - public boolean isFastly() { - return value instanceof FastlyValue; - } - - public boolean isMedium() { - return value instanceof MediumValue; - } - - public boolean isNotification() { - return value instanceof NotificationValue; - } - - public boolean isOpenSearch() { - return value instanceof OpenSearchValue; - } - - public boolean isPrerender() { - return value instanceof PrerenderValue; - } - - public boolean isScript() { - return value instanceof ScriptValue; - } - - public boolean isSignalR() { - return value instanceof SignalRValue; - } - - public boolean isSlack() { - return value instanceof SlackValue; - } - - public boolean isTweet() { - return value instanceof TweetValue; - } - - public boolean isTypesense() { - return value instanceof TypesenseValue; - } - - public boolean isWebhook() { - return value instanceof WebhookValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getAlgolia() { - if (isAlgolia()) { - return Optional.of(((AlgoliaValue) value).value); - } - return Optional.empty(); - } - - public Optional getAzureQueue() { - if (isAzureQueue()) { - return Optional.of(((AzureQueueValue) value).value); - } - return Optional.empty(); - } - - public Optional getComment() { - if (isComment()) { - return Optional.of(((CommentValue) value).value); - } - return Optional.empty(); - } - - public Optional getCreateContent() { - if (isCreateContent()) { - return Optional.of(((CreateContentValue) value).value); - } - return Optional.empty(); - } - - public Optional getDeepDetect() { - if (isDeepDetect()) { - return Optional.of(((DeepDetectValue) value).value); - } - return Optional.empty(); - } - - public Optional getDiscourse() { - if (isDiscourse()) { - return Optional.of(((DiscourseValue) value).value); - } - return Optional.empty(); - } - - public Optional getElasticSearch() { - if (isElasticSearch()) { - return Optional.of(((ElasticSearchValue) value).value); - } - return Optional.empty(); - } - - public Optional getEmail() { - if (isEmail()) { - return Optional.of(((EmailValue) value).value); - } - return Optional.empty(); - } - - public Optional getFastly() { - if (isFastly()) { - return Optional.of(((FastlyValue) value).value); - } - return Optional.empty(); - } - - public Optional getMedium() { - if (isMedium()) { - return Optional.of(((MediumValue) value).value); - } - return Optional.empty(); - } - - public Optional getNotification() { - if (isNotification()) { - return Optional.of(((NotificationValue) value).value); - } - return Optional.empty(); - } - - public Optional getOpenSearch() { - if (isOpenSearch()) { - return Optional.of(((OpenSearchValue) value).value); - } - return Optional.empty(); - } - - public Optional getPrerender() { - if (isPrerender()) { - return Optional.of(((PrerenderValue) value).value); - } - return Optional.empty(); - } - - public Optional getScript() { - if (isScript()) { - return Optional.of(((ScriptValue) value).value); - } - return Optional.empty(); - } - - public Optional getSignalR() { - if (isSignalR()) { - return Optional.of(((SignalRValue) value).value); - } - return Optional.empty(); - } - - public Optional getSlack() { - if (isSlack()) { - return Optional.of(((SlackValue) value).value); - } - return Optional.empty(); - } - - public Optional getTweet() { - if (isTweet()) { - return Optional.of(((TweetValue) value).value); - } - return Optional.empty(); - } - - public Optional getTypesense() { - if (isTypesense()) { - return Optional.of(((TypesenseValue) value).value); - } - return Optional.empty(); - } - - public Optional getWebhook() { - if (isWebhook()) { - return Optional.of(((WebhookValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitAlgolia(AlgoliaRuleActionDto algolia); - - T visitAzureQueue(AzureQueueRuleActionDto azureQueue); - - T visitComment(CommentRuleActionDto comment); - - T visitCreateContent(CreateContentRuleActionDto createContent); - - T visitDeepDetect(DeepDetectRuleActionDto deepDetect); - - T visitDiscourse(DiscourseRuleActionDto discourse); - - T visitElasticSearch(ElasticSearchRuleActionDto elasticSearch); - - T visitEmail(EmailRuleActionDto email); - - T visitFastly(FastlyRuleActionDto fastly); - - T visitMedium(MediumRuleActionDto medium); - - T visitNotification(NotificationRuleActionDto notification); - - T visitOpenSearch(OpenSearchRuleActionDto openSearch); - - T visitPrerender(PrerenderRuleActionDto prerender); - - T visitScript(ScriptRuleActionDto script); - - T visitSignalR(SignalRRuleActionDto signalR); - - T visitSlack(SlackRuleActionDto slack); - - T visitTweet(TweetRuleActionDto tweet); - - T visitTypesense(TypesenseRuleActionDto typesense); - - T visitWebhook(WebhookRuleActionDto webhook); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "actionType", - visible = true, - defaultImpl = _UnknownValue.class) - @JsonSubTypes({ - @JsonSubTypes.Type(AlgoliaValue.class), - @JsonSubTypes.Type(AzureQueueValue.class), - @JsonSubTypes.Type(CommentValue.class), - @JsonSubTypes.Type(CreateContentValue.class), - @JsonSubTypes.Type(DeepDetectValue.class), - @JsonSubTypes.Type(DiscourseValue.class), - @JsonSubTypes.Type(ElasticSearchValue.class), - @JsonSubTypes.Type(EmailValue.class), - @JsonSubTypes.Type(FastlyValue.class), - @JsonSubTypes.Type(MediumValue.class), - @JsonSubTypes.Type(NotificationValue.class), - @JsonSubTypes.Type(OpenSearchValue.class), - @JsonSubTypes.Type(PrerenderValue.class), - @JsonSubTypes.Type(ScriptValue.class), - @JsonSubTypes.Type(SignalRValue.class), - @JsonSubTypes.Type(SlackValue.class), - @JsonSubTypes.Type(TweetValue.class), - @JsonSubTypes.Type(TypesenseValue.class), - @JsonSubTypes.Type(WebhookValue.class) - }) - @JsonIgnoreProperties(ignoreUnknown = true) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("Algolia") - private static final class AlgoliaValue implements Value { - @JsonUnwrapped - private AlgoliaRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AlgoliaValue() {} - - private AlgoliaValue(AlgoliaRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitAlgolia(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AlgoliaValue && equalTo((AlgoliaValue) other); - } - - private boolean equalTo(AlgoliaValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("AzureQueue") - private static final class AzureQueueValue implements Value { - @JsonUnwrapped - private AzureQueueRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AzureQueueValue() {} - - private AzureQueueValue(AzureQueueRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitAzureQueue(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AzureQueueValue && equalTo((AzureQueueValue) other); - } - - private boolean equalTo(AzureQueueValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Comment") - private static final class CommentValue implements Value { - @JsonUnwrapped - private CommentRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private CommentValue() {} - - private CommentValue(CommentRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitComment(value); - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentValue && equalTo((CommentValue) other); - } - - private boolean equalTo(CommentValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("CreateContent") - private static final class CreateContentValue implements Value { - @JsonUnwrapped - private CreateContentRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private CreateContentValue() {} - - private CreateContentValue(CreateContentRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitCreateContent(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateContentValue && equalTo((CreateContentValue) other); - } - - private boolean equalTo(CreateContentValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("DeepDetect") - private static final class DeepDetectValue implements Value { - @JsonUnwrapped - private DeepDetectRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private DeepDetectValue() {} - - private DeepDetectValue(DeepDetectRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitDeepDetect(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DeepDetectValue && equalTo((DeepDetectValue) other); - } - - private boolean equalTo(DeepDetectValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Discourse") - private static final class DiscourseValue implements Value { - @JsonUnwrapped - private DiscourseRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private DiscourseValue() {} - - private DiscourseValue(DiscourseRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitDiscourse(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DiscourseValue && equalTo((DiscourseValue) other); - } - - private boolean equalTo(DiscourseValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("ElasticSearch") - private static final class ElasticSearchValue implements Value { - @JsonUnwrapped - private ElasticSearchRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ElasticSearchValue() {} - - private ElasticSearchValue(ElasticSearchRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitElasticSearch(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ElasticSearchValue && equalTo((ElasticSearchValue) other); - } - - private boolean equalTo(ElasticSearchValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Email") - private static final class EmailValue implements Value { - @JsonUnwrapped - private EmailRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private EmailValue() {} - - private EmailValue(EmailRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitEmail(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EmailValue && equalTo((EmailValue) other); - } - - private boolean equalTo(EmailValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Fastly") - private static final class FastlyValue implements Value { - @JsonUnwrapped - private FastlyRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private FastlyValue() {} - - private FastlyValue(FastlyRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitFastly(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof FastlyValue && equalTo((FastlyValue) other); - } - - private boolean equalTo(FastlyValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Medium") - private static final class MediumValue implements Value { - @JsonUnwrapped - private MediumRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private MediumValue() {} - - private MediumValue(MediumRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitMedium(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MediumValue && equalTo((MediumValue) other); - } - - private boolean equalTo(MediumValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Notification") - private static final class NotificationValue implements Value { - @JsonUnwrapped - private NotificationRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private NotificationValue() {} - - private NotificationValue(NotificationRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitNotification(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NotificationValue && equalTo((NotificationValue) other); - } - - private boolean equalTo(NotificationValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("OpenSearch") - private static final class OpenSearchValue implements Value { - @JsonUnwrapped - private OpenSearchRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private OpenSearchValue() {} - - private OpenSearchValue(OpenSearchRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitOpenSearch(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OpenSearchValue && equalTo((OpenSearchValue) other); - } - - private boolean equalTo(OpenSearchValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Prerender") - private static final class PrerenderValue implements Value { - @JsonUnwrapped - private PrerenderRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private PrerenderValue() {} - - private PrerenderValue(PrerenderRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitPrerender(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PrerenderValue && equalTo((PrerenderValue) other); - } - - private boolean equalTo(PrerenderValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Script") - private static final class ScriptValue implements Value { - @JsonUnwrapped - private ScriptRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ScriptValue() {} - - private ScriptValue(ScriptRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitScript(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ScriptValue && equalTo((ScriptValue) other); - } - - private boolean equalTo(ScriptValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("SignalR") - private static final class SignalRValue implements Value { - @JsonUnwrapped - private SignalRRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private SignalRValue() {} - - private SignalRValue(SignalRRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitSignalR(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SignalRValue && equalTo((SignalRValue) other); - } - - private boolean equalTo(SignalRValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Slack") - private static final class SlackValue implements Value { - @JsonUnwrapped - private SlackRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private SlackValue() {} - - private SlackValue(SlackRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitSlack(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SlackValue && equalTo((SlackValue) other); - } - - private boolean equalTo(SlackValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Tweet") - private static final class TweetValue implements Value { - @JsonUnwrapped - private TweetRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private TweetValue() {} - - private TweetValue(TweetRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitTweet(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TweetValue && equalTo((TweetValue) other); - } - - private boolean equalTo(TweetValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Typesense") - private static final class TypesenseValue implements Value { - @JsonUnwrapped - private TypesenseRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private TypesenseValue() {} - - private TypesenseValue(TypesenseRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitTypesense(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TypesenseValue && equalTo((TypesenseValue) other); - } - - private boolean equalTo(TypesenseValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Webhook") - private static final class WebhookValue implements Value { - @JsonUnwrapped - private WebhookRuleActionDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private WebhookValue() {} - - private WebhookValue(WebhookRuleActionDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitWebhook(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WebhookValue && equalTo((WebhookValue) other); - } - - private boolean equalTo(WebhookValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleActionDto{" + "value: " + value + "}"; - } - } - - private static final class _UnknownValue implements Value { - private String type; - - @JsonValue - private Object value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private _UnknownValue(@JsonProperty("value") Object value) {} - - @Override - public T visit(Visitor visitor) { - return visitor._visitUnknown(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof _UnknownValue && equalTo((_UnknownValue) other); - } - - private boolean equalTo(_UnknownValue other) { - return type.equals(other.type) && value.equals(other.value); - } +package com.squidex.api.types; - @Override - public int hashCode() { - return Objects.hash(this.type, this.value); - } +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.squidex.api.core.JSON; - @Override - public String toString() { - return "RuleActionDto{" + "type: " + type + ", value: " + value + "}"; - } - } +/** + * RuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RuleActionDto { + public RuleActionDto() { + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleActionDto ruleActionDto = (RuleActionDto) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(true); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleActionDto {\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("actionType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RuleActionDto is not found in the empty JSON string", RuleActionDto.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("actionType").getAsString(); + switch (discriminatorValue) { + case "Algolia": + AlgoliaRuleActionDto.validateJsonElement(jsonElement); + break; + case "AzureQueue": + AzureQueueRuleActionDto.validateJsonElement(jsonElement); + break; + case "Comment": + CommentRuleActionDto.validateJsonElement(jsonElement); + break; + case "CreateContent": + CreateContentRuleActionDto.validateJsonElement(jsonElement); + break; + case "Discourse": + DiscourseRuleActionDto.validateJsonElement(jsonElement); + break; + case "ElasticSearch": + ElasticSearchRuleActionDto.validateJsonElement(jsonElement); + break; + case "Email": + EmailRuleActionDto.validateJsonElement(jsonElement); + break; + case "Fastly": + FastlyRuleActionDto.validateJsonElement(jsonElement); + break; + case "Medium": + MediumRuleActionDto.validateJsonElement(jsonElement); + break; + case "Notification": + NotificationRuleActionDto.validateJsonElement(jsonElement); + break; + case "OpenSearch": + OpenSearchRuleActionDto.validateJsonElement(jsonElement); + break; + case "Prerender": + PrerenderRuleActionDto.validateJsonElement(jsonElement); + break; + case "Script": + ScriptRuleActionDto.validateJsonElement(jsonElement); + break; + case "SignalR": + SignalRRuleActionDto.validateJsonElement(jsonElement); + break; + case "Slack": + SlackRuleActionDto.validateJsonElement(jsonElement); + break; + case "Tweet": + TweetRuleActionDto.validateJsonElement(jsonElement); + break; + case "Typesense": + TypesenseRuleActionDto.validateJsonElement(jsonElement); + break; + case "Webhook": + WebhookRuleActionDto.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `actionType` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of RuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RuleActionDto + * @throws IOException if the JSON string is invalid with respect to RuleActionDto + */ + public static RuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RuleActionDto.class); + } + + /** + * Convert an instance of RuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RuleDto.java b/src/main/java/com/squidex/api/types/RuleDto.java index 901eebb..b70dec4 100644 --- a/src/main/java/com/squidex/api/types/RuleDto.java +++ b/src/main/java/com/squidex/api/types/RuleDto.java @@ -1,574 +1,563 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.RuleActionDto; +import com.squidex.api.types.RuleTriggerDto; +import java.io.IOException; import java.time.OffsetDateTime; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RuleDto.Builder.class) -public final class RuleDto implements IResource { - private final Map links; - - private final String id; - - private final String createdBy; - - private final String lastModifiedBy; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final int version; - - private final boolean isEnabled; - - private final Optional name; - - private final RuleTriggerDto trigger; - - private final RuleActionDto action; - - private final int numSucceeded; - - private final int numFailed; - - private final Optional lastExecuted; - - private RuleDto( - Map links, - String id, - String createdBy, - String lastModifiedBy, - OffsetDateTime created, - OffsetDateTime lastModified, - int version, - boolean isEnabled, - Optional name, - RuleTriggerDto trigger, - RuleActionDto action, - int numSucceeded, - int numFailed, - Optional lastExecuted) { - this.links = links; - this.id = id; - this.createdBy = createdBy; - this.lastModifiedBy = lastModifiedBy; - this.created = created; - this.lastModified = lastModified; - this.version = version; - this.isEnabled = isEnabled; - this.name = name; - this.trigger = trigger; - this.action = action; - this.numSucceeded = numSucceeded; - this.numFailed = numFailed; - this.lastExecuted = lastExecuted; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the rule. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The user that has created the rule. - */ - @JsonProperty("createdBy") - public String getCreatedBy() { - return createdBy; - } - - /** - * @return The user that has updated the rule. - */ - @JsonProperty("lastModifiedBy") - public String getLastModifiedBy() { - return lastModifiedBy; - } - - /** - * @return The date and time when the rule has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The date and time when the rule has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The version of the rule. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - /** - * @return Determines if the rule is enabled. - */ - @JsonProperty("isEnabled") - public boolean getIsEnabled() { - return isEnabled; - } - - /** - * @return Optional rule name. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The trigger properties. - */ - @JsonProperty("trigger") - public RuleTriggerDto getTrigger() { - return trigger; - } - - /** - * @return The action properties. - */ - @JsonProperty("action") - public RuleActionDto getAction() { - return action; - } - - /** - * @return The number of completed executions. - */ - @JsonProperty("numSucceeded") - public int getNumSucceeded() { - return numSucceeded; - } - - /** - * @return The number of failed executions. - */ - @JsonProperty("numFailed") - public int getNumFailed() { - return numFailed; - } - - /** - * @return The date and time when the rule was executed the last time. - */ - @JsonProperty("lastExecuted") - public Optional getLastExecuted() { - return lastExecuted; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RuleDto && equalTo((RuleDto) other); - } - - private boolean equalTo(RuleDto other) { - return links.equals(other.links) - && id.equals(other.id) - && createdBy.equals(other.createdBy) - && lastModifiedBy.equals(other.lastModifiedBy) - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && version == other.version - && isEnabled == other.isEnabled - && name.equals(other.name) - && trigger.equals(other.trigger) - && action.equals(other.action) - && numSucceeded == other.numSucceeded - && numFailed == other.numFailed - && lastExecuted.equals(other.lastExecuted); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.createdBy, - this.lastModifiedBy, - this.created, - this.lastModified, - this.version, - this.isEnabled, - this.name, - this.trigger, - this.action, - this.numSucceeded, - this.numFailed, - this.lastExecuted); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - CreatedByStage id(String id); - - Builder from(RuleDto other); - } - - public interface CreatedByStage { - LastModifiedByStage createdBy(String createdBy); - } - - public interface LastModifiedByStage { - CreatedStage lastModifiedBy(String lastModifiedBy); - } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); - } - - public interface LastModifiedStage { - VersionStage lastModified(OffsetDateTime lastModified); - } - - public interface VersionStage { - IsEnabledStage version(int version); - } - - public interface IsEnabledStage { - TriggerStage isEnabled(boolean isEnabled); - } - - public interface TriggerStage { - ActionStage trigger(RuleTriggerDto trigger); - } - - public interface ActionStage { - NumSucceededStage action(RuleActionDto action); - } - - public interface NumSucceededStage { - NumFailedStage numSucceeded(int numSucceeded); - } - - public interface NumFailedStage { - _FinalStage numFailed(int numFailed); - } - - public interface _FinalStage { - RuleDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage lastExecuted(Optional lastExecuted); - - _FinalStage lastExecuted(OffsetDateTime lastExecuted); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - CreatedByStage, - LastModifiedByStage, - CreatedStage, - LastModifiedStage, - VersionStage, - IsEnabledStage, - TriggerStage, - ActionStage, - NumSucceededStage, - NumFailedStage, - _FinalStage { - private String id; - - private String createdBy; - - private String lastModifiedBy; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private int version; - - private boolean isEnabled; - - private RuleTriggerDto trigger; - - private RuleActionDto action; - - private int numSucceeded; - - private int numFailed; - - private Optional lastExecuted = Optional.empty(); - - private Optional name = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(RuleDto other) { - links(other.getLinks()); - id(other.getId()); - createdBy(other.getCreatedBy()); - lastModifiedBy(other.getLastModifiedBy()); - created(other.getCreated()); - lastModified(other.getLastModified()); - version(other.getVersion()); - isEnabled(other.getIsEnabled()); - name(other.getName()); - trigger(other.getTrigger()); - action(other.getAction()); - numSucceeded(other.getNumSucceeded()); - numFailed(other.getNumFailed()); - lastExecuted(other.getLastExecuted()); - return this; - } - - /** - *

The ID of the rule.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public CreatedByStage id(String id) { - this.id = id; - return this; - } - - /** - *

The user that has created the rule.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("createdBy") - public LastModifiedByStage createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - *

The user that has updated the rule.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModifiedBy") - public CreatedStage lastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - return this; - } - - /** - *

The date and time when the rule has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The date and time when the rule has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public VersionStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

The version of the rule.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public IsEnabledStage version(int version) { - this.version = version; - return this; - } - - /** - *

Determines if the rule is enabled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isEnabled") - public TriggerStage isEnabled(boolean isEnabled) { - this.isEnabled = isEnabled; - return this; - } - - /** - *

The trigger properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("trigger") - public ActionStage trigger(RuleTriggerDto trigger) { - this.trigger = trigger; - return this; - } - - /** - *

The action properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("action") - public NumSucceededStage action(RuleActionDto action) { - this.action = action; - return this; - } - - /** - *

The number of completed executions.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("numSucceeded") - public NumFailedStage numSucceeded(int numSucceeded) { - this.numSucceeded = numSucceeded; - return this; - } - - /** - *

The number of failed executions.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("numFailed") - public _FinalStage numFailed(int numFailed) { - this.numFailed = numFailed; - return this; - } - - /** - *

The date and time when the rule was executed the last time.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage lastExecuted(OffsetDateTime lastExecuted) { - this.lastExecuted = Optional.of(lastExecuted); - return this; - } - - @Override - @JsonSetter(value = "lastExecuted", nulls = Nulls.SKIP) - public _FinalStage lastExecuted(Optional lastExecuted) { - this.lastExecuted = lastExecuted; - return this; - } - - /** - *

Optional rule name.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage name(String name) { - this.name = Optional.of(name); - return this; - } - - @Override - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } +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; - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } +import com.squidex.api.core.JSON; - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; +/** + * RuleDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RuleDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; + @SerializedName(SERIALIZED_NAME_CREATED_BY) + private String createdBy; + public static final String SERIALIZED_NAME_LAST_MODIFIED_BY = "lastModifiedBy"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED_BY) + private String lastModifiedBy; + public static final String SERIALIZED_NAME_CREATED = "created"; + @SerializedName(SERIALIZED_NAME_CREATED) + private OffsetDateTime created; + public static final String SERIALIZED_NAME_LAST_MODIFIED = "lastModified"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED) + private OffsetDateTime lastModified; + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Long version; + public static final String SERIALIZED_NAME_IS_ENABLED = "isEnabled"; + @SerializedName(SERIALIZED_NAME_IS_ENABLED) + private Boolean isEnabled; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_TRIGGER = "trigger"; + @SerializedName(SERIALIZED_NAME_TRIGGER) + private RuleTriggerDto trigger; + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private RuleActionDto action; + public static final String SERIALIZED_NAME_NUM_SUCCEEDED = "numSucceeded"; + @SerializedName(SERIALIZED_NAME_NUM_SUCCEEDED) + private Long numSucceeded; + public static final String SERIALIZED_NAME_NUM_FAILED = "numFailed"; + @SerializedName(SERIALIZED_NAME_NUM_FAILED) + private Long numFailed; + public static final String SERIALIZED_NAME_LAST_EXECUTED = "lastExecuted"; + @Deprecated + @SerializedName(SERIALIZED_NAME_LAST_EXECUTED) + private OffsetDateTime lastExecuted; + public RuleDto() { + } + public RuleDto links(Map links) { + this.links = links; + return this; + } + + public RuleDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public RuleDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the rule. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public RuleDto createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The user that has created the rule. + * @return createdBy + */ + @javax.annotation.Nonnull + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + public RuleDto lastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * The user that has updated the rule. + * @return lastModifiedBy + */ + @javax.annotation.Nonnull + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + public RuleDto created(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * The date and time when the rule has been created. + * @return created + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreated() { + return created; + } + + public void setCreated(OffsetDateTime created) { + this.created = created; + } + public RuleDto lastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * The date and time when the rule has been modified last. + * @return lastModified + */ + @javax.annotation.Nonnull + public OffsetDateTime getLastModified() { + return lastModified; + } + + public void setLastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + } + public RuleDto version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the rule. + * @return version + */ + @javax.annotation.Nonnull + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + public RuleDto isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Determines if the rule is enabled. + * @return isEnabled + */ + @javax.annotation.Nonnull + public Boolean getIsEnabled() { + return isEnabled; + } + + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + public RuleDto name(String name) { + this.name = name; + return this; + } + + /** + * Optional rule name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public RuleDto trigger(RuleTriggerDto trigger) { + this.trigger = trigger; + return this; + } + + /** + * Get trigger + * @return trigger + */ + @javax.annotation.Nonnull + public RuleTriggerDto getTrigger() { + return trigger; + } + + public void setTrigger(RuleTriggerDto trigger) { + this.trigger = trigger; + } + public RuleDto action(RuleActionDto action) { + this.action = action; + return this; + } + + /** + * Get action + * @return action + */ + @javax.annotation.Nonnull + public RuleActionDto getAction() { + return action; + } + + public void setAction(RuleActionDto action) { + this.action = action; + } + public RuleDto numSucceeded(Long numSucceeded) { + this.numSucceeded = numSucceeded; + return this; + } + + /** + * The number of completed executions. + * @return numSucceeded + */ + @javax.annotation.Nonnull + public Long getNumSucceeded() { + return numSucceeded; + } + + public void setNumSucceeded(Long numSucceeded) { + this.numSucceeded = numSucceeded; + } + public RuleDto numFailed(Long numFailed) { + this.numFailed = numFailed; + return this; + } + + /** + * The number of failed executions. + * @return numFailed + */ + @javax.annotation.Nonnull + public Long getNumFailed() { + return numFailed; + } + + public void setNumFailed(Long numFailed) { + this.numFailed = numFailed; + } + @Deprecated + public RuleDto lastExecuted(OffsetDateTime lastExecuted) { + this.lastExecuted = lastExecuted; + return this; + } + + /** + * The date and time when the rule was executed the last time. + * @return lastExecuted + * @deprecated + */ + @Deprecated + @javax.annotation.Nullable + public OffsetDateTime getLastExecuted() { + return lastExecuted; + } + + @Deprecated + public void setLastExecuted(OffsetDateTime lastExecuted) { + this.lastExecuted = lastExecuted; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleDto ruleDto = (RuleDto) o; + return Objects.equals(this.links, ruleDto.links) && + Objects.equals(this.id, ruleDto.id) && + Objects.equals(this.createdBy, ruleDto.createdBy) && + Objects.equals(this.lastModifiedBy, ruleDto.lastModifiedBy) && + Objects.equals(this.created, ruleDto.created) && + Objects.equals(this.lastModified, ruleDto.lastModified) && + Objects.equals(this.version, ruleDto.version) && + Objects.equals(this.isEnabled, ruleDto.isEnabled) && + Objects.equals(this.name, ruleDto.name) && + Objects.equals(this.trigger, ruleDto.trigger) && + Objects.equals(this.action, ruleDto.action) && + Objects.equals(this.numSucceeded, ruleDto.numSucceeded) && + Objects.equals(this.numFailed, ruleDto.numFailed) && + Objects.equals(this.lastExecuted, ruleDto.lastExecuted); + } + + 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(links, id, createdBy, lastModifiedBy, created, lastModified, version, isEnabled, name, trigger, action, numSucceeded, numFailed, lastExecuted); + } + + 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 RuleDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" lastModifiedBy: ").append(toIndentedString(lastModifiedBy)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" lastModified: ").append(toIndentedString(lastModified)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" numSucceeded: ").append(toIndentedString(numSucceeded)).append("\n"); + sb.append(" numFailed: ").append(toIndentedString(numFailed)).append("\n"); + sb.append(" lastExecuted: ").append(toIndentedString(lastExecuted)).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("_links"); + openapiFields.add("id"); + openapiFields.add("createdBy"); + openapiFields.add("lastModifiedBy"); + openapiFields.add("created"); + openapiFields.add("lastModified"); + openapiFields.add("version"); + openapiFields.add("isEnabled"); + openapiFields.add("name"); + openapiFields.add("trigger"); + openapiFields.add("action"); + openapiFields.add("numSucceeded"); + openapiFields.add("numFailed"); + openapiFields.add("lastExecuted"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("lastModifiedBy"); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("lastModified"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("isEnabled"); + openapiRequiredFields.add("trigger"); + openapiRequiredFields.add("action"); + openapiRequiredFields.add("numSucceeded"); + openapiRequiredFields.add("numFailed"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RuleDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RuleDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RuleDto is not found in the empty JSON string", RuleDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RuleDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RuleDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public RuleDto build() { - return new RuleDto( - links, - id, - createdBy, - lastModifiedBy, - created, - lastModified, - version, - isEnabled, - name, - trigger, - action, - numSucceeded, - numFailed, - lastExecuted); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RuleDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("createdBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); + } + if (!jsonObj.get("lastModifiedBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastModifiedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastModifiedBy").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 required field `trigger` + RuleTriggerDto.validateJsonElement(jsonObj.get("trigger")); + // validate the required field `action` + RuleActionDto.validateJsonElement(jsonObj.get("action")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RuleDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RuleDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RuleDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RuleDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RuleDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RuleDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RuleDto + * @throws IOException if the JSON string is invalid with respect to RuleDto + */ + public static RuleDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RuleDto.class); + } + + /** + * Convert an instance of RuleDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RuleElementDto.java b/src/main/java/com/squidex/api/types/RuleElementDto.java index 91269e1..6a61df0 100644 --- a/src/main/java/com/squidex/api/types/RuleElementDto.java +++ b/src/main/java/com/squidex/api/types/RuleElementDto.java @@ -1,334 +1,397 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.RuleElementPropertyDto; +import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RuleElementDto.Builder.class) -public final class RuleElementDto { - private final String description; - - private final String display; - - private final Optional title; - - private final Optional iconColor; - - private final Optional iconImage; - - private final Optional readMore; - - private final List properties; - - private RuleElementDto( - String description, - String display, - Optional title, - Optional iconColor, - Optional iconImage, - Optional readMore, - List properties) { - this.description = description; - this.display = display; - this.title = title; - this.iconColor = iconColor; - this.iconImage = iconImage; - this.readMore = readMore; - this.properties = properties; - } - - /** - * @return Describes the action or trigger type. - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * @return The label for the action or trigger type. - */ - @JsonProperty("display") - public String getDisplay() { - return display; - } - - /** - * @return Optional title. - */ - @JsonProperty("title") - public Optional getTitle() { - return title; - } - - /** - * @return The color for the icon. - */ - @JsonProperty("iconColor") - public Optional getIconColor() { - return iconColor; - } - - /** - * @return The image for the icon. - */ - @JsonProperty("iconImage") - public Optional getIconImage() { - return iconImage; - } - - /** - * @return The optional link to the product that is integrated. - */ - @JsonProperty("readMore") - public Optional getReadMore() { - return readMore; - } - - /** - * @return The properties. - */ - @JsonProperty("properties") - public List getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RuleElementDto && equalTo((RuleElementDto) other); - } +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; - private boolean equalTo(RuleElementDto other) { - return description.equals(other.description) - && display.equals(other.display) - && title.equals(other.title) - && iconColor.equals(other.iconColor) - && iconImage.equals(other.iconImage) - && readMore.equals(other.readMore) - && properties.equals(other.properties); - } +import com.squidex.api.core.JSON; - @Override - public int hashCode() { - return Objects.hash( - this.description, - this.display, - this.title, - this.iconColor, - this.iconImage, - this.readMore, - this.properties); +/** + * RuleElementDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RuleElementDto { + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + public static final String SERIALIZED_NAME_DISPLAY = "display"; + @SerializedName(SERIALIZED_NAME_DISPLAY) + private String display; + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + private String title; + public static final String SERIALIZED_NAME_ICON_COLOR = "iconColor"; + @SerializedName(SERIALIZED_NAME_ICON_COLOR) + private String iconColor; + public static final String SERIALIZED_NAME_ICON_IMAGE = "iconImage"; + @SerializedName(SERIALIZED_NAME_ICON_IMAGE) + private String iconImage; + public static final String SERIALIZED_NAME_READ_MORE = "readMore"; + @SerializedName(SERIALIZED_NAME_READ_MORE) + private String readMore; + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private List properties = new ArrayList<>(); + public RuleElementDto() { + } + public RuleElementDto description(String description) { + this.description = description; + return this; + } + + /** + * Describes the action or trigger type. + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public RuleElementDto display(String display) { + this.display = display; + return this; + } + + /** + * The label for the action or trigger type. + * @return display + */ + @javax.annotation.Nonnull + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + public RuleElementDto title(String title) { + this.title = title; + return this; + } + + /** + * Optional title. + * @return title + */ + @javax.annotation.Nullable + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + public RuleElementDto iconColor(String iconColor) { + this.iconColor = iconColor; + return this; + } + + /** + * The color for the icon. + * @return iconColor + */ + @javax.annotation.Nullable + public String getIconColor() { + return iconColor; + } + + public void setIconColor(String iconColor) { + this.iconColor = iconColor; + } + public RuleElementDto iconImage(String iconImage) { + this.iconImage = iconImage; + return this; + } + + /** + * The image for the icon. + * @return iconImage + */ + @javax.annotation.Nullable + public String getIconImage() { + return iconImage; + } + + public void setIconImage(String iconImage) { + this.iconImage = iconImage; + } + public RuleElementDto readMore(String readMore) { + this.readMore = readMore; + return this; + } + + /** + * The optional link to the product that is integrated. + * @return readMore + */ + @javax.annotation.Nullable + public String getReadMore() { + return readMore; + } + + public void setReadMore(String readMore) { + this.readMore = readMore; + } + public RuleElementDto properties(List properties) { + this.properties = properties; + return this; + } + + public RuleElementDto addPropertiesItem(RuleElementPropertyDto propertiesItem) { + if (this.properties == null) { + this.properties = new ArrayList<>(); } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + this.properties.add(propertiesItem); + return this; + } + + /** + * The properties. + * @return properties + */ + @javax.annotation.Nonnull + public List getProperties() { + return properties; + } + + public void setProperties(List properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public static DescriptionStage builder() { - return new Builder(); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface DescriptionStage { - DisplayStage description(String description); - - Builder from(RuleElementDto other); + RuleElementDto ruleElementDto = (RuleElementDto) o; + return Objects.equals(this.description, ruleElementDto.description) && + Objects.equals(this.display, ruleElementDto.display) && + Objects.equals(this.title, ruleElementDto.title) && + Objects.equals(this.iconColor, ruleElementDto.iconColor) && + Objects.equals(this.iconImage, ruleElementDto.iconImage) && + Objects.equals(this.readMore, ruleElementDto.readMore) && + Objects.equals(this.properties, ruleElementDto.properties); + } + + 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(description, display, title, iconColor, iconImage, readMore, properties); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface DisplayStage { - _FinalStage display(String display); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleElementDto {\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" display: ").append(toIndentedString(display)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" iconColor: ").append(toIndentedString(iconColor)).append("\n"); + sb.append(" iconImage: ").append(toIndentedString(iconImage)).append("\n"); + sb.append(" readMore: ").append(toIndentedString(readMore)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).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"; } - - public interface _FinalStage { - RuleElementDto build(); - - _FinalStage title(Optional title); - - _FinalStage title(String title); - - _FinalStage iconColor(Optional iconColor); - - _FinalStage iconColor(String iconColor); - - _FinalStage iconImage(Optional iconImage); - - _FinalStage iconImage(String iconImage); - - _FinalStage readMore(Optional readMore); - - _FinalStage readMore(String readMore); - - _FinalStage properties(List properties); - - _FinalStage addProperties(RuleElementPropertyDto properties); - - _FinalStage addAllProperties(List properties); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DescriptionStage, DisplayStage, _FinalStage { - private String description; - - private String display; - - private List properties = new ArrayList<>(); - - private Optional readMore = Optional.empty(); - - private Optional iconImage = Optional.empty(); - - private Optional iconColor = Optional.empty(); - - private Optional title = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(RuleElementDto other) { - description(other.getDescription()); - display(other.getDisplay()); - title(other.getTitle()); - iconColor(other.getIconColor()); - iconImage(other.getIconImage()); - readMore(other.getReadMore()); - properties(other.getProperties()); - return this; - } - - /** - *

Describes the action or trigger type.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("description") - public DisplayStage description(String description) { - this.description = description; - return this; - } - - /** - *

The label for the action or trigger type.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("display") - public _FinalStage display(String display) { - this.display = display; - return this; - } - - /** - *

The properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllProperties(List properties) { - this.properties.addAll(properties); - return this; - } - - /** - *

The properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addProperties(RuleElementPropertyDto properties) { - this.properties.add(properties); - return this; - } - - @Override - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public _FinalStage properties(List properties) { - this.properties.clear(); - this.properties.addAll(properties); - return this; - } - - /** - *

The optional link to the product that is integrated.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage readMore(String readMore) { - this.readMore = Optional.of(readMore); - return this; - } - - @Override - @JsonSetter(value = "readMore", nulls = Nulls.SKIP) - public _FinalStage readMore(Optional readMore) { - this.readMore = readMore; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("description"); + openapiFields.add("display"); + openapiFields.add("title"); + openapiFields.add("iconColor"); + openapiFields.add("iconImage"); + openapiFields.add("readMore"); + openapiFields.add("properties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("display"); + openapiRequiredFields.add("properties"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RuleElementDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RuleElementDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RuleElementDto is not found in the empty JSON string", RuleElementDto.openapiRequiredFields.toString())); } + } - /** - *

The image for the icon.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage iconImage(String iconImage) { - this.iconImage = Optional.of(iconImage); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RuleElementDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RuleElementDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - @JsonSetter(value = "iconImage", nulls = Nulls.SKIP) - public _FinalStage iconImage(Optional iconImage) { - this.iconImage = iconImage; - return this; - } - - /** - *

The color for the icon.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage iconColor(String iconColor) { - this.iconColor = Optional.of(iconColor); - return this; - } - - @Override - @JsonSetter(value = "iconColor", nulls = Nulls.SKIP) - public _FinalStage iconColor(Optional iconColor) { - this.iconColor = iconColor; - return this; - } - - /** - *

Optional title.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage title(String title) { - this.title = Optional.of(title); - return this; - } - - @Override - @JsonSetter(value = "title", nulls = Nulls.SKIP) - public _FinalStage title(Optional title) { - this.title = title; - return this; - } - - @Override - public RuleElementDto build() { - return new RuleElementDto(description, display, title, iconColor, iconImage, readMore, properties); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RuleElementDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("display").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `display` to be a primitive type in the JSON string but got `%s`", jsonObj.get("display").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("iconColor") != null && !jsonObj.get("iconColor").isJsonNull()) && !jsonObj.get("iconColor").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `iconColor` to be a primitive type in the JSON string but got `%s`", jsonObj.get("iconColor").toString())); + } + if ((jsonObj.get("iconImage") != null && !jsonObj.get("iconImage").isJsonNull()) && !jsonObj.get("iconImage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `iconImage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("iconImage").toString())); + } + if ((jsonObj.get("readMore") != null && !jsonObj.get("readMore").isJsonNull()) && !jsonObj.get("readMore").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `readMore` to be a primitive type in the JSON string but got `%s`", jsonObj.get("readMore").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("properties").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `properties` to be an array in the JSON string but got `%s`", jsonObj.get("properties").toString())); + } + + JsonArray jsonArrayproperties = jsonObj.getAsJsonArray("properties"); + // validate the required field `properties` (array) + for (int i = 0; i < jsonArrayproperties.size(); i++) { + RuleElementPropertyDto.validateJsonElement(jsonArrayproperties.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RuleElementDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RuleElementDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RuleElementDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RuleElementDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RuleElementDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of RuleElementDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RuleElementDto + * @throws IOException if the JSON string is invalid with respect to RuleElementDto + */ + public static RuleElementDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RuleElementDto.class); + } + + /** + * Convert an instance of RuleElementDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RuleElementPropertyDto.java b/src/main/java/com/squidex/api/types/RuleElementPropertyDto.java index e597259..a000cbd 100644 --- a/src/main/java/com/squidex/api/types/RuleElementPropertyDto.java +++ b/src/main/java/com/squidex/api/types/RuleElementPropertyDto.java @@ -1,303 +1,386 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RuleElementPropertyDto.Builder.class) -public final class RuleElementPropertyDto { - private final RuleFieldEditor editor; - - private final String name; - - private final String display; - - private final Optional> options; - - private final Optional description; - - private final boolean isFormattable; - - private final boolean isRequired; - - private RuleElementPropertyDto( - RuleFieldEditor editor, - String name, - String display, - Optional> options, - Optional description, - boolean isFormattable, - boolean isRequired) { - this.editor = editor; - this.name = name; - this.display = display; - this.options = options; - this.description = description; - this.isFormattable = isFormattable; - this.isRequired = isRequired; - } - - /** - * @return The html editor. - */ - @JsonProperty("editor") - public RuleFieldEditor getEditor() { - return editor; - } - - /** - * @return The name of the editor. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The label to use. - */ - @JsonProperty("display") - public String getDisplay() { - return display; - } - /** - * @return The options, if the editor is a dropdown. - */ - @JsonProperty("options") - public Optional> getOptions() { - return options; - } - - /** - * @return The optional description. - */ - @JsonProperty("description") - public Optional getDescription() { - return description; - } - - /** - * @return Indicates if the property is formattable. - */ - @JsonProperty("isFormattable") - public boolean getIsFormattable() { - return isFormattable; - } - - /** - * @return Indicates if the property is required. - */ - @JsonProperty("isRequired") - public boolean getIsRequired() { - return isRequired; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RuleElementPropertyDto && equalTo((RuleElementPropertyDto) other); - } - private boolean equalTo(RuleElementPropertyDto other) { - return editor.equals(other.editor) - && name.equals(other.name) - && display.equals(other.display) - && options.equals(other.options) - && description.equals(other.description) - && isFormattable == other.isFormattable - && isRequired == other.isRequired; - } - - @Override - public int hashCode() { - return Objects.hash( - this.editor, - this.name, - this.display, - this.options, - this.description, - this.isFormattable, - this.isRequired); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static EditorStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface EditorStage { - NameStage editor(RuleFieldEditor editor); +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.squidex.api.types.RuleFieldEditor; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +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; - Builder from(RuleElementPropertyDto other); - } +import com.squidex.api.core.JSON; - public interface NameStage { - DisplayStage name(String name); +/** + * RuleElementPropertyDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RuleElementPropertyDto { + public static final String SERIALIZED_NAME_EDITOR = "editor"; + @SerializedName(SERIALIZED_NAME_EDITOR) + private RuleFieldEditor editor; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_DISPLAY = "display"; + @SerializedName(SERIALIZED_NAME_DISPLAY) + private String display; + public static final String SERIALIZED_NAME_OPTIONS = "options"; + @SerializedName(SERIALIZED_NAME_OPTIONS) + private List options; + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + public static final String SERIALIZED_NAME_IS_FORMATTABLE = "isFormattable"; + @SerializedName(SERIALIZED_NAME_IS_FORMATTABLE) + private Boolean isFormattable; + public static final String SERIALIZED_NAME_IS_REQUIRED = "isRequired"; + @SerializedName(SERIALIZED_NAME_IS_REQUIRED) + private Boolean isRequired; + public RuleElementPropertyDto() { + } + public RuleElementPropertyDto editor(RuleFieldEditor editor) { + this.editor = editor; + return this; + } + + /** + * Get editor + * @return editor + */ + @javax.annotation.Nonnull + public RuleFieldEditor getEditor() { + return editor; + } + + public void setEditor(RuleFieldEditor editor) { + this.editor = editor; + } + public RuleElementPropertyDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the editor. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public RuleElementPropertyDto display(String display) { + this.display = display; + return this; + } + + /** + * The label to use. + * @return display + */ + @javax.annotation.Nonnull + public String getDisplay() { + return display; + } + + public void setDisplay(String display) { + this.display = display; + } + public RuleElementPropertyDto options(List options) { + this.options = options; + return this; + } + + public RuleElementPropertyDto addOptionsItem(String optionsItem) { + if (this.options == null) { + this.options = new ArrayList<>(); } - - public interface DisplayStage { - IsFormattableStage display(String display); + this.options.add(optionsItem); + return this; + } + + /** + * The options, if the editor is a dropdown. + * @return options + */ + @javax.annotation.Nullable + public List getOptions() { + return options; + } + + public void setOptions(List options) { + this.options = options; + } + public RuleElementPropertyDto description(String description) { + this.description = description; + return this; + } + + /** + * The optional description. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public RuleElementPropertyDto isFormattable(Boolean isFormattable) { + this.isFormattable = isFormattable; + return this; + } + + /** + * Indicates if the property is formattable. + * @return isFormattable + */ + @javax.annotation.Nonnull + public Boolean getIsFormattable() { + return isFormattable; + } + + public void setIsFormattable(Boolean isFormattable) { + this.isFormattable = isFormattable; + } + public RuleElementPropertyDto isRequired(Boolean isRequired) { + this.isRequired = isRequired; + return this; + } + + /** + * Indicates if the property is required. + * @return isRequired + */ + @javax.annotation.Nonnull + public Boolean getIsRequired() { + return isRequired; + } + + public void setIsRequired(Boolean isRequired) { + this.isRequired = isRequired; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface IsFormattableStage { - IsRequiredStage isFormattable(boolean isFormattable); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface IsRequiredStage { - _FinalStage isRequired(boolean isRequired); + RuleElementPropertyDto ruleElementPropertyDto = (RuleElementPropertyDto) o; + return Objects.equals(this.editor, ruleElementPropertyDto.editor) && + Objects.equals(this.name, ruleElementPropertyDto.name) && + Objects.equals(this.display, ruleElementPropertyDto.display) && + Objects.equals(this.options, ruleElementPropertyDto.options) && + Objects.equals(this.description, ruleElementPropertyDto.description) && + Objects.equals(this.isFormattable, ruleElementPropertyDto.isFormattable) && + Objects.equals(this.isRequired, ruleElementPropertyDto.isRequired); + } + + 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(editor, name, display, options, description, isFormattable, isRequired); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - RuleElementPropertyDto build(); - - _FinalStage options(Optional> options); - - _FinalStage options(List options); - - _FinalStage description(Optional description); - - _FinalStage description(String description); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleElementPropertyDto {\n"); + sb.append(" editor: ").append(toIndentedString(editor)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" display: ").append(toIndentedString(display)).append("\n"); + sb.append(" options: ").append(toIndentedString(options)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" isFormattable: ").append(toIndentedString(isFormattable)).append("\n"); + sb.append(" isRequired: ").append(toIndentedString(isRequired)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements EditorStage, NameStage, DisplayStage, IsFormattableStage, IsRequiredStage, _FinalStage { - private RuleFieldEditor editor; - - private String name; - - private String display; - - private boolean isFormattable; - - private boolean isRequired; - - private Optional description = Optional.empty(); - - private Optional> options = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(RuleElementPropertyDto other) { - editor(other.getEditor()); - name(other.getName()); - display(other.getDisplay()); - options(other.getOptions()); - description(other.getDescription()); - isFormattable(other.getIsFormattable()); - isRequired(other.getIsRequired()); - return this; - } - - /** - *

The html editor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("editor") - public NameStage editor(RuleFieldEditor editor) { - this.editor = editor; - return this; - } - - /** - *

The name of the editor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public DisplayStage name(String name) { - this.name = name; - return this; - } - - /** - *

The label to use.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("display") - public IsFormattableStage display(String display) { - this.display = display; - return this; - } - - /** - *

Indicates if the property is formattable.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isFormattable") - public IsRequiredStage isFormattable(boolean isFormattable) { - this.isFormattable = isFormattable; - return this; - } - - /** - *

Indicates if the property is required.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isRequired") - public _FinalStage isRequired(boolean isRequired) { - this.isRequired = isRequired; - return this; - } - - /** - *

The optional description.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage description(String description) { - this.description = Optional.of(description); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("editor"); + openapiFields.add("name"); + openapiFields.add("display"); + openapiFields.add("options"); + openapiFields.add("description"); + openapiFields.add("isFormattable"); + openapiFields.add("isRequired"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("editor"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("display"); + openapiRequiredFields.add("isFormattable"); + openapiRequiredFields.add("isRequired"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RuleElementPropertyDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RuleElementPropertyDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RuleElementPropertyDto is not found in the empty JSON string", RuleElementPropertyDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "description", nulls = Nulls.SKIP) - public _FinalStage description(Optional description) { - this.description = description; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RuleElementPropertyDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RuleElementPropertyDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The options, if the editor is a dropdown.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage options(List options) { - this.options = Optional.of(options); - return this; - } - - @Override - @JsonSetter(value = "options", nulls = Nulls.SKIP) - public _FinalStage options(Optional> options) { - this.options = options; - return this; - } - - @Override - public RuleElementPropertyDto build() { - return new RuleElementPropertyDto(editor, name, display, options, description, isFormattable, isRequired); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RuleElementPropertyDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `editor` + RuleFieldEditor.validateJsonElement(jsonObj.get("editor")); + 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("display").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `display` to be a primitive type in the JSON string but got `%s`", jsonObj.get("display").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("options") != null && !jsonObj.get("options").isJsonNull() && !jsonObj.get("options").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `options` to be an array in the JSON string but got `%s`", jsonObj.get("options").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RuleElementPropertyDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RuleElementPropertyDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RuleElementPropertyDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RuleElementPropertyDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RuleElementPropertyDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of RuleElementPropertyDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RuleElementPropertyDto + * @throws IOException if the JSON string is invalid with respect to RuleElementPropertyDto + */ + public static RuleElementPropertyDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RuleElementPropertyDto.class); + } + + /** + * Convert an instance of RuleElementPropertyDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RuleEventDto.java b/src/main/java/com/squidex/api/types/RuleEventDto.java index 0ea1bb0..1385d53 100644 --- a/src/main/java/com/squidex/api/types/RuleEventDto.java +++ b/src/main/java/com/squidex/api/types/RuleEventDto.java @@ -1,429 +1,462 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.RuleJobResult; +import com.squidex.api.types.RuleResult; +import java.io.IOException; import java.time.OffsetDateTime; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RuleEventDto.Builder.class) -public final class RuleEventDto implements IResource { - private final Map links; - - private final String id; - - private final OffsetDateTime created; - - private final String description; - - private final String eventName; - - private final Optional lastDump; - - private final int numCalls; - - private final Optional nextAttempt; - - private final RuleResult result; - - private final RuleJobResult jobResult; - - private RuleEventDto( - Map links, - String id, - OffsetDateTime created, - String description, - String eventName, - Optional lastDump, - int numCalls, - Optional nextAttempt, - RuleResult result, - RuleJobResult jobResult) { - this.links = links; - this.id = id; - this.created = created; - this.description = description; - this.eventName = eventName; - this.lastDump = lastDump; - this.numCalls = numCalls; - this.nextAttempt = nextAttempt; - this.result = result; - this.jobResult = jobResult; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the event. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The time when the event has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The description. - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * @return The name of the event. - */ - @JsonProperty("eventName") - public String getEventName() { - return eventName; - } - - /** - * @return The last dump. - */ - @JsonProperty("lastDump") - public Optional getLastDump() { - return lastDump; - } - - /** - * @return The number of calls. - */ - @JsonProperty("numCalls") - public int getNumCalls() { - return numCalls; - } - - /** - * @return The next attempt. - */ - @JsonProperty("nextAttempt") - public Optional getNextAttempt() { - return nextAttempt; - } - - /** - * @return The result of the event. - */ - @JsonProperty("result") - public RuleResult getResult() { - return result; - } - - /** - * @return The result of the job. - */ - @JsonProperty("jobResult") - public RuleJobResult getJobResult() { - return jobResult; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RuleEventDto && equalTo((RuleEventDto) other); - } - - private boolean equalTo(RuleEventDto other) { - return links.equals(other.links) - && id.equals(other.id) - && created.equals(other.created) - && description.equals(other.description) - && eventName.equals(other.eventName) - && lastDump.equals(other.lastDump) - && numCalls == other.numCalls - && nextAttempt.equals(other.nextAttempt) - && result.equals(other.result) - && jobResult.equals(other.jobResult); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.created, - this.description, - this.eventName, - this.lastDump, - this.numCalls, - this.nextAttempt, - this.result, - this.jobResult); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - CreatedStage id(String id); - - Builder from(RuleEventDto other); - } - - public interface CreatedStage { - DescriptionStage created(OffsetDateTime created); - } +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; - public interface DescriptionStage { - EventNameStage description(String description); - } +import com.squidex.api.core.JSON; - public interface EventNameStage { - NumCallsStage eventName(String eventName); +/** + * RuleEventDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RuleEventDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_CREATED = "created"; + @SerializedName(SERIALIZED_NAME_CREATED) + private OffsetDateTime created; + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; + @SerializedName(SERIALIZED_NAME_EVENT_NAME) + private String eventName; + public static final String SERIALIZED_NAME_LAST_DUMP = "lastDump"; + @SerializedName(SERIALIZED_NAME_LAST_DUMP) + private String lastDump; + public static final String SERIALIZED_NAME_NUM_CALLS = "numCalls"; + @SerializedName(SERIALIZED_NAME_NUM_CALLS) + private Integer numCalls; + public static final String SERIALIZED_NAME_NEXT_ATTEMPT = "nextAttempt"; + @SerializedName(SERIALIZED_NAME_NEXT_ATTEMPT) + private OffsetDateTime nextAttempt; + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private RuleResult result; + public static final String SERIALIZED_NAME_JOB_RESULT = "jobResult"; + @SerializedName(SERIALIZED_NAME_JOB_RESULT) + private RuleJobResult jobResult; + public RuleEventDto() { + } + public RuleEventDto links(Map links) { + this.links = links; + return this; + } + + public RuleEventDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface NumCallsStage { - ResultStage numCalls(int numCalls); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public RuleEventDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the event. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public RuleEventDto created(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * The time when the event has been created. + * @return created + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreated() { + return created; + } + + public void setCreated(OffsetDateTime created) { + this.created = created; + } + public RuleEventDto description(String description) { + this.description = description; + return this; + } + + /** + * The description. + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public RuleEventDto eventName(String eventName) { + this.eventName = eventName; + return this; + } + + /** + * The name of the event. + * @return eventName + */ + @javax.annotation.Nonnull + public String getEventName() { + return eventName; + } + + public void setEventName(String eventName) { + this.eventName = eventName; + } + public RuleEventDto lastDump(String lastDump) { + this.lastDump = lastDump; + return this; + } + + /** + * The last dump. + * @return lastDump + */ + @javax.annotation.Nullable + public String getLastDump() { + return lastDump; + } + + public void setLastDump(String lastDump) { + this.lastDump = lastDump; + } + public RuleEventDto numCalls(Integer numCalls) { + this.numCalls = numCalls; + return this; + } + + /** + * The number of calls. + * @return numCalls + */ + @javax.annotation.Nonnull + public Integer getNumCalls() { + return numCalls; + } + + public void setNumCalls(Integer numCalls) { + this.numCalls = numCalls; + } + public RuleEventDto nextAttempt(OffsetDateTime nextAttempt) { + this.nextAttempt = nextAttempt; + return this; + } + + /** + * The next attempt. + * @return nextAttempt + */ + @javax.annotation.Nullable + public OffsetDateTime getNextAttempt() { + return nextAttempt; + } + + public void setNextAttempt(OffsetDateTime nextAttempt) { + this.nextAttempt = nextAttempt; + } + public RuleEventDto result(RuleResult result) { + this.result = result; + return this; + } + + /** + * Get result + * @return result + */ + @javax.annotation.Nonnull + public RuleResult getResult() { + return result; + } + + public void setResult(RuleResult result) { + this.result = result; + } + public RuleEventDto jobResult(RuleJobResult jobResult) { + this.jobResult = jobResult; + return this; + } + + /** + * Get jobResult + * @return jobResult + */ + @javax.annotation.Nonnull + public RuleJobResult getJobResult() { + return jobResult; + } + + public void setJobResult(RuleJobResult jobResult) { + this.jobResult = jobResult; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ResultStage { - JobResultStage result(RuleResult result); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface JobResultStage { - _FinalStage jobResult(RuleJobResult jobResult); + RuleEventDto ruleEventDto = (RuleEventDto) o; + return Objects.equals(this.links, ruleEventDto.links) && + Objects.equals(this.id, ruleEventDto.id) && + Objects.equals(this.created, ruleEventDto.created) && + Objects.equals(this.description, ruleEventDto.description) && + Objects.equals(this.eventName, ruleEventDto.eventName) && + Objects.equals(this.lastDump, ruleEventDto.lastDump) && + Objects.equals(this.numCalls, ruleEventDto.numCalls) && + Objects.equals(this.nextAttempt, ruleEventDto.nextAttempt) && + Objects.equals(this.result, ruleEventDto.result) && + Objects.equals(this.jobResult, ruleEventDto.jobResult); + } + + 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(links, id, created, description, eventName, lastDump, numCalls, nextAttempt, result, jobResult); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - RuleEventDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage lastDump(Optional lastDump); - - _FinalStage lastDump(String lastDump); - - _FinalStage nextAttempt(Optional nextAttempt); - - _FinalStage nextAttempt(OffsetDateTime nextAttempt); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleEventDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); + sb.append(" lastDump: ").append(toIndentedString(lastDump)).append("\n"); + sb.append(" numCalls: ").append(toIndentedString(numCalls)).append("\n"); + sb.append(" nextAttempt: ").append(toIndentedString(nextAttempt)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append(" jobResult: ").append(toIndentedString(jobResult)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - CreatedStage, - DescriptionStage, - EventNameStage, - NumCallsStage, - ResultStage, - JobResultStage, - _FinalStage { - private String id; - - private OffsetDateTime created; - - private String description; - - private String eventName; - - private int numCalls; - - private RuleResult result; - - private RuleJobResult jobResult; - - private Optional nextAttempt = Optional.empty(); - - private Optional lastDump = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(RuleEventDto other) { - links(other.getLinks()); - id(other.getId()); - created(other.getCreated()); - description(other.getDescription()); - eventName(other.getEventName()); - lastDump(other.getLastDump()); - numCalls(other.getNumCalls()); - nextAttempt(other.getNextAttempt()); - result(other.getResult()); - jobResult(other.getJobResult()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("id"); + openapiFields.add("created"); + openapiFields.add("description"); + openapiFields.add("eventName"); + openapiFields.add("lastDump"); + openapiFields.add("numCalls"); + openapiFields.add("nextAttempt"); + openapiFields.add("result"); + openapiFields.add("jobResult"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("eventName"); + openapiRequiredFields.add("numCalls"); + openapiRequiredFields.add("result"); + openapiRequiredFields.add("jobResult"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RuleEventDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RuleEventDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RuleEventDto is not found in the empty JSON string", RuleEventDto.openapiRequiredFields.toString())); } + } - /** - *

The ID of the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public CreatedStage id(String id) { - this.id = id; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RuleEventDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RuleEventDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The time when the event has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public DescriptionStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The description.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("description") - public EventNameStage description(String description) { - this.description = description; - return this; - } - - /** - *

The name of the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("eventName") - public NumCallsStage eventName(String eventName) { - this.eventName = eventName; - return this; - } - - /** - *

The number of calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("numCalls") - public ResultStage numCalls(int numCalls) { - this.numCalls = numCalls; - return this; - } - - /** - *

The result of the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("result") - public JobResultStage result(RuleResult result) { - this.result = result; - return this; - } - - /** - *

The result of the job.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("jobResult") - public _FinalStage jobResult(RuleJobResult jobResult) { - this.jobResult = jobResult; - return this; - } - - /** - *

The next attempt.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage nextAttempt(OffsetDateTime nextAttempt) { - this.nextAttempt = Optional.of(nextAttempt); - return this; - } - - @Override - @JsonSetter(value = "nextAttempt", nulls = Nulls.SKIP) - public _FinalStage nextAttempt(Optional nextAttempt) { - this.nextAttempt = nextAttempt; - return this; - } - - /** - *

The last dump.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage lastDump(String lastDump) { - this.lastDump = Optional.of(lastDump); - return this; - } - - @Override - @JsonSetter(value = "lastDump", nulls = Nulls.SKIP) - public _FinalStage lastDump(Optional lastDump) { - this.lastDump = lastDump; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public RuleEventDto build() { - return new RuleEventDto( - links, id, created, description, eventName, lastDump, numCalls, nextAttempt, result, jobResult); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RuleEventDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + if (!jsonObj.get("eventName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventName").toString())); + } + if ((jsonObj.get("lastDump") != null && !jsonObj.get("lastDump").isJsonNull()) && !jsonObj.get("lastDump").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastDump` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastDump").toString())); + } + // validate the required field `result` + RuleResult.validateJsonElement(jsonObj.get("result")); + // validate the required field `jobResult` + RuleJobResult.validateJsonElement(jsonObj.get("jobResult")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RuleEventDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RuleEventDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RuleEventDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RuleEventDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RuleEventDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of RuleEventDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RuleEventDto + * @throws IOException if the JSON string is invalid with respect to RuleEventDto + */ + public static RuleEventDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RuleEventDto.class); + } + + /** + * Convert an instance of RuleEventDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RuleEventsDto.java b/src/main/java/com/squidex/api/types/RuleEventsDto.java index d7f185e..91ec604 100644 --- a/src/main/java/com/squidex/api/types/RuleEventsDto.java +++ b/src/main/java/com/squidex/api/types/RuleEventsDto.java @@ -1,195 +1,286 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.RuleEventDto; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RuleEventsDto.Builder.class) -public final class RuleEventsDto implements IResource { - private final Map links; - - private final int total; - private final List items; - - private RuleEventsDto(Map links, int total, List items) { - this.links = links; - this.total = total; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of rule events. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The rule events. - */ - @JsonProperty("items") - public List getItems() { - return items; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RuleEventsDto && equalTo((RuleEventsDto) other); +/** + * RuleEventsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RuleEventsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + private Long total; + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public RuleEventsDto() { + } + public RuleEventsDto links(Map links) { + this.links = links; + return this; + } + + public RuleEventsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - private boolean equalTo(RuleEventsDto other) { - return links.equals(other.links) && total == other.total && items.equals(other.items); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public RuleEventsDto total(Long total) { + this.total = total; + return this; + } + + /** + * The total number of rule events. + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + public RuleEventsDto items(List items) { + this.items = items; + return this; + } + + public RuleEventsDto addItemsItem(RuleEventDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items); + this.items.add(itemsItem); + return this; + } + + /** + * The rule events. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static TotalStage builder() { - return new Builder(); + RuleEventsDto ruleEventsDto = (RuleEventsDto) o; + return Objects.equals(this.links, ruleEventsDto.links) && + Objects.equals(this.total, ruleEventsDto.total) && + Objects.equals(this.items, ruleEventsDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, total, items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleEventsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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"; } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(RuleEventsDto other); - } - - public interface _FinalStage { - RuleEventsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(RuleEventDto items); - - _FinalStage addAllItems(List items); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(RuleEventsDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("total"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("items"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RuleEventsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RuleEventsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RuleEventsDto is not found in the empty JSON string", RuleEventsDto.openapiRequiredFields.toString())); } + } - /** - *

The total number of rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RuleEventsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RuleEventsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(RuleEventDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public RuleEventsDto build() { - return new RuleEventsDto(links, total, items); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RuleEventsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + RuleEventDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RuleEventsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RuleEventsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RuleEventsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RuleEventsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public RuleEventsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of RuleEventsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RuleEventsDto + * @throws IOException if the JSON string is invalid with respect to RuleEventsDto + */ + public static RuleEventsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RuleEventsDto.class); + } + + /** + * Convert an instance of RuleEventsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RuleFieldEditor.java b/src/main/java/com/squidex/api/types/RuleFieldEditor.java index 764b867..2f117da 100644 --- a/src/main/java/com/squidex/api/types/RuleFieldEditor.java +++ b/src/main/java/com/squidex/api/types/RuleFieldEditor.java @@ -1,38 +1,92 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonValue; -public enum RuleFieldEditor { - CHECKBOX("Checkbox"), - DROPDOWN("Dropdown"), +package com.squidex.api.types; - EMAIL("Email"), +import java.util.Objects; +import com.google.gson.annotations.SerializedName; - JAVASCRIPT("Javascript"), +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; - NUMBER("Number"), +/** + * + */ +@JsonAdapter(RuleFieldEditor.Adapter.class) +public enum RuleFieldEditor { + + CHECKBOX("Checkbox"), + + DROPDOWN("Dropdown"), + + EMAIL("Email"), + + JAVASCRIPT("Javascript"), + + NUMBER("Number"), + + PASSWORD("Password"), + + TEXT("Text"), + + TEXT_AREA("TextArea"), + + URL("Url"); - PASSWORD("Password"), + private String value; - TEXT("Text"), + RuleFieldEditor(String value) { + this.value = value; + } - TEXT_AREA("TextArea"), + public String getValue() { + return value; + } - URL("Url"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static RuleFieldEditor fromValue(String value) { + for (RuleFieldEditor b : RuleFieldEditor.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - RuleFieldEditor(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RuleFieldEditor enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public RuleFieldEditor read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RuleFieldEditor.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + RuleFieldEditor.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/RuleJobResult.java b/src/main/java/com/squidex/api/types/RuleJobResult.java index f3f54b6..dc1b42f 100644 --- a/src/main/java/com/squidex/api/types/RuleJobResult.java +++ b/src/main/java/com/squidex/api/types/RuleJobResult.java @@ -1,30 +1,84 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(RuleJobResult.Adapter.class) public enum RuleJobResult { - PENDING("Pending"), + + PENDING("Pending"), + + SUCCESS("Success"), + + RETRY("Retry"), + + FAILED("Failed"), + + CANCELLED("Cancelled"); - SUCCESS("Success"), + private String value; - RETRY("Retry"), + RuleJobResult(String value) { + this.value = value; + } - FAILED("Failed"), + public String getValue() { + return value; + } - CANCELLED("Cancelled"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static RuleJobResult fromValue(String value) { + for (RuleJobResult b : RuleJobResult.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - RuleJobResult(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final RuleJobResult enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public RuleJobResult read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RuleJobResult.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + RuleJobResult.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/RuleResult.java b/src/main/java/com/squidex/api/types/RuleResult.java index 7b09162..c7233f8 100644 --- a/src/main/java/com/squidex/api/types/RuleResult.java +++ b/src/main/java/com/squidex/api/types/RuleResult.java @@ -1,28 +1,82 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(RuleResult.Adapter.class) public enum RuleResult { - PENDING("Pending"), + + PENDING("Pending"), + + SUCCESS("Success"), + + FAILED("Failed"), + + TIMEOUT("Timeout"); - SUCCESS("Success"), + private String value; - FAILED("Failed"), + RuleResult(String value) { + this.value = value; + } - TIMEOUT("Timeout"); + public String getValue() { + return value; + } - private final String value; + @Override + public String toString() { + return String.valueOf(value); + } - RuleResult(String value) { - this.value = value; + public static RuleResult fromValue(String value) { + for (RuleResult b : RuleResult.values()) { + if (b.value.equals(value)) { + return b; + } } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - @JsonValue + public static class Adapter extends TypeAdapter { @Override - public String toString() { - return this.value; + public void write(final JsonWriter jsonWriter, final RuleResult enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } + + @Override + public RuleResult read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return RuleResult.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + RuleResult.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/RuleTriggerDto.java b/src/main/java/com/squidex/api/types/RuleTriggerDto.java index 2c9f0a6..373d645 100644 --- a/src/main/java/com/squidex/api/types/RuleTriggerDto.java +++ b/src/main/java/com/squidex/api/types/RuleTriggerDto.java @@ -1,431 +1,165 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import com.fasterxml.jackson.annotation.JsonValue; -import java.util.Objects; -import java.util.Optional; - -public final class RuleTriggerDto { - private final Value value; - - @JsonCreator(mode = JsonCreator.Mode.DELEGATING) - private RuleTriggerDto(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static RuleTriggerDto assetChanged(AssetChangedRuleTriggerDto value) { - return new RuleTriggerDto(new AssetChangedValue(value)); - } - - public static RuleTriggerDto comment(CommentRuleTriggerDto value) { - return new RuleTriggerDto(new CommentValue(value)); - } - - public static RuleTriggerDto contentChanged(ContentChangedRuleTriggerDto value) { - return new RuleTriggerDto(new ContentChangedValue(value)); - } - - public static RuleTriggerDto manual(ManualRuleTriggerDto value) { - return new RuleTriggerDto(new ManualValue(value)); - } - - public static RuleTriggerDto schemaChanged(SchemaChangedRuleTriggerDto value) { - return new RuleTriggerDto(new SchemaChangedValue(value)); - } - - public static RuleTriggerDto usage(UsageRuleTriggerDto value) { - return new RuleTriggerDto(new UsageValue(value)); - } - - public boolean isAssetChanged() { - return value instanceof AssetChangedValue; - } - - public boolean isComment() { - return value instanceof CommentValue; - } - - public boolean isContentChanged() { - return value instanceof ContentChangedValue; - } - - public boolean isManual() { - return value instanceof ManualValue; - } - - public boolean isSchemaChanged() { - return value instanceof SchemaChangedValue; - } - - public boolean isUsage() { - return value instanceof UsageValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getAssetChanged() { - if (isAssetChanged()) { - return Optional.of(((AssetChangedValue) value).value); - } - return Optional.empty(); - } - - public Optional getComment() { - if (isComment()) { - return Optional.of(((CommentValue) value).value); - } - return Optional.empty(); - } - - public Optional getContentChanged() { - if (isContentChanged()) { - return Optional.of(((ContentChangedValue) value).value); - } - return Optional.empty(); - } - - public Optional getManual() { - if (isManual()) { - return Optional.of(((ManualValue) value).value); - } - return Optional.empty(); - } - - public Optional getSchemaChanged() { - if (isSchemaChanged()) { - return Optional.of(((SchemaChangedValue) value).value); - } - return Optional.empty(); - } - - public Optional getUsage() { - if (isUsage()) { - return Optional.of(((UsageValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitAssetChanged(AssetChangedRuleTriggerDto assetChanged); - - T visitComment(CommentRuleTriggerDto comment); - - T visitContentChanged(ContentChangedRuleTriggerDto contentChanged); - - T visitManual(ManualRuleTriggerDto manual); - - T visitSchemaChanged(SchemaChangedRuleTriggerDto schemaChanged); - - T visitUsage(UsageRuleTriggerDto usage); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "triggerType", - visible = true, - defaultImpl = _UnknownValue.class) - @JsonSubTypes({ - @JsonSubTypes.Type(AssetChangedValue.class), - @JsonSubTypes.Type(CommentValue.class), - @JsonSubTypes.Type(ContentChangedValue.class), - @JsonSubTypes.Type(ManualValue.class), - @JsonSubTypes.Type(SchemaChangedValue.class), - @JsonSubTypes.Type(UsageValue.class) - }) - @JsonIgnoreProperties(ignoreUnknown = true) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("AssetChanged") - private static final class AssetChangedValue implements Value { - @JsonUnwrapped - private AssetChangedRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private AssetChangedValue() {} - - private AssetChangedValue(AssetChangedRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitAssetChanged(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof AssetChangedValue && equalTo((AssetChangedValue) other); - } - - private boolean equalTo(AssetChangedValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Comment") - private static final class CommentValue implements Value { - @JsonUnwrapped - private CommentRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private CommentValue() {} - - private CommentValue(CommentRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitComment(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CommentValue && equalTo((CommentValue) other); - } - - private boolean equalTo(CommentValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("ContentChanged") - private static final class ContentChangedValue implements Value { - @JsonUnwrapped - private ContentChangedRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ContentChangedValue() {} - - private ContentChangedValue(ContentChangedRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitContentChanged(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ContentChangedValue && equalTo((ContentChangedValue) other); - } - - private boolean equalTo(ContentChangedValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Manual") - private static final class ManualValue implements Value { - @JsonUnwrapped - private ManualRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private ManualValue() {} - - private ManualValue(ManualRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitManual(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ManualValue && equalTo((ManualValue) other); - } - - private boolean equalTo(ManualValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("SchemaChanged") - private static final class SchemaChangedValue implements Value { - @JsonUnwrapped - private SchemaChangedRuleTriggerDto value; - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private SchemaChangedValue() {} - private SchemaChangedValue(SchemaChangedRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitSchemaChanged(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaChangedValue && equalTo((SchemaChangedValue) other); - } - - private boolean equalTo(SchemaChangedValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - @JsonTypeName("Usage") - private static final class UsageValue implements Value { - @JsonUnwrapped - private UsageRuleTriggerDto value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private UsageValue() {} - - private UsageValue(UsageRuleTriggerDto value) { - this.value = value; - } - - @Override - public T visit(Visitor visitor) { - return visitor.visitUsage(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageValue && equalTo((UsageValue) other); - } - - private boolean equalTo(UsageValue other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } - - @Override - public String toString() { - return "RuleTriggerDto{" + "value: " + value + "}"; - } - } - - private static final class _UnknownValue implements Value { - private String type; - - @JsonValue - private Object value; - - @JsonCreator(mode = JsonCreator.Mode.PROPERTIES) - private _UnknownValue(@JsonProperty("value") Object value) {} - - @Override - public T visit(Visitor visitor) { - return visitor._visitUnknown(value); - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof _UnknownValue && equalTo((_UnknownValue) other); - } - - private boolean equalTo(_UnknownValue other) { - return type.equals(other.type) && value.equals(other.value); - } +package com.squidex.api.types; - @Override - public int hashCode() { - return Objects.hash(this.type, this.value); - } +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.squidex.api.core.JSON; - @Override - public String toString() { - return "RuleTriggerDto{" + "type: " + type + ", value: " + value + "}"; - } - } +/** + * RuleTriggerDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RuleTriggerDto { + public RuleTriggerDto() { + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RuleTriggerDto ruleTriggerDto = (RuleTriggerDto) o; + return true; + } + + @Override + public int hashCode() { + return Objects.hash(true); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RuleTriggerDto {\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("triggerType"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("triggerType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RuleTriggerDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RuleTriggerDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RuleTriggerDto is not found in the empty JSON string", RuleTriggerDto.openapiRequiredFields.toString())); + } + } + + String discriminatorValue = jsonElement.getAsJsonObject().get("triggerType").getAsString(); + switch (discriminatorValue) { + case "AssetChanged": + AssetChangedRuleTriggerDto.validateJsonElement(jsonElement); + break; + case "Comment": + CommentRuleTriggerDto.validateJsonElement(jsonElement); + break; + case "ContentChanged": + ContentChangedRuleTriggerDto.validateJsonElement(jsonElement); + break; + case "Manual": + ManualRuleTriggerDto.validateJsonElement(jsonElement); + break; + case "SchemaChanged": + SchemaChangedRuleTriggerDto.validateJsonElement(jsonElement); + break; + case "Usage": + UsageRuleTriggerDto.validateJsonElement(jsonElement); + break; + default: + throw new IllegalArgumentException(String.format("The value of the `triggerType` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + } + + + /** + * Create an instance of RuleTriggerDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RuleTriggerDto + * @throws IOException if the JSON string is invalid with respect to RuleTriggerDto + */ + public static RuleTriggerDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RuleTriggerDto.class); + } + + /** + * Convert an instance of RuleTriggerDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/RulesDto.java b/src/main/java/com/squidex/api/types/RulesDto.java index 33f474f..1dd4ee1 100644 --- a/src/main/java/com/squidex/api/types/RulesDto.java +++ b/src/main/java/com/squidex/api/types/RulesDto.java @@ -1,150 +1,300 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.RuleDto; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = RulesDto.Builder.class) -public final class RulesDto implements IResource { - private final Map links; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final List items; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final Optional runningRuleId; +import com.squidex.api.core.JSON; - private RulesDto(Map links, List items, Optional runningRuleId) { - this.links = links; - this.items = items; - this.runningRuleId = runningRuleId; - } +/** + * RulesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class RulesDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public static final String SERIALIZED_NAME_RUNNING_RULE_ID = "runningRuleId"; + @SerializedName(SERIALIZED_NAME_RUNNING_RULE_ID) + private String runningRuleId; + public RulesDto() { + } + public RulesDto links(Map links) { + this.links = links; + return this; + } - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; + public RulesDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } + this.links.put(key, linksItem); + return this; + } - /** - * @return The rules. - */ - @JsonProperty("items") - public List getItems() { - return items; - } + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } - /** - * @return The ID of the rule that is currently rerunning. - */ - @JsonProperty("runningRuleId") - public Optional getRunningRuleId() { - return runningRuleId; - } + public void setLinks(Map links) { + this.links = links; + } + public RulesDto items(List items) { + this.items = items; + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof RulesDto && equalTo((RulesDto) other); + public RulesDto addItemsItem(RuleDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } + this.items.add(itemsItem); + return this; + } - private boolean equalTo(RulesDto other) { - return links.equals(other.links) && items.equals(other.items) && runningRuleId.equals(other.runningRuleId); - } + /** + * The rules. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } - @Override - public int hashCode() { - return Objects.hash(this.links, this.items, this.runningRuleId); - } + public void setItems(List items) { + this.items = items; + } + public RulesDto runningRuleId(String runningRuleId) { + this.runningRuleId = runningRuleId; + return this; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + /** + * The ID of the rule that is currently rerunning. + * @return runningRuleId + */ + @javax.annotation.Nullable + public String getRunningRuleId() { + return runningRuleId; + } + + public void setRunningRuleId(String runningRuleId) { + this.runningRuleId = runningRuleId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + RulesDto rulesDto = (RulesDto) o; + return Objects.equals(this.links, rulesDto.links) && + Objects.equals(this.items, rulesDto.items) && + Objects.equals(this.runningRuleId, rulesDto.runningRuleId); + } + + 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())); + } - public static Builder builder() { - return new Builder(); + @Override + public int hashCode() { + return Objects.hash(links, items, runningRuleId); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RulesDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" runningRuleId: ").append(toIndentedString(runningRuleId)).append("\n"); + sb.append("}"); + return sb.toString(); + } - private List items = new ArrayList<>(); + /** + * 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 "); + } - private Optional runningRuleId = Optional.empty(); - private Builder() {} + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder from(RulesDto other) { - links(other.getLinks()); - items(other.getItems()); - runningRuleId(other.getRunningRuleId()); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("items"); + openapiFields.add("runningRuleId"); - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + } - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RulesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RulesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in RulesDto is not found in the empty JSON string", RulesDto.openapiRequiredFields.toString())); } + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!RulesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `RulesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : RulesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } - public Builder addItems(RuleDto items) { - this.items.add(items); - return this; - } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + RuleDto.validateJsonElement(jsonArrayitems.get(i)); + }; + if ((jsonObj.get("runningRuleId") != null && !jsonObj.get("runningRuleId").isJsonNull()) && !jsonObj.get("runningRuleId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `runningRuleId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("runningRuleId").toString())); + } + } - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RulesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RulesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RulesDto.class)); - @JsonSetter(value = "runningRuleId", nulls = Nulls.SKIP) - public Builder runningRuleId(Optional runningRuleId) { - this.runningRuleId = runningRuleId; - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RulesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public Builder runningRuleId(String runningRuleId) { - this.runningRuleId = Optional.of(runningRuleId); - return this; - } + @Override + public RulesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } - public RulesDto build() { - return new RulesDto(links, items, runningRuleId); - } + }.nullSafe(); } + } + + /** + * Create an instance of RulesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of RulesDto + * @throws IOException if the JSON string is invalid with respect to RulesDto + */ + public static RulesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RulesDto.class); + } + + /** + * Convert an instance of RulesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ScheduleJobDto.java b/src/main/java/com/squidex/api/types/ScheduleJobDto.java index 0e90225..c1f476f 100644 --- a/src/main/java/com/squidex/api/types/ScheduleJobDto.java +++ b/src/main/java/com/squidex/api/types/ScheduleJobDto.java @@ -1,215 +1,315 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.time.OffsetDateTime; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ScheduleJobDto.Builder.class) -public final class ScheduleJobDto { - private final String id; - - private final String status; - - private final OffsetDateTime dueTime; - - private final String color; - - private final String scheduledBy; - - private ScheduleJobDto(String id, String status, OffsetDateTime dueTime, String color, String scheduledBy) { - this.id = id; - this.status = status; - this.dueTime = dueTime; - this.color = color; - this.scheduledBy = scheduledBy; - } - - /** - * @return The ID of the schedule job. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The new status. - */ - @JsonProperty("status") - public String getStatus() { - return status; - } - - /** - * @return The target date and time when the content should be scheduled. - */ - @JsonProperty("dueTime") - public OffsetDateTime getDueTime() { - return dueTime; - } - - /** - * @return The color of the scheduled status. - */ - @JsonProperty("color") - public String getColor() { - return color; - } - - /** - * @return The user who schedule the content. - */ - @JsonProperty("scheduledBy") - public String getScheduledBy() { - return scheduledBy; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ScheduleJobDto && equalTo((ScheduleJobDto) other); - } - - private boolean equalTo(ScheduleJobDto other) { - return id.equals(other.id) - && status.equals(other.status) - && dueTime.equals(other.dueTime) - && color.equals(other.color) - && scheduledBy.equals(other.scheduledBy); - } - - @Override - public int hashCode() { - return Objects.hash(this.id, this.status, this.dueTime, this.color, this.scheduledBy); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - public interface IdStage { - StatusStage id(String id); - Builder from(ScheduleJobDto other); - } - - public interface StatusStage { - DueTimeStage status(String status); - } +package com.squidex.api.types; - public interface DueTimeStage { - ColorStage dueTime(OffsetDateTime dueTime); - } +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.squidex.api.core.JSON; - public interface ColorStage { - ScheduledByStage color(String color); +/** + * ScheduleJobDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ScheduleJobDto { + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + public static final String SERIALIZED_NAME_DUE_TIME = "dueTime"; + @SerializedName(SERIALIZED_NAME_DUE_TIME) + private OffsetDateTime dueTime; + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; + public static final String SERIALIZED_NAME_SCHEDULED_BY = "scheduledBy"; + @SerializedName(SERIALIZED_NAME_SCHEDULED_BY) + private String scheduledBy; + public ScheduleJobDto() { + } + public ScheduleJobDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the schedule job. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public ScheduleJobDto status(String status) { + this.status = status; + return this; + } + + /** + * The new status. + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + public ScheduleJobDto dueTime(OffsetDateTime dueTime) { + this.dueTime = dueTime; + return this; + } + + /** + * The target date and time when the content should be scheduled. + * @return dueTime + */ + @javax.annotation.Nonnull + public OffsetDateTime getDueTime() { + return dueTime; + } + + public void setDueTime(OffsetDateTime dueTime) { + this.dueTime = dueTime; + } + public ScheduleJobDto color(String color) { + this.color = color; + return this; + } + + /** + * The color of the scheduled status. + * @return color + */ + @javax.annotation.Nonnull + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + public ScheduleJobDto scheduledBy(String scheduledBy) { + this.scheduledBy = scheduledBy; + return this; + } + + /** + * The user who schedule the content. + * @return scheduledBy + */ + @javax.annotation.Nonnull + public String getScheduledBy() { + return scheduledBy; + } + + public void setScheduledBy(String scheduledBy) { + this.scheduledBy = scheduledBy; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ScheduledByStage { - _FinalStage scheduledBy(String scheduledBy); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - ScheduleJobDto build(); + ScheduleJobDto scheduleJobDto = (ScheduleJobDto) o; + return Objects.equals(this.id, scheduleJobDto.id) && + Objects.equals(this.status, scheduleJobDto.status) && + Objects.equals(this.dueTime, scheduleJobDto.dueTime) && + Objects.equals(this.color, scheduleJobDto.color) && + Objects.equals(this.scheduledBy, scheduleJobDto.scheduledBy); + } + + @Override + public int hashCode() { + return Objects.hash(id, status, dueTime, color, scheduledBy); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScheduleJobDto {\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" dueTime: ").append(toIndentedString(dueTime)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" scheduledBy: ").append(toIndentedString(scheduledBy)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, StatusStage, DueTimeStage, ColorStage, ScheduledByStage, _FinalStage { - private String id; - - private String status; - - private OffsetDateTime dueTime; - - private String color; - - private String scheduledBy; - - private Builder() {} - - @Override - public Builder from(ScheduleJobDto other) { - id(other.getId()); - status(other.getStatus()); - dueTime(other.getDueTime()); - color(other.getColor()); - scheduledBy(other.getScheduledBy()); - return this; - } - - /** - *

The ID of the schedule job.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public StatusStage id(String id) { - this.id = id; - return this; + return o.toString().replace("\n", "\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("status"); + openapiFields.add("dueTime"); + openapiFields.add("color"); + openapiFields.add("scheduledBy"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("dueTime"); + openapiRequiredFields.add("color"); + openapiRequiredFields.add("scheduledBy"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ScheduleJobDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ScheduleJobDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ScheduleJobDto is not found in the empty JSON string", ScheduleJobDto.openapiRequiredFields.toString())); } + } - /** - *

The new status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public DueTimeStage status(String status) { - this.status = status; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ScheduleJobDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ScheduleJobDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The target date and time when the content should be scheduled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("dueTime") - public ColorStage dueTime(OffsetDateTime dueTime) { - this.dueTime = dueTime; - return this; - } - - /** - *

The color of the scheduled status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("color") - public ScheduledByStage color(String color) { - this.color = color; - return this; - } - - /** - *

The user who schedule the content.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("scheduledBy") - public _FinalStage scheduledBy(String scheduledBy) { - this.scheduledBy = scheduledBy; - return this; - } - - @Override - public ScheduleJobDto build() { - return new ScheduleJobDto(id, status, dueTime, color, scheduledBy); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ScheduleJobDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + if (!jsonObj.get("scheduledBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `scheduledBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("scheduledBy").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!ScheduleJobDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ScheduleJobDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ScheduleJobDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ScheduleJobDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ScheduleJobDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ScheduleJobDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ScheduleJobDto + * @throws IOException if the JSON string is invalid with respect to ScheduleJobDto + */ + public static ScheduleJobDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ScheduleJobDto.class); + } + + /** + * Convert an instance of ScheduleJobDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java b/src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java index c21f2eb..30b9002 100644 --- a/src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java +++ b/src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java @@ -1,83 +1,221 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.RuleTriggerDto; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemaChangedRuleTriggerDto.Builder.class) -public final class SchemaChangedRuleTriggerDto { - private final Optional condition; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private SchemaChangedRuleTriggerDto(Optional condition) { - this.condition = condition; - } +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return Javascript condition when to trigger. - */ - @JsonProperty("condition") - public Optional getCondition() { - return condition; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaChangedRuleTriggerDto && equalTo((SchemaChangedRuleTriggerDto) other); - } +/** + * SchemaChangedRuleTriggerDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SchemaChangedRuleTriggerDto extends RuleTriggerDto { + public static final String SERIALIZED_NAME_CONDITION = "condition"; + @SerializedName(SERIALIZED_NAME_CONDITION) + private String condition; + public SchemaChangedRuleTriggerDto() { + } + public SchemaChangedRuleTriggerDto condition(String condition) { + this.condition = condition; + return this; + } - private boolean equalTo(SchemaChangedRuleTriggerDto other) { - return condition.equals(other.condition); - } + /** + * Javascript condition when to trigger. + * @return condition + */ + @javax.annotation.Nullable + public String getCondition() { + return condition; + } - @Override - public int hashCode() { - return Objects.hash(this.condition); + public void setCondition(String condition) { + this.condition = condition; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + SchemaChangedRuleTriggerDto schemaChangedRuleTriggerDto = (SchemaChangedRuleTriggerDto) o; + return Objects.equals(this.condition, schemaChangedRuleTriggerDto.condition) && + super.equals(o); + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + 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(condition, super.hashCode()); + } + + 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 SchemaChangedRuleTriggerDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" condition: ").append(toIndentedString(condition)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public static Builder builder() { - return new Builder(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional condition = Optional.empty(); - private Builder() {} + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder from(SchemaChangedRuleTriggerDto other) { - condition(other.getCondition()); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("triggerType"); + openapiFields.add("condition"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("triggerType"); + } - @JsonSetter(value = "condition", nulls = Nulls.SKIP) - public Builder condition(Optional condition) { - this.condition = condition; - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SchemaChangedRuleTriggerDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SchemaChangedRuleTriggerDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SchemaChangedRuleTriggerDto is not found in the empty JSON string", SchemaChangedRuleTriggerDto.openapiRequiredFields.toString())); } + } - public Builder condition(String condition) { - this.condition = Optional.of(condition); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SchemaChangedRuleTriggerDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SchemaChangedRuleTriggerDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public SchemaChangedRuleTriggerDto build() { - return new SchemaChangedRuleTriggerDto(condition); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SchemaChangedRuleTriggerDto.openapiRequiredFields) { + if (jsonElement.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 (!SchemaChangedRuleTriggerDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SchemaChangedRuleTriggerDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SchemaChangedRuleTriggerDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SchemaChangedRuleTriggerDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SchemaChangedRuleTriggerDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SchemaChangedRuleTriggerDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SchemaChangedRuleTriggerDto + * @throws IOException if the JSON string is invalid with respect to SchemaChangedRuleTriggerDto + */ + public static SchemaChangedRuleTriggerDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SchemaChangedRuleTriggerDto.class); + } + + /** + * Convert an instance of SchemaChangedRuleTriggerDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SchemaCondition.java b/src/main/java/com/squidex/api/types/SchemaCondition.java index 4787746..7344fd7 100644 --- a/src/main/java/com/squidex/api/types/SchemaCondition.java +++ b/src/main/java/com/squidex/api/types/SchemaCondition.java @@ -1,116 +1,247 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemaCondition.Builder.class) -public final class SchemaCondition { - private final String schemaId; - private final Optional condition; - private SchemaCondition(String schemaId, Optional condition) { - this.schemaId = schemaId; - this.condition = condition; - } - - @JsonProperty("schemaId") - public String getSchemaId() { - return schemaId; - } - - @JsonProperty("condition") - public Optional getCondition() { - return condition; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaCondition && equalTo((SchemaCondition) other); - } - - private boolean equalTo(SchemaCondition other) { - return schemaId.equals(other.schemaId) && condition.equals(other.condition); - } +package com.squidex.api.types; - @Override - public int hashCode() { - return Objects.hash(this.schemaId, this.condition); - } +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.squidex.api.core.JSON; - @Override - public String toString() { - return ObjectMappers.stringify(this); +/** + * SchemaCondition + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SchemaCondition { + public static final String SERIALIZED_NAME_SCHEMA_ID = "schemaId"; + @SerializedName(SERIALIZED_NAME_SCHEMA_ID) + private String schemaId; + public static final String SERIALIZED_NAME_CONDITION = "condition"; + @SerializedName(SERIALIZED_NAME_CONDITION) + private String condition; + public SchemaCondition() { + } + public SchemaCondition schemaId(String schemaId) { + this.schemaId = schemaId; + return this; + } + + /** + * Get schemaId + * @return schemaId + */ + @javax.annotation.Nonnull + public String getSchemaId() { + return schemaId; + } + + public void setSchemaId(String schemaId) { + this.schemaId = schemaId; + } + public SchemaCondition condition(String condition) { + this.condition = condition; + return this; + } + + /** + * Get condition + * @return condition + */ + @javax.annotation.Nullable + public String getCondition() { + return condition; + } + + public void setCondition(String condition) { + this.condition = condition; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public static SchemaIdStage builder() { - return new Builder(); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface SchemaIdStage { - _FinalStage schemaId(String schemaId); - - Builder from(SchemaCondition other); + SchemaCondition schemaCondition = (SchemaCondition) o; + return Objects.equals(this.schemaId, schemaCondition.schemaId) && + Objects.equals(this.condition, schemaCondition.condition); + } + + 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(schemaId, condition); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - SchemaCondition build(); - - _FinalStage condition(Optional condition); - - _FinalStage condition(String condition); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SchemaCondition {\n"); + sb.append(" schemaId: ").append(toIndentedString(schemaId)).append("\n"); + sb.append(" condition: ").append(toIndentedString(condition)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements SchemaIdStage, _FinalStage { - private String schemaId; - - private Optional condition = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(SchemaCondition other) { - schemaId(other.getSchemaId()); - condition(other.getCondition()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("schemaId"); + openapiFields.add("condition"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("schemaId"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SchemaCondition + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SchemaCondition.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SchemaCondition is not found in the empty JSON string", SchemaCondition.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter("schemaId") - public _FinalStage schemaId(String schemaId) { - this.schemaId = schemaId; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SchemaCondition.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SchemaCondition` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public _FinalStage condition(String condition) { - this.condition = Optional.of(condition); - return this; - } - - @Override - @JsonSetter(value = "condition", nulls = Nulls.SKIP) - public _FinalStage condition(Optional condition) { - this.condition = condition; - return this; - } - - @Override - public SchemaCondition build() { - return new SchemaCondition(schemaId, condition); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SchemaCondition.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("schemaId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `schemaId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("schemaId").toString())); + } + if ((jsonObj.get("condition") != null && !jsonObj.get("condition").isJsonNull()) && !jsonObj.get("condition").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `condition` to be a primitive type in the JSON string but got `%s`", jsonObj.get("condition").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SchemaCondition.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SchemaCondition' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SchemaCondition.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SchemaCondition value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SchemaCondition read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SchemaCondition given an JSON string + * + * @param jsonString JSON string + * @return An instance of SchemaCondition + * @throws IOException if the JSON string is invalid with respect to SchemaCondition + */ + public static SchemaCondition fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SchemaCondition.class); + } + + /** + * Convert an instance of SchemaCondition to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SchemaDto.java b/src/main/java/com/squidex/api/types/SchemaDto.java index bd42509..3184924 100644 --- a/src/main/java/com/squidex/api/types/SchemaDto.java +++ b/src/main/java/com/squidex/api/types/SchemaDto.java @@ -1,831 +1,766 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.FieldDto; +import com.squidex.api.types.FieldRuleDto; +import com.squidex.api.types.ResourceLink; +import com.squidex.api.types.SchemaPropertiesDto; +import com.squidex.api.types.SchemaScriptsDto; +import com.squidex.api.types.SchemaType; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemaDto.Builder.class) -public final class SchemaDto implements IResource { - private final Map links; - - private final String id; - - private final String createdBy; - - private final String lastModifiedBy; - - private final String name; - - private final SchemaType type; - - private final Optional category; - - private final SchemaPropertiesDto properties; - - private final boolean isSingleton; - - private final boolean isPublished; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final int version; - - private final SchemaScriptsDto scripts; - - private final Map previewUrls; - - private final List fieldsInLists; - - private final List fieldsInReferences; - - private final List fieldRules; - - private final List fields; - - private SchemaDto( - Map links, - String id, - String createdBy, - String lastModifiedBy, - String name, - SchemaType type, - Optional category, - SchemaPropertiesDto properties, - boolean isSingleton, - boolean isPublished, - OffsetDateTime created, - OffsetDateTime lastModified, - int version, - SchemaScriptsDto scripts, - Map previewUrls, - List fieldsInLists, - List fieldsInReferences, - List fieldRules, - List fields) { - this.links = links; - this.id = id; - this.createdBy = createdBy; - this.lastModifiedBy = lastModifiedBy; - this.name = name; - this.type = type; - this.category = category; - this.properties = properties; - this.isSingleton = isSingleton; - this.isPublished = isPublished; - this.created = created; - this.lastModified = lastModified; - this.version = version; - this.scripts = scripts; - this.previewUrls = previewUrls; - this.fieldsInLists = fieldsInLists; - this.fieldsInReferences = fieldsInReferences; - this.fieldRules = fieldRules; - this.fields = fields; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the schema. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The user that has created the schema. - */ - @JsonProperty("createdBy") - public String getCreatedBy() { - return createdBy; - } - - /** - * @return The user that has updated the schema. - */ - @JsonProperty("lastModifiedBy") - public String getLastModifiedBy() { - return lastModifiedBy; - } - - /** - * @return The name of the schema. Unique within the app. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The type of the schema. - */ - @JsonProperty("type") - public SchemaType getType() { - return type; - } - - /** - * @return The name of the category. - */ - @JsonProperty("category") - public Optional getCategory() { - return category; - } - - /** - * @return The schema properties. - */ - @JsonProperty("properties") - public SchemaPropertiesDto getProperties() { - return properties; - } - - /** - * @return Indicates if the schema is a singleton. - */ - @JsonProperty("isSingleton") - public boolean getIsSingleton() { - return isSingleton; - } - - /** - * @return Indicates if the schema is published. - */ - @JsonProperty("isPublished") - public boolean getIsPublished() { - return isPublished; - } - - /** - * @return The date and time when the schema has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The date and time when the schema has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The version of the schema. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - /** - * @return The scripts. - */ - @JsonProperty("scripts") - public SchemaScriptsDto getScripts() { - return scripts; - } - - /** - * @return The preview Urls. - */ - @JsonProperty("previewUrls") - public Map getPreviewUrls() { - return previewUrls; - } - - /** - * @return The name of fields that are used in content lists. - */ - @JsonProperty("fieldsInLists") - public List getFieldsInLists() { - return fieldsInLists; - } - - /** - * @return The name of fields that are used in content references. - */ - @JsonProperty("fieldsInReferences") - public List getFieldsInReferences() { - return fieldsInReferences; - } - - /** - * @return The field rules. - */ - @JsonProperty("fieldRules") - public List getFieldRules() { - return fieldRules; - } - - /** - * @return The list of fields. - */ - @JsonProperty("fields") - public List getFields() { - return fields; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaDto && equalTo((SchemaDto) other); - } +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; - private boolean equalTo(SchemaDto other) { - return links.equals(other.links) - && id.equals(other.id) - && createdBy.equals(other.createdBy) - && lastModifiedBy.equals(other.lastModifiedBy) - && name.equals(other.name) - && type.equals(other.type) - && category.equals(other.category) - && properties.equals(other.properties) - && isSingleton == other.isSingleton - && isPublished == other.isPublished - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && version == other.version - && scripts.equals(other.scripts) - && previewUrls.equals(other.previewUrls) - && fieldsInLists.equals(other.fieldsInLists) - && fieldsInReferences.equals(other.fieldsInReferences) - && fieldRules.equals(other.fieldRules) - && fields.equals(other.fields); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, - this.id, - this.createdBy, - this.lastModifiedBy, - this.name, - this.type, - this.category, - this.properties, - this.isSingleton, - this.isPublished, - this.created, - this.lastModified, - this.version, - this.scripts, - this.previewUrls, - this.fieldsInLists, - this.fieldsInReferences, - this.fieldRules, - this.fields); - } +import com.squidex.api.core.JSON; +/** + * SchemaDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SchemaDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_CREATED_BY = "createdBy"; + @SerializedName(SERIALIZED_NAME_CREATED_BY) + private String createdBy; + public static final String SERIALIZED_NAME_LAST_MODIFIED_BY = "lastModifiedBy"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED_BY) + private String lastModifiedBy; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private SchemaType type; + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + private String category; + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private SchemaPropertiesDto properties; + public static final String SERIALIZED_NAME_IS_SINGLETON = "isSingleton"; + @Deprecated + @SerializedName(SERIALIZED_NAME_IS_SINGLETON) + private Boolean isSingleton; + public static final String SERIALIZED_NAME_IS_PUBLISHED = "isPublished"; + @SerializedName(SERIALIZED_NAME_IS_PUBLISHED) + private Boolean isPublished; + public static final String SERIALIZED_NAME_CREATED = "created"; + @SerializedName(SERIALIZED_NAME_CREATED) + private OffsetDateTime created; + public static final String SERIALIZED_NAME_LAST_MODIFIED = "lastModified"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED) + private OffsetDateTime lastModified; + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Long version; + public static final String SERIALIZED_NAME_SCRIPTS = "scripts"; + @SerializedName(SERIALIZED_NAME_SCRIPTS) + private SchemaScriptsDto scripts; + public static final String SERIALIZED_NAME_PREVIEW_URLS = "previewUrls"; + @SerializedName(SERIALIZED_NAME_PREVIEW_URLS) + private Map previewUrls = new HashMap<>(); + public static final String SERIALIZED_NAME_FIELDS_IN_LISTS = "fieldsInLists"; + @SerializedName(SERIALIZED_NAME_FIELDS_IN_LISTS) + private List fieldsInLists = new ArrayList<>(); + public static final String SERIALIZED_NAME_FIELDS_IN_REFERENCES = "fieldsInReferences"; + @SerializedName(SERIALIZED_NAME_FIELDS_IN_REFERENCES) + private List fieldsInReferences = new ArrayList<>(); + public static final String SERIALIZED_NAME_FIELD_RULES = "fieldRules"; + @SerializedName(SERIALIZED_NAME_FIELD_RULES) + private List fieldRules = new ArrayList<>(); + public static final String SERIALIZED_NAME_FIELDS = "fields"; + @SerializedName(SERIALIZED_NAME_FIELDS) + private List fields = new ArrayList<>(); + public SchemaDto() { + } + public SchemaDto links(Map links) { + this.links = links; + return this; + } + + public SchemaDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); + } + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public SchemaDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the schema. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public SchemaDto createdBy(String createdBy) { + this.createdBy = createdBy; + return this; + } + + /** + * The user that has created the schema. + * @return createdBy + */ + @javax.annotation.Nonnull + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + public SchemaDto lastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + return this; + } + + /** + * The user that has updated the schema. + * @return lastModifiedBy + */ + @javax.annotation.Nonnull + public String getLastModifiedBy() { + return lastModifiedBy; + } + + public void setLastModifiedBy(String lastModifiedBy) { + this.lastModifiedBy = lastModifiedBy; + } + public SchemaDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the schema. Unique within the app. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public SchemaDto type(SchemaType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public SchemaType getType() { + return type; + } + + public void setType(SchemaType type) { + this.type = type; + } + public SchemaDto category(String category) { + this.category = category; + return this; + } + + /** + * The name of the category. + * @return category + */ + @javax.annotation.Nullable + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + public SchemaDto properties(SchemaPropertiesDto properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nonnull + public SchemaPropertiesDto getProperties() { + return properties; + } + + public void setProperties(SchemaPropertiesDto properties) { + this.properties = properties; + } + @Deprecated + public SchemaDto isSingleton(Boolean isSingleton) { + this.isSingleton = isSingleton; + return this; + } + + /** + * Indicates if the schema is a singleton. + * @return isSingleton + * @deprecated + */ + @Deprecated + @javax.annotation.Nonnull + public Boolean getIsSingleton() { + return isSingleton; + } + + @Deprecated + public void setIsSingleton(Boolean isSingleton) { + this.isSingleton = isSingleton; + } + public SchemaDto isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Indicates if the schema is published. + * @return isPublished + */ + @javax.annotation.Nonnull + public Boolean getIsPublished() { + return isPublished; + } + + public void setIsPublished(Boolean isPublished) { + this.isPublished = isPublished; + } + public SchemaDto created(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * The date and time when the schema has been created. + * @return created + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreated() { + return created; + } + + public void setCreated(OffsetDateTime created) { + this.created = created; + } + public SchemaDto lastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * The date and time when the schema has been modified last. + * @return lastModified + */ + @javax.annotation.Nonnull + public OffsetDateTime getLastModified() { + return lastModified; + } + + public void setLastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + } + public SchemaDto version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the schema. + * @return version + */ + @javax.annotation.Nonnull + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + public SchemaDto scripts(SchemaScriptsDto scripts) { + this.scripts = scripts; + return this; + } + + /** + * Get scripts + * @return scripts + */ + @javax.annotation.Nonnull + public SchemaScriptsDto getScripts() { + return scripts; + } + + public void setScripts(SchemaScriptsDto scripts) { + this.scripts = scripts; + } + public SchemaDto previewUrls(Map previewUrls) { + this.previewUrls = previewUrls; + return this; + } + + public SchemaDto putPreviewUrlsItem(String key, String previewUrlsItem) { + if (this.previewUrls == null) { + this.previewUrls = new HashMap<>(); + } + this.previewUrls.put(key, previewUrlsItem); + return this; + } + + /** + * The preview Urls. + * @return previewUrls + */ + @javax.annotation.Nonnull + public Map getPreviewUrls() { + return previewUrls; + } + + public void setPreviewUrls(Map previewUrls) { + this.previewUrls = previewUrls; + } + public SchemaDto fieldsInLists(List fieldsInLists) { + this.fieldsInLists = fieldsInLists; + return this; + } + + public SchemaDto addFieldsInListsItem(String fieldsInListsItem) { + if (this.fieldsInLists == null) { + this.fieldsInLists = new ArrayList<>(); + } + this.fieldsInLists.add(fieldsInListsItem); + return this; + } + + /** + * The name of fields that are used in content lists. + * @return fieldsInLists + */ + @javax.annotation.Nonnull + public List getFieldsInLists() { + return fieldsInLists; + } + + public void setFieldsInLists(List fieldsInLists) { + this.fieldsInLists = fieldsInLists; + } + public SchemaDto fieldsInReferences(List fieldsInReferences) { + this.fieldsInReferences = fieldsInReferences; + return this; + } + + public SchemaDto addFieldsInReferencesItem(String fieldsInReferencesItem) { + if (this.fieldsInReferences == null) { + this.fieldsInReferences = new ArrayList<>(); + } + this.fieldsInReferences.add(fieldsInReferencesItem); + return this; + } + + /** + * The name of fields that are used in content references. + * @return fieldsInReferences + */ + @javax.annotation.Nonnull + public List getFieldsInReferences() { + return fieldsInReferences; + } + + public void setFieldsInReferences(List fieldsInReferences) { + this.fieldsInReferences = fieldsInReferences; + } + public SchemaDto fieldRules(List fieldRules) { + this.fieldRules = fieldRules; + return this; + } + + public SchemaDto addFieldRulesItem(FieldRuleDto fieldRulesItem) { + if (this.fieldRules == null) { + this.fieldRules = new ArrayList<>(); + } + this.fieldRules.add(fieldRulesItem); + return this; + } + + /** + * The field rules. + * @return fieldRules + */ + @javax.annotation.Nonnull + public List getFieldRules() { + return fieldRules; + } + + public void setFieldRules(List fieldRules) { + this.fieldRules = fieldRules; + } + public SchemaDto fields(List fields) { + this.fields = fields; + return this; + } + + public SchemaDto addFieldsItem(FieldDto fieldsItem) { + if (this.fields == null) { + this.fields = new ArrayList<>(); + } + this.fields.add(fieldsItem); + return this; + } + + /** + * The list of fields. + * @return fields + */ + @javax.annotation.Nonnull + public List getFields() { + return fields; + } + + public void setFields(List fields) { + this.fields = fields; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SchemaDto schemaDto = (SchemaDto) o; + return Objects.equals(this.links, schemaDto.links) && + Objects.equals(this.id, schemaDto.id) && + Objects.equals(this.createdBy, schemaDto.createdBy) && + Objects.equals(this.lastModifiedBy, schemaDto.lastModifiedBy) && + Objects.equals(this.name, schemaDto.name) && + Objects.equals(this.type, schemaDto.type) && + Objects.equals(this.category, schemaDto.category) && + Objects.equals(this.properties, schemaDto.properties) && + Objects.equals(this.isSingleton, schemaDto.isSingleton) && + Objects.equals(this.isPublished, schemaDto.isPublished) && + Objects.equals(this.created, schemaDto.created) && + Objects.equals(this.lastModified, schemaDto.lastModified) && + Objects.equals(this.version, schemaDto.version) && + Objects.equals(this.scripts, schemaDto.scripts) && + Objects.equals(this.previewUrls, schemaDto.previewUrls) && + Objects.equals(this.fieldsInLists, schemaDto.fieldsInLists) && + Objects.equals(this.fieldsInReferences, schemaDto.fieldsInReferences) && + Objects.equals(this.fieldRules, schemaDto.fieldRules) && + Objects.equals(this.fields, schemaDto.fields); + } + + 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(links, id, createdBy, lastModifiedBy, name, type, category, properties, isSingleton, isPublished, created, lastModified, version, scripts, previewUrls, fieldsInLists, fieldsInReferences, fieldRules, fields); + } + + 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 SchemaDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" createdBy: ").append(toIndentedString(createdBy)).append("\n"); + sb.append(" lastModifiedBy: ").append(toIndentedString(lastModifiedBy)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" isSingleton: ").append(toIndentedString(isSingleton)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" lastModified: ").append(toIndentedString(lastModified)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" scripts: ").append(toIndentedString(scripts)).append("\n"); + sb.append(" previewUrls: ").append(toIndentedString(previewUrls)).append("\n"); + sb.append(" fieldsInLists: ").append(toIndentedString(fieldsInLists)).append("\n"); + sb.append(" fieldsInReferences: ").append(toIndentedString(fieldsInReferences)).append("\n"); + sb.append(" fieldRules: ").append(toIndentedString(fieldRules)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).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("_links"); + openapiFields.add("id"); + openapiFields.add("createdBy"); + openapiFields.add("lastModifiedBy"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("category"); + openapiFields.add("properties"); + openapiFields.add("isSingleton"); + openapiFields.add("isPublished"); + openapiFields.add("created"); + openapiFields.add("lastModified"); + openapiFields.add("version"); + openapiFields.add("scripts"); + openapiFields.add("previewUrls"); + openapiFields.add("fieldsInLists"); + openapiFields.add("fieldsInReferences"); + openapiFields.add("fieldRules"); + openapiFields.add("fields"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("createdBy"); + openapiRequiredFields.add("lastModifiedBy"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("type"); + openapiRequiredFields.add("properties"); + openapiRequiredFields.add("isSingleton"); + openapiRequiredFields.add("isPublished"); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("lastModified"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("scripts"); + openapiRequiredFields.add("previewUrls"); + openapiRequiredFields.add("fieldsInLists"); + openapiRequiredFields.add("fieldsInReferences"); + openapiRequiredFields.add("fieldRules"); + openapiRequiredFields.add("fields"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SchemaDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SchemaDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SchemaDto is not found in the empty JSON string", SchemaDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SchemaDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SchemaDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SchemaDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("createdBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `createdBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("createdBy").toString())); + } + if (!jsonObj.get("lastModifiedBy").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `lastModifiedBy` to be a primitive type in the JSON string but got `%s`", jsonObj.get("lastModifiedBy").toString())); + } + 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())); + } + // validate the required field `type` + SchemaType.validateJsonElement(jsonObj.get("type")); + if ((jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) && !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 `properties` + SchemaPropertiesDto.validateJsonElement(jsonObj.get("properties")); + // validate the required field `scripts` + SchemaScriptsDto.validateJsonElement(jsonObj.get("scripts")); + // ensure the required json array is present + if (jsonObj.get("fieldsInLists") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("fieldsInLists").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldsInLists` to be an array in the JSON string but got `%s`", jsonObj.get("fieldsInLists").toString())); + } + // ensure the required json array is present + if (jsonObj.get("fieldsInReferences") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("fieldsInReferences").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldsInReferences` to be an array in the JSON string but got `%s`", jsonObj.get("fieldsInReferences").toString())); + } + // ensure the json data is an array + if (!jsonObj.get("fieldRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldRules` to be an array in the JSON string but got `%s`", jsonObj.get("fieldRules").toString())); + } + + JsonArray jsonArrayfieldRules = jsonObj.getAsJsonArray("fieldRules"); + // validate the required field `fieldRules` (array) + for (int i = 0; i < jsonArrayfieldRules.size(); i++) { + FieldRuleDto.validateJsonElement(jsonArrayfieldRules.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("fields").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fields` to be an array in the JSON string but got `%s`", jsonObj.get("fields").toString())); + } + + JsonArray jsonArrayfields = jsonObj.getAsJsonArray("fields"); + // validate the required field `fields` (array) + for (int i = 0; i < jsonArrayfields.size(); i++) { + FieldDto.validateJsonElement(jsonArrayfields.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - CreatedByStage id(String id); - - Builder from(SchemaDto other); - } - - public interface CreatedByStage { - LastModifiedByStage createdBy(String createdBy); - } - - public interface LastModifiedByStage { - NameStage lastModifiedBy(String lastModifiedBy); - } - - public interface NameStage { - TypeStage name(String name); - } - - public interface TypeStage { - PropertiesStage type(SchemaType type); - } - - public interface PropertiesStage { - IsSingletonStage properties(SchemaPropertiesDto properties); - } - - public interface IsSingletonStage { - IsPublishedStage isSingleton(boolean isSingleton); - } - - public interface IsPublishedStage { - CreatedStage isPublished(boolean isPublished); - } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); - } - - public interface LastModifiedStage { - VersionStage lastModified(OffsetDateTime lastModified); - } - - public interface VersionStage { - ScriptsStage version(int version); - } - - public interface ScriptsStage { - _FinalStage scripts(SchemaScriptsDto scripts); - } - - public interface _FinalStage { - SchemaDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage category(Optional category); - - _FinalStage category(String category); - - _FinalStage previewUrls(Map previewUrls); - - _FinalStage putAllPreviewUrls(Map previewUrls); - - _FinalStage previewUrls(String key, String value); - - _FinalStage fieldsInLists(List fieldsInLists); - - _FinalStage addFieldsInLists(String fieldsInLists); - - _FinalStage addAllFieldsInLists(List fieldsInLists); - - _FinalStage fieldsInReferences(List fieldsInReferences); - - _FinalStage addFieldsInReferences(String fieldsInReferences); - - _FinalStage addAllFieldsInReferences(List fieldsInReferences); - - _FinalStage fieldRules(List fieldRules); - - _FinalStage addFieldRules(FieldRuleDto fieldRules); - - _FinalStage addAllFieldRules(List fieldRules); - - _FinalStage fields(List fields); - - _FinalStage addFields(FieldDto fields); - - _FinalStage addAllFields(List fields); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, - CreatedByStage, - LastModifiedByStage, - NameStage, - TypeStage, - PropertiesStage, - IsSingletonStage, - IsPublishedStage, - CreatedStage, - LastModifiedStage, - VersionStage, - ScriptsStage, - _FinalStage { - private String id; - - private String createdBy; - - private String lastModifiedBy; - - private String name; - - private SchemaType type; - - private SchemaPropertiesDto properties; - - private boolean isSingleton; - - private boolean isPublished; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private int version; - - private SchemaScriptsDto scripts; - - private List fields = new ArrayList<>(); - - private List fieldRules = new ArrayList<>(); - - private List fieldsInReferences = new ArrayList<>(); - - private List fieldsInLists = new ArrayList<>(); - - private Map previewUrls = new LinkedHashMap<>(); - - private Optional category = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(SchemaDto other) { - links(other.getLinks()); - id(other.getId()); - createdBy(other.getCreatedBy()); - lastModifiedBy(other.getLastModifiedBy()); - name(other.getName()); - type(other.getType()); - category(other.getCategory()); - properties(other.getProperties()); - isSingleton(other.getIsSingleton()); - isPublished(other.getIsPublished()); - created(other.getCreated()); - lastModified(other.getLastModified()); - version(other.getVersion()); - scripts(other.getScripts()); - previewUrls(other.getPreviewUrls()); - fieldsInLists(other.getFieldsInLists()); - fieldsInReferences(other.getFieldsInReferences()); - fieldRules(other.getFieldRules()); - fields(other.getFields()); - return this; - } - - /** - *

The ID of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public CreatedByStage id(String id) { - this.id = id; - return this; - } - - /** - *

The user that has created the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("createdBy") - public LastModifiedByStage createdBy(String createdBy) { - this.createdBy = createdBy; - return this; - } - - /** - *

The user that has updated the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModifiedBy") - public NameStage lastModifiedBy(String lastModifiedBy) { - this.lastModifiedBy = lastModifiedBy; - return this; - } - - /** - *

The name of the schema. Unique within the app.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public TypeStage name(String name) { - this.name = name; - return this; - } - - /** - *

The type of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("type") - public PropertiesStage type(SchemaType type) { - this.type = type; - return this; - } - - /** - *

The schema properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("properties") - public IsSingletonStage properties(SchemaPropertiesDto properties) { - this.properties = properties; - return this; - } - - /** - *

Indicates if the schema is a singleton.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isSingleton") - public IsPublishedStage isSingleton(boolean isSingleton) { - this.isSingleton = isSingleton; - return this; - } - - /** - *

Indicates if the schema is published.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isPublished") - public CreatedStage isPublished(boolean isPublished) { - this.isPublished = isPublished; - return this; - } - - /** - *

The date and time when the schema has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The date and time when the schema has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public VersionStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

The version of the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public ScriptsStage version(int version) { - this.version = version; - return this; - } - - /** - *

The scripts.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("scripts") - public _FinalStage scripts(SchemaScriptsDto scripts) { - this.scripts = scripts; - return this; - } - - /** - *

The list of fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFields(List fields) { - this.fields.addAll(fields); - return this; - } - - /** - *

The list of fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFields(FieldDto fields) { - this.fields.add(fields); - return this; - } - - @Override - @JsonSetter(value = "fields", nulls = Nulls.SKIP) - public _FinalStage fields(List fields) { - this.fields.clear(); - this.fields.addAll(fields); - return this; - } - - /** - *

The field rules.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFieldRules(List fieldRules) { - this.fieldRules.addAll(fieldRules); - return this; - } - - /** - *

The field rules.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFieldRules(FieldRuleDto fieldRules) { - this.fieldRules.add(fieldRules); - return this; - } - - @Override - @JsonSetter(value = "fieldRules", nulls = Nulls.SKIP) - public _FinalStage fieldRules(List fieldRules) { - this.fieldRules.clear(); - this.fieldRules.addAll(fieldRules); - return this; - } - - /** - *

The name of fields that are used in content references.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences.addAll(fieldsInReferences); - return this; - } - - /** - *

The name of fields that are used in content references.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFieldsInReferences(String fieldsInReferences) { - this.fieldsInReferences.add(fieldsInReferences); - return this; - } - - @Override - @JsonSetter(value = "fieldsInReferences", nulls = Nulls.SKIP) - public _FinalStage fieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences.clear(); - this.fieldsInReferences.addAll(fieldsInReferences); - return this; - } - - /** - *

The name of fields that are used in content lists.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllFieldsInLists(List fieldsInLists) { - this.fieldsInLists.addAll(fieldsInLists); - return this; - } - - /** - *

The name of fields that are used in content lists.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addFieldsInLists(String fieldsInLists) { - this.fieldsInLists.add(fieldsInLists); - return this; - } - - @Override - @JsonSetter(value = "fieldsInLists", nulls = Nulls.SKIP) - public _FinalStage fieldsInLists(List fieldsInLists) { - this.fieldsInLists.clear(); - this.fieldsInLists.addAll(fieldsInLists); - return this; - } - - /** - *

The preview Urls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage previewUrls(String key, String value) { - this.previewUrls.put(key, value); - return this; - } - - /** - *

The preview Urls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllPreviewUrls(Map previewUrls) { - this.previewUrls.putAll(previewUrls); - return this; - } - - @Override - @JsonSetter(value = "previewUrls", nulls = Nulls.SKIP) - public _FinalStage previewUrls(Map previewUrls) { - this.previewUrls.clear(); - this.previewUrls.putAll(previewUrls); - return this; - } - - /** - *

The name of the category.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage category(String category) { - this.category = Optional.of(category); - return this; - } - - @Override - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public _FinalStage category(Optional category) { - this.category = category; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public SchemaDto build() { - return new SchemaDto( - links, - id, - createdBy, - lastModifiedBy, - name, - type, - category, - properties, - isSingleton, - isPublished, - created, - lastModified, - version, - scripts, - previewUrls, - fieldsInLists, - fieldsInReferences, - fieldRules, - fields); - } - } + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SchemaDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SchemaDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SchemaDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SchemaDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SchemaDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SchemaDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SchemaDto + * @throws IOException if the JSON string is invalid with respect to SchemaDto + */ + public static SchemaDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SchemaDto.class); + } + + /** + * Convert an instance of SchemaDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SchemaPropertiesDto.java b/src/main/java/com/squidex/api/types/SchemaPropertiesDto.java index bd6ebbf..0b15c3b 100644 --- a/src/main/java/com/squidex/api/types/SchemaPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/SchemaPropertiesDto.java @@ -1,327 +1,437 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemaPropertiesDto.Builder.class) -public final class SchemaPropertiesDto { - private final Optional label; - - private final Optional hints; - - private final Optional contentsSidebarUrl; - - private final Optional contentSidebarUrl; - - private final Optional contentEditorUrl; - - private final boolean validateOnPublish; - - private final Optional> tags; - - private SchemaPropertiesDto( - Optional label, - Optional hints, - Optional contentsSidebarUrl, - Optional contentSidebarUrl, - Optional contentEditorUrl, - boolean validateOnPublish, - Optional> tags) { - this.label = label; - this.hints = hints; - this.contentsSidebarUrl = contentsSidebarUrl; - this.contentSidebarUrl = contentSidebarUrl; - this.contentEditorUrl = contentEditorUrl; - this.validateOnPublish = validateOnPublish; - this.tags = tags; - } - - /** - * @return Optional label for the editor. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; - } - - /** - * @return Hints to describe the schema. - */ - @JsonProperty("hints") - public Optional getHints() { - return hints; - } - - /** - * @return The url to a the sidebar plugin for content lists. - */ - @JsonProperty("contentsSidebarUrl") - public Optional getContentsSidebarUrl() { - return contentsSidebarUrl; - } - - /** - * @return The url to a the sidebar plugin for content items. - */ - @JsonProperty("contentSidebarUrl") - public Optional getContentSidebarUrl() { - return contentSidebarUrl; - } - /** - * @return The url to the editor plugin. - */ - @JsonProperty("contentEditorUrl") - public Optional getContentEditorUrl() { - return contentEditorUrl; - } - - /** - * @return True to validate the content items on publish. - */ - @JsonProperty("validateOnPublish") - public boolean getValidateOnPublish() { - return validateOnPublish; - } - /** - * @return Tags for automation processes. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } +package com.squidex.api.types; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaPropertiesDto && equalTo((SchemaPropertiesDto) other); - } +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.ArrayList; +import java.util.Arrays; +import java.util.List; +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; - private boolean equalTo(SchemaPropertiesDto other) { - return label.equals(other.label) - && hints.equals(other.hints) - && contentsSidebarUrl.equals(other.contentsSidebarUrl) - && contentSidebarUrl.equals(other.contentSidebarUrl) - && contentEditorUrl.equals(other.contentEditorUrl) - && validateOnPublish == other.validateOnPublish - && tags.equals(other.tags); - } +import com.squidex.api.core.JSON; - @Override - public int hashCode() { - return Objects.hash( - this.label, - this.hints, - this.contentsSidebarUrl, - this.contentSidebarUrl, - this.contentEditorUrl, - this.validateOnPublish, - this.tags); +/** + * SchemaPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SchemaPropertiesDto { + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + private String label; + public static final String SERIALIZED_NAME_HINTS = "hints"; + @SerializedName(SERIALIZED_NAME_HINTS) + private String hints; + public static final String SERIALIZED_NAME_CONTENTS_SIDEBAR_URL = "contentsSidebarUrl"; + @SerializedName(SERIALIZED_NAME_CONTENTS_SIDEBAR_URL) + private String contentsSidebarUrl; + public static final String SERIALIZED_NAME_CONTENT_SIDEBAR_URL = "contentSidebarUrl"; + @SerializedName(SERIALIZED_NAME_CONTENT_SIDEBAR_URL) + private String contentSidebarUrl; + public static final String SERIALIZED_NAME_CONTENT_EDITOR_URL = "contentEditorUrl"; + @SerializedName(SERIALIZED_NAME_CONTENT_EDITOR_URL) + private String contentEditorUrl; + public static final String SERIALIZED_NAME_CONTENTS_EDITOR_URL = "contentsEditorUrl"; + @SerializedName(SERIALIZED_NAME_CONTENTS_EDITOR_URL) + private String contentsEditorUrl; + public static final String SERIALIZED_NAME_CONTENTS_LIST_URL = "contentsListUrl"; + @SerializedName(SERIALIZED_NAME_CONTENTS_LIST_URL) + private String contentsListUrl; + public static final String SERIALIZED_NAME_VALIDATE_ON_PUBLISH = "validateOnPublish"; + @SerializedName(SERIALIZED_NAME_VALIDATE_ON_PUBLISH) + private Boolean validateOnPublish; + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private List tags; + public SchemaPropertiesDto() { + } + public SchemaPropertiesDto label(String label) { + this.label = label; + return this; + } + + /** + * Optional label for the editor. + * @return label + */ + @javax.annotation.Nullable + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + public SchemaPropertiesDto hints(String hints) { + this.hints = hints; + return this; + } + + /** + * Hints to describe the schema. + * @return hints + */ + @javax.annotation.Nullable + public String getHints() { + return hints; + } + + public void setHints(String hints) { + this.hints = hints; + } + public SchemaPropertiesDto contentsSidebarUrl(String contentsSidebarUrl) { + this.contentsSidebarUrl = contentsSidebarUrl; + return this; + } + + /** + * The url to a the sidebar plugin for content lists. + * @return contentsSidebarUrl + */ + @javax.annotation.Nullable + public String getContentsSidebarUrl() { + return contentsSidebarUrl; + } + + public void setContentsSidebarUrl(String contentsSidebarUrl) { + this.contentsSidebarUrl = contentsSidebarUrl; + } + public SchemaPropertiesDto contentSidebarUrl(String contentSidebarUrl) { + this.contentSidebarUrl = contentSidebarUrl; + return this; + } + + /** + * The url to a the sidebar plugin for content items. + * @return contentSidebarUrl + */ + @javax.annotation.Nullable + public String getContentSidebarUrl() { + return contentSidebarUrl; + } + + public void setContentSidebarUrl(String contentSidebarUrl) { + this.contentSidebarUrl = contentSidebarUrl; + } + public SchemaPropertiesDto contentEditorUrl(String contentEditorUrl) { + this.contentEditorUrl = contentEditorUrl; + return this; + } + + /** + * The url to the editor plugin. + * @return contentEditorUrl + */ + @javax.annotation.Nullable + public String getContentEditorUrl() { + return contentEditorUrl; + } + + public void setContentEditorUrl(String contentEditorUrl) { + this.contentEditorUrl = contentEditorUrl; + } + public SchemaPropertiesDto contentsEditorUrl(String contentsEditorUrl) { + this.contentsEditorUrl = contentsEditorUrl; + return this; + } + + /** + * The url to the editor plugin. + * @return contentsEditorUrl + */ + @javax.annotation.Nullable + public String getContentsEditorUrl() { + return contentsEditorUrl; + } + + public void setContentsEditorUrl(String contentsEditorUrl) { + this.contentsEditorUrl = contentsEditorUrl; + } + public SchemaPropertiesDto contentsListUrl(String contentsListUrl) { + this.contentsListUrl = contentsListUrl; + return this; + } + + /** + * The url to the content list plugin. + * @return contentsListUrl + */ + @javax.annotation.Nullable + public String getContentsListUrl() { + return contentsListUrl; + } + + public void setContentsListUrl(String contentsListUrl) { + this.contentsListUrl = contentsListUrl; + } + public SchemaPropertiesDto validateOnPublish(Boolean validateOnPublish) { + this.validateOnPublish = validateOnPublish; + return this; + } + + /** + * True to validate the content items on publish. + * @return validateOnPublish + */ + @javax.annotation.Nonnull + public Boolean getValidateOnPublish() { + return validateOnPublish; + } + + public void setValidateOnPublish(Boolean validateOnPublish) { + this.validateOnPublish = validateOnPublish; + } + public SchemaPropertiesDto tags(List tags) { + this.tags = tags; + return this; + } + + public SchemaPropertiesDto addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + this.tags.add(tagsItem); + return this; + } + + /** + * Tags for automation processes. + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public static ValidateOnPublishStage builder() { - return new Builder(); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface ValidateOnPublishStage { - _FinalStage validateOnPublish(boolean validateOnPublish); - - Builder from(SchemaPropertiesDto other); + SchemaPropertiesDto schemaPropertiesDto = (SchemaPropertiesDto) o; + return Objects.equals(this.label, schemaPropertiesDto.label) && + Objects.equals(this.hints, schemaPropertiesDto.hints) && + Objects.equals(this.contentsSidebarUrl, schemaPropertiesDto.contentsSidebarUrl) && + Objects.equals(this.contentSidebarUrl, schemaPropertiesDto.contentSidebarUrl) && + Objects.equals(this.contentEditorUrl, schemaPropertiesDto.contentEditorUrl) && + Objects.equals(this.contentsEditorUrl, schemaPropertiesDto.contentsEditorUrl) && + Objects.equals(this.contentsListUrl, schemaPropertiesDto.contentsListUrl) && + Objects.equals(this.validateOnPublish, schemaPropertiesDto.validateOnPublish) && + Objects.equals(this.tags, schemaPropertiesDto.tags); + } + + 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(label, hints, contentsSidebarUrl, contentSidebarUrl, contentEditorUrl, contentsEditorUrl, contentsListUrl, validateOnPublish, tags); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - SchemaPropertiesDto build(); - - _FinalStage label(Optional label); - - _FinalStage label(String label); - - _FinalStage hints(Optional hints); - - _FinalStage hints(String hints); - - _FinalStage contentsSidebarUrl(Optional contentsSidebarUrl); - - _FinalStage contentsSidebarUrl(String contentsSidebarUrl); - - _FinalStage contentSidebarUrl(Optional contentSidebarUrl); - - _FinalStage contentSidebarUrl(String contentSidebarUrl); - - _FinalStage contentEditorUrl(Optional contentEditorUrl); - - _FinalStage contentEditorUrl(String contentEditorUrl); - - _FinalStage tags(Optional> tags); - - _FinalStage tags(List tags); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SchemaPropertiesDto {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" hints: ").append(toIndentedString(hints)).append("\n"); + sb.append(" contentsSidebarUrl: ").append(toIndentedString(contentsSidebarUrl)).append("\n"); + sb.append(" contentSidebarUrl: ").append(toIndentedString(contentSidebarUrl)).append("\n"); + sb.append(" contentEditorUrl: ").append(toIndentedString(contentEditorUrl)).append("\n"); + sb.append(" contentsEditorUrl: ").append(toIndentedString(contentsEditorUrl)).append("\n"); + sb.append(" contentsListUrl: ").append(toIndentedString(contentsListUrl)).append("\n"); + sb.append(" validateOnPublish: ").append(toIndentedString(validateOnPublish)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ValidateOnPublishStage, _FinalStage { - private boolean validateOnPublish; - - private Optional> tags = Optional.empty(); - - private Optional contentEditorUrl = Optional.empty(); - - private Optional contentSidebarUrl = Optional.empty(); - - private Optional contentsSidebarUrl = Optional.empty(); - - private Optional hints = Optional.empty(); - - private Optional label = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(SchemaPropertiesDto other) { - label(other.getLabel()); - hints(other.getHints()); - contentsSidebarUrl(other.getContentsSidebarUrl()); - contentSidebarUrl(other.getContentSidebarUrl()); - contentEditorUrl(other.getContentEditorUrl()); - validateOnPublish(other.getValidateOnPublish()); - tags(other.getTags()); - return this; - } - - /** - *

True to validate the content items on publish.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("validateOnPublish") - public _FinalStage validateOnPublish(boolean validateOnPublish) { - this.validateOnPublish = validateOnPublish; - return this; - } - - /** - *

Tags for automation processes.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage tags(List tags) { - this.tags = Optional.of(tags); - return this; - } - - @Override - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public _FinalStage tags(Optional> tags) { - this.tags = tags; - return this; - } - - /** - *

The url to the editor plugin.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage contentEditorUrl(String contentEditorUrl) { - this.contentEditorUrl = Optional.of(contentEditorUrl); - return this; - } - - @Override - @JsonSetter(value = "contentEditorUrl", nulls = Nulls.SKIP) - public _FinalStage contentEditorUrl(Optional contentEditorUrl) { - this.contentEditorUrl = contentEditorUrl; - return this; - } - - /** - *

The url to a the sidebar plugin for content items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage contentSidebarUrl(String contentSidebarUrl) { - this.contentSidebarUrl = Optional.of(contentSidebarUrl); - return this; - } - - @Override - @JsonSetter(value = "contentSidebarUrl", nulls = Nulls.SKIP) - public _FinalStage contentSidebarUrl(Optional contentSidebarUrl) { - this.contentSidebarUrl = contentSidebarUrl; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("contentsSidebarUrl"); + openapiFields.add("contentSidebarUrl"); + openapiFields.add("contentEditorUrl"); + openapiFields.add("contentsEditorUrl"); + openapiFields.add("contentsListUrl"); + openapiFields.add("validateOnPublish"); + openapiFields.add("tags"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("validateOnPublish"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SchemaPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SchemaPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SchemaPropertiesDto is not found in the empty JSON string", SchemaPropertiesDto.openapiRequiredFields.toString())); } + } - /** - *

The url to a the sidebar plugin for content lists.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage contentsSidebarUrl(String contentsSidebarUrl) { - this.contentsSidebarUrl = Optional.of(contentsSidebarUrl); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SchemaPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SchemaPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - @JsonSetter(value = "contentsSidebarUrl", nulls = Nulls.SKIP) - public _FinalStage contentsSidebarUrl(Optional contentsSidebarUrl) { - this.contentsSidebarUrl = contentsSidebarUrl; - return this; - } - - /** - *

Hints to describe the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage hints(String hints) { - this.hints = Optional.of(hints); - return this; - } - - @Override - @JsonSetter(value = "hints", nulls = Nulls.SKIP) - public _FinalStage hints(Optional hints) { - this.hints = hints; - return this; - } - - /** - *

Optional label for the editor.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage label(String label) { - this.label = Optional.of(label); - return this; - } - - @Override - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public _FinalStage label(Optional label) { - this.label = label; - return this; - } - - @Override - public SchemaPropertiesDto build() { - return new SchemaPropertiesDto( - label, hints, contentsSidebarUrl, contentSidebarUrl, contentEditorUrl, validateOnPublish, tags); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SchemaPropertiesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("label") != null && !jsonObj.get("label").isJsonNull()) && !jsonObj.get("label").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `label` to be a primitive type in the JSON string but got `%s`", jsonObj.get("label").toString())); + } + if ((jsonObj.get("hints") != null && !jsonObj.get("hints").isJsonNull()) && !jsonObj.get("hints").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `hints` to be a primitive type in the JSON string but got `%s`", jsonObj.get("hints").toString())); + } + if ((jsonObj.get("contentsSidebarUrl") != null && !jsonObj.get("contentsSidebarUrl").isJsonNull()) && !jsonObj.get("contentsSidebarUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentsSidebarUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentsSidebarUrl").toString())); + } + if ((jsonObj.get("contentSidebarUrl") != null && !jsonObj.get("contentSidebarUrl").isJsonNull()) && !jsonObj.get("contentSidebarUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentSidebarUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentSidebarUrl").toString())); + } + if ((jsonObj.get("contentEditorUrl") != null && !jsonObj.get("contentEditorUrl").isJsonNull()) && !jsonObj.get("contentEditorUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentEditorUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentEditorUrl").toString())); + } + if ((jsonObj.get("contentsEditorUrl") != null && !jsonObj.get("contentsEditorUrl").isJsonNull()) && !jsonObj.get("contentsEditorUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentsEditorUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentsEditorUrl").toString())); + } + if ((jsonObj.get("contentsListUrl") != null && !jsonObj.get("contentsListUrl").isJsonNull()) && !jsonObj.get("contentsListUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentsListUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentsListUrl").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull() && !jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SchemaPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SchemaPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SchemaPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SchemaPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SchemaPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SchemaPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SchemaPropertiesDto + * @throws IOException if the JSON string is invalid with respect to SchemaPropertiesDto + */ + public static SchemaPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SchemaPropertiesDto.class); + } + + /** + * Convert an instance of SchemaPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SchemaScriptsDto.java b/src/main/java/com/squidex/api/types/SchemaScriptsDto.java index 0807c64..ecbeeca 100644 --- a/src/main/java/com/squidex/api/types/SchemaScriptsDto.java +++ b/src/main/java/com/squidex/api/types/SchemaScriptsDto.java @@ -1,219 +1,343 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemaScriptsDto.Builder.class) -public final class SchemaScriptsDto { - private final Optional query; - - private final Optional queryPre; - - private final Optional create; - - private final Optional update; - - private final Optional delete; - private final Optional change; - - private SchemaScriptsDto( - Optional query, - Optional queryPre, - Optional create, - Optional update, - Optional delete, - Optional change) { - this.query = query; - this.queryPre = queryPre; - this.create = create; - this.update = update; - this.delete = delete; - this.change = change; - } - - /** - * @return The script that is executed for each content when querying contents. - */ - @JsonProperty("query") - public Optional getQuery() { - return query; - } - - /** - * @return The script that is executed for all contents when querying contents. - */ - @JsonProperty("queryPre") - public Optional getQueryPre() { - return queryPre; - } - - /** - * @return The script that is executed when creating a content. - */ - @JsonProperty("create") - public Optional getCreate() { - return create; - } - /** - * @return The script that is executed when updating a content. - */ - @JsonProperty("update") - public Optional getUpdate() { - return update; - } - - /** - * @return The script that is executed when deleting a content. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - /** - * @return The script that is executed when change a content status. - */ - @JsonProperty("change") - public Optional getChange() { - return change; - } +package com.squidex.api.types; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemaScriptsDto && equalTo((SchemaScriptsDto) other); - } +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.squidex.api.core.JSON; - private boolean equalTo(SchemaScriptsDto other) { - return query.equals(other.query) - && queryPre.equals(other.queryPre) - && create.equals(other.create) - && update.equals(other.update) - && delete.equals(other.delete) - && change.equals(other.change); +/** + * SchemaScriptsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SchemaScriptsDto { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + public static final String SERIALIZED_NAME_QUERY_PRE = "queryPre"; + @SerializedName(SERIALIZED_NAME_QUERY_PRE) + private String queryPre; + public static final String SERIALIZED_NAME_CREATE = "create"; + @SerializedName(SERIALIZED_NAME_CREATE) + private String create; + public static final String SERIALIZED_NAME_UPDATE = "update"; + @SerializedName(SERIALIZED_NAME_UPDATE) + private String update; + public static final String SERIALIZED_NAME_DELETE = "delete"; + @SerializedName(SERIALIZED_NAME_DELETE) + private String delete; + public static final String SERIALIZED_NAME_CHANGE = "change"; + @SerializedName(SERIALIZED_NAME_CHANGE) + private String change; + public SchemaScriptsDto() { + } + public SchemaScriptsDto query(String query) { + this.query = query; + return this; + } + + /** + * The script that is executed for each content when querying contents. + * @return query + */ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + public SchemaScriptsDto queryPre(String queryPre) { + this.queryPre = queryPre; + return this; + } + + /** + * The script that is executed for all contents when querying contents. + * @return queryPre + */ + @javax.annotation.Nullable + public String getQueryPre() { + return queryPre; + } + + public void setQueryPre(String queryPre) { + this.queryPre = queryPre; + } + public SchemaScriptsDto create(String create) { + this.create = create; + return this; + } + + /** + * The script that is executed when creating a content. + * @return create + */ + @javax.annotation.Nullable + public String getCreate() { + return create; + } + + public void setCreate(String create) { + this.create = create; + } + public SchemaScriptsDto update(String update) { + this.update = update; + return this; + } + + /** + * The script that is executed when updating a content. + * @return update + */ + @javax.annotation.Nullable + public String getUpdate() { + return update; + } + + public void setUpdate(String update) { + this.update = update; + } + public SchemaScriptsDto delete(String delete) { + this.delete = delete; + return this; + } + + /** + * The script that is executed when deleting a content. + * @return delete + */ + @javax.annotation.Nullable + public String getDelete() { + return delete; + } + + public void setDelete(String delete) { + this.delete = delete; + } + public SchemaScriptsDto change(String change) { + this.change = change; + return this; + } + + /** + * The script that is executed when change a content status. + * @return change + */ + @javax.annotation.Nullable + public String getChange() { + return change; + } + + public void setChange(String change) { + this.change = change; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public int hashCode() { - return Objects.hash(this.query, this.queryPre, this.create, this.update, this.delete, this.change); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + SchemaScriptsDto schemaScriptsDto = (SchemaScriptsDto) o; + return Objects.equals(this.query, schemaScriptsDto.query) && + Objects.equals(this.queryPre, schemaScriptsDto.queryPre) && + Objects.equals(this.create, schemaScriptsDto.create) && + Objects.equals(this.update, schemaScriptsDto.update) && + Objects.equals(this.delete, schemaScriptsDto.delete) && + Objects.equals(this.change, schemaScriptsDto.change); + } + + 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(query, queryPre, create, update, delete, change); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static Builder builder() { - return new Builder(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SchemaScriptsDto {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" queryPre: ").append(toIndentedString(queryPre)).append("\n"); + sb.append(" create: ").append(toIndentedString(create)).append("\n"); + sb.append(" update: ").append(toIndentedString(update)).append("\n"); + sb.append(" delete: ").append(toIndentedString(delete)).append("\n"); + sb.append(" change: ").append(toIndentedString(change)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional query = Optional.empty(); - - private Optional queryPre = Optional.empty(); - - private Optional create = Optional.empty(); - - private Optional update = Optional.empty(); - - private Optional delete = Optional.empty(); - - private Optional change = Optional.empty(); - - private Builder() {} - - public Builder from(SchemaScriptsDto other) { - query(other.getQuery()); - queryPre(other.getQueryPre()); - create(other.getCreate()); - update(other.getUpdate()); - delete(other.getDelete()); - change(other.getChange()); - return this; + return o.toString().replace("\n", "\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("queryPre"); + openapiFields.add("create"); + openapiFields.add("update"); + openapiFields.add("delete"); + openapiFields.add("change"); + + // 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 SchemaScriptsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SchemaScriptsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SchemaScriptsDto is not found in the empty JSON string", SchemaScriptsDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "query", nulls = Nulls.SKIP) - public Builder query(Optional query) { - this.query = query; - return this; - } - - public Builder query(String query) { - this.query = Optional.of(query); - return this; - } - - @JsonSetter(value = "queryPre", nulls = Nulls.SKIP) - public Builder queryPre(Optional queryPre) { - this.queryPre = queryPre; - return this; - } - - public Builder queryPre(String queryPre) { - this.queryPre = Optional.of(queryPre); - return this; - } - - @JsonSetter(value = "create", nulls = Nulls.SKIP) - public Builder create(Optional create) { - this.create = create; - return this; - } - - public Builder create(String create) { - this.create = Optional.of(create); - return this; - } - - @JsonSetter(value = "update", nulls = Nulls.SKIP) - public Builder update(Optional update) { - this.update = update; - return this; - } - - public Builder update(String update) { - this.update = Optional.of(update); - return this; - } - - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public Builder delete(Optional delete) { - this.delete = delete; - return this; - } - - public Builder delete(String delete) { - this.delete = Optional.of(delete); - return this; - } - - @JsonSetter(value = "change", nulls = Nulls.SKIP) - public Builder change(Optional change) { - this.change = change; - return this; - } - - public Builder change(String change) { - this.change = Optional.of(change); - return this; - } - - public SchemaScriptsDto build() { - return new SchemaScriptsDto(query, queryPre, create, update, delete, change); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SchemaScriptsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SchemaScriptsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString())); + } + if ((jsonObj.get("queryPre") != null && !jsonObj.get("queryPre").isJsonNull()) && !jsonObj.get("queryPre").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `queryPre` to be a primitive type in the JSON string but got `%s`", jsonObj.get("queryPre").toString())); + } + if ((jsonObj.get("create") != null && !jsonObj.get("create").isJsonNull()) && !jsonObj.get("create").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `create` to be a primitive type in the JSON string but got `%s`", jsonObj.get("create").toString())); + } + if ((jsonObj.get("update") != null && !jsonObj.get("update").isJsonNull()) && !jsonObj.get("update").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `update` to be a primitive type in the JSON string but got `%s`", jsonObj.get("update").toString())); + } + if ((jsonObj.get("delete") != null && !jsonObj.get("delete").isJsonNull()) && !jsonObj.get("delete").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `delete` to be a primitive type in the JSON string but got `%s`", jsonObj.get("delete").toString())); + } + if ((jsonObj.get("change") != null && !jsonObj.get("change").isJsonNull()) && !jsonObj.get("change").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `change` to be a primitive type in the JSON string but got `%s`", jsonObj.get("change").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SchemaScriptsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SchemaScriptsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SchemaScriptsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SchemaScriptsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SchemaScriptsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SchemaScriptsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SchemaScriptsDto + * @throws IOException if the JSON string is invalid with respect to SchemaScriptsDto + */ + public static SchemaScriptsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SchemaScriptsDto.class); + } + + /** + * Convert an instance of SchemaScriptsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SchemaType.java b/src/main/java/com/squidex/api/types/SchemaType.java index 7bb0196..8e29697 100644 --- a/src/main/java/com/squidex/api/types/SchemaType.java +++ b/src/main/java/com/squidex/api/types/SchemaType.java @@ -1,26 +1,80 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(SchemaType.Adapter.class) public enum SchemaType { - DEFAULT("Default"), + + DEFAULT("Default"), + + SINGLETON("Singleton"), + + COMPONENT("Component"); - SINGLETON("Singleton"), + private String value; - COMPONENT("Component"); + SchemaType(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - SchemaType(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static SchemaType fromValue(String value) { + for (SchemaType b : SchemaType.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 SchemaType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public SchemaType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SchemaType.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SchemaType.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/SchemasDto.java b/src/main/java/com/squidex/api/types/SchemasDto.java index 70c6a31..ff508a7 100644 --- a/src/main/java/com/squidex/api/types/SchemasDto.java +++ b/src/main/java/com/squidex/api/types/SchemasDto.java @@ -1,124 +1,262 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.SchemaDto; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SchemasDto.Builder.class) -public final class SchemasDto implements IResource { - private final Map links; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final List items; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private SchemasDto(Map links, List items) { - this.links = links; - this.items = items; - } +import com.squidex.api.core.JSON; - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } +/** + * SchemasDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SchemasDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public SchemasDto() { + } + public SchemasDto links(Map links) { + this.links = links; + return this; + } - /** - * @return The schemas. - */ - @JsonProperty("items") - public List getItems() { - return items; + public SchemasDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } + this.links.put(key, linksItem); + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SchemasDto && equalTo((SchemasDto) other); - } + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } - private boolean equalTo(SchemasDto other) { - return links.equals(other.links) && items.equals(other.items); - } + public void setLinks(Map links) { + this.links = links; + } + public SchemasDto items(List items) { + this.items = items; + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); + public SchemasDto addItemsItem(SchemaDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } + this.items.add(itemsItem); + return this; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + /** + * The schemas. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + SchemasDto schemasDto = (SchemasDto) o; + return Objects.equals(this.links, schemasDto.links) && + Objects.equals(this.items, schemasDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, items); + } - public static Builder builder() { - return new Builder(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SchemasDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - private List items = new ArrayList<>(); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Builder() {} + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("items"); - public Builder from(SchemasDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + } - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SchemasDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SchemasDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SchemasDto is not found in the empty JSON string", SchemasDto.openapiRequiredFields.toString())); } + } - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SchemasDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SchemasDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SchemasDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + SchemaDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } - public Builder addItems(SchemaDto items) { - this.items.add(items); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SchemasDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SchemasDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SchemasDto.class)); - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SchemasDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public SchemasDto build() { - return new SchemasDto(links, items); - } + @Override + public SchemasDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SchemasDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SchemasDto + * @throws IOException if the JSON string is invalid with respect to SchemasDto + */ + public static SchemasDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SchemasDto.class); + } + + /** + * Convert an instance of SchemasDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/ScriptRuleActionDto.java b/src/main/java/com/squidex/api/types/ScriptRuleActionDto.java index 4592ac2..f145a24 100644 --- a/src/main/java/com/squidex/api/types/ScriptRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/ScriptRuleActionDto.java @@ -1,93 +1,210 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = ScriptRuleActionDto.Builder.class) -public final class ScriptRuleActionDto { - private final String script; - - private ScriptRuleActionDto(String script) { - this.script = script; - } - - /** - * @return The script to render. - */ - @JsonProperty("script") - public String getScript() { - return script; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ScriptRuleActionDto && equalTo((ScriptRuleActionDto) other); - } - - private boolean equalTo(ScriptRuleActionDto other) { - return script.equals(other.script); - } - - @Override - public int hashCode() { - return Objects.hash(this.script); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.types.RuleActionDto; +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.squidex.api.core.JSON; - public static ScriptStage builder() { - return new Builder(); +/** + * ScriptRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class ScriptRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_SCRIPT = "script"; + @SerializedName(SERIALIZED_NAME_SCRIPT) + private String script; + public ScriptRuleActionDto() { + } + public ScriptRuleActionDto script(String script) { + this.script = script; + return this; + } + + /** + * The script to render. + * @return script + */ + @javax.annotation.Nonnull + public String getScript() { + return script; + } + + public void setScript(String script) { + this.script = script; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ScriptStage { - _FinalStage script(String script); - - Builder from(ScriptRuleActionDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - ScriptRuleActionDto build(); + ScriptRuleActionDto scriptRuleActionDto = (ScriptRuleActionDto) o; + return Objects.equals(this.script, scriptRuleActionDto.script) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(script, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ScriptRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" script: ").append(toIndentedString(script)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ScriptStage, _FinalStage { - private String script; - - private Builder() {} - - @Override - public Builder from(ScriptRuleActionDto other) { - script(other.getScript()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("script"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("script"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to ScriptRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!ScriptRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in ScriptRuleActionDto is not found in the empty JSON string", ScriptRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The script to render.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("script") - public _FinalStage script(String script) { - this.script = script; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!ScriptRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `ScriptRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public ScriptRuleActionDto build() { - return new ScriptRuleActionDto(script); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : ScriptRuleActionDto.openapiRequiredFields) { + if (jsonElement.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 (!ScriptRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'ScriptRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(ScriptRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, ScriptRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public ScriptRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of ScriptRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of ScriptRuleActionDto + * @throws IOException if the JSON string is invalid with respect to ScriptRuleActionDto + */ + public static ScriptRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, ScriptRuleActionDto.class); + } + + /** + * Convert an instance of ScriptRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SearchResultDto.java b/src/main/java/com/squidex/api/types/SearchResultDto.java index 3dc9eed..3f7c8a1 100644 --- a/src/main/java/com/squidex/api/types/SearchResultDto.java +++ b/src/main/java/com/squidex/api/types/SearchResultDto.java @@ -1,214 +1,309 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SearchResultDto.Builder.class) -public final class SearchResultDto implements IResource { - private final Map links; - - private final String name; - - private final SearchResultType type; - - private final Optional label; - - private SearchResultDto( - Map links, String name, SearchResultType type, Optional label) { - this.links = links; - this.name = name; - this.type = type; - this.label = label; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The name of the search result. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The type of the search result. - */ - @JsonProperty("type") - public SearchResultType getType() { - return type; - } - /** - * @return An optional label. - */ - @JsonProperty("label") - public Optional getLabel() { - return label; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SearchResultDto && equalTo((SearchResultDto) other); - } +package com.squidex.api.types; - private boolean equalTo(SearchResultDto other) { - return links.equals(other.links) - && name.equals(other.name) - && type.equals(other.type) - && label.equals(other.label); - } +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.SearchResultType; +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; - @Override - public int hashCode() { - return Objects.hash(this.links, this.name, this.type, this.label); - } +import com.squidex.api.core.JSON; - @Override - public String toString() { - return ObjectMappers.stringify(this); +/** + * SearchResultDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SearchResultDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_TYPE = "type"; + @SerializedName(SERIALIZED_NAME_TYPE) + private SearchResultType type; + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + private String label; + public SearchResultDto() { + } + public SearchResultDto links(Map links) { + this.links = links; + return this; + } + + public SearchResultDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public static NameStage builder() { - return new Builder(); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public SearchResultDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the search result. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public SearchResultDto type(SearchResultType type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + */ + @javax.annotation.Nonnull + public SearchResultType getType() { + return type; + } + + public void setType(SearchResultType type) { + this.type = type; + } + public SearchResultDto label(String label) { + this.label = label; + return this; + } + + /** + * An optional label. + * @return label + */ + @javax.annotation.Nullable + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface NameStage { - TypeStage name(String name); - - Builder from(SearchResultDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface TypeStage { - _FinalStage type(SearchResultType type); + SearchResultDto searchResultDto = (SearchResultDto) o; + return Objects.equals(this.links, searchResultDto.links) && + Objects.equals(this.name, searchResultDto.name) && + Objects.equals(this.type, searchResultDto.type) && + Objects.equals(this.label, searchResultDto.label); + } + + 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(links, name, type, label); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - SearchResultDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage label(Optional label); - - _FinalStage label(String label); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SearchResultDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" type: ").append(toIndentedString(type)).append("\n"); + sb.append(" label: ").append(toIndentedString(label)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, TypeStage, _FinalStage { - private String name; - - private SearchResultType type; - - private Optional label = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(SearchResultDto other) { - links(other.getLinks()); - name(other.getName()); - type(other.getType()); - label(other.getLabel()); - return this; - } - - /** - *

The name of the search result.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public TypeStage name(String name) { - this.name = name; - return this; - } - - /** - *

The type of the search result.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("type") - public _FinalStage type(SearchResultType type) { - this.type = type; - return this; - } - - /** - *

An optional label.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage label(String label) { - this.label = Optional.of(label); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("name"); + openapiFields.add("type"); + openapiFields.add("label"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("name"); + 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 SearchResultDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SearchResultDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SearchResultDto is not found in the empty JSON string", SearchResultDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "label", nulls = Nulls.SKIP) - public _FinalStage label(Optional label) { - this.label = label; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SearchResultDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SearchResultDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public SearchResultDto build() { - return new SearchResultDto(links, name, type, label); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SearchResultDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + // validate the required field `type` + SearchResultType.validateJsonElement(jsonObj.get("type")); + if ((jsonObj.get("label") != null && !jsonObj.get("label").isJsonNull()) && !jsonObj.get("label").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `label` to be a primitive type in the JSON string but got `%s`", jsonObj.get("label").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SearchResultDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SearchResultDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SearchResultDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SearchResultDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SearchResultDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SearchResultDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SearchResultDto + * @throws IOException if the JSON string is invalid with respect to SearchResultDto + */ + public static SearchResultDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SearchResultDto.class); + } + + /** + * Convert an instance of SearchResultDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SearchResultType.java b/src/main/java/com/squidex/api/types/SearchResultType.java index d00d19c..c3e02e6 100644 --- a/src/main/java/com/squidex/api/types/SearchResultType.java +++ b/src/main/java/com/squidex/api/types/SearchResultType.java @@ -1,32 +1,86 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -public enum SearchResultType { - ASSET("Asset"), +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; - CONTENT("Content"), +/** + * + */ +@JsonAdapter(SearchResultType.Adapter.class) +public enum SearchResultType { + + ASSET("Asset"), + + CONTENT("Content"), + + DASHBOARD("Dashboard"), + + SETTING("Setting"), + + RULE("Rule"), + + SCHEMA("Schema"); - DASHBOARD("Dashboard"), + private String value; - SETTING("Setting"), + SearchResultType(String value) { + this.value = value; + } - RULE("Rule"), + public String getValue() { + return value; + } - SCHEMA("Schema"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static SearchResultType fromValue(String value) { + for (SearchResultType b : SearchResultType.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - SearchResultType(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SearchResultType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public SearchResultType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SearchResultType.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SearchResultType.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/SignalRRuleActionDto.java b/src/main/java/com/squidex/api/types/SignalRRuleActionDto.java index d4a8a15..0660a95 100644 --- a/src/main/java/com/squidex/api/types/SignalRRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/SignalRRuleActionDto.java @@ -1,278 +1,340 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SignalRRuleActionDto.Builder.class) -public final class SignalRRuleActionDto { - private final String connectionString; - - private final String hubName; - - private final ActionTypeEnum action; - - private final Optional methodName; - - private final Optional target; - - private final Optional payload; - - private SignalRRuleActionDto( - String connectionString, - String hubName, - ActionTypeEnum action, - Optional methodName, - Optional target, - Optional payload) { - this.connectionString = connectionString; - this.hubName = hubName; - this.action = action; - this.methodName = methodName; - this.target = target; - this.payload = payload; - } - - /** - * @return The connection string to the Azure SignalR. - */ - @JsonProperty("connectionString") - public String getConnectionString() { - return connectionString; - } - - /** - * @return The name of the hub. - */ - @JsonProperty("hubName") - public String getHubName() { - return hubName; - } - - /** - * @return
    - *
  • Broadcast = send to all users.
  • - *
  • User = send to all target users(s).
  • - *
  • Group = send to all target group(s).
  • - *
- */ - @JsonProperty("action") - public ActionTypeEnum getAction() { - return action; - } - /** - * @return Set the Name of the hub method received by the customer. - */ - @JsonProperty("methodName") - public Optional getMethodName() { - return methodName; - } - - /** - * @return Define target users or groups by id or name. One item per line. Not needed for Broadcast action. - */ - @JsonProperty("target") - public Optional getTarget() { - return target; - } - - /** - * @return Leave it empty to use the full event as body. - */ - @JsonProperty("payload") - public Optional getPayload() { - return payload; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SignalRRuleActionDto && equalTo((SignalRRuleActionDto) other); - } - - private boolean equalTo(SignalRRuleActionDto other) { - return connectionString.equals(other.connectionString) - && hubName.equals(other.hubName) - && action.equals(other.action) - && methodName.equals(other.methodName) - && target.equals(other.target) - && payload.equals(other.payload); - } - @Override - public int hashCode() { - return Objects.hash( - this.connectionString, this.hubName, this.action, this.methodName, this.target, this.payload); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ConnectionStringStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface ConnectionStringStage { - HubNameStage connectionString(String connectionString); +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.squidex.api.types.ActionTypeEnum; +import com.squidex.api.types.RuleActionDto; +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.squidex.api.core.JSON; - Builder from(SignalRRuleActionDto other); +/** + * SignalRRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SignalRRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_CONNECTION_STRING = "connectionString"; + @SerializedName(SERIALIZED_NAME_CONNECTION_STRING) + private String connectionString; + public static final String SERIALIZED_NAME_HUB_NAME = "hubName"; + @SerializedName(SERIALIZED_NAME_HUB_NAME) + private String hubName; + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private ActionTypeEnum action; + public static final String SERIALIZED_NAME_METHOD_NAME = "methodName"; + @SerializedName(SERIALIZED_NAME_METHOD_NAME) + private String methodName; + public static final String SERIALIZED_NAME_TARGET = "target"; + @SerializedName(SERIALIZED_NAME_TARGET) + private String target; + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + @SerializedName(SERIALIZED_NAME_PAYLOAD) + private String payload; + public SignalRRuleActionDto() { + } + public SignalRRuleActionDto connectionString(String connectionString) { + this.connectionString = connectionString; + return this; + } + + /** + * The connection string to the Azure SignalR. + * @return connectionString + */ + @javax.annotation.Nonnull + public String getConnectionString() { + return connectionString; + } + + public void setConnectionString(String connectionString) { + this.connectionString = connectionString; + } + public SignalRRuleActionDto hubName(String hubName) { + this.hubName = hubName; + return this; + } + + /** + * The name of the hub. + * @return hubName + */ + @javax.annotation.Nonnull + public String getHubName() { + return hubName; + } + + public void setHubName(String hubName) { + this.hubName = hubName; + } + public SignalRRuleActionDto action(ActionTypeEnum action) { + this.action = action; + return this; + } + + /** + * Get action + * @return action + */ + @javax.annotation.Nonnull + public ActionTypeEnum getAction() { + return action; + } + + public void setAction(ActionTypeEnum action) { + this.action = action; + } + public SignalRRuleActionDto methodName(String methodName) { + this.methodName = methodName; + return this; + } + + /** + * Set the Name of the hub method received by the customer. + * @return methodName + */ + @javax.annotation.Nullable + public String getMethodName() { + return methodName; + } + + public void setMethodName(String methodName) { + this.methodName = methodName; + } + public SignalRRuleActionDto target(String target) { + this.target = target; + return this; + } + + /** + * Define target users or groups by id or name. One item per line. Not needed for Broadcast action. + * @return target + */ + @javax.annotation.Nullable + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + public SignalRRuleActionDto payload(String payload) { + this.payload = payload; + return this; + } + + /** + * Leave it empty to use the full event as body. + * @return payload + */ + @javax.annotation.Nullable + public String getPayload() { + return payload; + } + + public void setPayload(String payload) { + this.payload = payload; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface HubNameStage { - ActionStage hubName(String hubName); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface ActionStage { - _FinalStage action(ActionTypeEnum action); + SignalRRuleActionDto signalRRuleActionDto = (SignalRRuleActionDto) o; + return Objects.equals(this.connectionString, signalRRuleActionDto.connectionString) && + Objects.equals(this.hubName, signalRRuleActionDto.hubName) && + Objects.equals(this.action, signalRRuleActionDto.action) && + Objects.equals(this.methodName, signalRRuleActionDto.methodName) && + Objects.equals(this.target, signalRRuleActionDto.target) && + Objects.equals(this.payload, signalRRuleActionDto.payload) && + super.equals(o); + } + + 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(connectionString, hubName, action, methodName, target, payload, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - SignalRRuleActionDto build(); - - _FinalStage methodName(Optional methodName); - - _FinalStage methodName(String methodName); - - _FinalStage target(Optional target); - - _FinalStage target(String target); - - _FinalStage payload(Optional payload); - - _FinalStage payload(String payload); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SignalRRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" connectionString: ").append(toIndentedString(connectionString)).append("\n"); + sb.append(" hubName: ").append(toIndentedString(hubName)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" methodName: ").append(toIndentedString(methodName)).append("\n"); + sb.append(" target: ").append(toIndentedString(target)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ConnectionStringStage, HubNameStage, ActionStage, _FinalStage { - private String connectionString; - - private String hubName; - - private ActionTypeEnum action; - - private Optional payload = Optional.empty(); - - private Optional target = Optional.empty(); - - private Optional methodName = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(SignalRRuleActionDto other) { - connectionString(other.getConnectionString()); - hubName(other.getHubName()); - action(other.getAction()); - methodName(other.getMethodName()); - target(other.getTarget()); - payload(other.getPayload()); - return this; - } - - /** - *

The connection string to the Azure SignalR.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("connectionString") - public HubNameStage connectionString(String connectionString) { - this.connectionString = connectionString; - return this; - } - - /** - *

The name of the hub.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("hubName") - public ActionStage hubName(String hubName) { - this.hubName = hubName; - return this; - } - - /** - *
    - *
  • Broadcast = send to all users.
  • - *
  • User = send to all target users(s).
  • - *
  • Group = send to all target group(s).
  • - *
- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("action") - public _FinalStage action(ActionTypeEnum action) { - this.action = action; - return this; - } - - /** - *

Leave it empty to use the full event as body.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage payload(String payload) { - this.payload = Optional.of(payload); - return this; - } - - @Override - @JsonSetter(value = "payload", nulls = Nulls.SKIP) - public _FinalStage payload(Optional payload) { - this.payload = payload; - return this; - } - - /** - *

Define target users or groups by id or name. One item per line. Not needed for Broadcast action.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage target(String target) { - this.target = Optional.of(target); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("connectionString"); + openapiFields.add("hubName"); + openapiFields.add("action"); + openapiFields.add("methodName"); + openapiFields.add("target"); + openapiFields.add("payload"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("connectionString"); + openapiRequiredFields.add("hubName"); + openapiRequiredFields.add("action"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SignalRRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SignalRRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SignalRRuleActionDto is not found in the empty JSON string", SignalRRuleActionDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "target", nulls = Nulls.SKIP) - public _FinalStage target(Optional target) { - this.target = target; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SignalRRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SignalRRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

Set the Name of the hub method received by the customer.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage methodName(String methodName) { - this.methodName = Optional.of(methodName); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SignalRRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @Override - @JsonSetter(value = "methodName", nulls = Nulls.SKIP) - public _FinalStage methodName(Optional methodName) { - this.methodName = methodName; - return this; - } - - @Override - public SignalRRuleActionDto build() { - return new SignalRRuleActionDto(connectionString, hubName, action, methodName, target, payload); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SignalRRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SignalRRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SignalRRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SignalRRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SignalRRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SignalRRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SignalRRuleActionDto + * @throws IOException if the JSON string is invalid with respect to SignalRRuleActionDto + */ + public static SignalRRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SignalRRuleActionDto.class); + } + + /** + * Convert an instance of SignalRRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java b/src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java index 992b069..6affc5f 100644 --- a/src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java +++ b/src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java @@ -1,385 +1,441 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.SkipReason; +import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SimulatedRuleEventDto.Builder.class) -public final class SimulatedRuleEventDto { - private final String eventId; - - private final String uniqueId; - - private final String eventName; - - private final Object event; - - private final Optional enrichedEvent; - - private final Optional actionName; - - private final Optional actionData; - - private final Optional error; - - private final List skipReasons; - - private SimulatedRuleEventDto( - String eventId, - String uniqueId, - String eventName, - Object event, - Optional enrichedEvent, - Optional actionName, - Optional actionData, - Optional error, - List skipReasons) { - this.eventId = eventId; - this.uniqueId = uniqueId; - this.eventName = eventName; - this.event = event; - this.enrichedEvent = enrichedEvent; - this.actionName = actionName; - this.actionData = actionData; - this.error = error; - this.skipReasons = skipReasons; - } - - /** - * @return The unique event id. - */ - @JsonProperty("eventId") - public String getEventId() { - return eventId; - } - - /** - * @return The the unique id of the simulated event. - */ - @JsonProperty("uniqueId") - public String getUniqueId() { - return uniqueId; - } - - /** - * @return The name of the event. - */ - @JsonProperty("eventName") - public String getEventName() { - return eventName; - } - - @JsonProperty("event") - public Object getEvent() { - return event; - } - - @JsonProperty("enrichedEvent") - public Optional getEnrichedEvent() { - return enrichedEvent; - } - - /** - * @return The data for the action. - */ - @JsonProperty("actionName") - public Optional getActionName() { - return actionName; - } - - /** - * @return The name of the action. - */ - @JsonProperty("actionData") - public Optional getActionData() { - return actionData; - } - - /** - * @return The name of the event. - */ - @JsonProperty("error") - public Optional getError() { - return error; - } - - /** - * @return The reason why the event has been skipped. - */ - @JsonProperty("skipReasons") - public List getSkipReasons() { - return skipReasons; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SimulatedRuleEventDto && equalTo((SimulatedRuleEventDto) other); - } - - private boolean equalTo(SimulatedRuleEventDto other) { - return eventId.equals(other.eventId) - && uniqueId.equals(other.uniqueId) - && eventName.equals(other.eventName) - && event.equals(other.event) - && enrichedEvent.equals(other.enrichedEvent) - && actionName.equals(other.actionName) - && actionData.equals(other.actionData) - && error.equals(other.error) - && skipReasons.equals(other.skipReasons); - } - - @Override - public int hashCode() { - return Objects.hash( - this.eventId, - this.uniqueId, - this.eventName, - this.event, - this.enrichedEvent, - this.actionName, - this.actionData, - this.error, - this.skipReasons); - } +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; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +import com.squidex.api.core.JSON; - public static EventIdStage builder() { - return new Builder(); +/** + * SimulatedRuleEventDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SimulatedRuleEventDto { + public static final String SERIALIZED_NAME_EVENT_ID = "eventId"; + @SerializedName(SERIALIZED_NAME_EVENT_ID) + private String eventId; + public static final String SERIALIZED_NAME_UNIQUE_ID = "uniqueId"; + @SerializedName(SERIALIZED_NAME_UNIQUE_ID) + private String uniqueId; + public static final String SERIALIZED_NAME_EVENT_NAME = "eventName"; + @SerializedName(SERIALIZED_NAME_EVENT_NAME) + private String eventName; + public static final String SERIALIZED_NAME_EVENT = "event"; + @SerializedName(SERIALIZED_NAME_EVENT) + private Object event = null; + public static final String SERIALIZED_NAME_ENRICHED_EVENT = "enrichedEvent"; + @SerializedName(SERIALIZED_NAME_ENRICHED_EVENT) + private Object enrichedEvent = null; + public static final String SERIALIZED_NAME_ACTION_NAME = "actionName"; + @SerializedName(SERIALIZED_NAME_ACTION_NAME) + private String actionName; + public static final String SERIALIZED_NAME_ACTION_DATA = "actionData"; + @SerializedName(SERIALIZED_NAME_ACTION_DATA) + private String actionData; + public static final String SERIALIZED_NAME_ERROR = "error"; + @SerializedName(SERIALIZED_NAME_ERROR) + private String error; + public static final String SERIALIZED_NAME_SKIP_REASONS = "skipReasons"; + @SerializedName(SERIALIZED_NAME_SKIP_REASONS) + private List skipReasons = new ArrayList<>(); + public SimulatedRuleEventDto() { + } + public SimulatedRuleEventDto eventId(String eventId) { + this.eventId = eventId; + return this; + } + + /** + * The unique event id. + * @return eventId + */ + @javax.annotation.Nonnull + public String getEventId() { + return eventId; + } + + public void setEventId(String eventId) { + this.eventId = eventId; + } + public SimulatedRuleEventDto uniqueId(String uniqueId) { + this.uniqueId = uniqueId; + return this; + } + + /** + * The the unique id of the simulated event. + * @return uniqueId + */ + @javax.annotation.Nonnull + public String getUniqueId() { + return uniqueId; + } + + public void setUniqueId(String uniqueId) { + this.uniqueId = uniqueId; + } + public SimulatedRuleEventDto eventName(String eventName) { + this.eventName = eventName; + return this; + } + + /** + * The name of the event. + * @return eventName + */ + @javax.annotation.Nonnull + public String getEventName() { + return eventName; + } + + public void setEventName(String eventName) { + this.eventName = eventName; + } + public SimulatedRuleEventDto event(Object event) { + this.event = event; + return this; + } + + /** + * The source event. + * @return event + */ + @javax.annotation.Nullable + public Object getEvent() { + return event; + } + + public void setEvent(Object event) { + this.event = event; + } + public SimulatedRuleEventDto enrichedEvent(Object enrichedEvent) { + this.enrichedEvent = enrichedEvent; + return this; + } + + /** + * The enriched event. + * @return enrichedEvent + */ + @javax.annotation.Nullable + public Object getEnrichedEvent() { + return enrichedEvent; + } + + public void setEnrichedEvent(Object enrichedEvent) { + this.enrichedEvent = enrichedEvent; + } + public SimulatedRuleEventDto actionName(String actionName) { + this.actionName = actionName; + return this; + } + + /** + * The data for the action. + * @return actionName + */ + @javax.annotation.Nullable + public String getActionName() { + return actionName; + } + + public void setActionName(String actionName) { + this.actionName = actionName; + } + public SimulatedRuleEventDto actionData(String actionData) { + this.actionData = actionData; + return this; + } + + /** + * The name of the action. + * @return actionData + */ + @javax.annotation.Nullable + public String getActionData() { + return actionData; + } + + public void setActionData(String actionData) { + this.actionData = actionData; + } + public SimulatedRuleEventDto error(String error) { + this.error = error; + return this; + } + + /** + * The name of the event. + * @return error + */ + @javax.annotation.Nullable + public String getError() { + return error; + } + + public void setError(String error) { + this.error = error; + } + public SimulatedRuleEventDto skipReasons(List skipReasons) { + this.skipReasons = skipReasons; + return this; + } + + public SimulatedRuleEventDto addSkipReasonsItem(SkipReason skipReasonsItem) { + if (this.skipReasons == null) { + this.skipReasons = new ArrayList<>(); } - - public interface EventIdStage { - UniqueIdStage eventId(String eventId); - - Builder from(SimulatedRuleEventDto other); + this.skipReasons.add(skipReasonsItem); + return this; + } + + /** + * The reason why the event has been skipped. + * @return skipReasons + */ + @javax.annotation.Nonnull + public List getSkipReasons() { + return skipReasons; + } + + public void setSkipReasons(List skipReasons) { + this.skipReasons = skipReasons; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface UniqueIdStage { - EventNameStage uniqueId(String uniqueId); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface EventNameStage { - EventStage eventName(String eventName); + SimulatedRuleEventDto simulatedRuleEventDto = (SimulatedRuleEventDto) o; + return Objects.equals(this.eventId, simulatedRuleEventDto.eventId) && + Objects.equals(this.uniqueId, simulatedRuleEventDto.uniqueId) && + Objects.equals(this.eventName, simulatedRuleEventDto.eventName) && + Objects.equals(this.event, simulatedRuleEventDto.event) && + Objects.equals(this.enrichedEvent, simulatedRuleEventDto.enrichedEvent) && + Objects.equals(this.actionName, simulatedRuleEventDto.actionName) && + Objects.equals(this.actionData, simulatedRuleEventDto.actionData) && + Objects.equals(this.error, simulatedRuleEventDto.error) && + Objects.equals(this.skipReasons, simulatedRuleEventDto.skipReasons); + } + + 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(eventId, uniqueId, eventName, event, enrichedEvent, actionName, actionData, error, skipReasons); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface EventStage { - _FinalStage event(Object event); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SimulatedRuleEventDto {\n"); + sb.append(" eventId: ").append(toIndentedString(eventId)).append("\n"); + sb.append(" uniqueId: ").append(toIndentedString(uniqueId)).append("\n"); + sb.append(" eventName: ").append(toIndentedString(eventName)).append("\n"); + sb.append(" event: ").append(toIndentedString(event)).append("\n"); + sb.append(" enrichedEvent: ").append(toIndentedString(enrichedEvent)).append("\n"); + sb.append(" actionName: ").append(toIndentedString(actionName)).append("\n"); + sb.append(" actionData: ").append(toIndentedString(actionData)).append("\n"); + sb.append(" error: ").append(toIndentedString(error)).append("\n"); + sb.append(" skipReasons: ").append(toIndentedString(skipReasons)).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"; } - - public interface _FinalStage { - SimulatedRuleEventDto build(); - - _FinalStage enrichedEvent(Optional enrichedEvent); - - _FinalStage enrichedEvent(Object enrichedEvent); - - _FinalStage actionName(Optional actionName); - - _FinalStage actionName(String actionName); - - _FinalStage actionData(Optional actionData); - - _FinalStage actionData(String actionData); - - _FinalStage error(Optional error); - - _FinalStage error(String error); - - _FinalStage skipReasons(List skipReasons); - - _FinalStage addSkipReasons(SkipReason skipReasons); - - _FinalStage addAllSkipReasons(List skipReasons); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements EventIdStage, UniqueIdStage, EventNameStage, EventStage, _FinalStage { - private String eventId; - - private String uniqueId; - - private String eventName; - - private Object event; - - private List skipReasons = new ArrayList<>(); - - private Optional error = Optional.empty(); - - private Optional actionData = Optional.empty(); - - private Optional actionName = Optional.empty(); - - private Optional enrichedEvent = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(SimulatedRuleEventDto other) { - eventId(other.getEventId()); - uniqueId(other.getUniqueId()); - eventName(other.getEventName()); - event(other.getEvent()); - enrichedEvent(other.getEnrichedEvent()); - actionName(other.getActionName()); - actionData(other.getActionData()); - error(other.getError()); - skipReasons(other.getSkipReasons()); - return this; - } - - /** - *

The unique event id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("eventId") - public UniqueIdStage eventId(String eventId) { - this.eventId = eventId; - return this; - } - - /** - *

The the unique id of the simulated event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("uniqueId") - public EventNameStage uniqueId(String uniqueId) { - this.uniqueId = uniqueId; - return this; - } - - /** - *

The name of the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("eventName") - public EventStage eventName(String eventName) { - this.eventName = eventName; - return this; - } - - @Override - @JsonSetter("event") - public _FinalStage event(Object event) { - this.event = event; - return this; - } - - /** - *

The reason why the event has been skipped.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllSkipReasons(List skipReasons) { - this.skipReasons.addAll(skipReasons); - return this; - } - - /** - *

The reason why the event has been skipped.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addSkipReasons(SkipReason skipReasons) { - this.skipReasons.add(skipReasons); - return this; - } - - @Override - @JsonSetter(value = "skipReasons", nulls = Nulls.SKIP) - public _FinalStage skipReasons(List skipReasons) { - this.skipReasons.clear(); - this.skipReasons.addAll(skipReasons); - return this; - } - - /** - *

The name of the event.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage error(String error) { - this.error = Optional.of(error); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("eventId"); + openapiFields.add("uniqueId"); + openapiFields.add("eventName"); + openapiFields.add("event"); + openapiFields.add("enrichedEvent"); + openapiFields.add("actionName"); + openapiFields.add("actionData"); + openapiFields.add("error"); + openapiFields.add("skipReasons"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("eventId"); + openapiRequiredFields.add("uniqueId"); + openapiRequiredFields.add("eventName"); + openapiRequiredFields.add("event"); + openapiRequiredFields.add("skipReasons"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SimulatedRuleEventDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SimulatedRuleEventDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SimulatedRuleEventDto is not found in the empty JSON string", SimulatedRuleEventDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "error", nulls = Nulls.SKIP) - public _FinalStage error(Optional error) { - this.error = error; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SimulatedRuleEventDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SimulatedRuleEventDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The name of the action.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage actionData(String actionData) { - this.actionData = Optional.of(actionData); - return this; - } - - @Override - @JsonSetter(value = "actionData", nulls = Nulls.SKIP) - public _FinalStage actionData(Optional actionData) { - this.actionData = actionData; - return this; - } - - /** - *

The data for the action.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage actionName(String actionName) { - this.actionName = Optional.of(actionName); - return this; - } - - @Override - @JsonSetter(value = "actionName", nulls = Nulls.SKIP) - public _FinalStage actionName(Optional actionName) { - this.actionName = actionName; - return this; - } - - @Override - public _FinalStage enrichedEvent(Object enrichedEvent) { - this.enrichedEvent = Optional.of(enrichedEvent); - return this; - } - - @Override - @JsonSetter(value = "enrichedEvent", nulls = Nulls.SKIP) - public _FinalStage enrichedEvent(Optional enrichedEvent) { - this.enrichedEvent = enrichedEvent; - return this; - } - - @Override - public SimulatedRuleEventDto build() { - return new SimulatedRuleEventDto( - eventId, uniqueId, eventName, event, enrichedEvent, actionName, actionData, error, skipReasons); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SimulatedRuleEventDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("eventId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventId").toString())); + } + if (!jsonObj.get("uniqueId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `uniqueId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("uniqueId").toString())); + } + if (!jsonObj.get("eventName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `eventName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("eventName").toString())); + } + if ((jsonObj.get("actionName") != null && !jsonObj.get("actionName").isJsonNull()) && !jsonObj.get("actionName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `actionName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actionName").toString())); + } + if ((jsonObj.get("actionData") != null && !jsonObj.get("actionData").isJsonNull()) && !jsonObj.get("actionData").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `actionData` to be a primitive type in the JSON string but got `%s`", jsonObj.get("actionData").toString())); + } + if ((jsonObj.get("error") != null && !jsonObj.get("error").isJsonNull()) && !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())); + } + // ensure the required json array is present + if (jsonObj.get("skipReasons") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("skipReasons").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `skipReasons` to be an array in the JSON string but got `%s`", jsonObj.get("skipReasons").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SimulatedRuleEventDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SimulatedRuleEventDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SimulatedRuleEventDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SimulatedRuleEventDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SimulatedRuleEventDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SimulatedRuleEventDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SimulatedRuleEventDto + * @throws IOException if the JSON string is invalid with respect to SimulatedRuleEventDto + */ + public static SimulatedRuleEventDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SimulatedRuleEventDto.class); + } + + /** + * Convert an instance of SimulatedRuleEventDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java b/src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java index 0a569ba..90e2a2b 100644 --- a/src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java +++ b/src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java @@ -1,195 +1,286 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.SimulatedRuleEventDto; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SimulatedRuleEventsDto.Builder.class) -public final class SimulatedRuleEventsDto implements IResource { - private final Map links; - - private final int total; - private final List items; - - private SimulatedRuleEventsDto(Map links, int total, List items) { - this.links = links; - this.total = total; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of simulated rule events. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The simulated rule events. - */ - @JsonProperty("items") - public List getItems() { - return items; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SimulatedRuleEventsDto && equalTo((SimulatedRuleEventsDto) other); +/** + * SimulatedRuleEventsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SimulatedRuleEventsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + private Long total; + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public SimulatedRuleEventsDto() { + } + public SimulatedRuleEventsDto links(Map links) { + this.links = links; + return this; + } + + public SimulatedRuleEventsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - private boolean equalTo(SimulatedRuleEventsDto other) { - return links.equals(other.links) && total == other.total && items.equals(other.items); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public SimulatedRuleEventsDto total(Long total) { + this.total = total; + return this; + } + + /** + * The total number of simulated rule events. + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + public SimulatedRuleEventsDto items(List items) { + this.items = items; + return this; + } + + public SimulatedRuleEventsDto addItemsItem(SimulatedRuleEventDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items); + this.items.add(itemsItem); + return this; + } + + /** + * The simulated rule events. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static TotalStage builder() { - return new Builder(); + SimulatedRuleEventsDto simulatedRuleEventsDto = (SimulatedRuleEventsDto) o; + return Objects.equals(this.links, simulatedRuleEventsDto.links) && + Objects.equals(this.total, simulatedRuleEventsDto.total) && + Objects.equals(this.items, simulatedRuleEventsDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, total, items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SimulatedRuleEventsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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"; } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(SimulatedRuleEventsDto other); - } - - public interface _FinalStage { - SimulatedRuleEventsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(SimulatedRuleEventDto items); - - _FinalStage addAllItems(List items); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(SimulatedRuleEventsDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("total"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("items"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SimulatedRuleEventsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SimulatedRuleEventsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SimulatedRuleEventsDto is not found in the empty JSON string", SimulatedRuleEventsDto.openapiRequiredFields.toString())); } + } - /** - *

The total number of simulated rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SimulatedRuleEventsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SimulatedRuleEventsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The simulated rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The simulated rule events.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(SimulatedRuleEventDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public SimulatedRuleEventsDto build() { - return new SimulatedRuleEventsDto(links, total, items); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SimulatedRuleEventsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + SimulatedRuleEventDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SimulatedRuleEventsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SimulatedRuleEventsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SimulatedRuleEventsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SimulatedRuleEventsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SimulatedRuleEventsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SimulatedRuleEventsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SimulatedRuleEventsDto + * @throws IOException if the JSON string is invalid with respect to SimulatedRuleEventsDto + */ + public static SimulatedRuleEventsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SimulatedRuleEventsDto.class); + } + + /** + * Convert an instance of SimulatedRuleEventsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SkipReason.java b/src/main/java/com/squidex/api/types/SkipReason.java index 7b439fb..3b476c4 100644 --- a/src/main/java/com/squidex/api/types/SkipReason.java +++ b/src/main/java/com/squidex/api/types/SkipReason.java @@ -1,42 +1,96 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum SkipReason { - NONE("None"), - CONDITION_DOES_NOT_MATCH("ConditionDoesNotMatch"), - - CONDITION_PRECHECK_DOES_NOT_MATCH("ConditionPrecheckDoesNotMatch"), - - DISABLED("Disabled"), +package com.squidex.api.types; - FAILED("Failed"), +import java.util.Objects; +import com.google.gson.annotations.SerializedName; - FROM_RULE("FromRule"), +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; - NO_ACTION("NoAction"), +/** + * + */ +@JsonAdapter(SkipReason.Adapter.class) +public enum SkipReason { + + NONE("None"), + + CONDITION_DOES_NOT_MATCH("ConditionDoesNotMatch"), + + CONDITION_PRECHECK_DOES_NOT_MATCH("ConditionPrecheckDoesNotMatch"), + + DISABLED("Disabled"), + + FAILED("Failed"), + + FROM_RULE("FromRule"), + + NO_ACTION("NoAction"), + + NO_TRIGGER("NoTrigger"), + + TOO_OLD("TooOld"), + + WRONG_EVENT("WrongEvent"), + + WRONG_EVENT_FOR_TRIGGER("WrongEventForTrigger"); - NO_TRIGGER("NoTrigger"), + private String value; - TOO_OLD("TooOld"), + SkipReason(String value) { + this.value = value; + } - WRONG_EVENT("WrongEvent"), + public String getValue() { + return value; + } - WRONG_EVENT_FOR_TRIGGER("WrongEventForTrigger"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static SkipReason fromValue(String value) { + for (SkipReason b : SkipReason.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - SkipReason(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final SkipReason enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public SkipReason read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SkipReason.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SkipReason.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/SlackRuleActionDto.java b/src/main/java/com/squidex/api/types/SlackRuleActionDto.java index e415621..feaae4a 100644 --- a/src/main/java/com/squidex/api/types/SlackRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/SlackRuleActionDto.java @@ -1,122 +1,235 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SlackRuleActionDto.Builder.class) -public final class SlackRuleActionDto { - private final String webhookUrl; - - private final String text; - - private SlackRuleActionDto(String webhookUrl, String text) { - this.webhookUrl = webhookUrl; - this.text = text; - } - - /** - * @return The slack webhook url. - */ - @JsonProperty("webhookUrl") - public String getWebhookUrl() { - return webhookUrl; - } - - /** - * @return The text that is sent as message to slack. - */ - @JsonProperty("text") - public String getText() { - return text; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SlackRuleActionDto && equalTo((SlackRuleActionDto) other); - } - private boolean equalTo(SlackRuleActionDto other) { - return webhookUrl.equals(other.webhookUrl) && text.equals(other.text); - } - - @Override - public int hashCode() { - return Objects.hash(this.webhookUrl, this.text); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.types.RuleActionDto; +import java.io.IOException; +import java.net.URI; +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.squidex.api.core.JSON; - public static WebhookUrlStage builder() { - return new Builder(); +/** + * SlackRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SlackRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_WEBHOOK_URL = "webhookUrl"; + @SerializedName(SERIALIZED_NAME_WEBHOOK_URL) + private URI webhookUrl; + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + public SlackRuleActionDto() { + } + public SlackRuleActionDto webhookUrl(URI webhookUrl) { + this.webhookUrl = webhookUrl; + return this; + } + + /** + * The slack webhook url. + * @return webhookUrl + */ + @javax.annotation.Nonnull + public URI getWebhookUrl() { + return webhookUrl; + } + + public void setWebhookUrl(URI webhookUrl) { + this.webhookUrl = webhookUrl; + } + public SlackRuleActionDto text(String text) { + this.text = text; + return this; + } + + /** + * The text that is sent as message to slack. + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface WebhookUrlStage { - TextStage webhookUrl(String webhookUrl); - - Builder from(SlackRuleActionDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface TextStage { - _FinalStage text(String text); + SlackRuleActionDto slackRuleActionDto = (SlackRuleActionDto) o; + return Objects.equals(this.webhookUrl, slackRuleActionDto.webhookUrl) && + Objects.equals(this.text, slackRuleActionDto.text) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(webhookUrl, text, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SlackRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" webhookUrl: ").append(toIndentedString(webhookUrl)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).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"; } - - public interface _FinalStage { - SlackRuleActionDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements WebhookUrlStage, TextStage, _FinalStage { - private String webhookUrl; - - private String text; - - private Builder() {} - - @Override - public Builder from(SlackRuleActionDto other) { - webhookUrl(other.getWebhookUrl()); - text(other.getText()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("webhookUrl"); + openapiFields.add("text"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("webhookUrl"); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SlackRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SlackRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SlackRuleActionDto is not found in the empty JSON string", SlackRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The slack webhook url.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("webhookUrl") - public TextStage webhookUrl(String webhookUrl) { - this.webhookUrl = webhookUrl; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SlackRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SlackRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The text that is sent as message to slack.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SlackRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @Override - public SlackRuleActionDto build() { - return new SlackRuleActionDto(webhookUrl, text); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SlackRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SlackRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SlackRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SlackRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SlackRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SlackRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SlackRuleActionDto + * @throws IOException if the JSON string is invalid with respect to SlackRuleActionDto + */ + public static SlackRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SlackRuleActionDto.class); + } + + /** + * Convert an instance of SlackRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SortNode.java b/src/main/java/com/squidex/api/types/SortNode.java index 50bd50b..9a02f43 100644 --- a/src/main/java/com/squidex/api/types/SortNode.java +++ b/src/main/java/com/squidex/api/types/SortNode.java @@ -1,126 +1,236 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = SortNode.Builder.class) -public final class SortNode { - private final List path; - private final SortOrder order; - private SortNode(List path, SortOrder order) { - this.path = path; - this.order = order; - } - - @JsonProperty("path") - public List getPath() { - return path; - } - - @JsonProperty("order") - public SortOrder getOrder() { - return order; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SortNode && equalTo((SortNode) other); - } - - private boolean equalTo(SortNode other) { - return path.equals(other.path) && order.equals(other.order); - } +package com.squidex.api.types; - @Override - public int hashCode() { - return Objects.hash(this.path, this.order); - } +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.squidex.api.types.SortOrder; +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; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +import com.squidex.api.core.JSON; - public static OrderStage builder() { - return new Builder(); +/** + * SortNode + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SortNode { + public static final String SERIALIZED_NAME_PATH = "path"; + @SerializedName(SERIALIZED_NAME_PATH) + private String path; + public static final String SERIALIZED_NAME_ORDER = "order"; + @SerializedName(SERIALIZED_NAME_ORDER) + private SortOrder order; + public SortNode() { + } + public SortNode path(String path) { + this.path = path; + return this; + } + + /** + * Get path + * @return path + */ + @javax.annotation.Nonnull + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + public SortNode order(SortOrder order) { + this.order = order; + return this; + } + + /** + * Get order + * @return order + */ + @javax.annotation.Nonnull + public SortOrder getOrder() { + return order; + } + + public void setOrder(SortOrder order) { + this.order = order; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface OrderStage { - _FinalStage order(SortOrder order); - - Builder from(SortNode other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - SortNode build(); - - _FinalStage path(List path); - - _FinalStage addPath(String path); - - _FinalStage addAllPath(List path); + SortNode sortNode = (SortNode) o; + return Objects.equals(this.path, sortNode.path) && + Objects.equals(this.order, sortNode.order); + } + + @Override + public int hashCode() { + return Objects.hash(path, order); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SortNode {\n"); + sb.append(" path: ").append(toIndentedString(path)).append("\n"); + sb.append(" order: ").append(toIndentedString(order)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements OrderStage, _FinalStage { - private SortOrder order; - - private List path = new ArrayList<>(); - - private Builder() {} - - @Override - public Builder from(SortNode other) { - path(other.getPath()); - order(other.getOrder()); - return this; - } - - @Override - @JsonSetter("order") - public _FinalStage order(SortOrder order) { - this.order = order; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("path"); + openapiFields.add("order"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("path"); + openapiRequiredFields.add("order"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to SortNode + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SortNode.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SortNode is not found in the empty JSON string", SortNode.openapiRequiredFields.toString())); } + } - @Override - public _FinalStage addAllPath(List path) { - this.path.addAll(path); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SortNode.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SortNode` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public _FinalStage addPath(String path) { - this.path.add(path); - return this; - } - - @Override - @JsonSetter(value = "path", nulls = Nulls.SKIP) - public _FinalStage path(List path) { - this.path.clear(); - this.path.addAll(path); - return this; - } - - @Override - public SortNode build() { - return new SortNode(path, order); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : SortNode.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("path").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `path` to be a primitive type in the JSON string but got `%s`", jsonObj.get("path").toString())); + } + // validate the required field `order` + SortOrder.validateJsonElement(jsonObj.get("order")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SortNode.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SortNode' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SortNode.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SortNode value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SortNode read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of SortNode given an JSON string + * + * @param jsonString JSON string + * @return An instance of SortNode + * @throws IOException if the JSON string is invalid with respect to SortNode + */ + public static SortNode fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SortNode.class); + } + + /** + * Convert an instance of SortNode to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SortOrder.java b/src/main/java/com/squidex/api/types/SortOrder.java index 5d5189f..433c0d3 100644 --- a/src/main/java/com/squidex/api/types/SortOrder.java +++ b/src/main/java/com/squidex/api/types/SortOrder.java @@ -1,24 +1,78 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; +/** + * + */ +@JsonAdapter(SortOrder.Adapter.class) public enum SortOrder { - ASCENDING("Ascending"), + + ASCENDING("Ascending"), + + DESCENDING("Descending"); + + private String value; - DESCENDING("Descending"); + SortOrder(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - SortOrder(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static SortOrder fromValue(String value) { + for (SortOrder b : SortOrder.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 SortOrder enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public SortOrder read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return SortOrder.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + SortOrder.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/StatusInfoDto.java b/src/main/java/com/squidex/api/types/StatusInfoDto.java index 7f3ef4a..698b012 100644 --- a/src/main/java/com/squidex/api/types/StatusInfoDto.java +++ b/src/main/java/com/squidex/api/types/StatusInfoDto.java @@ -1,122 +1,236 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = StatusInfoDto.Builder.class) -public final class StatusInfoDto { - private final String status; - - private final String color; - - private StatusInfoDto(String status, String color) { - this.status = status; - this.color = color; - } - - /** - * @return The name of the status. - */ - @JsonProperty("status") - public String getStatus() { - return status; - } - - /** - * @return The color of the status. - */ - @JsonProperty("color") - public String getColor() { - return color; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof StatusInfoDto && equalTo((StatusInfoDto) other); - } - - private boolean equalTo(StatusInfoDto other) { - return status.equals(other.status) && color.equals(other.color); - } - - @Override - public int hashCode() { - return Objects.hash(this.status, this.color); - } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static StatusStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface StatusStage { - ColorStage status(String status); +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.squidex.api.core.JSON; - Builder from(StatusInfoDto other); +/** + * StatusInfoDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class StatusInfoDto { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private String status; + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; + public StatusInfoDto() { + } + public StatusInfoDto status(String status) { + this.status = status; + return this; + } + + /** + * The name of the status. + * @return status + */ + @javax.annotation.Nonnull + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + public StatusInfoDto color(String color) { + this.color = color; + return this; + } + + /** + * The color of the status. + * @return color + */ + @javax.annotation.Nonnull + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ColorStage { - _FinalStage color(String color); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - StatusInfoDto build(); + StatusInfoDto statusInfoDto = (StatusInfoDto) o; + return Objects.equals(this.status, statusInfoDto.status) && + Objects.equals(this.color, statusInfoDto.color); + } + + @Override + public int hashCode() { + return Objects.hash(status, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StatusInfoDto {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements StatusStage, ColorStage, _FinalStage { - private String status; - - private String color; - - private Builder() {} - - @Override - public Builder from(StatusInfoDto other) { - status(other.getStatus()); - color(other.getColor()); - return this; - } - - /** - *

The name of the status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public ColorStage status(String status) { - this.status = status; - return this; + return o.toString().replace("\n", "\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("color"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("color"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StatusInfoDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StatusInfoDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StatusInfoDto is not found in the empty JSON string", StatusInfoDto.openapiRequiredFields.toString())); } + } - /** - *

The color of the status.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("color") - public _FinalStage color(String color) { - this.color = color; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StatusInfoDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StatusInfoDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public StatusInfoDto build() { - return new StatusInfoDto(status, color); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StatusInfoDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StatusInfoDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StatusInfoDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StatusInfoDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StatusInfoDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StatusInfoDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of StatusInfoDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of StatusInfoDto + * @throws IOException if the JSON string is invalid with respect to StatusInfoDto + */ + public static StatusInfoDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StatusInfoDto.class); + } + + /** + * Convert an instance of StatusInfoDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java b/src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java index bb0b3bf..509cfb1 100644 --- a/src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java +++ b/src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java @@ -1,151 +1,255 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = StorageUsagePerDateDto.Builder.class) -public final class StorageUsagePerDateDto { - private final String date; - - private final int totalCount; - - private final int totalSize; - - private StorageUsagePerDateDto(String date, int totalCount, int totalSize) { - this.date = date; - this.totalCount = totalCount; - this.totalSize = totalSize; - } - - /** - * @return The date when the usage was tracked. - */ - @JsonProperty("date") - public String getDate() { - return date; - } - /** - * @return The number of assets. - */ - @JsonProperty("totalCount") - public int getTotalCount() { - return totalCount; - } - - /** - * @return The size in bytes. - */ - @JsonProperty("totalSize") - public int getTotalSize() { - return totalSize; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof StorageUsagePerDateDto && equalTo((StorageUsagePerDateDto) other); - } - - private boolean equalTo(StorageUsagePerDateDto other) { - return date.equals(other.date) && totalCount == other.totalCount && totalSize == other.totalSize; - } - - @Override - public int hashCode() { - return Objects.hash(this.date, this.totalCount, this.totalSize); - } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DateStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface DateStage { - TotalCountStage date(String date); +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.LocalDate; +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.squidex.api.core.JSON; - Builder from(StorageUsagePerDateDto other); +/** + * StorageUsagePerDateDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class StorageUsagePerDateDto { + public static final String SERIALIZED_NAME_DATE = "date"; + @SerializedName(SERIALIZED_NAME_DATE) + private LocalDate date; + public static final String SERIALIZED_NAME_TOTAL_COUNT = "totalCount"; + @SerializedName(SERIALIZED_NAME_TOTAL_COUNT) + private Long totalCount; + public static final String SERIALIZED_NAME_TOTAL_SIZE = "totalSize"; + @SerializedName(SERIALIZED_NAME_TOTAL_SIZE) + private Long totalSize; + public StorageUsagePerDateDto() { + } + public StorageUsagePerDateDto date(LocalDate date) { + this.date = date; + return this; + } + + /** + * The date when the usage was tracked. + * @return date + */ + @javax.annotation.Nonnull + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + public StorageUsagePerDateDto totalCount(Long totalCount) { + this.totalCount = totalCount; + return this; + } + + /** + * The number of assets. + * @return totalCount + */ + @javax.annotation.Nonnull + public Long getTotalCount() { + return totalCount; + } + + public void setTotalCount(Long totalCount) { + this.totalCount = totalCount; + } + public StorageUsagePerDateDto totalSize(Long totalSize) { + this.totalSize = totalSize; + return this; + } + + /** + * The size in bytes. + * @return totalSize + */ + @javax.annotation.Nonnull + public Long getTotalSize() { + return totalSize; + } + + public void setTotalSize(Long totalSize) { + this.totalSize = totalSize; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface TotalCountStage { - TotalSizeStage totalCount(int totalCount); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface TotalSizeStage { - _FinalStage totalSize(int totalSize); + StorageUsagePerDateDto storageUsagePerDateDto = (StorageUsagePerDateDto) o; + return Objects.equals(this.date, storageUsagePerDateDto.date) && + Objects.equals(this.totalCount, storageUsagePerDateDto.totalCount) && + Objects.equals(this.totalSize, storageUsagePerDateDto.totalSize); + } + + @Override + public int hashCode() { + return Objects.hash(date, totalCount, totalSize); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StorageUsagePerDateDto {\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" totalCount: ").append(toIndentedString(totalCount)).append("\n"); + sb.append(" totalSize: ").append(toIndentedString(totalSize)).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"; } - - public interface _FinalStage { - StorageUsagePerDateDto build(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DateStage, TotalCountStage, TotalSizeStage, _FinalStage { - private String date; - - private int totalCount; - - private int totalSize; - - private Builder() {} - - @Override - public Builder from(StorageUsagePerDateDto other) { - date(other.getDate()); - totalCount(other.getTotalCount()); - totalSize(other.getTotalSize()); - return this; - } - - /** - *

The date when the usage was tracked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("date") - public TotalCountStage date(String date) { - this.date = date; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("date"); + openapiFields.add("totalCount"); + openapiFields.add("totalSize"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("date"); + openapiRequiredFields.add("totalCount"); + openapiRequiredFields.add("totalSize"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StorageUsagePerDateDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StorageUsagePerDateDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StorageUsagePerDateDto is not found in the empty JSON string", StorageUsagePerDateDto.openapiRequiredFields.toString())); } + } - /** - *

The number of assets.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalCount") - public TotalSizeStage totalCount(int totalCount) { - this.totalCount = totalCount; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StorageUsagePerDateDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StorageUsagePerDateDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The size in bytes.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("totalSize") - public _FinalStage totalSize(int totalSize) { - this.totalSize = totalSize; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StorageUsagePerDateDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + } - @Override - public StorageUsagePerDateDto build() { - return new StorageUsagePerDateDto(date, totalCount, totalSize); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StorageUsagePerDateDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StorageUsagePerDateDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StorageUsagePerDateDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StorageUsagePerDateDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StorageUsagePerDateDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of StorageUsagePerDateDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of StorageUsagePerDateDto + * @throws IOException if the JSON string is invalid with respect to StorageUsagePerDateDto + */ + public static StorageUsagePerDateDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StorageUsagePerDateDto.class); + } + + /** + * Convert an instance of StorageUsagePerDateDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/StringContentType.java b/src/main/java/com/squidex/api/types/StringContentType.java index eb737e3..8439e89 100644 --- a/src/main/java/com/squidex/api/types/StringContentType.java +++ b/src/main/java/com/squidex/api/types/StringContentType.java @@ -1,26 +1,80 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(StringContentType.Adapter.class) public enum StringContentType { - UNSPECIFIED("Unspecified"), + + UNSPECIFIED("Unspecified"), + + HTML("Html"), + + MARKDOWN("Markdown"); - HTML("Html"), + private String value; - MARKDOWN("Markdown"); + StringContentType(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - StringContentType(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static StringContentType fromValue(String value) { + for (StringContentType b : StringContentType.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 StringContentType enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public StringContentType read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StringContentType.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StringContentType.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/StringFieldEditor.java b/src/main/java/com/squidex/api/types/StringFieldEditor.java index 74f2908..9024605 100644 --- a/src/main/java/com/squidex/api/types/StringFieldEditor.java +++ b/src/main/java/com/squidex/api/types/StringFieldEditor.java @@ -1,40 +1,94 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; - -public enum StringFieldEditor { - INPUT("Input"), - COLOR("Color"), - - MARKDOWN("Markdown"), +package com.squidex.api.types; - DROPDOWN("Dropdown"), +import java.util.Objects; +import com.google.gson.annotations.SerializedName; - HTML("Html"), +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; - RADIO("Radio"), +/** + * + */ +@JsonAdapter(StringFieldEditor.Adapter.class) +public enum StringFieldEditor { + + INPUT("Input"), + + COLOR("Color"), + + MARKDOWN("Markdown"), + + DROPDOWN("Dropdown"), + + HTML("Html"), + + RADIO("Radio"), + + RICH_TEXT("RichText"), + + SLUG("Slug"), + + STOCK_PHOTO("StockPhoto"), + + TEXT_AREA("TextArea"); - RICH_TEXT("RichText"), + private String value; - SLUG("Slug"), + StringFieldEditor(String value) { + this.value = value; + } - STOCK_PHOTO("StockPhoto"), + public String getValue() { + return value; + } - TEXT_AREA("TextArea"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static StringFieldEditor fromValue(String value) { + for (StringFieldEditor b : StringFieldEditor.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - StringFieldEditor(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final StringFieldEditor enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public StringFieldEditor read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StringFieldEditor.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + StringFieldEditor.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java index 1ac9bd9..2e0de3e 100644 --- a/src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java @@ -1,610 +1,704 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.FieldPropertiesDto; +import com.squidex.api.types.StringContentType; +import com.squidex.api.types.StringFieldEditor; +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.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = StringFieldPropertiesDto.Builder.class) -public final class StringFieldPropertiesDto { - private final Optional> defaultValues; - - private final Optional defaultValue; - - private final Optional pattern; - - private final Optional patternMessage; - - private final Optional folderId; - - private final Optional minLength; - - private final Optional maxLength; - - private final Optional minCharacters; - - private final Optional maxCharacters; - - private final Optional minWords; - - private final Optional maxWords; - - private final Optional> allowedValues; - - private final Optional> schemaIds; - - private final Optional isUnique; - - private final Optional isEmbeddable; - - private final Optional inlineEditable; - - private final Optional createEnum; - - private final Optional contentType; - - private final Optional editor; - - private StringFieldPropertiesDto( - Optional> defaultValues, - Optional defaultValue, - Optional pattern, - Optional patternMessage, - Optional folderId, - Optional minLength, - Optional maxLength, - Optional minCharacters, - Optional maxCharacters, - Optional minWords, - Optional maxWords, - Optional> allowedValues, - Optional> schemaIds, - Optional isUnique, - Optional isEmbeddable, - Optional inlineEditable, - Optional createEnum, - Optional contentType, - Optional editor) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.pattern = pattern; - this.patternMessage = patternMessage; - this.folderId = folderId; - this.minLength = minLength; - this.maxLength = maxLength; - this.minCharacters = minCharacters; - this.maxCharacters = maxCharacters; - this.minWords = minWords; - this.maxWords = maxWords; - this.allowedValues = allowedValues; - this.schemaIds = schemaIds; - this.isUnique = isUnique; - this.isEmbeddable = isEmbeddable; - this.inlineEditable = inlineEditable; - this.createEnum = createEnum; - this.contentType = contentType; - this.editor = editor; - } - - /** - * @return The language specific default value for the field value. - */ - @JsonProperty("defaultValues") - public Optional> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value for the field value. - */ - @JsonProperty("defaultValue") - public Optional getDefaultValue() { - return defaultValue; - } - - /** - * @return The pattern to enforce a specific format for the field value. - */ - @JsonProperty("pattern") - public Optional getPattern() { - return pattern; - } - - /** - * @return The validation message for the pattern. - */ - @JsonProperty("patternMessage") - public Optional getPatternMessage() { - return patternMessage; - } - - /** - * @return The initial id to the folder when the control supports file uploads. - */ - @JsonProperty("folderId") - public Optional getFolderId() { - return folderId; - } - - /** - * @return The minimum allowed length for the field value. - */ - @JsonProperty("minLength") - public Optional getMinLength() { - return minLength; - } - - /** - * @return The maximum allowed length for the field value. - */ - @JsonProperty("maxLength") - public Optional getMaxLength() { - return maxLength; - } - - /** - * @return The minimum allowed of normal characters for the field value. - */ - @JsonProperty("minCharacters") - public Optional getMinCharacters() { - return minCharacters; - } - - /** - * @return The maximum allowed of normal characters for the field value. - */ - @JsonProperty("maxCharacters") - public Optional getMaxCharacters() { - return maxCharacters; - } - - /** - * @return The minimum allowed number of words for the field value. - */ - @JsonProperty("minWords") - public Optional getMinWords() { - return minWords; - } - - /** - * @return The maximum allowed number of words for the field value. - */ - @JsonProperty("maxWords") - public Optional getMaxWords() { - return maxWords; - } - - /** - * @return The allowed values for the field value. - */ - @JsonProperty("allowedValues") - public Optional> getAllowedValues() { - return allowedValues; - } +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; - /** - * @return The allowed schema ids that can be embedded. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; - } +import com.squidex.api.core.JSON; - /** - * @return Indicates if the field value must be unique. Ignored for nested fields and localized fields. - */ - @JsonProperty("isUnique") - public Optional getIsUnique() { - return isUnique; - } - - /** - * @return Indicates that other content items or references are embedded. - */ - @JsonProperty("isEmbeddable") - public Optional getIsEmbeddable() { - return isEmbeddable; +/** + * StringFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class StringFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_DEFAULT_VALUES = "defaultValues"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUES) + private Map defaultValues = new HashMap<>(); + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private String defaultValue; + public static final String SERIALIZED_NAME_PATTERN = "pattern"; + @SerializedName(SERIALIZED_NAME_PATTERN) + private String pattern; + public static final String SERIALIZED_NAME_PATTERN_MESSAGE = "patternMessage"; + @SerializedName(SERIALIZED_NAME_PATTERN_MESSAGE) + private String patternMessage; + public static final String SERIALIZED_NAME_FOLDER_ID = "folderId"; + @SerializedName(SERIALIZED_NAME_FOLDER_ID) + private String folderId; + public static final String SERIALIZED_NAME_MIN_LENGTH = "minLength"; + @SerializedName(SERIALIZED_NAME_MIN_LENGTH) + private Integer minLength; + public static final String SERIALIZED_NAME_MAX_LENGTH = "maxLength"; + @SerializedName(SERIALIZED_NAME_MAX_LENGTH) + private Integer maxLength; + public static final String SERIALIZED_NAME_MIN_CHARACTERS = "minCharacters"; + @SerializedName(SERIALIZED_NAME_MIN_CHARACTERS) + private Integer minCharacters; + public static final String SERIALIZED_NAME_MAX_CHARACTERS = "maxCharacters"; + @SerializedName(SERIALIZED_NAME_MAX_CHARACTERS) + private Integer maxCharacters; + public static final String SERIALIZED_NAME_MIN_WORDS = "minWords"; + @SerializedName(SERIALIZED_NAME_MIN_WORDS) + private Integer minWords; + public static final String SERIALIZED_NAME_MAX_WORDS = "maxWords"; + @SerializedName(SERIALIZED_NAME_MAX_WORDS) + private Integer maxWords; + public static final String SERIALIZED_NAME_CLASS_NAMES = "classNames"; + @SerializedName(SERIALIZED_NAME_CLASS_NAMES) + private List classNames; + public static final String SERIALIZED_NAME_ALLOWED_VALUES = "allowedValues"; + @SerializedName(SERIALIZED_NAME_ALLOWED_VALUES) + private List allowedValues; + public static final String SERIALIZED_NAME_SCHEMA_IDS = "schemaIds"; + @SerializedName(SERIALIZED_NAME_SCHEMA_IDS) + private List schemaIds; + public static final String SERIALIZED_NAME_IS_UNIQUE = "isUnique"; + @SerializedName(SERIALIZED_NAME_IS_UNIQUE) + private Boolean isUnique; + public static final String SERIALIZED_NAME_IS_EMBEDDABLE = "isEmbeddable"; + @SerializedName(SERIALIZED_NAME_IS_EMBEDDABLE) + private Boolean isEmbeddable; + public static final String SERIALIZED_NAME_INLINE_EDITABLE = "inlineEditable"; + @SerializedName(SERIALIZED_NAME_INLINE_EDITABLE) + private Boolean inlineEditable; + public static final String SERIALIZED_NAME_CREATE_ENUM = "createEnum"; + @SerializedName(SERIALIZED_NAME_CREATE_ENUM) + private Boolean createEnum; + public static final String SERIALIZED_NAME_CONTENT_TYPE = "contentType"; + @SerializedName(SERIALIZED_NAME_CONTENT_TYPE) + private StringContentType contentType; + public static final String SERIALIZED_NAME_EDITOR = "editor"; + @SerializedName(SERIALIZED_NAME_EDITOR) + private StringFieldEditor editor; + public StringFieldPropertiesDto() { + } + public StringFieldPropertiesDto defaultValues(Map defaultValues) { + this.defaultValues = defaultValues; + return this; + } + + public StringFieldPropertiesDto putDefaultValuesItem(String key, String defaultValuesItem) { + if (this.defaultValues == null) { + this.defaultValues = new HashMap<>(); } - - /** - * @return Indicates that the inline editor is enabled for this field. - */ - @JsonProperty("inlineEditable") - public Optional getInlineEditable() { - return inlineEditable; + this.defaultValues.put(key, defaultValuesItem); + return this; + } + + /** + * Get defaultValues + * @return defaultValues + */ + @javax.annotation.Nullable + public Map getDefaultValues() { + return defaultValues; + } + + public void setDefaultValues(Map defaultValues) { + this.defaultValues = defaultValues; + } + public StringFieldPropertiesDto defaultValue(String defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + /** + * The default value for the field value. + * @return defaultValue + */ + @javax.annotation.Nullable + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + public StringFieldPropertiesDto pattern(String pattern) { + this.pattern = pattern; + return this; + } + + /** + * The pattern to enforce a specific format for the field value. + * @return pattern + */ + @javax.annotation.Nullable + public String getPattern() { + return pattern; + } + + public void setPattern(String pattern) { + this.pattern = pattern; + } + public StringFieldPropertiesDto patternMessage(String patternMessage) { + this.patternMessage = patternMessage; + return this; + } + + /** + * The validation message for the pattern. + * @return patternMessage + */ + @javax.annotation.Nullable + public String getPatternMessage() { + return patternMessage; + } + + public void setPatternMessage(String patternMessage) { + this.patternMessage = patternMessage; + } + public StringFieldPropertiesDto folderId(String folderId) { + this.folderId = folderId; + return this; + } + + /** + * The initial id to the folder when the control supports file uploads. + * @return folderId + */ + @javax.annotation.Nullable + public String getFolderId() { + return folderId; + } + + public void setFolderId(String folderId) { + this.folderId = folderId; + } + public StringFieldPropertiesDto minLength(Integer minLength) { + this.minLength = minLength; + return this; + } + + /** + * The minimum allowed length for the field value. + * @return minLength + */ + @javax.annotation.Nullable + public Integer getMinLength() { + return minLength; + } + + public void setMinLength(Integer minLength) { + this.minLength = minLength; + } + public StringFieldPropertiesDto maxLength(Integer maxLength) { + this.maxLength = maxLength; + return this; + } + + /** + * The maximum allowed length for the field value. + * @return maxLength + */ + @javax.annotation.Nullable + public Integer getMaxLength() { + return maxLength; + } + + public void setMaxLength(Integer maxLength) { + this.maxLength = maxLength; + } + public StringFieldPropertiesDto minCharacters(Integer minCharacters) { + this.minCharacters = minCharacters; + return this; + } + + /** + * The minimum allowed of normal characters for the field value. + * @return minCharacters + */ + @javax.annotation.Nullable + public Integer getMinCharacters() { + return minCharacters; + } + + public void setMinCharacters(Integer minCharacters) { + this.minCharacters = minCharacters; + } + public StringFieldPropertiesDto maxCharacters(Integer maxCharacters) { + this.maxCharacters = maxCharacters; + return this; + } + + /** + * The maximum allowed of normal characters for the field value. + * @return maxCharacters + */ + @javax.annotation.Nullable + public Integer getMaxCharacters() { + return maxCharacters; + } + + public void setMaxCharacters(Integer maxCharacters) { + this.maxCharacters = maxCharacters; + } + public StringFieldPropertiesDto minWords(Integer minWords) { + this.minWords = minWords; + return this; + } + + /** + * The minimum allowed number of words for the field value. + * @return minWords + */ + @javax.annotation.Nullable + public Integer getMinWords() { + return minWords; + } + + public void setMinWords(Integer minWords) { + this.minWords = minWords; + } + public StringFieldPropertiesDto maxWords(Integer maxWords) { + this.maxWords = maxWords; + return this; + } + + /** + * The maximum allowed number of words for the field value. + * @return maxWords + */ + @javax.annotation.Nullable + public Integer getMaxWords() { + return maxWords; + } + + public void setMaxWords(Integer maxWords) { + this.maxWords = maxWords; + } + public StringFieldPropertiesDto classNames(List classNames) { + this.classNames = classNames; + return this; + } + + public StringFieldPropertiesDto addClassNamesItem(String classNamesItem) { + if (this.classNames == null) { + this.classNames = new ArrayList<>(); } - - /** - * @return Indicates whether GraphQL Enum should be created. - */ - @JsonProperty("createEnum") - public Optional getCreateEnum() { - return createEnum; + this.classNames.add(classNamesItem); + return this; + } + + /** + * The class names for the editor. + * @return classNames + */ + @javax.annotation.Nullable + public List getClassNames() { + return classNames; + } + + public void setClassNames(List classNames) { + this.classNames = classNames; + } + public StringFieldPropertiesDto allowedValues(List allowedValues) { + this.allowedValues = allowedValues; + return this; + } + + public StringFieldPropertiesDto addAllowedValuesItem(String allowedValuesItem) { + if (this.allowedValues == null) { + this.allowedValues = new ArrayList<>(); } - - /** - * @return How the string content should be interpreted. - */ - @JsonProperty("contentType") - public Optional getContentType() { - return contentType; + this.allowedValues.add(allowedValuesItem); + return this; + } + + /** + * The allowed values for the field value. + * @return allowedValues + */ + @javax.annotation.Nullable + public List getAllowedValues() { + return allowedValues; + } + + public void setAllowedValues(List allowedValues) { + this.allowedValues = allowedValues; + } + public StringFieldPropertiesDto schemaIds(List schemaIds) { + this.schemaIds = schemaIds; + return this; + } + + public StringFieldPropertiesDto addSchemaIdsItem(String schemaIdsItem) { + if (this.schemaIds == null) { + this.schemaIds = new ArrayList<>(); } - - /** - * @return The editor that is used to manage this field. - */ - @JsonProperty("editor") - public Optional getEditor() { - return editor; + this.schemaIds.add(schemaIdsItem); + return this; + } + + /** + * The allowed schema ids that can be embedded. + * @return schemaIds + */ + @javax.annotation.Nullable + public List getSchemaIds() { + return schemaIds; + } + + public void setSchemaIds(List schemaIds) { + this.schemaIds = schemaIds; + } + public StringFieldPropertiesDto isUnique(Boolean isUnique) { + this.isUnique = isUnique; + return this; + } + + /** + * Indicates if the field value must be unique. Ignored for nested fields and localized fields. + * @return isUnique + */ + @javax.annotation.Nullable + public Boolean getIsUnique() { + return isUnique; + } + + public void setIsUnique(Boolean isUnique) { + this.isUnique = isUnique; + } + public StringFieldPropertiesDto isEmbeddable(Boolean isEmbeddable) { + this.isEmbeddable = isEmbeddable; + return this; + } + + /** + * Indicates that other content items or references are embedded. + * @return isEmbeddable + */ + @javax.annotation.Nullable + public Boolean getIsEmbeddable() { + return isEmbeddable; + } + + public void setIsEmbeddable(Boolean isEmbeddable) { + this.isEmbeddable = isEmbeddable; + } + public StringFieldPropertiesDto inlineEditable(Boolean inlineEditable) { + this.inlineEditable = inlineEditable; + return this; + } + + /** + * Indicates that the inline editor is enabled for this field. + * @return inlineEditable + */ + @javax.annotation.Nullable + public Boolean getInlineEditable() { + return inlineEditable; + } + + public void setInlineEditable(Boolean inlineEditable) { + this.inlineEditable = inlineEditable; + } + public StringFieldPropertiesDto createEnum(Boolean createEnum) { + this.createEnum = createEnum; + return this; + } + + /** + * Indicates whether GraphQL Enum should be created. + * @return createEnum + */ + @javax.annotation.Nullable + public Boolean getCreateEnum() { + return createEnum; + } + + public void setCreateEnum(Boolean createEnum) { + this.createEnum = createEnum; + } + public StringFieldPropertiesDto contentType(StringContentType contentType) { + this.contentType = contentType; + return this; + } + + /** + * Get contentType + * @return contentType + */ + @javax.annotation.Nullable + public StringContentType getContentType() { + return contentType; + } + + public void setContentType(StringContentType contentType) { + this.contentType = contentType; + } + public StringFieldPropertiesDto editor(StringFieldEditor editor) { + this.editor = editor; + return this; + } + + /** + * Get editor + * @return editor + */ + @javax.annotation.Nullable + public StringFieldEditor getEditor() { + return editor; + } + + public void setEditor(StringFieldEditor editor) { + this.editor = editor; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof StringFieldPropertiesDto && equalTo((StringFieldPropertiesDto) other); + if (o == null || getClass() != o.getClass()) { + return false; } - - private boolean equalTo(StringFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && pattern.equals(other.pattern) - && patternMessage.equals(other.patternMessage) - && folderId.equals(other.folderId) - && minLength.equals(other.minLength) - && maxLength.equals(other.maxLength) - && minCharacters.equals(other.minCharacters) - && maxCharacters.equals(other.maxCharacters) - && minWords.equals(other.minWords) - && maxWords.equals(other.maxWords) - && allowedValues.equals(other.allowedValues) - && schemaIds.equals(other.schemaIds) - && isUnique.equals(other.isUnique) - && isEmbeddable.equals(other.isEmbeddable) - && inlineEditable.equals(other.inlineEditable) - && createEnum.equals(other.createEnum) - && contentType.equals(other.contentType) - && editor.equals(other.editor); + StringFieldPropertiesDto stringFieldPropertiesDto = (StringFieldPropertiesDto) o; + return Objects.equals(this.defaultValues, stringFieldPropertiesDto.defaultValues) && + Objects.equals(this.defaultValue, stringFieldPropertiesDto.defaultValue) && + Objects.equals(this.pattern, stringFieldPropertiesDto.pattern) && + Objects.equals(this.patternMessage, stringFieldPropertiesDto.patternMessage) && + Objects.equals(this.folderId, stringFieldPropertiesDto.folderId) && + Objects.equals(this.minLength, stringFieldPropertiesDto.minLength) && + Objects.equals(this.maxLength, stringFieldPropertiesDto.maxLength) && + Objects.equals(this.minCharacters, stringFieldPropertiesDto.minCharacters) && + Objects.equals(this.maxCharacters, stringFieldPropertiesDto.maxCharacters) && + Objects.equals(this.minWords, stringFieldPropertiesDto.minWords) && + Objects.equals(this.maxWords, stringFieldPropertiesDto.maxWords) && + Objects.equals(this.classNames, stringFieldPropertiesDto.classNames) && + Objects.equals(this.allowedValues, stringFieldPropertiesDto.allowedValues) && + Objects.equals(this.schemaIds, stringFieldPropertiesDto.schemaIds) && + Objects.equals(this.isUnique, stringFieldPropertiesDto.isUnique) && + Objects.equals(this.isEmbeddable, stringFieldPropertiesDto.isEmbeddable) && + Objects.equals(this.inlineEditable, stringFieldPropertiesDto.inlineEditable) && + Objects.equals(this.createEnum, stringFieldPropertiesDto.createEnum) && + Objects.equals(this.contentType, stringFieldPropertiesDto.contentType) && + Objects.equals(this.editor, stringFieldPropertiesDto.editor) && + super.equals(o); + } + + 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(defaultValues, defaultValue, pattern, patternMessage, folderId, minLength, maxLength, minCharacters, maxCharacters, minWords, maxWords, classNames, allowedValues, schemaIds, isUnique, isEmbeddable, inlineEditable, createEnum, contentType, editor, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash( - this.defaultValues, - this.defaultValue, - this.pattern, - this.patternMessage, - this.folderId, - this.minLength, - this.maxLength, - this.minCharacters, - this.maxCharacters, - this.minWords, - this.maxWords, - this.allowedValues, - this.schemaIds, - this.isUnique, - this.isEmbeddable, - this.inlineEditable, - this.createEnum, - this.contentType, - this.editor); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" defaultValues: ").append(toIndentedString(defaultValues)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" pattern: ").append(toIndentedString(pattern)).append("\n"); + sb.append(" patternMessage: ").append(toIndentedString(patternMessage)).append("\n"); + sb.append(" folderId: ").append(toIndentedString(folderId)).append("\n"); + sb.append(" minLength: ").append(toIndentedString(minLength)).append("\n"); + sb.append(" maxLength: ").append(toIndentedString(maxLength)).append("\n"); + sb.append(" minCharacters: ").append(toIndentedString(minCharacters)).append("\n"); + sb.append(" maxCharacters: ").append(toIndentedString(maxCharacters)).append("\n"); + sb.append(" minWords: ").append(toIndentedString(minWords)).append("\n"); + sb.append(" maxWords: ").append(toIndentedString(maxWords)).append("\n"); + sb.append(" classNames: ").append(toIndentedString(classNames)).append("\n"); + sb.append(" allowedValues: ").append(toIndentedString(allowedValues)).append("\n"); + sb.append(" schemaIds: ").append(toIndentedString(schemaIds)).append("\n"); + sb.append(" isUnique: ").append(toIndentedString(isUnique)).append("\n"); + sb.append(" isEmbeddable: ").append(toIndentedString(isEmbeddable)).append("\n"); + sb.append(" inlineEditable: ").append(toIndentedString(inlineEditable)).append("\n"); + sb.append(" createEnum: ").append(toIndentedString(createEnum)).append("\n"); + sb.append(" contentType: ").append(toIndentedString(contentType)).append("\n"); + sb.append(" editor: ").append(toIndentedString(editor)).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("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("defaultValues"); + openapiFields.add("defaultValue"); + openapiFields.add("pattern"); + openapiFields.add("patternMessage"); + openapiFields.add("folderId"); + openapiFields.add("minLength"); + openapiFields.add("maxLength"); + openapiFields.add("minCharacters"); + openapiFields.add("maxCharacters"); + openapiFields.add("minWords"); + openapiFields.add("maxWords"); + openapiFields.add("classNames"); + openapiFields.add("allowedValues"); + openapiFields.add("schemaIds"); + openapiFields.add("isUnique"); + openapiFields.add("isEmbeddable"); + openapiFields.add("inlineEditable"); + openapiFields.add("createEnum"); + openapiFields.add("contentType"); + openapiFields.add("editor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to StringFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!StringFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in StringFieldPropertiesDto is not found in the empty JSON string", StringFieldPropertiesDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!StringFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `StringFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : StringFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.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 String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> defaultValues = Optional.empty(); - - private Optional defaultValue = Optional.empty(); - - private Optional pattern = Optional.empty(); - - private Optional patternMessage = Optional.empty(); - - private Optional folderId = Optional.empty(); - - private Optional minLength = Optional.empty(); - - private Optional maxLength = Optional.empty(); - - private Optional minCharacters = Optional.empty(); - - private Optional maxCharacters = Optional.empty(); - - private Optional minWords = Optional.empty(); - - private Optional maxWords = Optional.empty(); - - private Optional> allowedValues = Optional.empty(); - - private Optional> schemaIds = Optional.empty(); - - private Optional isUnique = Optional.empty(); - - private Optional isEmbeddable = Optional.empty(); - - private Optional inlineEditable = Optional.empty(); - - private Optional createEnum = Optional.empty(); - - private Optional contentType = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Builder() {} - - public Builder from(StringFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - pattern(other.getPattern()); - patternMessage(other.getPatternMessage()); - folderId(other.getFolderId()); - minLength(other.getMinLength()); - maxLength(other.getMaxLength()); - minCharacters(other.getMinCharacters()); - maxCharacters(other.getMaxCharacters()); - minWords(other.getMinWords()); - maxWords(other.getMaxWords()); - allowedValues(other.getAllowedValues()); - schemaIds(other.getSchemaIds()); - isUnique(other.getIsUnique()); - isEmbeddable(other.getIsEmbeddable()); - inlineEditable(other.getInlineEditable()); - createEnum(other.getCreateEnum()); - contentType(other.getContentType()); - editor(other.getEditor()); - return this; - } - - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional> defaultValues) { - this.defaultValues = defaultValues; - return this; - } - - public Builder defaultValues(Map defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; - } - - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(String defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "pattern", nulls = Nulls.SKIP) - public Builder pattern(Optional pattern) { - this.pattern = pattern; - return this; - } - - public Builder pattern(String pattern) { - this.pattern = Optional.of(pattern); - return this; - } - - @JsonSetter(value = "patternMessage", nulls = Nulls.SKIP) - public Builder patternMessage(Optional patternMessage) { - this.patternMessage = patternMessage; - return this; - } - - public Builder patternMessage(String patternMessage) { - this.patternMessage = Optional.of(patternMessage); - return this; - } - - @JsonSetter(value = "folderId", nulls = Nulls.SKIP) - public Builder folderId(Optional folderId) { - this.folderId = folderId; - return this; - } - - public Builder folderId(String folderId) { - this.folderId = Optional.of(folderId); - return this; - } - - @JsonSetter(value = "minLength", nulls = Nulls.SKIP) - public Builder minLength(Optional minLength) { - this.minLength = minLength; - return this; - } - - public Builder minLength(Integer minLength) { - this.minLength = Optional.of(minLength); - return this; - } - - @JsonSetter(value = "maxLength", nulls = Nulls.SKIP) - public Builder maxLength(Optional maxLength) { - this.maxLength = maxLength; - return this; - } - - public Builder maxLength(Integer maxLength) { - this.maxLength = Optional.of(maxLength); - return this; - } - - @JsonSetter(value = "minCharacters", nulls = Nulls.SKIP) - public Builder minCharacters(Optional minCharacters) { - this.minCharacters = minCharacters; - return this; - } - - public Builder minCharacters(Integer minCharacters) { - this.minCharacters = Optional.of(minCharacters); - return this; - } - - @JsonSetter(value = "maxCharacters", nulls = Nulls.SKIP) - public Builder maxCharacters(Optional maxCharacters) { - this.maxCharacters = maxCharacters; - return this; - } - - public Builder maxCharacters(Integer maxCharacters) { - this.maxCharacters = Optional.of(maxCharacters); - return this; - } - - @JsonSetter(value = "minWords", nulls = Nulls.SKIP) - public Builder minWords(Optional minWords) { - this.minWords = minWords; - return this; - } - - public Builder minWords(Integer minWords) { - this.minWords = Optional.of(minWords); - return this; - } - - @JsonSetter(value = "maxWords", nulls = Nulls.SKIP) - public Builder maxWords(Optional maxWords) { - this.maxWords = maxWords; - return this; - } - - public Builder maxWords(Integer maxWords) { - this.maxWords = Optional.of(maxWords); - return this; - } - - @JsonSetter(value = "allowedValues", nulls = Nulls.SKIP) - public Builder allowedValues(Optional> allowedValues) { - this.allowedValues = allowedValues; - return this; - } - - public Builder allowedValues(List allowedValues) { - this.allowedValues = Optional.of(allowedValues); - return this; - } - - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public Builder schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - public Builder schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - @JsonSetter(value = "isUnique", nulls = Nulls.SKIP) - public Builder isUnique(Optional isUnique) { - this.isUnique = isUnique; - return this; - } - - public Builder isUnique(Boolean isUnique) { - this.isUnique = Optional.of(isUnique); - return this; - } - - @JsonSetter(value = "isEmbeddable", nulls = Nulls.SKIP) - public Builder isEmbeddable(Optional isEmbeddable) { - this.isEmbeddable = isEmbeddable; - return this; - } - - public Builder isEmbeddable(Boolean isEmbeddable) { - this.isEmbeddable = Optional.of(isEmbeddable); - return this; - } - - @JsonSetter(value = "inlineEditable", nulls = Nulls.SKIP) - public Builder inlineEditable(Optional inlineEditable) { - this.inlineEditable = inlineEditable; - return this; - } - - public Builder inlineEditable(Boolean inlineEditable) { - this.inlineEditable = Optional.of(inlineEditable); - return this; - } - - @JsonSetter(value = "createEnum", nulls = Nulls.SKIP) - public Builder createEnum(Optional createEnum) { - this.createEnum = createEnum; - return this; - } - - public Builder createEnum(Boolean createEnum) { - this.createEnum = Optional.of(createEnum); - return this; - } - - @JsonSetter(value = "contentType", nulls = Nulls.SKIP) - public Builder contentType(Optional contentType) { - this.contentType = contentType; - return this; - } - - public Builder contentType(StringContentType contentType) { - this.contentType = Optional.of(contentType); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(StringFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - public StringFieldPropertiesDto build() { - return new StringFieldPropertiesDto( - defaultValues, - defaultValue, - pattern, - patternMessage, - folderId, - minLength, - maxLength, - minCharacters, - maxCharacters, - minWords, - maxWords, - allowedValues, - schemaIds, - isUnique, - isEmbeddable, - inlineEditable, - createEnum, - contentType, - editor); - } + public TypeAdapter create(Gson gson, TypeToken type) { + if (!StringFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'StringFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(StringFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, StringFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public StringFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of StringFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of StringFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to StringFieldPropertiesDto + */ + public static StringFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, StringFieldPropertiesDto.class); + } + + /** + * Convert an instance of StringFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/SynchronizeSchemaDto.java b/src/main/java/com/squidex/api/types/SynchronizeSchemaDto.java new file mode 100644 index 0000000..aaac0cb --- /dev/null +++ b/src/main/java/com/squidex/api/types/SynchronizeSchemaDto.java @@ -0,0 +1,535 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.FieldRuleDto; +import com.squidex.api.types.SchemaPropertiesDto; +import com.squidex.api.types.SchemaScriptsDto; +import com.squidex.api.types.UpsertSchemaFieldDto; +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 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.squidex.api.core.JSON; + +/** + * SynchronizeSchemaDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class SynchronizeSchemaDto { + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private SchemaPropertiesDto properties; + public static final String SERIALIZED_NAME_SCRIPTS = "scripts"; + @SerializedName(SERIALIZED_NAME_SCRIPTS) + private SchemaScriptsDto scripts; + public static final String SERIALIZED_NAME_FIELDS_IN_REFERENCES = "fieldsInReferences"; + @SerializedName(SERIALIZED_NAME_FIELDS_IN_REFERENCES) + private List fieldsInReferences; + public static final String SERIALIZED_NAME_FIELDS_IN_LISTS = "fieldsInLists"; + @SerializedName(SERIALIZED_NAME_FIELDS_IN_LISTS) + private List fieldsInLists; + public static final String SERIALIZED_NAME_FIELDS = "fields"; + @SerializedName(SERIALIZED_NAME_FIELDS) + private List fields; + public static final String SERIALIZED_NAME_PREVIEW_URLS = "previewUrls"; + @SerializedName(SERIALIZED_NAME_PREVIEW_URLS) + private Map previewUrls; + public static final String SERIALIZED_NAME_FIELD_RULES = "fieldRules"; + @SerializedName(SERIALIZED_NAME_FIELD_RULES) + private List fieldRules; + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + private String category; + public static final String SERIALIZED_NAME_IS_PUBLISHED = "isPublished"; + @SerializedName(SERIALIZED_NAME_IS_PUBLISHED) + private Boolean isPublished; + public static final String SERIALIZED_NAME_NO_FIELD_DELETION = "noFieldDeletion"; + @SerializedName(SERIALIZED_NAME_NO_FIELD_DELETION) + private Boolean noFieldDeletion; + public static final String SERIALIZED_NAME_NO_FIELD_RECREATION = "noFieldRecreation"; + @SerializedName(SERIALIZED_NAME_NO_FIELD_RECREATION) + private Boolean noFieldRecreation; + public SynchronizeSchemaDto() { + } + public SynchronizeSchemaDto properties(SchemaPropertiesDto properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nullable + public SchemaPropertiesDto getProperties() { + return properties; + } + + public void setProperties(SchemaPropertiesDto properties) { + this.properties = properties; + } + public SynchronizeSchemaDto scripts(SchemaScriptsDto scripts) { + this.scripts = scripts; + return this; + } + + /** + * Get scripts + * @return scripts + */ + @javax.annotation.Nullable + public SchemaScriptsDto getScripts() { + return scripts; + } + + public void setScripts(SchemaScriptsDto scripts) { + this.scripts = scripts; + } + public SynchronizeSchemaDto fieldsInReferences(List fieldsInReferences) { + this.fieldsInReferences = fieldsInReferences; + return this; + } + + public SynchronizeSchemaDto addFieldsInReferencesItem(String fieldsInReferencesItem) { + if (this.fieldsInReferences == null) { + this.fieldsInReferences = new ArrayList<>(); + } + this.fieldsInReferences.add(fieldsInReferencesItem); + return this; + } + + /** + * The names of the fields that should be used in references. + * @return fieldsInReferences + */ + @javax.annotation.Nullable + public List getFieldsInReferences() { + return fieldsInReferences; + } + + public void setFieldsInReferences(List fieldsInReferences) { + this.fieldsInReferences = fieldsInReferences; + } + public SynchronizeSchemaDto fieldsInLists(List fieldsInLists) { + this.fieldsInLists = fieldsInLists; + return this; + } + + public SynchronizeSchemaDto addFieldsInListsItem(String fieldsInListsItem) { + if (this.fieldsInLists == null) { + this.fieldsInLists = new ArrayList<>(); + } + this.fieldsInLists.add(fieldsInListsItem); + return this; + } + + /** + * The names of the fields that should be shown in lists, including meta fields. + * @return fieldsInLists + */ + @javax.annotation.Nullable + public List getFieldsInLists() { + return fieldsInLists; + } + + public void setFieldsInLists(List fieldsInLists) { + this.fieldsInLists = fieldsInLists; + } + public SynchronizeSchemaDto fields(List fields) { + this.fields = fields; + return this; + } + + public SynchronizeSchemaDto addFieldsItem(UpsertSchemaFieldDto fieldsItem) { + if (this.fields == null) { + this.fields = new ArrayList<>(); + } + this.fields.add(fieldsItem); + return this; + } + + /** + * Optional fields. + * @return fields + */ + @javax.annotation.Nullable + public List getFields() { + return fields; + } + + public void setFields(List fields) { + this.fields = fields; + } + public SynchronizeSchemaDto previewUrls(Map previewUrls) { + this.previewUrls = previewUrls; + return this; + } + + public SynchronizeSchemaDto putPreviewUrlsItem(String key, String previewUrlsItem) { + if (this.previewUrls == null) { + this.previewUrls = new HashMap<>(); + } + this.previewUrls.put(key, previewUrlsItem); + return this; + } + + /** + * The optional preview urls. + * @return previewUrls + */ + @javax.annotation.Nullable + public Map getPreviewUrls() { + return previewUrls; + } + + public void setPreviewUrls(Map previewUrls) { + this.previewUrls = previewUrls; + } + public SynchronizeSchemaDto fieldRules(List fieldRules) { + this.fieldRules = fieldRules; + return this; + } + + public SynchronizeSchemaDto addFieldRulesItem(FieldRuleDto fieldRulesItem) { + if (this.fieldRules == null) { + this.fieldRules = new ArrayList<>(); + } + this.fieldRules.add(fieldRulesItem); + return this; + } + + /** + * The optional field Rules. + * @return fieldRules + */ + @javax.annotation.Nullable + public List getFieldRules() { + return fieldRules; + } + + public void setFieldRules(List fieldRules) { + this.fieldRules = fieldRules; + } + public SynchronizeSchemaDto category(String category) { + this.category = category; + return this; + } + + /** + * The category. + * @return category + */ + @javax.annotation.Nullable + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + public SynchronizeSchemaDto isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Set it to true to autopublish the schema. + * @return isPublished + */ + @javax.annotation.Nullable + public Boolean getIsPublished() { + return isPublished; + } + + public void setIsPublished(Boolean isPublished) { + this.isPublished = isPublished; + } + public SynchronizeSchemaDto noFieldDeletion(Boolean noFieldDeletion) { + this.noFieldDeletion = noFieldDeletion; + return this; + } + + /** + * True, when fields should not be deleted. + * @return noFieldDeletion + */ + @javax.annotation.Nullable + public Boolean getNoFieldDeletion() { + return noFieldDeletion; + } + + public void setNoFieldDeletion(Boolean noFieldDeletion) { + this.noFieldDeletion = noFieldDeletion; + } + public SynchronizeSchemaDto noFieldRecreation(Boolean noFieldRecreation) { + this.noFieldRecreation = noFieldRecreation; + return this; + } + + /** + * True, when fields with different types should not be recreated. + * @return noFieldRecreation + */ + @javax.annotation.Nullable + public Boolean getNoFieldRecreation() { + return noFieldRecreation; + } + + public void setNoFieldRecreation(Boolean noFieldRecreation) { + this.noFieldRecreation = noFieldRecreation; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SynchronizeSchemaDto synchronizeSchemaDto = (SynchronizeSchemaDto) o; + return Objects.equals(this.properties, synchronizeSchemaDto.properties) && + Objects.equals(this.scripts, synchronizeSchemaDto.scripts) && + Objects.equals(this.fieldsInReferences, synchronizeSchemaDto.fieldsInReferences) && + Objects.equals(this.fieldsInLists, synchronizeSchemaDto.fieldsInLists) && + Objects.equals(this.fields, synchronizeSchemaDto.fields) && + Objects.equals(this.previewUrls, synchronizeSchemaDto.previewUrls) && + Objects.equals(this.fieldRules, synchronizeSchemaDto.fieldRules) && + Objects.equals(this.category, synchronizeSchemaDto.category) && + Objects.equals(this.isPublished, synchronizeSchemaDto.isPublished) && + Objects.equals(this.noFieldDeletion, synchronizeSchemaDto.noFieldDeletion) && + Objects.equals(this.noFieldRecreation, synchronizeSchemaDto.noFieldRecreation); + } + + 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(properties, scripts, fieldsInReferences, fieldsInLists, fields, previewUrls, fieldRules, category, isPublished, noFieldDeletion, noFieldRecreation); + } + + 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 SynchronizeSchemaDto {\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" scripts: ").append(toIndentedString(scripts)).append("\n"); + sb.append(" fieldsInReferences: ").append(toIndentedString(fieldsInReferences)).append("\n"); + sb.append(" fieldsInLists: ").append(toIndentedString(fieldsInLists)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" previewUrls: ").append(toIndentedString(previewUrls)).append("\n"); + sb.append(" fieldRules: ").append(toIndentedString(fieldRules)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).append("\n"); + sb.append(" noFieldDeletion: ").append(toIndentedString(noFieldDeletion)).append("\n"); + sb.append(" noFieldRecreation: ").append(toIndentedString(noFieldRecreation)).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("properties"); + openapiFields.add("scripts"); + openapiFields.add("fieldsInReferences"); + openapiFields.add("fieldsInLists"); + openapiFields.add("fields"); + openapiFields.add("previewUrls"); + openapiFields.add("fieldRules"); + openapiFields.add("category"); + openapiFields.add("isPublished"); + openapiFields.add("noFieldDeletion"); + openapiFields.add("noFieldRecreation"); + + // 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 SynchronizeSchemaDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!SynchronizeSchemaDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in SynchronizeSchemaDto is not found in the empty JSON string", SynchronizeSchemaDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!SynchronizeSchemaDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `SynchronizeSchemaDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `properties` + if (jsonObj.get("properties") != null && !jsonObj.get("properties").isJsonNull()) { + SchemaPropertiesDto.validateJsonElement(jsonObj.get("properties")); + } + // validate the optional field `scripts` + if (jsonObj.get("scripts") != null && !jsonObj.get("scripts").isJsonNull()) { + SchemaScriptsDto.validateJsonElement(jsonObj.get("scripts")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("fieldsInReferences") != null && !jsonObj.get("fieldsInReferences").isJsonNull() && !jsonObj.get("fieldsInReferences").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldsInReferences` to be an array in the JSON string but got `%s`", jsonObj.get("fieldsInReferences").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("fieldsInLists") != null && !jsonObj.get("fieldsInLists").isJsonNull() && !jsonObj.get("fieldsInLists").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldsInLists` to be an array in the JSON string but got `%s`", jsonObj.get("fieldsInLists").toString())); + } + if (jsonObj.get("fields") != null && !jsonObj.get("fields").isJsonNull()) { + JsonArray jsonArrayfields = jsonObj.getAsJsonArray("fields"); + if (jsonArrayfields != null) { + // ensure the json data is an array + if (!jsonObj.get("fields").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fields` to be an array in the JSON string but got `%s`", jsonObj.get("fields").toString())); + } + + // validate the optional field `fields` (array) + for (int i = 0; i < jsonArrayfields.size(); i++) { + UpsertSchemaFieldDto.validateJsonElement(jsonArrayfields.get(i)); + }; + } + } + if (jsonObj.get("fieldRules") != null && !jsonObj.get("fieldRules").isJsonNull()) { + JsonArray jsonArrayfieldRules = jsonObj.getAsJsonArray("fieldRules"); + if (jsonArrayfieldRules != null) { + // ensure the json data is an array + if (!jsonObj.get("fieldRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldRules` to be an array in the JSON string but got `%s`", jsonObj.get("fieldRules").toString())); + } + + // validate the optional field `fieldRules` (array) + for (int i = 0; i < jsonArrayfieldRules.size(); i++) { + FieldRuleDto.validateJsonElement(jsonArrayfieldRules.get(i)); + }; + } + } + if ((jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) && !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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!SynchronizeSchemaDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'SynchronizeSchemaDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(SynchronizeSchemaDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, SynchronizeSchemaDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public SynchronizeSchemaDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of SynchronizeSchemaDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of SynchronizeSchemaDto + * @throws IOException if the JSON string is invalid with respect to SynchronizeSchemaDto + */ + public static SynchronizeSchemaDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, SynchronizeSchemaDto.class); + } + + /** + * Convert an instance of SynchronizeSchemaDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/TagsFieldEditor.java b/src/main/java/com/squidex/api/types/TagsFieldEditor.java index 5c3d341..2dce4e9 100644 --- a/src/main/java/com/squidex/api/types/TagsFieldEditor.java +++ b/src/main/java/com/squidex/api/types/TagsFieldEditor.java @@ -1,26 +1,80 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(TagsFieldEditor.Adapter.class) public enum TagsFieldEditor { - TAGS("Tags"), + + TAGS("Tags"), + + CHECKBOXES("Checkboxes"), + + DROPDOWN("Dropdown"); - CHECKBOXES("Checkboxes"), + private String value; - DROPDOWN("Dropdown"); + TagsFieldEditor(String value) { + this.value = value; + } - private final String value; + public String getValue() { + return value; + } - TagsFieldEditor(String value) { - this.value = value; + @Override + public String toString() { + return String.valueOf(value); + } + + public static TagsFieldEditor fromValue(String value) { + for (TagsFieldEditor b : TagsFieldEditor.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 TagsFieldEditor enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public TagsFieldEditor read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TagsFieldEditor.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TagsFieldEditor.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java index ab43096..44e5660 100644 --- a/src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java @@ -1,256 +1,396 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.FieldPropertiesDto; +import com.squidex.api.types.TagsFieldEditor; +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.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TagsFieldPropertiesDto.Builder.class) -public final class TagsFieldPropertiesDto { - private final Optional>> defaultValues; - - private final Optional> defaultValue; - - private final Optional minItems; - - private final Optional maxItems; - - private final Optional> allowedValues; - - private final Optional createEnum; - - private final Optional editor; - - private TagsFieldPropertiesDto( - Optional>> defaultValues, - Optional> defaultValue, - Optional minItems, - Optional maxItems, - Optional> allowedValues, - Optional createEnum, - Optional editor) { - this.defaultValues = defaultValues; - this.defaultValue = defaultValue; - this.minItems = minItems; - this.maxItems = maxItems; - this.allowedValues = allowedValues; - this.createEnum = createEnum; - this.editor = editor; - } - - /** - * @return The language specific default value for the field value. - */ - @JsonProperty("defaultValues") - public Optional>> getDefaultValues() { - return defaultValues; - } - - /** - * @return The default value. - */ - @JsonProperty("defaultValue") - public Optional> getDefaultValue() { - return defaultValue; - } - - /** - * @return The minimum allowed items for the field value. - */ - @JsonProperty("minItems") - public Optional getMinItems() { - return minItems; - } - - /** - * @return The maximum allowed items for the field value. - */ - @JsonProperty("maxItems") - public Optional getMaxItems() { - return maxItems; - } +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; - /** - * @return The allowed values for the field value. - */ - @JsonProperty("allowedValues") - public Optional> getAllowedValues() { - return allowedValues; - } +import com.squidex.api.core.JSON; - /** - * @return Indicates whether GraphQL Enum should be created. - */ - @JsonProperty("createEnum") - public Optional getCreateEnum() { - return createEnum; +/** + * TagsFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class TagsFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_DEFAULT_VALUES = "defaultValues"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUES) + private Map> defaultValues = new HashMap<>(); + public static final String SERIALIZED_NAME_DEFAULT_VALUE = "defaultValue"; + @SerializedName(SERIALIZED_NAME_DEFAULT_VALUE) + private List defaultValue; + public static final String SERIALIZED_NAME_MIN_ITEMS = "minItems"; + @SerializedName(SERIALIZED_NAME_MIN_ITEMS) + private Integer minItems; + public static final String SERIALIZED_NAME_MAX_ITEMS = "maxItems"; + @SerializedName(SERIALIZED_NAME_MAX_ITEMS) + private Integer maxItems; + public static final String SERIALIZED_NAME_ALLOWED_VALUES = "allowedValues"; + @SerializedName(SERIALIZED_NAME_ALLOWED_VALUES) + private List allowedValues; + public static final String SERIALIZED_NAME_CREATE_ENUM = "createEnum"; + @SerializedName(SERIALIZED_NAME_CREATE_ENUM) + private Boolean createEnum; + public static final String SERIALIZED_NAME_EDITOR = "editor"; + @SerializedName(SERIALIZED_NAME_EDITOR) + private TagsFieldEditor editor; + public TagsFieldPropertiesDto() { + } + public TagsFieldPropertiesDto defaultValues(Map> defaultValues) { + this.defaultValues = defaultValues; + return this; + } + + public TagsFieldPropertiesDto putDefaultValuesItem(String key, List defaultValuesItem) { + if (this.defaultValues == null) { + this.defaultValues = new HashMap<>(); } - - /** - * @return The editor that is used to manage this field. - */ - @JsonProperty("editor") - public Optional getEditor() { - return editor; + this.defaultValues.put(key, defaultValuesItem); + return this; + } + + /** + * Get defaultValues + * @return defaultValues + */ + @javax.annotation.Nullable + public Map> getDefaultValues() { + return defaultValues; + } + + public void setDefaultValues(Map> defaultValues) { + this.defaultValues = defaultValues; + } + public TagsFieldPropertiesDto defaultValue(List defaultValue) { + this.defaultValue = defaultValue; + return this; + } + + public TagsFieldPropertiesDto addDefaultValueItem(String defaultValueItem) { + if (this.defaultValue == null) { + this.defaultValue = new ArrayList<>(); } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TagsFieldPropertiesDto && equalTo((TagsFieldPropertiesDto) other); + this.defaultValue.add(defaultValueItem); + return this; + } + + /** + * The default value. + * @return defaultValue + */ + @javax.annotation.Nullable + public List getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(List defaultValue) { + this.defaultValue = defaultValue; + } + public TagsFieldPropertiesDto minItems(Integer minItems) { + this.minItems = minItems; + return this; + } + + /** + * The minimum allowed items for the field value. + * @return minItems + */ + @javax.annotation.Nullable + public Integer getMinItems() { + return minItems; + } + + public void setMinItems(Integer minItems) { + this.minItems = minItems; + } + public TagsFieldPropertiesDto maxItems(Integer maxItems) { + this.maxItems = maxItems; + return this; + } + + /** + * The maximum allowed items for the field value. + * @return maxItems + */ + @javax.annotation.Nullable + public Integer getMaxItems() { + return maxItems; + } + + public void setMaxItems(Integer maxItems) { + this.maxItems = maxItems; + } + public TagsFieldPropertiesDto allowedValues(List allowedValues) { + this.allowedValues = allowedValues; + return this; + } + + public TagsFieldPropertiesDto addAllowedValuesItem(String allowedValuesItem) { + if (this.allowedValues == null) { + this.allowedValues = new ArrayList<>(); } - - private boolean equalTo(TagsFieldPropertiesDto other) { - return defaultValues.equals(other.defaultValues) - && defaultValue.equals(other.defaultValue) - && minItems.equals(other.minItems) - && maxItems.equals(other.maxItems) - && allowedValues.equals(other.allowedValues) - && createEnum.equals(other.createEnum) - && editor.equals(other.editor); + this.allowedValues.add(allowedValuesItem); + return this; + } + + /** + * The allowed values for the field value. + * @return allowedValues + */ + @javax.annotation.Nullable + public List getAllowedValues() { + return allowedValues; + } + + public void setAllowedValues(List allowedValues) { + this.allowedValues = allowedValues; + } + public TagsFieldPropertiesDto createEnum(Boolean createEnum) { + this.createEnum = createEnum; + return this; + } + + /** + * Indicates whether GraphQL Enum should be created. + * @return createEnum + */ + @javax.annotation.Nullable + public Boolean getCreateEnum() { + return createEnum; + } + + public void setCreateEnum(Boolean createEnum) { + this.createEnum = createEnum; + } + public TagsFieldPropertiesDto editor(TagsFieldEditor editor) { + this.editor = editor; + return this; + } + + /** + * Get editor + * @return editor + */ + @javax.annotation.Nullable + public TagsFieldEditor getEditor() { + return editor; + } + + public void setEditor(TagsFieldEditor editor) { + this.editor = editor; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public int hashCode() { - return Objects.hash( - this.defaultValues, - this.defaultValue, - this.minItems, - this.maxItems, - this.allowedValues, - this.createEnum, - this.editor); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + TagsFieldPropertiesDto tagsFieldPropertiesDto = (TagsFieldPropertiesDto) o; + return Objects.equals(this.defaultValues, tagsFieldPropertiesDto.defaultValues) && + Objects.equals(this.defaultValue, tagsFieldPropertiesDto.defaultValue) && + Objects.equals(this.minItems, tagsFieldPropertiesDto.minItems) && + Objects.equals(this.maxItems, tagsFieldPropertiesDto.maxItems) && + Objects.equals(this.allowedValues, tagsFieldPropertiesDto.allowedValues) && + Objects.equals(this.createEnum, tagsFieldPropertiesDto.createEnum) && + Objects.equals(this.editor, tagsFieldPropertiesDto.editor) && + super.equals(o); + } + + 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(defaultValues, defaultValue, minItems, maxItems, allowedValues, createEnum, editor, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public static Builder builder() { - return new Builder(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TagsFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" defaultValues: ").append(toIndentedString(defaultValues)).append("\n"); + sb.append(" defaultValue: ").append(toIndentedString(defaultValue)).append("\n"); + sb.append(" minItems: ").append(toIndentedString(minItems)).append("\n"); + sb.append(" maxItems: ").append(toIndentedString(maxItems)).append("\n"); + sb.append(" allowedValues: ").append(toIndentedString(allowedValues)).append("\n"); + sb.append(" createEnum: ").append(toIndentedString(createEnum)).append("\n"); + sb.append(" editor: ").append(toIndentedString(editor)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional>> defaultValues = Optional.empty(); - - private Optional> defaultValue = Optional.empty(); - - private Optional minItems = Optional.empty(); - - private Optional maxItems = Optional.empty(); - - private Optional> allowedValues = Optional.empty(); - - private Optional createEnum = Optional.empty(); - - private Optional editor = Optional.empty(); - - private Builder() {} - - public Builder from(TagsFieldPropertiesDto other) { - defaultValues(other.getDefaultValues()); - defaultValue(other.getDefaultValue()); - minItems(other.getMinItems()); - maxItems(other.getMaxItems()); - allowedValues(other.getAllowedValues()); - createEnum(other.getCreateEnum()); - editor(other.getEditor()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("defaultValues"); + openapiFields.add("defaultValue"); + openapiFields.add("minItems"); + openapiFields.add("maxItems"); + openapiFields.add("allowedValues"); + openapiFields.add("createEnum"); + openapiFields.add("editor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TagsFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TagsFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TagsFieldPropertiesDto is not found in the empty JSON string", TagsFieldPropertiesDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "defaultValues", nulls = Nulls.SKIP) - public Builder defaultValues(Optional>> defaultValues) { - this.defaultValues = defaultValues; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TagsFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TagsFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder defaultValues(Map> defaultValues) { - this.defaultValues = Optional.of(defaultValues); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TagsFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @JsonSetter(value = "defaultValue", nulls = Nulls.SKIP) - public Builder defaultValue(Optional> defaultValue) { - this.defaultValue = defaultValue; - return this; - } - - public Builder defaultValue(List defaultValue) { - this.defaultValue = Optional.of(defaultValue); - return this; - } - - @JsonSetter(value = "minItems", nulls = Nulls.SKIP) - public Builder minItems(Optional minItems) { - this.minItems = minItems; - return this; - } - - public Builder minItems(Integer minItems) { - this.minItems = Optional.of(minItems); - return this; - } - - @JsonSetter(value = "maxItems", nulls = Nulls.SKIP) - public Builder maxItems(Optional maxItems) { - this.maxItems = maxItems; - return this; - } - - public Builder maxItems(Integer maxItems) { - this.maxItems = Optional.of(maxItems); - return this; - } - - @JsonSetter(value = "allowedValues", nulls = Nulls.SKIP) - public Builder allowedValues(Optional> allowedValues) { - this.allowedValues = allowedValues; - return this; - } - - public Builder allowedValues(List allowedValues) { - this.allowedValues = Optional.of(allowedValues); - return this; - } - - @JsonSetter(value = "createEnum", nulls = Nulls.SKIP) - public Builder createEnum(Optional createEnum) { - this.createEnum = createEnum; - return this; - } - - public Builder createEnum(Boolean createEnum) { - this.createEnum = Optional.of(createEnum); - return this; - } - - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; - } - - public Builder editor(TagsFieldEditor editor) { - this.editor = Optional.of(editor); - return this; - } - - public TagsFieldPropertiesDto build() { - return new TagsFieldPropertiesDto( - defaultValues, defaultValue, minItems, maxItems, allowedValues, createEnum, editor); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TagsFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TagsFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TagsFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TagsFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TagsFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of TagsFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TagsFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to TagsFieldPropertiesDto + */ + public static TagsFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TagsFieldPropertiesDto.class); + } + + /** + * Convert an instance of TagsFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/TeamDto.java b/src/main/java/com/squidex/api/types/TeamDto.java index 160d7aa..5dfc0e0 100644 --- a/src/main/java/com/squidex/api/types/TeamDto.java +++ b/src/main/java/com/squidex/api/types/TeamDto.java @@ -1,313 +1,382 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import java.io.IOException; import java.time.OffsetDateTime; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TeamDto.Builder.class) -public final class TeamDto implements IResource { - private final Map links; - - private final String id; - - private final String name; - - private final int version; - - private final OffsetDateTime created; - - private final OffsetDateTime lastModified; - - private final Optional roleName; - - private TeamDto( - Map links, - String id, - String name, - int version, - OffsetDateTime created, - OffsetDateTime lastModified, - Optional roleName) { - this.links = links; - this.id = id; - this.name = name; - this.version = version; - this.created = created; - this.lastModified = lastModified; - this.roleName = roleName; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the team. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The name of the team. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The version of the team. - */ - @JsonProperty("version") - public int getVersion() { - return version; - } - - /** - * @return The timestamp when the team has been created. - */ - @JsonProperty("created") - public OffsetDateTime getCreated() { - return created; - } - - /** - * @return The timestamp when the team has been modified last. - */ - @JsonProperty("lastModified") - public OffsetDateTime getLastModified() { - return lastModified; - } - - /** - * @return The role name of the user. - */ - @JsonProperty("roleName") - public Optional getRoleName() { - return roleName; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TeamDto && equalTo((TeamDto) other); - } - - private boolean equalTo(TeamDto other) { - return links.equals(other.links) - && id.equals(other.id) - && name.equals(other.name) - && version == other.version - && created.equals(other.created) - && lastModified.equals(other.lastModified) - && roleName.equals(other.roleName); - } - - @Override - public int hashCode() { - return Objects.hash( - this.links, this.id, this.name, this.version, this.created, this.lastModified, this.roleName); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } +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; - public interface IdStage { - NameStage id(String id); +import com.squidex.api.core.JSON; - Builder from(TeamDto other); +/** + * TeamDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class TeamDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_VERSION = "version"; + @SerializedName(SERIALIZED_NAME_VERSION) + private Long version; + public static final String SERIALIZED_NAME_CREATED = "created"; + @SerializedName(SERIALIZED_NAME_CREATED) + private OffsetDateTime created; + public static final String SERIALIZED_NAME_LAST_MODIFIED = "lastModified"; + @SerializedName(SERIALIZED_NAME_LAST_MODIFIED) + private OffsetDateTime lastModified; + public static final String SERIALIZED_NAME_ROLE_NAME = "roleName"; + @SerializedName(SERIALIZED_NAME_ROLE_NAME) + private String roleName; + public TeamDto() { + } + public TeamDto links(Map links) { + this.links = links; + return this; + } + + public TeamDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface NameStage { - VersionStage name(String name); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public TeamDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the team. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public TeamDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the team. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public TeamDto version(Long version) { + this.version = version; + return this; + } + + /** + * The version of the team. + * @return version + */ + @javax.annotation.Nonnull + public Long getVersion() { + return version; + } + + public void setVersion(Long version) { + this.version = version; + } + public TeamDto created(OffsetDateTime created) { + this.created = created; + return this; + } + + /** + * The timestamp when the team has been created. + * @return created + */ + @javax.annotation.Nonnull + public OffsetDateTime getCreated() { + return created; + } + + public void setCreated(OffsetDateTime created) { + this.created = created; + } + public TeamDto lastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + return this; + } + + /** + * The timestamp when the team has been modified last. + * @return lastModified + */ + @javax.annotation.Nonnull + public OffsetDateTime getLastModified() { + return lastModified; + } + + public void setLastModified(OffsetDateTime lastModified) { + this.lastModified = lastModified; + } + public TeamDto roleName(String roleName) { + this.roleName = roleName; + return this; + } + + /** + * The role name of the user. + * @return roleName + */ + @javax.annotation.Nullable + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface VersionStage { - CreatedStage version(int version); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface CreatedStage { - LastModifiedStage created(OffsetDateTime created); + TeamDto teamDto = (TeamDto) o; + return Objects.equals(this.links, teamDto.links) && + Objects.equals(this.id, teamDto.id) && + Objects.equals(this.name, teamDto.name) && + Objects.equals(this.version, teamDto.version) && + Objects.equals(this.created, teamDto.created) && + Objects.equals(this.lastModified, teamDto.lastModified) && + Objects.equals(this.roleName, teamDto.roleName); + } + + 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(links, id, name, version, created, lastModified, roleName); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface LastModifiedStage { - _FinalStage lastModified(OffsetDateTime lastModified); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TeamDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" version: ").append(toIndentedString(version)).append("\n"); + sb.append(" created: ").append(toIndentedString(created)).append("\n"); + sb.append(" lastModified: ").append(toIndentedString(lastModified)).append("\n"); + sb.append(" roleName: ").append(toIndentedString(roleName)).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"; } - - public interface _FinalStage { - TeamDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage roleName(Optional roleName); - - _FinalStage roleName(String roleName); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder - implements IdStage, NameStage, VersionStage, CreatedStage, LastModifiedStage, _FinalStage { - private String id; - - private String name; - - private int version; - - private OffsetDateTime created; - - private OffsetDateTime lastModified; - - private Optional roleName = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(TeamDto other) { - links(other.getLinks()); - id(other.getId()); - name(other.getName()); - version(other.getVersion()); - created(other.getCreated()); - lastModified(other.getLastModified()); - roleName(other.getRoleName()); - return this; - } - - /** - *

The ID of the team.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public NameStage id(String id) { - this.id = id; - return this; - } - - /** - *

The name of the team.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public VersionStage name(String name) { - this.name = name; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("version"); + openapiFields.add("created"); + openapiFields.add("lastModified"); + openapiFields.add("roleName"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("version"); + openapiRequiredFields.add("created"); + openapiRequiredFields.add("lastModified"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TeamDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TeamDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TeamDto is not found in the empty JSON string", TeamDto.openapiRequiredFields.toString())); } + } - /** - *

The version of the team.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("version") - public CreatedStage version(int version) { - this.version = version; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TeamDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TeamDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The timestamp when the team has been created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("created") - public LastModifiedStage created(OffsetDateTime created) { - this.created = created; - return this; - } - - /** - *

The timestamp when the team has been modified last.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("lastModified") - public _FinalStage lastModified(OffsetDateTime lastModified) { - this.lastModified = lastModified; - return this; - } - - /** - *

The role name of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage roleName(String roleName) { - this.roleName = Optional.of(roleName); - return this; - } - - @Override - @JsonSetter(value = "roleName", nulls = Nulls.SKIP) - public _FinalStage roleName(Optional roleName) { - this.roleName = roleName; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public TeamDto build() { - return new TeamDto(links, id, name, version, created, lastModified, roleName); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TeamDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("roleName") != null && !jsonObj.get("roleName").isJsonNull()) && !jsonObj.get("roleName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `roleName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("roleName").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TeamDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TeamDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TeamDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TeamDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TeamDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of TeamDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TeamDto + * @throws IOException if the JSON string is invalid with respect to TeamDto + */ + public static TeamDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TeamDto.class); + } + + /** + * Convert an instance of TeamDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/TemplateDetailsDto.java b/src/main/java/com/squidex/api/types/TemplateDetailsDto.java index cd00d48..8e1636a 100644 --- a/src/main/java/com/squidex/api/types/TemplateDetailsDto.java +++ b/src/main/java/com/squidex/api/types/TemplateDetailsDto.java @@ -1,145 +1,244 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TemplateDetailsDto.Builder.class) -public final class TemplateDetailsDto implements IResource { - private final Map links; - private final String details; - - private TemplateDetailsDto(Map links, String details) { - this.links = links; - this.details = details; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - /** - * @return The details of the template. - */ - @JsonProperty("details") - public String getDetails() { - return details; - } +package com.squidex.api.types; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TemplateDetailsDto && equalTo((TemplateDetailsDto) other); - } +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.squidex.api.types.ResourceLink; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; - private boolean equalTo(TemplateDetailsDto other) { - return links.equals(other.links) && details.equals(other.details); - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - @Override - public int hashCode() { - return Objects.hash(this.links, this.details); - } +import com.squidex.api.core.JSON; - @Override - public String toString() { - return ObjectMappers.stringify(this); +/** + * TemplateDetailsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class TemplateDetailsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_DETAILS = "details"; + @SerializedName(SERIALIZED_NAME_DETAILS) + private String details; + public TemplateDetailsDto() { + } + public TemplateDetailsDto links(Map links) { + this.links = links; + return this; + } + + public TemplateDetailsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public static DetailsStage builder() { - return new Builder(); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public TemplateDetailsDto details(String details) { + this.details = details; + return this; + } + + /** + * The details of the template. + * @return details + */ + @javax.annotation.Nonnull + public String getDetails() { + return details; + } + + public void setDetails(String details) { + this.details = details; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface DetailsStage { - _FinalStage details(String details); - - Builder from(TemplateDetailsDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - TemplateDetailsDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); + TemplateDetailsDto templateDetailsDto = (TemplateDetailsDto) o; + return Objects.equals(this.links, templateDetailsDto.links) && + Objects.equals(this.details, templateDetailsDto.details); + } + + @Override + public int hashCode() { + return Objects.hash(links, details); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemplateDetailsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" details: ").append(toIndentedString(details)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements DetailsStage, _FinalStage { - private String details; - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(TemplateDetailsDto other) { - links(other.getLinks()); - details(other.getDetails()); - return this; - } - - /** - *

The details of the template.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("details") - public _FinalStage details(String details) { - this.details = details; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("details"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("details"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TemplateDetailsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TemplateDetailsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TemplateDetailsDto is not found in the empty JSON string", TemplateDetailsDto.openapiRequiredFields.toString())); } + } - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TemplateDetailsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TemplateDetailsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public TemplateDetailsDto build() { - return new TemplateDetailsDto(links, details); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TemplateDetailsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("details").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `details` to be a primitive type in the JSON string but got `%s`", jsonObj.get("details").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TemplateDetailsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TemplateDetailsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TemplateDetailsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TemplateDetailsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TemplateDetailsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of TemplateDetailsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TemplateDetailsDto + * @throws IOException if the JSON string is invalid with respect to TemplateDetailsDto + */ + public static TemplateDetailsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TemplateDetailsDto.class); + } + + /** + * Convert an instance of TemplateDetailsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/TemplateDto.java b/src/main/java/com/squidex/api/types/TemplateDto.java index a445049..68e92e4 100644 --- a/src/main/java/com/squidex/api/types/TemplateDto.java +++ b/src/main/java/com/squidex/api/types/TemplateDto.java @@ -1,237 +1,322 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TemplateDto.Builder.class) -public final class TemplateDto implements IResource { - private final Map links; - - private final String name; - - private final String title; - - private final String description; - private final boolean isStarter; - private TemplateDto( - Map links, String name, String title, String description, boolean isStarter) { - this.links = links; - this.name = name; - this.title = title; - this.description = description; - this.isStarter = isStarter; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The name of the template. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return The title of the template. - */ - @JsonProperty("title") - public String getTitle() { - return title; - } - - /** - * @return The description of the template. - */ - @JsonProperty("description") - public String getDescription() { - return description; - } - - /** - * @return True, if the template is a starter. - */ - @JsonProperty("isStarter") - public boolean getIsStarter() { - return isStarter; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TemplateDto && equalTo((TemplateDto) other); - } - - private boolean equalTo(TemplateDto other) { - return links.equals(other.links) - && name.equals(other.name) - && title.equals(other.title) - && description.equals(other.description) - && isStarter == other.isStarter; - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.name, this.title, this.description, this.isStarter); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +package com.squidex.api.types; - public static NameStage builder() { - return new Builder(); - } +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.squidex.api.types.ResourceLink; +import java.io.IOException; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; - public interface NameStage { - TitleStage name(String name); +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - Builder from(TemplateDto other); - } +import com.squidex.api.core.JSON; - public interface TitleStage { - DescriptionStage title(String title); +/** + * TemplateDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class TemplateDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_TITLE = "title"; + @SerializedName(SERIALIZED_NAME_TITLE) + private String title; + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + public static final String SERIALIZED_NAME_IS_STARTER = "isStarter"; + @SerializedName(SERIALIZED_NAME_IS_STARTER) + private Boolean isStarter; + public TemplateDto() { + } + public TemplateDto links(Map links) { + this.links = links; + return this; + } + + public TemplateDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface DescriptionStage { - IsStarterStage description(String description); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public TemplateDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the template. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public TemplateDto title(String title) { + this.title = title; + return this; + } + + /** + * The title of the template. + * @return title + */ + @javax.annotation.Nonnull + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + public TemplateDto description(String description) { + this.description = description; + return this; + } + + /** + * The description of the template. + * @return description + */ + @javax.annotation.Nonnull + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public TemplateDto isStarter(Boolean isStarter) { + this.isStarter = isStarter; + return this; + } + + /** + * True, if the template is a starter. + * @return isStarter + */ + @javax.annotation.Nonnull + public Boolean getIsStarter() { + return isStarter; + } + + public void setIsStarter(Boolean isStarter) { + this.isStarter = isStarter; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface IsStarterStage { - _FinalStage isStarter(boolean isStarter); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - TemplateDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); + TemplateDto templateDto = (TemplateDto) o; + return Objects.equals(this.links, templateDto.links) && + Objects.equals(this.name, templateDto.name) && + Objects.equals(this.title, templateDto.title) && + Objects.equals(this.description, templateDto.description) && + Objects.equals(this.isStarter, templateDto.isStarter); + } + + @Override + public int hashCode() { + return Objects.hash(links, name, title, description, isStarter); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemplateDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" title: ").append(toIndentedString(title)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).append("\n"); + sb.append(" isStarter: ").append(toIndentedString(isStarter)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, TitleStage, DescriptionStage, IsStarterStage, _FinalStage { - private String name; - - private String title; - - private String description; - - private boolean isStarter; - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(TemplateDto other) { - links(other.getLinks()); - name(other.getName()); - title(other.getTitle()); - description(other.getDescription()); - isStarter(other.getIsStarter()); - return this; - } - - /** - *

The name of the template.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public TitleStage name(String name) { - this.name = name; - return this; - } - - /** - *

The title of the template.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("title") - public DescriptionStage title(String title) { - this.title = title; - return this; - } - - /** - *

The description of the template.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("description") - public IsStarterStage description(String description) { - this.description = description; - return this; - } - - /** - *

True, if the template is a starter.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isStarter") - public _FinalStage isStarter(boolean isStarter) { - this.isStarter = isStarter; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("name"); + openapiFields.add("title"); + openapiFields.add("description"); + openapiFields.add("isStarter"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("title"); + openapiRequiredFields.add("description"); + openapiRequiredFields.add("isStarter"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TemplateDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TemplateDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TemplateDto is not found in the empty JSON string", TemplateDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TemplateDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TemplateDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public TemplateDto build() { - return new TemplateDto(links, name, title, description, isStarter); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TemplateDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TemplateDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TemplateDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TemplateDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TemplateDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TemplateDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of TemplateDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TemplateDto + * @throws IOException if the JSON string is invalid with respect to TemplateDto + */ + public static TemplateDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TemplateDto.class); + } + + /** + * Convert an instance of TemplateDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/TemplatesDto.java b/src/main/java/com/squidex/api/types/TemplatesDto.java index a88e650..5165f7c 100644 --- a/src/main/java/com/squidex/api/types/TemplatesDto.java +++ b/src/main/java/com/squidex/api/types/TemplatesDto.java @@ -1,124 +1,262 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.TemplateDto; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TemplatesDto.Builder.class) -public final class TemplatesDto implements IResource { - private final Map links; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final List items; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private TemplatesDto(Map links, List items) { - this.links = links; - this.items = items; - } +import com.squidex.api.core.JSON; - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } +/** + * TemplatesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class TemplatesDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public TemplatesDto() { + } + public TemplatesDto links(Map links) { + this.links = links; + return this; + } - /** - * @return The event consumers. - */ - @JsonProperty("items") - public List getItems() { - return items; + public TemplatesDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } + this.links.put(key, linksItem); + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TemplatesDto && equalTo((TemplatesDto) other); - } + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } - private boolean equalTo(TemplatesDto other) { - return links.equals(other.links) && items.equals(other.items); - } + public void setLinks(Map links) { + this.links = links; + } + public TemplatesDto items(List items) { + this.items = items; + return this; + } - @Override - public int hashCode() { - return Objects.hash(this.links, this.items); + public TemplatesDto addItemsItem(TemplateDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } + this.items.add(itemsItem); + return this; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + /** + * The event consumers. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + TemplatesDto templatesDto = (TemplatesDto) o; + return Objects.equals(this.links, templatesDto.links) && + Objects.equals(this.items, templatesDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, items); + } - public static Builder builder() { - return new Builder(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TemplatesDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); - private List items = new ArrayList<>(); + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Builder() {} + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("items"); - public Builder from(TemplatesDto other) { - links(other.getLinks()); - items(other.getItems()); - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + } - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TemplatesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TemplatesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TemplatesDto is not found in the empty JSON string", TemplatesDto.openapiRequiredFields.toString())); } + } - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TemplatesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TemplatesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TemplatesDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + TemplateDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } - public Builder addItems(TemplateDto items) { - this.items.add(items); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TemplatesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TemplatesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TemplatesDto.class)); - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TemplatesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public TemplatesDto build() { - return new TemplatesDto(links, items); - } + @Override + public TemplatesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of TemplatesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TemplatesDto + * @throws IOException if the JSON string is invalid with respect to TemplatesDto + */ + public static TemplatesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TemplatesDto.class); + } + + /** + * Convert an instance of TemplatesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/TransferToTeamDto.java b/src/main/java/com/squidex/api/types/TransferToTeamDto.java new file mode 100644 index 0000000..adb2874 --- /dev/null +++ b/src/main/java/com/squidex/api/types/TransferToTeamDto.java @@ -0,0 +1,213 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * TransferToTeamDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class TransferToTeamDto { + public static final String SERIALIZED_NAME_TEAM_ID = "teamId"; + @SerializedName(SERIALIZED_NAME_TEAM_ID) + private String teamId; + public TransferToTeamDto() { + } + public TransferToTeamDto teamId(String teamId) { + this.teamId = teamId; + return this; + } + + /** + * The ID of the team. + * @return teamId + */ + @javax.annotation.Nullable + public String getTeamId() { + return teamId; + } + + public void setTeamId(String teamId) { + this.teamId = teamId; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TransferToTeamDto transferToTeamDto = (TransferToTeamDto) o; + return Objects.equals(this.teamId, transferToTeamDto.teamId); + } + + 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(teamId); + } + + 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 TransferToTeamDto {\n"); + sb.append(" teamId: ").append(toIndentedString(teamId)).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("teamId"); + + // 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 TransferToTeamDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TransferToTeamDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TransferToTeamDto is not found in the empty JSON string", TransferToTeamDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TransferToTeamDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TransferToTeamDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("teamId") != null && !jsonObj.get("teamId").isJsonNull()) && !jsonObj.get("teamId").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `teamId` to be a primitive type in the JSON string but got `%s`", jsonObj.get("teamId").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TransferToTeamDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TransferToTeamDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TransferToTeamDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TransferToTeamDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TransferToTeamDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TransferToTeamDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TransferToTeamDto + * @throws IOException if the JSON string is invalid with respect to TransferToTeamDto + */ + public static TransferToTeamDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TransferToTeamDto.class); + } + + /** + * Convert an instance of TransferToTeamDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/TranslateDto.java b/src/main/java/com/squidex/api/types/TranslateDto.java new file mode 100644 index 0000000..df44bfe --- /dev/null +++ b/src/main/java/com/squidex/api/types/TranslateDto.java @@ -0,0 +1,262 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * TranslateDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class TranslateDto { + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + public static final String SERIALIZED_NAME_TARGET_LANGUAGE = "targetLanguage"; + @SerializedName(SERIALIZED_NAME_TARGET_LANGUAGE) + private String targetLanguage; + public static final String SERIALIZED_NAME_SOURCE_LANGUAGE = "sourceLanguage"; + @SerializedName(SERIALIZED_NAME_SOURCE_LANGUAGE) + private String sourceLanguage; + public TranslateDto() { + } + public TranslateDto text(String text) { + this.text = text; + return this; + } + + /** + * The text to translate. + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + public TranslateDto targetLanguage(String targetLanguage) { + this.targetLanguage = targetLanguage; + return this; + } + + /** + * The target language. + * @return targetLanguage + */ + @javax.annotation.Nonnull + public String getTargetLanguage() { + return targetLanguage; + } + + public void setTargetLanguage(String targetLanguage) { + this.targetLanguage = targetLanguage; + } + public TranslateDto sourceLanguage(String sourceLanguage) { + this.sourceLanguage = sourceLanguage; + return this; + } + + /** + * The optional source language. + * @return sourceLanguage + */ + @javax.annotation.Nullable + public String getSourceLanguage() { + return sourceLanguage; + } + + public void setSourceLanguage(String sourceLanguage) { + this.sourceLanguage = sourceLanguage; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + TranslateDto translateDto = (TranslateDto) o; + return Objects.equals(this.text, translateDto.text) && + Objects.equals(this.targetLanguage, translateDto.targetLanguage) && + Objects.equals(this.sourceLanguage, translateDto.sourceLanguage); + } + + @Override + public int hashCode() { + return Objects.hash(text, targetLanguage, sourceLanguage); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TranslateDto {\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" targetLanguage: ").append(toIndentedString(targetLanguage)).append("\n"); + sb.append(" sourceLanguage: ").append(toIndentedString(sourceLanguage)).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("text"); + openapiFields.add("targetLanguage"); + openapiFields.add("sourceLanguage"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("targetLanguage"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TranslateDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TranslateDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TranslateDto is not found in the empty JSON string", TranslateDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TranslateDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TranslateDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TranslateDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + if (!jsonObj.get("targetLanguage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `targetLanguage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("targetLanguage").toString())); + } + if ((jsonObj.get("sourceLanguage") != null && !jsonObj.get("sourceLanguage").isJsonNull()) && !jsonObj.get("sourceLanguage").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `sourceLanguage` to be a primitive type in the JSON string but got `%s`", jsonObj.get("sourceLanguage").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TranslateDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TranslateDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TranslateDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TranslateDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TranslateDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of TranslateDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranslateDto + * @throws IOException if the JSON string is invalid with respect to TranslateDto + */ + public static TranslateDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TranslateDto.class); + } + + /** + * Convert an instance of TranslateDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/TranslationDto.java b/src/main/java/com/squidex/api/types/TranslationDto.java index 6ac0961..def219f 100644 --- a/src/main/java/com/squidex/api/types/TranslationDto.java +++ b/src/main/java/com/squidex/api/types/TranslationDto.java @@ -1,159 +1,273 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.TranslationStatus; +import java.io.IOException; +import java.util.Arrays; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TranslationDto.Builder.class) -public final class TranslationDto { - private final TranslationStatus status; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final TranslationStatus result; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final Optional text; +import com.squidex.api.core.JSON; - private TranslationDto(TranslationStatus status, TranslationStatus result, Optional text) { - this.status = status; - this.result = result; - this.text = text; - } +/** + * TranslationDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class TranslationDto { + public static final String SERIALIZED_NAME_STATUS = "status"; + @SerializedName(SERIALIZED_NAME_STATUS) + private TranslationStatus status; + public static final String SERIALIZED_NAME_RESULT = "result"; + @SerializedName(SERIALIZED_NAME_RESULT) + private TranslationStatus result; + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + public TranslationDto() { + } + public TranslationDto status(TranslationStatus status) { + this.status = status; + return this; + } - /** - * @return The result of the translation. - */ - @JsonProperty("status") - public TranslationStatus getStatus() { - return status; - } + /** + * Get status + * @return status + */ + @javax.annotation.Nonnull + public TranslationStatus getStatus() { + return status; + } - /** - * @return The result of the translation. - */ - @JsonProperty("result") - public TranslationStatus getResult() { - return result; - } + public void setStatus(TranslationStatus status) { + this.status = status; + } + public TranslationDto result(TranslationStatus result) { + this.result = result; + return this; + } - /** - * @return The translated text. - */ - @JsonProperty("text") - public Optional getText() { - return text; - } + /** + * Get result + * @return result + */ + @javax.annotation.Nonnull + public TranslationStatus getResult() { + return result; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TranslationDto && equalTo((TranslationDto) other); - } + public void setResult(TranslationStatus result) { + this.result = result; + } + public TranslationDto text(String text) { + this.text = text; + return this; + } - private boolean equalTo(TranslationDto other) { - return status.equals(other.status) && result.equals(other.result) && text.equals(other.text); - } + /** + * The translated text. + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } - @Override - public int hashCode() { - return Objects.hash(this.status, this.result, this.text); - } + public void setText(String text) { + this.text = text; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static StatusStage builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + TranslationDto translationDto = (TranslationDto) o; + return Objects.equals(this.status, translationDto.status) && + Objects.equals(this.result, translationDto.result) && + Objects.equals(this.text, translationDto.text); + } - public interface StatusStage { - ResultStage status(TranslationStatus status); + 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())); + } - Builder from(TranslationDto other); - } + @Override + public int hashCode() { + return Objects.hash(status, result, text); + } - public interface ResultStage { - _FinalStage result(TranslationStatus result); + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } - public interface _FinalStage { - TranslationDto build(); - - _FinalStage text(Optional text); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TranslationDto {\n"); + sb.append(" status: ").append(toIndentedString(status)).append("\n"); + sb.append(" result: ").append(toIndentedString(result)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append("}"); + return sb.toString(); + } - _FinalStage text(String text); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements StatusStage, ResultStage, _FinalStage { - private TranslationStatus status; - private TranslationStatus result; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private Optional text = Optional.empty(); + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("status"); + openapiFields.add("result"); + openapiFields.add("text"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("status"); + openapiRequiredFields.add("result"); + } - @Override - public Builder from(TranslationDto other) { - status(other.getStatus()); - result(other.getResult()); - text(other.getText()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TranslationDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TranslationDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TranslationDto is not found in the empty JSON string", TranslationDto.openapiRequiredFields.toString())); } + } - /** - *

The result of the translation.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("status") - public ResultStage status(TranslationStatus status) { - this.status = status; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TranslationDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TranslationDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The result of the translation.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("result") - public _FinalStage result(TranslationStatus result) { - this.result = result; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TranslationDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `status` + TranslationStatus.validateJsonElement(jsonObj.get("status")); + // validate the required field `result` + TranslationStatus.validateJsonElement(jsonObj.get("result")); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } - /** - *

The translated text.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage text(String text) { - this.text = Optional.of(text); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TranslationDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TranslationDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TranslationDto.class)); - @Override - @JsonSetter(value = "text", nulls = Nulls.SKIP) - public _FinalStage text(Optional text) { - this.text = text; - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TranslationDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - @Override - public TranslationDto build() { - return new TranslationDto(status, result, text); - } + @Override + public TranslationDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of TranslationDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TranslationDto + * @throws IOException if the JSON string is invalid with respect to TranslationDto + */ + public static TranslationDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TranslationDto.class); + } + + /** + * Convert an instance of TranslationDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/TranslationStatus.java b/src/main/java/com/squidex/api/types/TranslationStatus.java index e7357c2..0a60384 100644 --- a/src/main/java/com/squidex/api/types/TranslationStatus.java +++ b/src/main/java/com/squidex/api/types/TranslationStatus.java @@ -1,32 +1,86 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import com.google.gson.annotations.SerializedName; -public enum TranslationStatus { - TRANSLATED("Translated"), +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; - LANGUAGE_NOT_SUPPORTED("LanguageNotSupported"), +/** + * + */ +@JsonAdapter(TranslationStatus.Adapter.class) +public enum TranslationStatus { + + TRANSLATED("Translated"), + + LANGUAGE_NOT_SUPPORTED("LanguageNotSupported"), + + NOT_TRANSLATED("NotTranslated"), + + NOT_CONFIGURED("NotConfigured"), + + UNAUTHORIZED("Unauthorized"), + + FAILED("Failed"); - NOT_TRANSLATED("NotTranslated"), + private String value; - NOT_CONFIGURED("NotConfigured"), + TranslationStatus(String value) { + this.value = value; + } - UNAUTHORIZED("Unauthorized"), + public String getValue() { + return value; + } - FAILED("Failed"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static TranslationStatus fromValue(String value) { + for (TranslationStatus b : TranslationStatus.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - TranslationStatus(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final TranslationStatus enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public TranslationStatus read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return TranslationStatus.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + TranslationStatus.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/TweetRuleActionDto.java b/src/main/java/com/squidex/api/types/TweetRuleActionDto.java index 5429b69..6cd2969 100644 --- a/src/main/java/com/squidex/api/types/TweetRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/TweetRuleActionDto.java @@ -1,153 +1,258 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; 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.squidex.api.types.RuleActionDto; +import java.io.IOException; +import java.util.Arrays; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TweetRuleActionDto.Builder.class) -public final class TweetRuleActionDto { - private final String accessToken; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final String accessSecret; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final String text; +import com.squidex.api.core.JSON; - private TweetRuleActionDto(String accessToken, String accessSecret, String text) { - this.accessToken = accessToken; - this.accessSecret = accessSecret; - this.text = text; - } +/** + * TweetRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class TweetRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_ACCESS_TOKEN = "accessToken"; + @SerializedName(SERIALIZED_NAME_ACCESS_TOKEN) + private String accessToken; + public static final String SERIALIZED_NAME_ACCESS_SECRET = "accessSecret"; + @SerializedName(SERIALIZED_NAME_ACCESS_SECRET) + private String accessSecret; + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + private String text; + public TweetRuleActionDto() { + } + public TweetRuleActionDto accessToken(String accessToken) { + this.accessToken = accessToken; + return this; + } - /** - * @return The generated access token. - */ - @JsonProperty("accessToken") - public String getAccessToken() { - return accessToken; - } + /** + * The generated access token. + * @return accessToken + */ + @javax.annotation.Nonnull + public String getAccessToken() { + return accessToken; + } - /** - * @return The generated access secret. - */ - @JsonProperty("accessSecret") - public String getAccessSecret() { - return accessSecret; - } + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + public TweetRuleActionDto accessSecret(String accessSecret) { + this.accessSecret = accessSecret; + return this; + } - /** - * @return The text that is sent as tweet to twitter. - */ - @JsonProperty("text") - public String getText() { - return text; - } + /** + * The generated access secret. + * @return accessSecret + */ + @javax.annotation.Nonnull + public String getAccessSecret() { + return accessSecret; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TweetRuleActionDto && equalTo((TweetRuleActionDto) other); - } + public void setAccessSecret(String accessSecret) { + this.accessSecret = accessSecret; + } + public TweetRuleActionDto text(String text) { + this.text = text; + return this; + } - private boolean equalTo(TweetRuleActionDto other) { - return accessToken.equals(other.accessToken) - && accessSecret.equals(other.accessSecret) - && text.equals(other.text); - } + /** + * The text that is sent as tweet to twitter. + * @return text + */ + @javax.annotation.Nonnull + public String getText() { + return text; + } - @Override - public int hashCode() { - return Objects.hash(this.accessToken, this.accessSecret, this.text); - } + public void setText(String text) { + this.text = text; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static AccessTokenStage builder() { - return new Builder(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface AccessTokenStage { - AccessSecretStage accessToken(String accessToken); - - Builder from(TweetRuleActionDto other); + if (o == null || getClass() != o.getClass()) { + return false; } + TweetRuleActionDto tweetRuleActionDto = (TweetRuleActionDto) o; + return Objects.equals(this.accessToken, tweetRuleActionDto.accessToken) && + Objects.equals(this.accessSecret, tweetRuleActionDto.accessSecret) && + Objects.equals(this.text, tweetRuleActionDto.text) && + super.equals(o); + } - public interface AccessSecretStage { - TextStage accessSecret(String accessSecret); - } + @Override + public int hashCode() { + return Objects.hash(accessToken, accessSecret, text, super.hashCode()); + } - public interface TextStage { - _FinalStage text(String text); - } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TweetRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" accessToken: ").append(toIndentedString(accessToken)).append("\n"); + sb.append(" accessSecret: ").append(toIndentedString(accessSecret)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public interface _FinalStage { - TweetRuleActionDto build(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements AccessTokenStage, AccessSecretStage, TextStage, _FinalStage { - private String accessToken; - private String accessSecret; + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - private String text; + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("accessToken"); + openapiFields.add("accessSecret"); + openapiFields.add("text"); - private Builder() {} + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("accessToken"); + openapiRequiredFields.add("accessSecret"); + openapiRequiredFields.add("text"); + openapiRequiredFields.add("actionType"); + } - @Override - public Builder from(TweetRuleActionDto other) { - accessToken(other.getAccessToken()); - accessSecret(other.getAccessSecret()); - text(other.getText()); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TweetRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TweetRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TweetRuleActionDto is not found in the empty JSON string", TweetRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The generated access token.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("accessToken") - public AccessSecretStage accessToken(String accessToken) { - this.accessToken = accessToken; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TweetRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TweetRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The generated access secret.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("accessSecret") - public TextStage accessSecret(String accessSecret) { - this.accessSecret = accessSecret; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TweetRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - /** - *

The text that is sent as tweet to twitter.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TweetRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TweetRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TweetRuleActionDto.class)); - @Override - public TweetRuleActionDto build() { - return new TweetRuleActionDto(accessToken, accessSecret, text); - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TweetRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TweetRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of TweetRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TweetRuleActionDto + * @throws IOException if the JSON string is invalid with respect to TweetRuleActionDto + */ + public static TweetRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TweetRuleActionDto.class); + } + + /** + * Convert an instance of TweetRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java b/src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java index b991b9f..e0c51d8 100644 --- a/src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java @@ -1,228 +1,317 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = TypesenseRuleActionDto.Builder.class) -public final class TypesenseRuleActionDto { - private final String host; - - private final String indexName; - - private final String apiKey; - - private final Optional document; - private final Optional delete; - - private TypesenseRuleActionDto( - String host, String indexName, String apiKey, Optional document, Optional delete) { - this.host = host; - this.indexName = indexName; - this.apiKey = apiKey; - this.document = document; - this.delete = delete; - } - - /** - * @return The url to the instance or cluster. - */ - @JsonProperty("host") - public String getHost() { - return host; - } - - /** - * @return The name of the index. - */ - @JsonProperty("indexName") - public String getIndexName() { - return indexName; - } - - /** - * @return The api key. - */ - @JsonProperty("apiKey") - public String getApiKey() { - return apiKey; - } - - /** - * @return The optional custom document. - */ - @JsonProperty("document") - public Optional getDocument() { - return document; - } - - /** - * @return The condition when to delete the document. - */ - @JsonProperty("delete") - public Optional getDelete() { - return delete; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TypesenseRuleActionDto && equalTo((TypesenseRuleActionDto) other); - } - - private boolean equalTo(TypesenseRuleActionDto other) { - return host.equals(other.host) - && indexName.equals(other.indexName) - && apiKey.equals(other.apiKey) - && document.equals(other.document) - && delete.equals(other.delete); - } - - @Override - public int hashCode() { - return Objects.hash(this.host, this.indexName, this.apiKey, this.document, this.delete); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static HostStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface HostStage { - IndexNameStage host(String host); +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.squidex.api.types.RuleActionDto; +import java.io.IOException; +import java.net.URI; +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.squidex.api.core.JSON; - Builder from(TypesenseRuleActionDto other); +/** + * TypesenseRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class TypesenseRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_HOST = "host"; + @SerializedName(SERIALIZED_NAME_HOST) + private URI host; + public static final String SERIALIZED_NAME_INDEX_NAME = "indexName"; + @SerializedName(SERIALIZED_NAME_INDEX_NAME) + private String indexName; + public static final String SERIALIZED_NAME_API_KEY = "apiKey"; + @SerializedName(SERIALIZED_NAME_API_KEY) + private String apiKey; + public static final String SERIALIZED_NAME_DOCUMENT = "document"; + @SerializedName(SERIALIZED_NAME_DOCUMENT) + private String document; + public static final String SERIALIZED_NAME_DELETE = "delete"; + @SerializedName(SERIALIZED_NAME_DELETE) + private String delete; + public TypesenseRuleActionDto() { + } + public TypesenseRuleActionDto host(URI host) { + this.host = host; + return this; + } + + /** + * The url to the instance or cluster. + * @return host + */ + @javax.annotation.Nonnull + public URI getHost() { + return host; + } + + public void setHost(URI host) { + this.host = host; + } + public TypesenseRuleActionDto indexName(String indexName) { + this.indexName = indexName; + return this; + } + + /** + * The name of the index. + * @return indexName + */ + @javax.annotation.Nonnull + public String getIndexName() { + return indexName; + } + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + public TypesenseRuleActionDto apiKey(String apiKey) { + this.apiKey = apiKey; + return this; + } + + /** + * The api key. + * @return apiKey + */ + @javax.annotation.Nonnull + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + public TypesenseRuleActionDto document(String document) { + this.document = document; + return this; + } + + /** + * The optional custom document. + * @return document + */ + @javax.annotation.Nullable + public String getDocument() { + return document; + } + + public void setDocument(String document) { + this.document = document; + } + public TypesenseRuleActionDto delete(String delete) { + this.delete = delete; + return this; + } + + /** + * The condition when to delete the document. + * @return delete + */ + @javax.annotation.Nullable + public String getDelete() { + return delete; + } + + public void setDelete(String delete) { + this.delete = delete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface IndexNameStage { - ApiKeyStage indexName(String indexName); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface ApiKeyStage { - _FinalStage apiKey(String apiKey); + TypesenseRuleActionDto typesenseRuleActionDto = (TypesenseRuleActionDto) o; + return Objects.equals(this.host, typesenseRuleActionDto.host) && + Objects.equals(this.indexName, typesenseRuleActionDto.indexName) && + Objects.equals(this.apiKey, typesenseRuleActionDto.apiKey) && + Objects.equals(this.document, typesenseRuleActionDto.document) && + Objects.equals(this.delete, typesenseRuleActionDto.delete) && + super.equals(o); + } + + 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(host, indexName, apiKey, document, delete, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - TypesenseRuleActionDto build(); - - _FinalStage document(Optional document); - - _FinalStage document(String document); - - _FinalStage delete(Optional delete); - - _FinalStage delete(String delete); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class TypesenseRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" host: ").append(toIndentedString(host)).append("\n"); + sb.append(" indexName: ").append(toIndentedString(indexName)).append("\n"); + sb.append(" apiKey: ").append(toIndentedString(apiKey)).append("\n"); + sb.append(" document: ").append(toIndentedString(document)).append("\n"); + sb.append(" delete: ").append(toIndentedString(delete)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements HostStage, IndexNameStage, ApiKeyStage, _FinalStage { - private String host; - - private String indexName; - - private String apiKey; - - private Optional delete = Optional.empty(); - - private Optional document = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(TypesenseRuleActionDto other) { - host(other.getHost()); - indexName(other.getIndexName()); - apiKey(other.getApiKey()); - document(other.getDocument()); - delete(other.getDelete()); - return this; - } - - /** - *

The url to the instance or cluster.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("host") - public IndexNameStage host(String host) { - this.host = host; - return this; - } - - /** - *

The name of the index.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("indexName") - public ApiKeyStage indexName(String indexName) { - this.indexName = indexName; - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("host"); + openapiFields.add("indexName"); + openapiFields.add("apiKey"); + openapiFields.add("document"); + openapiFields.add("delete"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("host"); + openapiRequiredFields.add("indexName"); + openapiRequiredFields.add("apiKey"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to TypesenseRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!TypesenseRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in TypesenseRuleActionDto is not found in the empty JSON string", TypesenseRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The api key.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("apiKey") - public _FinalStage apiKey(String apiKey) { - this.apiKey = apiKey; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!TypesenseRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `TypesenseRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The condition when to delete the document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage delete(String delete) { - this.delete = Optional.of(delete); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : TypesenseRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @Override - @JsonSetter(value = "delete", nulls = Nulls.SKIP) - public _FinalStage delete(Optional delete) { - this.delete = delete; - return this; - } - - /** - *

The optional custom document.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage document(String document) { - this.document = Optional.of(document); - return this; - } - - @Override - @JsonSetter(value = "document", nulls = Nulls.SKIP) - public _FinalStage document(Optional document) { - this.document = document; - return this; - } - - @Override - public TypesenseRuleActionDto build() { - return new TypesenseRuleActionDto(host, indexName, apiKey, document, delete); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!TypesenseRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'TypesenseRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(TypesenseRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, TypesenseRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public TypesenseRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of TypesenseRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of TypesenseRuleActionDto + * @throws IOException if the JSON string is invalid with respect to TypesenseRuleActionDto + */ + public static TypesenseRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, TypesenseRuleActionDto.class); + } + + /** + * Convert an instance of TypesenseRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/UIFieldEditor.java b/src/main/java/com/squidex/api/types/UIFieldEditor.java new file mode 100644 index 0000000..528b2c7 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UIFieldEditor.java @@ -0,0 +1,76 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(UIFieldEditor.Adapter.class) +public enum UIFieldEditor { + + SEPARATOR("Separator"); + + private String value; + + UIFieldEditor(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static UIFieldEditor fromValue(String value) { + for (UIFieldEditor b : UIFieldEditor.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 UIFieldEditor enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public UIFieldEditor read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return UIFieldEditor.fromValue(value); + } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + UIFieldEditor.fromValue(value); + } +} + diff --git a/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java index 561490d..66926da 100644 --- a/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java +++ b/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java @@ -1,83 +1,232 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; import java.util.Objects; -import java.util.Optional; +import com.google.gson.TypeAdapter; +import 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.squidex.api.types.FieldPropertiesDto; +import com.squidex.api.types.UIFieldEditor; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.openapitools.jackson.nullable.JsonNullable; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UiFieldPropertiesDto.Builder.class) -public final class UiFieldPropertiesDto { - private final Optional editor; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private UiFieldPropertiesDto(Optional editor) { - this.editor = editor; - } +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The editor that is used to manage this field. - */ - @JsonProperty("editor") - public Optional getEditor() { - return editor; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UiFieldPropertiesDto && equalTo((UiFieldPropertiesDto) other); - } +/** + * UIFieldPropertiesDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UIFieldPropertiesDto extends FieldPropertiesDto { + public static final String SERIALIZED_NAME_EDITOR = "editor"; + @SerializedName(SERIALIZED_NAME_EDITOR) + private UIFieldEditor editor; + public UIFieldPropertiesDto() { + } + public UIFieldPropertiesDto editor(UIFieldEditor editor) { + this.editor = editor; + return this; + } - private boolean equalTo(UiFieldPropertiesDto other) { - return editor.equals(other.editor); - } + /** + * Get editor + * @return editor + */ + @javax.annotation.Nullable + public UIFieldEditor getEditor() { + return editor; + } - @Override - public int hashCode() { - return Objects.hash(this.editor); + public void setEditor(UIFieldEditor editor) { + this.editor = editor; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + UIFieldPropertiesDto uiFieldPropertiesDto = (UIFieldPropertiesDto) o; + return Objects.equals(this.editor, uiFieldPropertiesDto.editor) && + super.equals(o); + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + 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(editor, super.hashCode()); + } + + 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 UIFieldPropertiesDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" editor: ").append(toIndentedString(editor)).append("\n"); + sb.append("}"); + return sb.toString(); + } - public static Builder builder() { - return new Builder(); + /** + * 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 "); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional editor = Optional.empty(); - private Builder() {} + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - public Builder from(UiFieldPropertiesDto other) { - editor(other.getEditor()); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("label"); + openapiFields.add("hints"); + openapiFields.add("placeholder"); + openapiFields.add("isRequired"); + openapiFields.add("isRequiredOnPublish"); + openapiFields.add("isHalfWidth"); + openapiFields.add("editorUrl"); + openapiFields.add("tags"); + openapiFields.add("fieldType"); + openapiFields.add("editor"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("fieldType"); + } - @JsonSetter(value = "editor", nulls = Nulls.SKIP) - public Builder editor(Optional editor) { - this.editor = editor; - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UIFieldPropertiesDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UIFieldPropertiesDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UIFieldPropertiesDto is not found in the empty JSON string", UIFieldPropertiesDto.openapiRequiredFields.toString())); } + } - public Builder editor(String editor) { - this.editor = Optional.of(editor); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UIFieldPropertiesDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UIFieldPropertiesDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public UiFieldPropertiesDto build() { - return new UiFieldPropertiesDto(editor); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UIFieldPropertiesDto.openapiRequiredFields) { + if (jsonElement.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 (!UIFieldPropertiesDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UIFieldPropertiesDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UIFieldPropertiesDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UIFieldPropertiesDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UIFieldPropertiesDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of UIFieldPropertiesDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UIFieldPropertiesDto + * @throws IOException if the JSON string is invalid with respect to UIFieldPropertiesDto + */ + public static UIFieldPropertiesDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UIFieldPropertiesDto.class); + } + + /** + * Convert an instance of UIFieldPropertiesDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/UpdateAppDto.java b/src/main/java/com/squidex/api/types/UpdateAppDto.java new file mode 100644 index 0000000..2981160 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateAppDto.java @@ -0,0 +1,239 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * UpdateAppDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateAppDto { + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + private String label; + public static final String SERIALIZED_NAME_DESCRIPTION = "description"; + @SerializedName(SERIALIZED_NAME_DESCRIPTION) + private String description; + public UpdateAppDto() { + } + public UpdateAppDto label(String label) { + this.label = label; + return this; + } + + /** + * The optional label of your app. + * @return label + */ + @javax.annotation.Nullable + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + public UpdateAppDto description(String description) { + this.description = description; + return this; + } + + /** + * The optional description of your app. + * @return description + */ + @javax.annotation.Nullable + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateAppDto updateAppDto = (UpdateAppDto) o; + return Objects.equals(this.label, updateAppDto.label) && + Objects.equals(this.description, updateAppDto.description); + } + + 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(label, description); + } + + 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 UpdateAppDto {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" description: ").append(toIndentedString(description)).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("label"); + openapiFields.add("description"); + + // 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 UpdateAppDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAppDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateAppDto is not found in the empty JSON string", UpdateAppDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateAppDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateAppDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("label") != null && !jsonObj.get("label").isJsonNull()) && !jsonObj.get("label").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `label` to be a primitive type in the JSON string but got `%s`", jsonObj.get("label").toString())); + } + if ((jsonObj.get("description") != null && !jsonObj.get("description").isJsonNull()) && !jsonObj.get("description").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `description` to be a primitive type in the JSON string but got `%s`", jsonObj.get("description").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAppDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAppDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateAppDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAppDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAppDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAppDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAppDto + * @throws IOException if the JSON string is invalid with respect to UpdateAppDto + */ + public static UpdateAppDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAppDto.class); + } + + /** + * Convert an instance of UpdateAppDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateAppSettingsDto.java b/src/main/java/com/squidex/api/types/UpdateAppSettingsDto.java new file mode 100644 index 0000000..469af57 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateAppSettingsDto.java @@ -0,0 +1,316 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.EditorDto; +import com.squidex.api.types.PatternDto; +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.squidex.api.core.JSON; + +/** + * UpdateAppSettingsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateAppSettingsDto { + public static final String SERIALIZED_NAME_PATTERNS = "patterns"; + @SerializedName(SERIALIZED_NAME_PATTERNS) + private List patterns = new ArrayList<>(); + public static final String SERIALIZED_NAME_EDITORS = "editors"; + @SerializedName(SERIALIZED_NAME_EDITORS) + private List editors = new ArrayList<>(); + public static final String SERIALIZED_NAME_HIDE_SCHEDULER = "hideScheduler"; + @SerializedName(SERIALIZED_NAME_HIDE_SCHEDULER) + private Boolean hideScheduler; + public static final String SERIALIZED_NAME_HIDE_DATE_TIME_MODE_BUTTON = "hideDateTimeModeButton"; + @SerializedName(SERIALIZED_NAME_HIDE_DATE_TIME_MODE_BUTTON) + private Boolean hideDateTimeModeButton; + public UpdateAppSettingsDto() { + } + public UpdateAppSettingsDto patterns(List patterns) { + this.patterns = patterns; + return this; + } + + public UpdateAppSettingsDto addPatternsItem(PatternDto patternsItem) { + if (this.patterns == null) { + this.patterns = new ArrayList<>(); + } + this.patterns.add(patternsItem); + return this; + } + + /** + * The configured app patterns. + * @return patterns + */ + @javax.annotation.Nonnull + public List getPatterns() { + return patterns; + } + + public void setPatterns(List patterns) { + this.patterns = patterns; + } + public UpdateAppSettingsDto editors(List editors) { + this.editors = editors; + return this; + } + + public UpdateAppSettingsDto addEditorsItem(EditorDto editorsItem) { + if (this.editors == null) { + this.editors = new ArrayList<>(); + } + this.editors.add(editorsItem); + return this; + } + + /** + * The configured UI editors. + * @return editors + */ + @javax.annotation.Nonnull + public List getEditors() { + return editors; + } + + public void setEditors(List editors) { + this.editors = editors; + } + public UpdateAppSettingsDto hideScheduler(Boolean hideScheduler) { + this.hideScheduler = hideScheduler; + return this; + } + + /** + * Hide the scheduler for content items. + * @return hideScheduler + */ + @javax.annotation.Nullable + public Boolean getHideScheduler() { + return hideScheduler; + } + + public void setHideScheduler(Boolean hideScheduler) { + this.hideScheduler = hideScheduler; + } + public UpdateAppSettingsDto hideDateTimeModeButton(Boolean hideDateTimeModeButton) { + this.hideDateTimeModeButton = hideDateTimeModeButton; + return this; + } + + /** + * Hide the datetime mode button. + * @return hideDateTimeModeButton + */ + @javax.annotation.Nullable + public Boolean getHideDateTimeModeButton() { + return hideDateTimeModeButton; + } + + public void setHideDateTimeModeButton(Boolean hideDateTimeModeButton) { + this.hideDateTimeModeButton = hideDateTimeModeButton; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateAppSettingsDto updateAppSettingsDto = (UpdateAppSettingsDto) o; + return Objects.equals(this.patterns, updateAppSettingsDto.patterns) && + Objects.equals(this.editors, updateAppSettingsDto.editors) && + Objects.equals(this.hideScheduler, updateAppSettingsDto.hideScheduler) && + Objects.equals(this.hideDateTimeModeButton, updateAppSettingsDto.hideDateTimeModeButton); + } + + @Override + public int hashCode() { + return Objects.hash(patterns, editors, hideScheduler, hideDateTimeModeButton); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateAppSettingsDto {\n"); + sb.append(" patterns: ").append(toIndentedString(patterns)).append("\n"); + sb.append(" editors: ").append(toIndentedString(editors)).append("\n"); + sb.append(" hideScheduler: ").append(toIndentedString(hideScheduler)).append("\n"); + sb.append(" hideDateTimeModeButton: ").append(toIndentedString(hideDateTimeModeButton)).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("patterns"); + openapiFields.add("editors"); + openapiFields.add("hideScheduler"); + openapiFields.add("hideDateTimeModeButton"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("patterns"); + openapiRequiredFields.add("editors"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateAppSettingsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAppSettingsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateAppSettingsDto is not found in the empty JSON string", UpdateAppSettingsDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateAppSettingsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateAppSettingsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateAppSettingsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("patterns").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `patterns` to be an array in the JSON string but got `%s`", jsonObj.get("patterns").toString())); + } + + JsonArray jsonArraypatterns = jsonObj.getAsJsonArray("patterns"); + // validate the required field `patterns` (array) + for (int i = 0; i < jsonArraypatterns.size(); i++) { + PatternDto.validateJsonElement(jsonArraypatterns.get(i)); + }; + // ensure the json data is an array + if (!jsonObj.get("editors").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `editors` to be an array in the JSON string but got `%s`", jsonObj.get("editors").toString())); + } + + JsonArray jsonArrayeditors = jsonObj.getAsJsonArray("editors"); + // validate the required field `editors` (array) + for (int i = 0; i < jsonArrayeditors.size(); i++) { + EditorDto.validateJsonElement(jsonArrayeditors.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAppSettingsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAppSettingsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateAppSettingsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAppSettingsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAppSettingsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAppSettingsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAppSettingsDto + * @throws IOException if the JSON string is invalid with respect to UpdateAppSettingsDto + */ + public static UpdateAppSettingsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAppSettingsDto.class); + } + + /** + * Convert an instance of UpdateAppSettingsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateAssetScriptsDto.java b/src/main/java/com/squidex/api/types/UpdateAssetScriptsDto.java new file mode 100644 index 0000000..e75c19c --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateAssetScriptsDto.java @@ -0,0 +1,369 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * UpdateAssetScriptsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateAssetScriptsDto { + public static final String SERIALIZED_NAME_QUERY = "query"; + @SerializedName(SERIALIZED_NAME_QUERY) + private String query; + public static final String SERIALIZED_NAME_QUERY_PRE = "queryPre"; + @SerializedName(SERIALIZED_NAME_QUERY_PRE) + private String queryPre; + public static final String SERIALIZED_NAME_CREATE = "create"; + @SerializedName(SERIALIZED_NAME_CREATE) + private String create; + public static final String SERIALIZED_NAME_UPDATE = "update"; + @SerializedName(SERIALIZED_NAME_UPDATE) + private String update; + public static final String SERIALIZED_NAME_ANNOTATE = "annotate"; + @SerializedName(SERIALIZED_NAME_ANNOTATE) + private String annotate; + public static final String SERIALIZED_NAME_MOVE = "move"; + @SerializedName(SERIALIZED_NAME_MOVE) + private String move; + public static final String SERIALIZED_NAME_DELETE = "delete"; + @SerializedName(SERIALIZED_NAME_DELETE) + private String delete; + public UpdateAssetScriptsDto() { + } + public UpdateAssetScriptsDto query(String query) { + this.query = query; + return this; + } + + /** + * The script that is executed for each asset when querying assets. + * @return query + */ + @javax.annotation.Nullable + public String getQuery() { + return query; + } + + public void setQuery(String query) { + this.query = query; + } + public UpdateAssetScriptsDto queryPre(String queryPre) { + this.queryPre = queryPre; + return this; + } + + /** + * The script that is executed for all assets when querying assets. + * @return queryPre + */ + @javax.annotation.Nullable + public String getQueryPre() { + return queryPre; + } + + public void setQueryPre(String queryPre) { + this.queryPre = queryPre; + } + public UpdateAssetScriptsDto create(String create) { + this.create = create; + return this; + } + + /** + * The script that is executed when creating an asset. + * @return create + */ + @javax.annotation.Nullable + public String getCreate() { + return create; + } + + public void setCreate(String create) { + this.create = create; + } + public UpdateAssetScriptsDto update(String update) { + this.update = update; + return this; + } + + /** + * The script that is executed when updating a content. + * @return update + */ + @javax.annotation.Nullable + public String getUpdate() { + return update; + } + + public void setUpdate(String update) { + this.update = update; + } + public UpdateAssetScriptsDto annotate(String annotate) { + this.annotate = annotate; + return this; + } + + /** + * The script that is executed when annotating a content. + * @return annotate + */ + @javax.annotation.Nullable + public String getAnnotate() { + return annotate; + } + + public void setAnnotate(String annotate) { + this.annotate = annotate; + } + public UpdateAssetScriptsDto move(String move) { + this.move = move; + return this; + } + + /** + * The script that is executed when moving a content. + * @return move + */ + @javax.annotation.Nullable + public String getMove() { + return move; + } + + public void setMove(String move) { + this.move = move; + } + public UpdateAssetScriptsDto delete(String delete) { + this.delete = delete; + return this; + } + + /** + * The script that is executed when deleting a content. + * @return delete + */ + @javax.annotation.Nullable + public String getDelete() { + return delete; + } + + public void setDelete(String delete) { + this.delete = delete; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateAssetScriptsDto updateAssetScriptsDto = (UpdateAssetScriptsDto) o; + return Objects.equals(this.query, updateAssetScriptsDto.query) && + Objects.equals(this.queryPre, updateAssetScriptsDto.queryPre) && + Objects.equals(this.create, updateAssetScriptsDto.create) && + Objects.equals(this.update, updateAssetScriptsDto.update) && + Objects.equals(this.annotate, updateAssetScriptsDto.annotate) && + Objects.equals(this.move, updateAssetScriptsDto.move) && + Objects.equals(this.delete, updateAssetScriptsDto.delete); + } + + 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(query, queryPre, create, update, annotate, move, delete); + } + + 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 UpdateAssetScriptsDto {\n"); + sb.append(" query: ").append(toIndentedString(query)).append("\n"); + sb.append(" queryPre: ").append(toIndentedString(queryPre)).append("\n"); + sb.append(" create: ").append(toIndentedString(create)).append("\n"); + sb.append(" update: ").append(toIndentedString(update)).append("\n"); + sb.append(" annotate: ").append(toIndentedString(annotate)).append("\n"); + sb.append(" move: ").append(toIndentedString(move)).append("\n"); + sb.append(" delete: ").append(toIndentedString(delete)).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("query"); + openapiFields.add("queryPre"); + openapiFields.add("create"); + openapiFields.add("update"); + openapiFields.add("annotate"); + openapiFields.add("move"); + openapiFields.add("delete"); + + // 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 UpdateAssetScriptsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateAssetScriptsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateAssetScriptsDto is not found in the empty JSON string", UpdateAssetScriptsDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateAssetScriptsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateAssetScriptsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("query") != null && !jsonObj.get("query").isJsonNull()) && !jsonObj.get("query").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `query` to be a primitive type in the JSON string but got `%s`", jsonObj.get("query").toString())); + } + if ((jsonObj.get("queryPre") != null && !jsonObj.get("queryPre").isJsonNull()) && !jsonObj.get("queryPre").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `queryPre` to be a primitive type in the JSON string but got `%s`", jsonObj.get("queryPre").toString())); + } + if ((jsonObj.get("create") != null && !jsonObj.get("create").isJsonNull()) && !jsonObj.get("create").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `create` to be a primitive type in the JSON string but got `%s`", jsonObj.get("create").toString())); + } + if ((jsonObj.get("update") != null && !jsonObj.get("update").isJsonNull()) && !jsonObj.get("update").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `update` to be a primitive type in the JSON string but got `%s`", jsonObj.get("update").toString())); + } + if ((jsonObj.get("annotate") != null && !jsonObj.get("annotate").isJsonNull()) && !jsonObj.get("annotate").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `annotate` to be a primitive type in the JSON string but got `%s`", jsonObj.get("annotate").toString())); + } + if ((jsonObj.get("move") != null && !jsonObj.get("move").isJsonNull()) && !jsonObj.get("move").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `move` to be a primitive type in the JSON string but got `%s`", jsonObj.get("move").toString())); + } + if ((jsonObj.get("delete") != null && !jsonObj.get("delete").isJsonNull()) && !jsonObj.get("delete").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `delete` to be a primitive type in the JSON string but got `%s`", jsonObj.get("delete").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateAssetScriptsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateAssetScriptsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateAssetScriptsDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateAssetScriptsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateAssetScriptsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateAssetScriptsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateAssetScriptsDto + * @throws IOException if the JSON string is invalid with respect to UpdateAssetScriptsDto + */ + public static UpdateAssetScriptsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateAssetScriptsDto.class); + } + + /** + * Convert an instance of UpdateAssetScriptsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateClientDto.java b/src/main/java/com/squidex/api/types/UpdateClientDto.java new file mode 100644 index 0000000..5ed4714 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateClientDto.java @@ -0,0 +1,308 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * UpdateClientDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateClientDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_ROLE = "role"; + @SerializedName(SERIALIZED_NAME_ROLE) + private String role; + public static final String SERIALIZED_NAME_ALLOW_ANONYMOUS = "allowAnonymous"; + @SerializedName(SERIALIZED_NAME_ALLOW_ANONYMOUS) + private Boolean allowAnonymous; + public static final String SERIALIZED_NAME_API_CALLS_LIMIT = "apiCallsLimit"; + @SerializedName(SERIALIZED_NAME_API_CALLS_LIMIT) + private Long apiCallsLimit; + public static final String SERIALIZED_NAME_API_TRAFFIC_LIMIT = "apiTrafficLimit"; + @SerializedName(SERIALIZED_NAME_API_TRAFFIC_LIMIT) + private Long apiTrafficLimit; + public UpdateClientDto() { + } + public UpdateClientDto name(String name) { + this.name = name; + return this; + } + + /** + * The new display name of the client. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public UpdateClientDto role(String role) { + this.role = role; + return this; + } + + /** + * The role of the client. + * @return role + */ + @javax.annotation.Nullable + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + public UpdateClientDto allowAnonymous(Boolean allowAnonymous) { + this.allowAnonymous = allowAnonymous; + return this; + } + + /** + * True to allow anonymous access without an access token for this client. + * @return allowAnonymous + */ + @javax.annotation.Nullable + public Boolean getAllowAnonymous() { + return allowAnonymous; + } + + public void setAllowAnonymous(Boolean allowAnonymous) { + this.allowAnonymous = allowAnonymous; + } + public UpdateClientDto apiCallsLimit(Long apiCallsLimit) { + this.apiCallsLimit = apiCallsLimit; + return this; + } + + /** + * The number of allowed api calls per month for this client. + * @return apiCallsLimit + */ + @javax.annotation.Nullable + public Long getApiCallsLimit() { + return apiCallsLimit; + } + + public void setApiCallsLimit(Long apiCallsLimit) { + this.apiCallsLimit = apiCallsLimit; + } + public UpdateClientDto apiTrafficLimit(Long apiTrafficLimit) { + this.apiTrafficLimit = apiTrafficLimit; + return this; + } + + /** + * The number of allowed api traffic bytes per month for this client. + * @return apiTrafficLimit + */ + @javax.annotation.Nullable + public Long getApiTrafficLimit() { + return apiTrafficLimit; + } + + public void setApiTrafficLimit(Long apiTrafficLimit) { + this.apiTrafficLimit = apiTrafficLimit; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateClientDto updateClientDto = (UpdateClientDto) o; + return Objects.equals(this.name, updateClientDto.name) && + Objects.equals(this.role, updateClientDto.role) && + Objects.equals(this.allowAnonymous, updateClientDto.allowAnonymous) && + Objects.equals(this.apiCallsLimit, updateClientDto.apiCallsLimit) && + Objects.equals(this.apiTrafficLimit, updateClientDto.apiTrafficLimit); + } + + 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(name, role, allowAnonymous, apiCallsLimit, apiTrafficLimit); + } + + 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 UpdateClientDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" role: ").append(toIndentedString(role)).append("\n"); + sb.append(" allowAnonymous: ").append(toIndentedString(allowAnonymous)).append("\n"); + sb.append(" apiCallsLimit: ").append(toIndentedString(apiCallsLimit)).append("\n"); + sb.append(" apiTrafficLimit: ").append(toIndentedString(apiTrafficLimit)).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("role"); + openapiFields.add("allowAnonymous"); + openapiFields.add("apiCallsLimit"); + openapiFields.add("apiTrafficLimit"); + + // 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 UpdateClientDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateClientDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateClientDto is not found in the empty JSON string", UpdateClientDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateClientDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateClientDto` 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("role") != null && !jsonObj.get("role").isJsonNull()) && !jsonObj.get("role").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `role` to be a primitive type in the JSON string but got `%s`", jsonObj.get("role").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateClientDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateClientDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateClientDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateClientDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateClientDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateClientDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateClientDto + * @throws IOException if the JSON string is invalid with respect to UpdateClientDto + */ + public static UpdateClientDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateClientDto.class); + } + + /** + * Convert an instance of UpdateClientDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateFieldDto.java b/src/main/java/com/squidex/api/types/UpdateFieldDto.java index 6ac3512..770fad3 100644 --- a/src/main/java/com/squidex/api/types/UpdateFieldDto.java +++ b/src/main/java/com/squidex/api/types/UpdateFieldDto.java @@ -1,93 +1,209 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateFieldDto.Builder.class) -public final class UpdateFieldDto { - private final FieldPropertiesDto properties; - - private UpdateFieldDto(FieldPropertiesDto properties) { - this.properties = properties; - } - /** - * @return The field properties. - */ - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateFieldDto && equalTo((UpdateFieldDto) other); - } - private boolean equalTo(UpdateFieldDto other) { - return properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash(this.properties); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.types.FieldPropertiesDto; +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.squidex.api.core.JSON; - public static PropertiesStage builder() { - return new Builder(); +/** + * UpdateFieldDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateFieldDto { + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private FieldPropertiesDto properties; + public UpdateFieldDto() { + } + public UpdateFieldDto properties(FieldPropertiesDto properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nonnull + public FieldPropertiesDto getProperties() { + return properties; + } + + public void setProperties(FieldPropertiesDto properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); - - Builder from(UpdateFieldDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - UpdateFieldDto build(); + UpdateFieldDto updateFieldDto = (UpdateFieldDto) o; + return Objects.equals(this.properties, updateFieldDto.properties); + } + + @Override + public int hashCode() { + return Objects.hash(properties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateFieldDto {\n"); + sb.append(" properties: ").append(toIndentedString(properties)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements PropertiesStage, _FinalStage { - private FieldPropertiesDto properties; - - private Builder() {} - - @Override - public Builder from(UpdateFieldDto other) { - properties(other.getProperties()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("properties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("properties"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateFieldDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateFieldDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateFieldDto is not found in the empty JSON string", UpdateFieldDto.openapiRequiredFields.toString())); } + } - /** - *

The field properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateFieldDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateFieldDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public UpdateFieldDto build() { - return new UpdateFieldDto(properties); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateFieldDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 `properties` + FieldPropertiesDto.validateJsonElement(jsonObj.get("properties")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateFieldDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateFieldDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateFieldDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateFieldDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateFieldDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdateFieldDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateFieldDto + * @throws IOException if the JSON string is invalid with respect to UpdateFieldDto + */ + public static UpdateFieldDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateFieldDto.class); + } + + /** + * Convert an instance of UpdateFieldDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/UpdateLanguageDto.java b/src/main/java/com/squidex/api/types/UpdateLanguageDto.java new file mode 100644 index 0000000..bbec43c --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateLanguageDto.java @@ -0,0 +1,270 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.ArrayList; +import java.util.Arrays; +import java.util.List; +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.squidex.api.core.JSON; + +/** + * UpdateLanguageDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateLanguageDto { + public static final String SERIALIZED_NAME_IS_MASTER = "isMaster"; + @SerializedName(SERIALIZED_NAME_IS_MASTER) + private Boolean isMaster; + public static final String SERIALIZED_NAME_IS_OPTIONAL = "isOptional"; + @SerializedName(SERIALIZED_NAME_IS_OPTIONAL) + private Boolean isOptional; + public static final String SERIALIZED_NAME_FALLBACK = "fallback"; + @SerializedName(SERIALIZED_NAME_FALLBACK) + private List fallback; + public UpdateLanguageDto() { + } + public UpdateLanguageDto isMaster(Boolean isMaster) { + this.isMaster = isMaster; + return this; + } + + /** + * Set the value to true to make the language the master. + * @return isMaster + */ + @javax.annotation.Nullable + public Boolean getIsMaster() { + return isMaster; + } + + public void setIsMaster(Boolean isMaster) { + this.isMaster = isMaster; + } + public UpdateLanguageDto isOptional(Boolean isOptional) { + this.isOptional = isOptional; + return this; + } + + /** + * Set the value to true to make the language optional. + * @return isOptional + */ + @javax.annotation.Nullable + public Boolean getIsOptional() { + return isOptional; + } + + public void setIsOptional(Boolean isOptional) { + this.isOptional = isOptional; + } + public UpdateLanguageDto fallback(List fallback) { + this.fallback = fallback; + return this; + } + + public UpdateLanguageDto addFallbackItem(String fallbackItem) { + if (this.fallback == null) { + this.fallback = new ArrayList<>(); + } + this.fallback.add(fallbackItem); + return this; + } + + /** + * Optional fallback languages. + * @return fallback + */ + @javax.annotation.Nullable + public List getFallback() { + return fallback; + } + + public void setFallback(List fallback) { + this.fallback = fallback; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateLanguageDto updateLanguageDto = (UpdateLanguageDto) o; + return Objects.equals(this.isMaster, updateLanguageDto.isMaster) && + Objects.equals(this.isOptional, updateLanguageDto.isOptional) && + Objects.equals(this.fallback, updateLanguageDto.fallback); + } + + 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(isMaster, isOptional, fallback); + } + + 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 UpdateLanguageDto {\n"); + sb.append(" isMaster: ").append(toIndentedString(isMaster)).append("\n"); + sb.append(" isOptional: ").append(toIndentedString(isOptional)).append("\n"); + sb.append(" fallback: ").append(toIndentedString(fallback)).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("isMaster"); + openapiFields.add("isOptional"); + openapiFields.add("fallback"); + + // 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 UpdateLanguageDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateLanguageDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateLanguageDto is not found in the empty JSON string", UpdateLanguageDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateLanguageDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateLanguageDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // ensure the optional json data is an array if present + if (jsonObj.get("fallback") != null && !jsonObj.get("fallback").isJsonNull() && !jsonObj.get("fallback").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fallback` to be an array in the JSON string but got `%s`", jsonObj.get("fallback").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateLanguageDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateLanguageDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateLanguageDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateLanguageDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateLanguageDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateLanguageDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateLanguageDto + * @throws IOException if the JSON string is invalid with respect to UpdateLanguageDto + */ + public static UpdateLanguageDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateLanguageDto.class); + } + + /** + * Convert an instance of UpdateLanguageDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateProfileDto.java b/src/main/java/com/squidex/api/types/UpdateProfileDto.java new file mode 100644 index 0000000..84e8d25 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateProfileDto.java @@ -0,0 +1,220 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.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.squidex.api.core.JSON; + +/** + * UpdateProfileDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateProfileDto { + public static final String SERIALIZED_NAME_ANSWERS = "answers"; + @SerializedName(SERIALIZED_NAME_ANSWERS) + private Map answers; + public UpdateProfileDto() { + } + public UpdateProfileDto answers(Map answers) { + this.answers = answers; + return this; + } + + public UpdateProfileDto putAnswersItem(String key, String answersItem) { + if (this.answers == null) { + this.answers = new HashMap<>(); + } + this.answers.put(key, answersItem); + return this; + } + + /** + * The answers from a questionaire. + * @return answers + */ + @javax.annotation.Nullable + public Map getAnswers() { + return answers; + } + + public void setAnswers(Map answers) { + this.answers = answers; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateProfileDto updateProfileDto = (UpdateProfileDto) o; + return Objects.equals(this.answers, updateProfileDto.answers); + } + + 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(answers); + } + + 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 UpdateProfileDto {\n"); + sb.append(" answers: ").append(toIndentedString(answers)).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("answers"); + + // 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 UpdateProfileDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateProfileDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateProfileDto is not found in the empty JSON string", UpdateProfileDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateProfileDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateProfileDto` 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 (!UpdateProfileDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateProfileDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateProfileDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateProfileDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateProfileDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateProfileDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateProfileDto + * @throws IOException if the JSON string is invalid with respect to UpdateProfileDto + */ + public static UpdateProfileDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateProfileDto.class); + } + + /** + * Convert an instance of UpdateProfileDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateRoleDto.java b/src/main/java/com/squidex/api/types/UpdateRoleDto.java new file mode 100644 index 0000000..460db00 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateRoleDto.java @@ -0,0 +1,255 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.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.squidex.api.core.JSON; + +/** + * UpdateRoleDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateRoleDto { + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private Map properties = new HashMap<>(); + public UpdateRoleDto() { + } + public UpdateRoleDto permissions(List permissions) { + this.permissions = permissions; + return this; + } + + public UpdateRoleDto addPermissionsItem(String permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } + + /** + * Associated list of permissions. + * @return permissions + */ + @javax.annotation.Nonnull + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + public UpdateRoleDto properties(Map properties) { + this.properties = properties; + return this; + } + + public UpdateRoleDto putPropertiesItem(String key, Object propertiesItem) { + if (this.properties == null) { + this.properties = new HashMap<>(); + } + this.properties.put(key, propertiesItem); + return this; + } + + /** + * Associated list of UI properties. + * @return properties + */ + @javax.annotation.Nullable + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateRoleDto updateRoleDto = (UpdateRoleDto) o; + return Objects.equals(this.permissions, updateRoleDto.permissions) && + Objects.equals(this.properties, updateRoleDto.properties); + } + + @Override + public int hashCode() { + return Objects.hash(permissions, properties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateRoleDto {\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).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("permissions"); + openapiFields.add("properties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("permissions"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateRoleDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateRoleDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateRoleDto is not found in the empty JSON string", UpdateRoleDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateRoleDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateRoleDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateRoleDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 required json array is present + if (jsonObj.get("permissions") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("permissions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be an array in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateRoleDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateRoleDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateRoleDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateRoleDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateRoleDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateRoleDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateRoleDto + * @throws IOException if the JSON string is invalid with respect to UpdateRoleDto + */ + public static UpdateRoleDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateRoleDto.class); + } + + /** + * Convert an instance of UpdateRoleDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateRuleDto.java b/src/main/java/com/squidex/api/types/UpdateRuleDto.java new file mode 100644 index 0000000..87265c7 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateRuleDto.java @@ -0,0 +1,292 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.RuleActionDto; +import com.squidex.api.types.RuleTriggerDto; +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.squidex.api.core.JSON; + +/** + * UpdateRuleDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateRuleDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_TRIGGER = "trigger"; + @SerializedName(SERIALIZED_NAME_TRIGGER) + private RuleTriggerDto trigger; + public static final String SERIALIZED_NAME_ACTION = "action"; + @SerializedName(SERIALIZED_NAME_ACTION) + private RuleActionDto action; + public static final String SERIALIZED_NAME_IS_ENABLED = "isEnabled"; + @SerializedName(SERIALIZED_NAME_IS_ENABLED) + private Boolean isEnabled; + public UpdateRuleDto() { + } + public UpdateRuleDto name(String name) { + this.name = name; + return this; + } + + /** + * Optional rule name. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public UpdateRuleDto trigger(RuleTriggerDto trigger) { + this.trigger = trigger; + return this; + } + + /** + * Get trigger + * @return trigger + */ + @javax.annotation.Nullable + public RuleTriggerDto getTrigger() { + return trigger; + } + + public void setTrigger(RuleTriggerDto trigger) { + this.trigger = trigger; + } + public UpdateRuleDto action(RuleActionDto action) { + this.action = action; + return this; + } + + /** + * Get action + * @return action + */ + @javax.annotation.Nullable + public RuleActionDto getAction() { + return action; + } + + public void setAction(RuleActionDto action) { + this.action = action; + } + public UpdateRuleDto isEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Enable or disable the rule. + * @return isEnabled + */ + @javax.annotation.Nullable + public Boolean getIsEnabled() { + return isEnabled; + } + + public void setIsEnabled(Boolean isEnabled) { + this.isEnabled = isEnabled; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateRuleDto updateRuleDto = (UpdateRuleDto) o; + return Objects.equals(this.name, updateRuleDto.name) && + Objects.equals(this.trigger, updateRuleDto.trigger) && + Objects.equals(this.action, updateRuleDto.action) && + Objects.equals(this.isEnabled, updateRuleDto.isEnabled); + } + + 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(name, trigger, action, isEnabled); + } + + 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 UpdateRuleDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" trigger: ").append(toIndentedString(trigger)).append("\n"); + sb.append(" action: ").append(toIndentedString(action)).append("\n"); + sb.append(" isEnabled: ").append(toIndentedString(isEnabled)).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("trigger"); + openapiFields.add("action"); + openapiFields.add("isEnabled"); + + // 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 UpdateRuleDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateRuleDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateRuleDto is not found in the empty JSON string", UpdateRuleDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateRuleDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateRuleDto` 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())); + } + // validate the optional field `trigger` + if (jsonObj.get("trigger") != null && !jsonObj.get("trigger").isJsonNull()) { + RuleTriggerDto.validateJsonElement(jsonObj.get("trigger")); + } + // validate the optional field `action` + if (jsonObj.get("action") != null && !jsonObj.get("action").isJsonNull()) { + RuleActionDto.validateJsonElement(jsonObj.get("action")); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateRuleDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateRuleDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateRuleDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateRuleDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateRuleDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateRuleDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateRuleDto + * @throws IOException if the JSON string is invalid with respect to UpdateRuleDto + */ + public static UpdateRuleDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateRuleDto.class); + } + + /** + * Convert an instance of UpdateRuleDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateSchemaDto.java b/src/main/java/com/squidex/api/types/UpdateSchemaDto.java new file mode 100644 index 0000000..89be162 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateSchemaDto.java @@ -0,0 +1,377 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.ArrayList; +import java.util.Arrays; +import java.util.List; +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.squidex.api.core.JSON; + +/** + * UpdateSchemaDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateSchemaDto { + public static final String SERIALIZED_NAME_LABEL = "label"; + @SerializedName(SERIALIZED_NAME_LABEL) + private String label; + public static final String SERIALIZED_NAME_HINTS = "hints"; + @SerializedName(SERIALIZED_NAME_HINTS) + private String hints; + public static final String SERIALIZED_NAME_CONTENTS_SIDEBAR_URL = "contentsSidebarUrl"; + @SerializedName(SERIALIZED_NAME_CONTENTS_SIDEBAR_URL) + private String contentsSidebarUrl; + public static final String SERIALIZED_NAME_CONTENT_SIDEBAR_URL = "contentSidebarUrl"; + @SerializedName(SERIALIZED_NAME_CONTENT_SIDEBAR_URL) + private String contentSidebarUrl; + public static final String SERIALIZED_NAME_CONTENTS_LIST_URL = "contentsListUrl"; + @SerializedName(SERIALIZED_NAME_CONTENTS_LIST_URL) + private String contentsListUrl; + public static final String SERIALIZED_NAME_VALIDATE_ON_PUBLISH = "validateOnPublish"; + @SerializedName(SERIALIZED_NAME_VALIDATE_ON_PUBLISH) + private Boolean validateOnPublish; + public static final String SERIALIZED_NAME_TAGS = "tags"; + @SerializedName(SERIALIZED_NAME_TAGS) + private List tags; + public UpdateSchemaDto() { + } + public UpdateSchemaDto label(String label) { + this.label = label; + return this; + } + + /** + * Optional label for the editor. + * @return label + */ + @javax.annotation.Nullable + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + public UpdateSchemaDto hints(String hints) { + this.hints = hints; + return this; + } + + /** + * Hints to describe the schema. + * @return hints + */ + @javax.annotation.Nullable + public String getHints() { + return hints; + } + + public void setHints(String hints) { + this.hints = hints; + } + public UpdateSchemaDto contentsSidebarUrl(String contentsSidebarUrl) { + this.contentsSidebarUrl = contentsSidebarUrl; + return this; + } + + /** + * The url to a the sidebar plugin for content lists. + * @return contentsSidebarUrl + */ + @javax.annotation.Nullable + public String getContentsSidebarUrl() { + return contentsSidebarUrl; + } + + public void setContentsSidebarUrl(String contentsSidebarUrl) { + this.contentsSidebarUrl = contentsSidebarUrl; + } + public UpdateSchemaDto contentSidebarUrl(String contentSidebarUrl) { + this.contentSidebarUrl = contentSidebarUrl; + return this; + } + + /** + * The url to a the sidebar plugin for content items. + * @return contentSidebarUrl + */ + @javax.annotation.Nullable + public String getContentSidebarUrl() { + return contentSidebarUrl; + } + + public void setContentSidebarUrl(String contentSidebarUrl) { + this.contentSidebarUrl = contentSidebarUrl; + } + public UpdateSchemaDto contentsListUrl(String contentsListUrl) { + this.contentsListUrl = contentsListUrl; + return this; + } + + /** + * The url to the content list plugin. + * @return contentsListUrl + */ + @javax.annotation.Nullable + public String getContentsListUrl() { + return contentsListUrl; + } + + public void setContentsListUrl(String contentsListUrl) { + this.contentsListUrl = contentsListUrl; + } + public UpdateSchemaDto validateOnPublish(Boolean validateOnPublish) { + this.validateOnPublish = validateOnPublish; + return this; + } + + /** + * True to validate the content items on publish. + * @return validateOnPublish + */ + @javax.annotation.Nullable + public Boolean getValidateOnPublish() { + return validateOnPublish; + } + + public void setValidateOnPublish(Boolean validateOnPublish) { + this.validateOnPublish = validateOnPublish; + } + public UpdateSchemaDto tags(List tags) { + this.tags = tags; + return this; + } + + public UpdateSchemaDto addTagsItem(String tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Tags for automation processes. + * @return tags + */ + @javax.annotation.Nullable + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateSchemaDto updateSchemaDto = (UpdateSchemaDto) o; + return Objects.equals(this.label, updateSchemaDto.label) && + Objects.equals(this.hints, updateSchemaDto.hints) && + Objects.equals(this.contentsSidebarUrl, updateSchemaDto.contentsSidebarUrl) && + Objects.equals(this.contentSidebarUrl, updateSchemaDto.contentSidebarUrl) && + Objects.equals(this.contentsListUrl, updateSchemaDto.contentsListUrl) && + Objects.equals(this.validateOnPublish, updateSchemaDto.validateOnPublish) && + Objects.equals(this.tags, updateSchemaDto.tags); + } + + 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(label, hints, contentsSidebarUrl, contentSidebarUrl, contentsListUrl, validateOnPublish, tags); + } + + 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 UpdateSchemaDto {\n"); + sb.append(" label: ").append(toIndentedString(label)).append("\n"); + sb.append(" hints: ").append(toIndentedString(hints)).append("\n"); + sb.append(" contentsSidebarUrl: ").append(toIndentedString(contentsSidebarUrl)).append("\n"); + sb.append(" contentSidebarUrl: ").append(toIndentedString(contentSidebarUrl)).append("\n"); + sb.append(" contentsListUrl: ").append(toIndentedString(contentsListUrl)).append("\n"); + sb.append(" validateOnPublish: ").append(toIndentedString(validateOnPublish)).append("\n"); + sb.append(" tags: ").append(toIndentedString(tags)).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("label"); + openapiFields.add("hints"); + openapiFields.add("contentsSidebarUrl"); + openapiFields.add("contentSidebarUrl"); + openapiFields.add("contentsListUrl"); + openapiFields.add("validateOnPublish"); + openapiFields.add("tags"); + + // 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 UpdateSchemaDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSchemaDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSchemaDto is not found in the empty JSON string", UpdateSchemaDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSchemaDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSchemaDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("label") != null && !jsonObj.get("label").isJsonNull()) && !jsonObj.get("label").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `label` to be a primitive type in the JSON string but got `%s`", jsonObj.get("label").toString())); + } + if ((jsonObj.get("hints") != null && !jsonObj.get("hints").isJsonNull()) && !jsonObj.get("hints").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `hints` to be a primitive type in the JSON string but got `%s`", jsonObj.get("hints").toString())); + } + if ((jsonObj.get("contentsSidebarUrl") != null && !jsonObj.get("contentsSidebarUrl").isJsonNull()) && !jsonObj.get("contentsSidebarUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentsSidebarUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentsSidebarUrl").toString())); + } + if ((jsonObj.get("contentSidebarUrl") != null && !jsonObj.get("contentSidebarUrl").isJsonNull()) && !jsonObj.get("contentSidebarUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentSidebarUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentSidebarUrl").toString())); + } + if ((jsonObj.get("contentsListUrl") != null && !jsonObj.get("contentsListUrl").isJsonNull()) && !jsonObj.get("contentsListUrl").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `contentsListUrl` to be a primitive type in the JSON string but got `%s`", jsonObj.get("contentsListUrl").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("tags") != null && !jsonObj.get("tags").isJsonNull() && !jsonObj.get("tags").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `tags` to be an array in the JSON string but got `%s`", jsonObj.get("tags").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateSchemaDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSchemaDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSchemaDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSchemaDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSchemaDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateSchemaDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSchemaDto + * @throws IOException if the JSON string is invalid with respect to UpdateSchemaDto + */ + public static UpdateSchemaDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSchemaDto.class); + } + + /** + * Convert an instance of UpdateSchemaDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateSettingDto.java b/src/main/java/com/squidex/api/types/UpdateSettingDto.java index d48bafc..ca10a56 100644 --- a/src/main/java/com/squidex/api/types/UpdateSettingDto.java +++ b/src/main/java/com/squidex/api/types/UpdateSettingDto.java @@ -1,86 +1,206 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpdateSettingDto.Builder.class) -public final class UpdateSettingDto { - private final Object value; - - private UpdateSettingDto(Object value) { - this.value = value; - } - - @JsonProperty("value") - public Object getValue() { - return value; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateSettingDto && equalTo((UpdateSettingDto) other); - } - - private boolean equalTo(UpdateSettingDto other) { - return value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.value); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.core.JSON; - public static ValueStage builder() { - return new Builder(); +/** + * UpdateSettingDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateSettingDto { + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private Object value = null; + public UpdateSettingDto() { + } + public UpdateSettingDto value(Object value) { + this.value = value; + return this; + } + + /** + * The value for the setting. + * @return value + */ + @javax.annotation.Nullable + public Object getValue() { + return value; + } + + public void setValue(Object value) { + this.value = value; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ValueStage { - _FinalStage value(Object value); - - Builder from(UpdateSettingDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - UpdateSettingDto build(); + UpdateSettingDto updateSettingDto = (UpdateSettingDto) o; + return Objects.equals(this.value, updateSettingDto.value); + } + + @Override + public int hashCode() { + return Objects.hash(value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateSettingDto {\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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements ValueStage, _FinalStage { - private Object value; - - private Builder() {} - - @Override - public Builder from(UpdateSettingDto other) { - value(other.getValue()); - return this; + return o.toString().replace("\n", "\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(); + 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 UpdateSettingDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateSettingDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateSettingDto is not found in the empty JSON string", UpdateSettingDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter("value") - public _FinalStage value(Object value) { - this.value = value; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateSettingDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateSettingDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public UpdateSettingDto build() { - return new UpdateSettingDto(value); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateSettingDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!UpdateSettingDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateSettingDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateSettingDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateSettingDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateSettingDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpdateSettingDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateSettingDto + * @throws IOException if the JSON string is invalid with respect to UpdateSettingDto + */ + public static UpdateSettingDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateSettingDto.class); + } + + /** + * Convert an instance of UpdateSettingDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/UpdateTeamDto.java b/src/main/java/com/squidex/api/types/UpdateTeamDto.java new file mode 100644 index 0000000..3f9c52d --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateTeamDto.java @@ -0,0 +1,209 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.core.JSON; + +/** + * UpdateTeamDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateTeamDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public UpdateTeamDto() { + } + public UpdateTeamDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the team. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateTeamDto updateTeamDto = (UpdateTeamDto) o; + return Objects.equals(this.name, updateTeamDto.name); + } + + @Override + public int hashCode() { + return Objects.hash(name); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpdateTeamDto {\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("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 UpdateTeamDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateTeamDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateTeamDto is not found in the empty JSON string", UpdateTeamDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateTeamDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateTeamDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateTeamDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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 (!UpdateTeamDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateTeamDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateTeamDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateTeamDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateTeamDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateTeamDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateTeamDto + * @throws IOException if the JSON string is invalid with respect to UpdateTeamDto + */ + public static UpdateTeamDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateTeamDto.class); + } + + /** + * Convert an instance of UpdateTeamDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateUserDto.java b/src/main/java/com/squidex/api/types/UpdateUserDto.java new file mode 100644 index 0000000..dd9a9dd --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateUserDto.java @@ -0,0 +1,314 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.ArrayList; +import java.util.Arrays; +import java.util.List; +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.squidex.api.core.JSON; + +/** + * UpdateUserDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateUserDto { + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + private String displayName; + public static final String SERIALIZED_NAME_PASSWORD = "password"; + @SerializedName(SERIALIZED_NAME_PASSWORD) + private String password; + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); + public UpdateUserDto() { + } + public UpdateUserDto email(String email) { + this.email = email; + return this; + } + + /** + * The email of the user. Unique value. + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + public UpdateUserDto displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The display name (usually first name and last name) of the user. + * @return displayName + */ + @javax.annotation.Nonnull + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + public UpdateUserDto password(String password) { + this.password = password; + return this; + } + + /** + * The password of the user. + * @return password + */ + @javax.annotation.Nullable + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + public UpdateUserDto permissions(List permissions) { + this.permissions = permissions; + return this; + } + + public UpdateUserDto addPermissionsItem(String permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); + } + this.permissions.add(permissionsItem); + return this; + } + + /** + * Additional permissions for the user. + * @return permissions + */ + @javax.annotation.Nonnull + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateUserDto updateUserDto = (UpdateUserDto) o; + return Objects.equals(this.email, updateUserDto.email) && + Objects.equals(this.displayName, updateUserDto.displayName) && + Objects.equals(this.password, updateUserDto.password) && + Objects.equals(this.permissions, updateUserDto.permissions); + } + + 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(email, displayName, password, permissions); + } + + 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 UpdateUserDto {\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).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("email"); + openapiFields.add("displayName"); + openapiFields.add("password"); + openapiFields.add("permissions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("displayName"); + openapiRequiredFields.add("permissions"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateUserDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateUserDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateUserDto is not found in the empty JSON string", UpdateUserDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateUserDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateUserDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateUserDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").toString())); + } + if ((jsonObj.get("password") != null && !jsonObj.get("password").isJsonNull()) && !jsonObj.get("password").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `password` to be a primitive type in the JSON string but got `%s`", jsonObj.get("password").toString())); + } + // ensure the required json array is present + if (jsonObj.get("permissions") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("permissions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be an array in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateUserDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateUserDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateUserDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateUserDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateUserDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateUserDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateUserDto + * @throws IOException if the JSON string is invalid with respect to UpdateUserDto + */ + public static UpdateUserDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateUserDto.class); + } + + /** + * Convert an instance of UpdateUserDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateWorkflowDto.java b/src/main/java/com/squidex/api/types/UpdateWorkflowDto.java new file mode 100644 index 0000000..7d41682 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateWorkflowDto.java @@ -0,0 +1,319 @@ +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; + +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.squidex.api.types.WorkflowStepDto; +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 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.squidex.api.core.JSON; + +/** + * UpdateWorkflowDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpdateWorkflowDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_STEPS = "steps"; + @SerializedName(SERIALIZED_NAME_STEPS) + private Map steps = new HashMap<>(); + public static final String SERIALIZED_NAME_SCHEMA_IDS = "schemaIds"; + @SerializedName(SERIALIZED_NAME_SCHEMA_IDS) + private List schemaIds; + public static final String SERIALIZED_NAME_INITIAL = "initial"; + @SerializedName(SERIALIZED_NAME_INITIAL) + private String initial; + public UpdateWorkflowDto() { + } + public UpdateWorkflowDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the workflow. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public UpdateWorkflowDto steps(Map steps) { + this.steps = steps; + return this; + } + + public UpdateWorkflowDto putStepsItem(String key, WorkflowStepDto stepsItem) { + if (this.steps == null) { + this.steps = new HashMap<>(); + } + this.steps.put(key, stepsItem); + return this; + } + + /** + * The workflow steps. + * @return steps + */ + @javax.annotation.Nonnull + public Map getSteps() { + return steps; + } + + public void setSteps(Map steps) { + this.steps = steps; + } + public UpdateWorkflowDto schemaIds(List schemaIds) { + this.schemaIds = schemaIds; + return this; + } + + public UpdateWorkflowDto addSchemaIdsItem(String schemaIdsItem) { + if (this.schemaIds == null) { + this.schemaIds = new ArrayList<>(); + } + this.schemaIds.add(schemaIdsItem); + return this; + } + + /** + * The schema ids. + * @return schemaIds + */ + @javax.annotation.Nullable + public List getSchemaIds() { + return schemaIds; + } + + public void setSchemaIds(List schemaIds) { + this.schemaIds = schemaIds; + } + public UpdateWorkflowDto initial(String initial) { + this.initial = initial; + return this; + } + + /** + * The initial step. + * @return initial + */ + @javax.annotation.Nonnull + public String getInitial() { + return initial; + } + + public void setInitial(String initial) { + this.initial = initial; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + UpdateWorkflowDto updateWorkflowDto = (UpdateWorkflowDto) o; + return Objects.equals(this.name, updateWorkflowDto.name) && + Objects.equals(this.steps, updateWorkflowDto.steps) && + Objects.equals(this.schemaIds, updateWorkflowDto.schemaIds) && + Objects.equals(this.initial, updateWorkflowDto.initial); + } + + 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(name, steps, schemaIds, initial); + } + + 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 UpdateWorkflowDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" steps: ").append(toIndentedString(steps)).append("\n"); + sb.append(" schemaIds: ").append(toIndentedString(schemaIds)).append("\n"); + sb.append(" initial: ").append(toIndentedString(initial)).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("steps"); + openapiFields.add("schemaIds"); + openapiFields.add("initial"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("steps"); + openapiRequiredFields.add("initial"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpdateWorkflowDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpdateWorkflowDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpdateWorkflowDto is not found in the empty JSON string", UpdateWorkflowDto.openapiRequiredFields.toString())); + } + } + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpdateWorkflowDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpdateWorkflowDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpdateWorkflowDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("schemaIds") != null && !jsonObj.get("schemaIds").isJsonNull() && !jsonObj.get("schemaIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `schemaIds` to be an array in the JSON string but got `%s`", jsonObj.get("schemaIds").toString())); + } + if (!jsonObj.get("initial").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `initial` to be a primitive type in the JSON string but got `%s`", jsonObj.get("initial").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpdateWorkflowDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpdateWorkflowDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpdateWorkflowDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpdateWorkflowDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpdateWorkflowDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); + } + } + + /** + * Create an instance of UpdateWorkflowDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpdateWorkflowDto + * @throws IOException if the JSON string is invalid with respect to UpdateWorkflowDto + */ + public static UpdateWorkflowDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpdateWorkflowDto.class); + } + + /** + * Convert an instance of UpdateWorkflowDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} diff --git a/src/main/java/com/squidex/api/types/UpsertCommentDto.java b/src/main/java/com/squidex/api/types/UpsertCommentDto.java deleted file mode 100644 index 3cae2db..0000000 --- a/src/main/java/com/squidex/api/types/UpsertCommentDto.java +++ /dev/null @@ -1,130 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ -package com.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpsertCommentDto.Builder.class) -public final class UpsertCommentDto { - private final String text; - - private final Optional url; - - private UpsertCommentDto(String text, Optional url) { - this.text = text; - this.url = url; - } - - /** - * @return The comment text. - */ - @JsonProperty("text") - public String getText() { - return text; - } - - /** - * @return The url where the comment is created. - */ - @JsonProperty("url") - public Optional getUrl() { - return url; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpsertCommentDto && equalTo((UpsertCommentDto) other); - } - - private boolean equalTo(UpsertCommentDto other) { - return text.equals(other.text) && url.equals(other.url); - } - - @Override - public int hashCode() { - return Objects.hash(this.text, this.url); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TextStage builder() { - return new Builder(); - } - - public interface TextStage { - _FinalStage text(String text); - - Builder from(UpsertCommentDto other); - } - - public interface _FinalStage { - UpsertCommentDto build(); - - _FinalStage url(Optional url); - - _FinalStage url(String url); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TextStage, _FinalStage { - private String text; - - private Optional url = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UpsertCommentDto other) { - text(other.getText()); - url(other.getUrl()); - return this; - } - - /** - *

The comment text.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("text") - public _FinalStage text(String text) { - this.text = text; - return this; - } - - /** - *

The url where the comment is created.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage url(String url) { - this.url = Optional.of(url); - return this; - } - - @Override - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public _FinalStage url(Optional url) { - this.url = url; - return this; - } - - @Override - public UpsertCommentDto build() { - return new UpsertCommentDto(text, url); - } - } -} diff --git a/src/main/java/com/squidex/api/types/UpsertSchemaDto.java b/src/main/java/com/squidex/api/types/UpsertSchemaDto.java index f15d79c..0fda00c 100644 --- a/src/main/java/com/squidex/api/types/UpsertSchemaDto.java +++ b/src/main/java/com/squidex/api/types/UpsertSchemaDto.java @@ -1,329 +1,489 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.FieldRuleDto; +import com.squidex.api.types.SchemaPropertiesDto; +import com.squidex.api.types.SchemaScriptsDto; +import com.squidex.api.types.UpsertSchemaFieldDto; +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.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpsertSchemaDto.Builder.class) -public final class UpsertSchemaDto implements IUpsertSchemaDto { - private final Optional properties; - - private final Optional scripts; - - private final Optional> fieldsInReferences; - - private final Optional> fieldsInLists; - - private final Optional> fields; - - private final Optional>> previewUrls; - - private final Optional> fieldRules; - - private final Optional category; - - private final Optional isPublished; - - private UpsertSchemaDto( - Optional properties, - Optional scripts, - Optional> fieldsInReferences, - Optional> fieldsInLists, - Optional> fields, - Optional>> previewUrls, - Optional> fieldRules, - Optional category, - Optional isPublished) { - this.properties = properties; - this.scripts = scripts; - this.fieldsInReferences = fieldsInReferences; - this.fieldsInLists = fieldsInLists; - this.fields = fields; - this.previewUrls = previewUrls; - this.fieldRules = fieldRules; - this.category = category; - this.isPublished = isPublished; - } - - /** - * @return The optional properties. - */ - @JsonProperty("properties") - @Override - public Optional getProperties() { - return properties; - } - - /** - * @return The optional scripts. - */ - @JsonProperty("scripts") - @Override - public Optional getScripts() { - return scripts; - } - - /** - * @return The names of the fields that should be used in references. - */ - @JsonProperty("fieldsInReferences") - @Override - public Optional> getFieldsInReferences() { - return fieldsInReferences; - } +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; - /** - * @return The names of the fields that should be shown in lists, including meta fields. - */ - @JsonProperty("fieldsInLists") - @Override - public Optional> getFieldsInLists() { - return fieldsInLists; - } +import com.squidex.api.core.JSON; - /** - * @return Optional fields. - */ - @JsonProperty("fields") - @Override - public Optional> getFields() { - return fields; +/** + * UpsertSchemaDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpsertSchemaDto { + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private SchemaPropertiesDto properties; + public static final String SERIALIZED_NAME_SCRIPTS = "scripts"; + @SerializedName(SERIALIZED_NAME_SCRIPTS) + private SchemaScriptsDto scripts; + public static final String SERIALIZED_NAME_FIELDS_IN_REFERENCES = "fieldsInReferences"; + @SerializedName(SERIALIZED_NAME_FIELDS_IN_REFERENCES) + private List fieldsInReferences; + public static final String SERIALIZED_NAME_FIELDS_IN_LISTS = "fieldsInLists"; + @SerializedName(SERIALIZED_NAME_FIELDS_IN_LISTS) + private List fieldsInLists; + public static final String SERIALIZED_NAME_FIELDS = "fields"; + @SerializedName(SERIALIZED_NAME_FIELDS) + private List fields; + public static final String SERIALIZED_NAME_PREVIEW_URLS = "previewUrls"; + @SerializedName(SERIALIZED_NAME_PREVIEW_URLS) + private Map previewUrls; + public static final String SERIALIZED_NAME_FIELD_RULES = "fieldRules"; + @SerializedName(SERIALIZED_NAME_FIELD_RULES) + private List fieldRules; + public static final String SERIALIZED_NAME_CATEGORY = "category"; + @SerializedName(SERIALIZED_NAME_CATEGORY) + private String category; + public static final String SERIALIZED_NAME_IS_PUBLISHED = "isPublished"; + @SerializedName(SERIALIZED_NAME_IS_PUBLISHED) + private Boolean isPublished; + public UpsertSchemaDto() { + } + public UpsertSchemaDto properties(SchemaPropertiesDto properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nullable + public SchemaPropertiesDto getProperties() { + return properties; + } + + public void setProperties(SchemaPropertiesDto properties) { + this.properties = properties; + } + public UpsertSchemaDto scripts(SchemaScriptsDto scripts) { + this.scripts = scripts; + return this; + } + + /** + * Get scripts + * @return scripts + */ + @javax.annotation.Nullable + public SchemaScriptsDto getScripts() { + return scripts; + } + + public void setScripts(SchemaScriptsDto scripts) { + this.scripts = scripts; + } + public UpsertSchemaDto fieldsInReferences(List fieldsInReferences) { + this.fieldsInReferences = fieldsInReferences; + return this; + } + + public UpsertSchemaDto addFieldsInReferencesItem(String fieldsInReferencesItem) { + if (this.fieldsInReferences == null) { + this.fieldsInReferences = new ArrayList<>(); } - - /** - * @return The optional preview urls. - */ - @JsonProperty("previewUrls") - @Override - public Optional>> getPreviewUrls() { - return previewUrls; + this.fieldsInReferences.add(fieldsInReferencesItem); + return this; + } + + /** + * The names of the fields that should be used in references. + * @return fieldsInReferences + */ + @javax.annotation.Nullable + public List getFieldsInReferences() { + return fieldsInReferences; + } + + public void setFieldsInReferences(List fieldsInReferences) { + this.fieldsInReferences = fieldsInReferences; + } + public UpsertSchemaDto fieldsInLists(List fieldsInLists) { + this.fieldsInLists = fieldsInLists; + return this; + } + + public UpsertSchemaDto addFieldsInListsItem(String fieldsInListsItem) { + if (this.fieldsInLists == null) { + this.fieldsInLists = new ArrayList<>(); } - - /** - * @return The optional field Rules. - */ - @JsonProperty("fieldRules") - @Override - public Optional> getFieldRules() { - return fieldRules; + this.fieldsInLists.add(fieldsInListsItem); + return this; + } + + /** + * The names of the fields that should be shown in lists, including meta fields. + * @return fieldsInLists + */ + @javax.annotation.Nullable + public List getFieldsInLists() { + return fieldsInLists; + } + + public void setFieldsInLists(List fieldsInLists) { + this.fieldsInLists = fieldsInLists; + } + public UpsertSchemaDto fields(List fields) { + this.fields = fields; + return this; + } + + public UpsertSchemaDto addFieldsItem(UpsertSchemaFieldDto fieldsItem) { + if (this.fields == null) { + this.fields = new ArrayList<>(); } - - /** - * @return The category. - */ - @JsonProperty("category") - @Override - public Optional getCategory() { - return category; + this.fields.add(fieldsItem); + return this; + } + + /** + * Optional fields. + * @return fields + */ + @javax.annotation.Nullable + public List getFields() { + return fields; + } + + public void setFields(List fields) { + this.fields = fields; + } + public UpsertSchemaDto previewUrls(Map previewUrls) { + this.previewUrls = previewUrls; + return this; + } + + public UpsertSchemaDto putPreviewUrlsItem(String key, String previewUrlsItem) { + if (this.previewUrls == null) { + this.previewUrls = new HashMap<>(); } - - /** - * @return Set it to true to autopublish the schema. - */ - @JsonProperty("isPublished") - @Override - public Optional getIsPublished() { - return isPublished; + this.previewUrls.put(key, previewUrlsItem); + return this; + } + + /** + * The optional preview urls. + * @return previewUrls + */ + @javax.annotation.Nullable + public Map getPreviewUrls() { + return previewUrls; + } + + public void setPreviewUrls(Map previewUrls) { + this.previewUrls = previewUrls; + } + public UpsertSchemaDto fieldRules(List fieldRules) { + this.fieldRules = fieldRules; + return this; + } + + public UpsertSchemaDto addFieldRulesItem(FieldRuleDto fieldRulesItem) { + if (this.fieldRules == null) { + this.fieldRules = new ArrayList<>(); } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpsertSchemaDto && equalTo((UpsertSchemaDto) other); + this.fieldRules.add(fieldRulesItem); + return this; + } + + /** + * The optional field Rules. + * @return fieldRules + */ + @javax.annotation.Nullable + public List getFieldRules() { + return fieldRules; + } + + public void setFieldRules(List fieldRules) { + this.fieldRules = fieldRules; + } + public UpsertSchemaDto category(String category) { + this.category = category; + return this; + } + + /** + * The category. + * @return category + */ + @javax.annotation.Nullable + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + public UpsertSchemaDto isPublished(Boolean isPublished) { + this.isPublished = isPublished; + return this; + } + + /** + * Set it to true to autopublish the schema. + * @return isPublished + */ + @javax.annotation.Nullable + public Boolean getIsPublished() { + return isPublished; + } + + public void setIsPublished(Boolean isPublished) { + this.isPublished = isPublished; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - private boolean equalTo(UpsertSchemaDto other) { - return properties.equals(other.properties) - && scripts.equals(other.scripts) - && fieldsInReferences.equals(other.fieldsInReferences) - && fieldsInLists.equals(other.fieldsInLists) - && fields.equals(other.fields) - && previewUrls.equals(other.previewUrls) - && fieldRules.equals(other.fieldRules) - && category.equals(other.category) - && isPublished.equals(other.isPublished); + if (o == null || getClass() != o.getClass()) { + return false; } - - @Override - public int hashCode() { - return Objects.hash( - this.properties, - this.scripts, - this.fieldsInReferences, - this.fieldsInLists, - this.fields, - this.previewUrls, - this.fieldRules, - this.category, - this.isPublished); + UpsertSchemaDto upsertSchemaDto = (UpsertSchemaDto) o; + return Objects.equals(this.properties, upsertSchemaDto.properties) && + Objects.equals(this.scripts, upsertSchemaDto.scripts) && + Objects.equals(this.fieldsInReferences, upsertSchemaDto.fieldsInReferences) && + Objects.equals(this.fieldsInLists, upsertSchemaDto.fieldsInLists) && + Objects.equals(this.fields, upsertSchemaDto.fields) && + Objects.equals(this.previewUrls, upsertSchemaDto.previewUrls) && + Objects.equals(this.fieldRules, upsertSchemaDto.fieldRules) && + Objects.equals(this.category, upsertSchemaDto.category) && + Objects.equals(this.isPublished, upsertSchemaDto.isPublished); + } + + 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(properties, scripts, fieldsInReferences, fieldsInLists, fields, previewUrls, fieldRules, category, isPublished); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertSchemaDto {\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" scripts: ").append(toIndentedString(scripts)).append("\n"); + sb.append(" fieldsInReferences: ").append(toIndentedString(fieldsInReferences)).append("\n"); + sb.append(" fieldsInLists: ").append(toIndentedString(fieldsInLists)).append("\n"); + sb.append(" fields: ").append(toIndentedString(fields)).append("\n"); + sb.append(" previewUrls: ").append(toIndentedString(previewUrls)).append("\n"); + sb.append(" fieldRules: ").append(toIndentedString(fieldRules)).append("\n"); + sb.append(" category: ").append(toIndentedString(category)).append("\n"); + sb.append(" isPublished: ").append(toIndentedString(isPublished)).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"; } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional properties = Optional.empty(); - - private Optional scripts = Optional.empty(); - - private Optional> fieldsInReferences = Optional.empty(); - - private Optional> fieldsInLists = Optional.empty(); - - private Optional> fields = Optional.empty(); - - private Optional>> previewUrls = Optional.empty(); - - private Optional> fieldRules = Optional.empty(); - - private Optional category = Optional.empty(); - - private Optional isPublished = Optional.empty(); - - private Builder() {} - - public Builder from(UpsertSchemaDto other) { - properties(other.getProperties()); - scripts(other.getScripts()); - fieldsInReferences(other.getFieldsInReferences()); - fieldsInLists(other.getFieldsInLists()); - fields(other.getFields()); - previewUrls(other.getPreviewUrls()); - fieldRules(other.getFieldRules()); - category(other.getCategory()); - isPublished(other.getIsPublished()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("properties"); + openapiFields.add("scripts"); + openapiFields.add("fieldsInReferences"); + openapiFields.add("fieldsInLists"); + openapiFields.add("fields"); + openapiFields.add("previewUrls"); + openapiFields.add("fieldRules"); + openapiFields.add("category"); + openapiFields.add("isPublished"); + + // 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 UpsertSchemaDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpsertSchemaDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpsertSchemaDto is not found in the empty JSON string", UpsertSchemaDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "properties", nulls = Nulls.SKIP) - public Builder properties(Optional properties) { - this.properties = properties; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpsertSchemaDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpsertSchemaDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } - - public Builder properties(SchemaPropertiesDto properties) { - this.properties = Optional.of(properties); - return this; - } - - @JsonSetter(value = "scripts", nulls = Nulls.SKIP) - public Builder scripts(Optional scripts) { - this.scripts = scripts; - return this; - } - - public Builder scripts(SchemaScriptsDto scripts) { - this.scripts = Optional.of(scripts); - return this; - } - - @JsonSetter(value = "fieldsInReferences", nulls = Nulls.SKIP) - public Builder fieldsInReferences(Optional> fieldsInReferences) { - this.fieldsInReferences = fieldsInReferences; - return this; - } - - public Builder fieldsInReferences(List fieldsInReferences) { - this.fieldsInReferences = Optional.of(fieldsInReferences); - return this; + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // validate the optional field `properties` + if (jsonObj.get("properties") != null && !jsonObj.get("properties").isJsonNull()) { + SchemaPropertiesDto.validateJsonElement(jsonObj.get("properties")); + } + // validate the optional field `scripts` + if (jsonObj.get("scripts") != null && !jsonObj.get("scripts").isJsonNull()) { + SchemaScriptsDto.validateJsonElement(jsonObj.get("scripts")); + } + // ensure the optional json data is an array if present + if (jsonObj.get("fieldsInReferences") != null && !jsonObj.get("fieldsInReferences").isJsonNull() && !jsonObj.get("fieldsInReferences").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldsInReferences` to be an array in the JSON string but got `%s`", jsonObj.get("fieldsInReferences").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("fieldsInLists") != null && !jsonObj.get("fieldsInLists").isJsonNull() && !jsonObj.get("fieldsInLists").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldsInLists` to be an array in the JSON string but got `%s`", jsonObj.get("fieldsInLists").toString())); + } + if (jsonObj.get("fields") != null && !jsonObj.get("fields").isJsonNull()) { + JsonArray jsonArrayfields = jsonObj.getAsJsonArray("fields"); + if (jsonArrayfields != null) { + // ensure the json data is an array + if (!jsonObj.get("fields").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fields` to be an array in the JSON string but got `%s`", jsonObj.get("fields").toString())); + } + + // validate the optional field `fields` (array) + for (int i = 0; i < jsonArrayfields.size(); i++) { + UpsertSchemaFieldDto.validateJsonElement(jsonArrayfields.get(i)); + }; } - - @JsonSetter(value = "fieldsInLists", nulls = Nulls.SKIP) - public Builder fieldsInLists(Optional> fieldsInLists) { - this.fieldsInLists = fieldsInLists; - return this; - } - - public Builder fieldsInLists(List fieldsInLists) { - this.fieldsInLists = Optional.of(fieldsInLists); - return this; - } - - @JsonSetter(value = "fields", nulls = Nulls.SKIP) - public Builder fields(Optional> fields) { - this.fields = fields; - return this; - } - - public Builder fields(List fields) { - this.fields = Optional.of(fields); - return this; - } - - @JsonSetter(value = "previewUrls", nulls = Nulls.SKIP) - public Builder previewUrls(Optional>> previewUrls) { - this.previewUrls = previewUrls; - return this; - } - - public Builder previewUrls(Map> previewUrls) { - this.previewUrls = Optional.of(previewUrls); - return this; - } - - @JsonSetter(value = "fieldRules", nulls = Nulls.SKIP) - public Builder fieldRules(Optional> fieldRules) { - this.fieldRules = fieldRules; - return this; - } - - public Builder fieldRules(List fieldRules) { - this.fieldRules = Optional.of(fieldRules); - return this; - } - - @JsonSetter(value = "category", nulls = Nulls.SKIP) - public Builder category(Optional category) { - this.category = category; - return this; - } - - public Builder category(String category) { - this.category = Optional.of(category); - return this; - } - - @JsonSetter(value = "isPublished", nulls = Nulls.SKIP) - public Builder isPublished(Optional isPublished) { - this.isPublished = isPublished; - return this; - } - - public Builder isPublished(Boolean isPublished) { - this.isPublished = Optional.of(isPublished); - return this; - } - - public UpsertSchemaDto build() { - return new UpsertSchemaDto( - properties, - scripts, - fieldsInReferences, - fieldsInLists, - fields, - previewUrls, - fieldRules, - category, - isPublished); + } + if (jsonObj.get("fieldRules") != null && !jsonObj.get("fieldRules").isJsonNull()) { + JsonArray jsonArrayfieldRules = jsonObj.getAsJsonArray("fieldRules"); + if (jsonArrayfieldRules != null) { + // ensure the json data is an array + if (!jsonObj.get("fieldRules").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `fieldRules` to be an array in the JSON string but got `%s`", jsonObj.get("fieldRules").toString())); + } + + // validate the optional field `fieldRules` (array) + for (int i = 0; i < jsonArrayfieldRules.size(); i++) { + FieldRuleDto.validateJsonElement(jsonArrayfieldRules.get(i)); + }; } + } + if ((jsonObj.get("category") != null && !jsonObj.get("category").isJsonNull()) && !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())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertSchemaDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertSchemaDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpsertSchemaDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertSchemaDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpsertSchemaDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpsertSchemaDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertSchemaDto + * @throws IOException if the JSON string is invalid with respect to UpsertSchemaDto + */ + public static UpsertSchemaDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertSchemaDto.class); + } + + /** + * Convert an instance of UpsertSchemaDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java b/src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java index ee63c6a..647040e 100644 --- a/src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java +++ b/src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java @@ -1,320 +1,391 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpsertSchemaFieldDto.Builder.class) -public final class UpsertSchemaFieldDto { - private final String name; - - private final Optional isHidden; - - private final Optional isLocked; - - private final Optional isDisabled; - - private final Optional partitioning; - - private final FieldPropertiesDto properties; - - private final Optional> nested; - - private UpsertSchemaFieldDto( - String name, - Optional isHidden, - Optional isLocked, - Optional isDisabled, - Optional partitioning, - FieldPropertiesDto properties, - Optional> nested) { - this.name = name; - this.isHidden = isHidden; - this.isLocked = isLocked; - this.isDisabled = isDisabled; - this.partitioning = partitioning; - this.properties = properties; - this.nested = nested; - } - - /** - * @return The name of the field. Must be unique within the schema. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Defines if the field is hidden. - */ - @JsonProperty("isHidden") - public Optional getIsHidden() { - return isHidden; - } - - /** - * @return Defines if the field is locked. - */ - @JsonProperty("isLocked") - public Optional getIsLocked() { - return isLocked; - } - - /** - * @return Defines if the field is disabled. - */ - @JsonProperty("isDisabled") - public Optional getIsDisabled() { - return isDisabled; - } - - /** - * @return Determines the optional partitioning of the field. - */ - @JsonProperty("partitioning") - public Optional getPartitioning() { - return partitioning; - } - /** - * @return The field properties. - */ - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - /** - * @return The nested fields. - */ - @JsonProperty("nested") - public Optional> getNested() { - return nested; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpsertSchemaFieldDto && equalTo((UpsertSchemaFieldDto) other); - } +package com.squidex.api.types; - private boolean equalTo(UpsertSchemaFieldDto other) { - return name.equals(other.name) - && isHidden.equals(other.isHidden) - && isLocked.equals(other.isLocked) - && isDisabled.equals(other.isDisabled) - && partitioning.equals(other.partitioning) - && properties.equals(other.properties) - && nested.equals(other.nested); - } +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.squidex.api.types.FieldPropertiesDto; +import com.squidex.api.types.UpsertSchemaNestedFieldDto; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +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; - @Override - public int hashCode() { - return Objects.hash( - this.name, - this.isHidden, - this.isLocked, - this.isDisabled, - this.partitioning, - this.properties, - this.nested); - } +import com.squidex.api.core.JSON; - @Override - public String toString() { - return ObjectMappers.stringify(this); +/** + * UpsertSchemaFieldDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpsertSchemaFieldDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_IS_HIDDEN = "isHidden"; + @SerializedName(SERIALIZED_NAME_IS_HIDDEN) + private Boolean isHidden; + public static final String SERIALIZED_NAME_IS_LOCKED = "isLocked"; + @SerializedName(SERIALIZED_NAME_IS_LOCKED) + private Boolean isLocked; + public static final String SERIALIZED_NAME_IS_DISABLED = "isDisabled"; + @SerializedName(SERIALIZED_NAME_IS_DISABLED) + private Boolean isDisabled; + public static final String SERIALIZED_NAME_PARTITIONING = "partitioning"; + @SerializedName(SERIALIZED_NAME_PARTITIONING) + private String partitioning; + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private FieldPropertiesDto properties; + public static final String SERIALIZED_NAME_NESTED = "nested"; + @SerializedName(SERIALIZED_NAME_NESTED) + private List nested; + public UpsertSchemaFieldDto() { + } + public UpsertSchemaFieldDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the field. Must be unique within the schema. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public UpsertSchemaFieldDto isHidden(Boolean isHidden) { + this.isHidden = isHidden; + return this; + } + + /** + * Defines if the field is hidden. + * @return isHidden + */ + @javax.annotation.Nullable + public Boolean getIsHidden() { + return isHidden; + } + + public void setIsHidden(Boolean isHidden) { + this.isHidden = isHidden; + } + public UpsertSchemaFieldDto isLocked(Boolean isLocked) { + this.isLocked = isLocked; + return this; + } + + /** + * Defines if the field is locked. + * @return isLocked + */ + @javax.annotation.Nullable + public Boolean getIsLocked() { + return isLocked; + } + + public void setIsLocked(Boolean isLocked) { + this.isLocked = isLocked; + } + public UpsertSchemaFieldDto isDisabled(Boolean isDisabled) { + this.isDisabled = isDisabled; + return this; + } + + /** + * Defines if the field is disabled. + * @return isDisabled + */ + @javax.annotation.Nullable + public Boolean getIsDisabled() { + return isDisabled; + } + + public void setIsDisabled(Boolean isDisabled) { + this.isDisabled = isDisabled; + } + public UpsertSchemaFieldDto partitioning(String partitioning) { + this.partitioning = partitioning; + return this; + } + + /** + * Determines the optional partitioning of the field. + * @return partitioning + */ + @javax.annotation.Nullable + public String getPartitioning() { + return partitioning; + } + + public void setPartitioning(String partitioning) { + this.partitioning = partitioning; + } + public UpsertSchemaFieldDto properties(FieldPropertiesDto properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nonnull + public FieldPropertiesDto getProperties() { + return properties; + } + + public void setProperties(FieldPropertiesDto properties) { + this.properties = properties; + } + public UpsertSchemaFieldDto nested(List nested) { + this.nested = nested; + return this; + } + + public UpsertSchemaFieldDto addNestedItem(UpsertSchemaNestedFieldDto nestedItem) { + if (this.nested == null) { + this.nested = new ArrayList<>(); } - - public static NameStage builder() { - return new Builder(); + this.nested.add(nestedItem); + return this; + } + + /** + * The nested fields. + * @return nested + */ + @javax.annotation.Nullable + public List getNested() { + return nested; + } + + public void setNested(List nested) { + this.nested = nested; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface NameStage { - PropertiesStage name(String name); - - Builder from(UpsertSchemaFieldDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); + UpsertSchemaFieldDto upsertSchemaFieldDto = (UpsertSchemaFieldDto) o; + return Objects.equals(this.name, upsertSchemaFieldDto.name) && + Objects.equals(this.isHidden, upsertSchemaFieldDto.isHidden) && + Objects.equals(this.isLocked, upsertSchemaFieldDto.isLocked) && + Objects.equals(this.isDisabled, upsertSchemaFieldDto.isDisabled) && + Objects.equals(this.partitioning, upsertSchemaFieldDto.partitioning) && + Objects.equals(this.properties, upsertSchemaFieldDto.properties) && + Objects.equals(this.nested, upsertSchemaFieldDto.nested); + } + + 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(name, isHidden, isLocked, isDisabled, partitioning, properties, nested); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - UpsertSchemaFieldDto build(); - - _FinalStage isHidden(Optional isHidden); - - _FinalStage isHidden(Boolean isHidden); - - _FinalStage isLocked(Optional isLocked); - - _FinalStage isLocked(Boolean isLocked); - - _FinalStage isDisabled(Optional isDisabled); - - _FinalStage isDisabled(Boolean isDisabled); - - _FinalStage partitioning(Optional partitioning); - - _FinalStage partitioning(String partitioning); - - _FinalStage nested(Optional> nested); - - _FinalStage nested(List nested); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertSchemaFieldDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" isHidden: ").append(toIndentedString(isHidden)).append("\n"); + sb.append(" isLocked: ").append(toIndentedString(isLocked)).append("\n"); + sb.append(" isDisabled: ").append(toIndentedString(isDisabled)).append("\n"); + sb.append(" partitioning: ").append(toIndentedString(partitioning)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).append("\n"); + sb.append(" nested: ").append(toIndentedString(nested)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, PropertiesStage, _FinalStage { - private String name; - - private FieldPropertiesDto properties; - - private Optional> nested = Optional.empty(); - - private Optional partitioning = Optional.empty(); - - private Optional isDisabled = Optional.empty(); - - private Optional isLocked = Optional.empty(); - - private Optional isHidden = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UpsertSchemaFieldDto other) { - name(other.getName()); - isHidden(other.getIsHidden()); - isLocked(other.getIsLocked()); - isDisabled(other.getIsDisabled()); - partitioning(other.getPartitioning()); - properties(other.getProperties()); - nested(other.getNested()); - return this; + return o.toString().replace("\n", "\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("isHidden"); + openapiFields.add("isLocked"); + openapiFields.add("isDisabled"); + openapiFields.add("partitioning"); + openapiFields.add("properties"); + openapiFields.add("nested"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("properties"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpsertSchemaFieldDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpsertSchemaFieldDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpsertSchemaFieldDto is not found in the empty JSON string", UpsertSchemaFieldDto.openapiRequiredFields.toString())); } + } - /** - *

The name of the field. Must be unique within the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public PropertiesStage name(String name) { - this.name = name; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpsertSchemaFieldDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpsertSchemaFieldDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The field properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpsertSchemaFieldDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } - - /** - *

The nested fields.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage nested(List nested) { - this.nested = Optional.of(nested); - return this; - } - - @Override - @JsonSetter(value = "nested", nulls = Nulls.SKIP) - public _FinalStage nested(Optional> nested) { - this.nested = nested; - return this; - } - - /** - *

Determines the optional partitioning of the field.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage partitioning(String partitioning) { - this.partitioning = Optional.of(partitioning); - return this; - } - - @Override - @JsonSetter(value = "partitioning", nulls = Nulls.SKIP) - public _FinalStage partitioning(Optional partitioning) { - this.partitioning = partitioning; - return this; - } - - /** - *

Defines if the field is disabled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isDisabled(Boolean isDisabled) { - this.isDisabled = Optional.of(isDisabled); - return this; - } - - @Override - @JsonSetter(value = "isDisabled", nulls = Nulls.SKIP) - public _FinalStage isDisabled(Optional isDisabled) { - this.isDisabled = isDisabled; - return this; + } + 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("partitioning") != null && !jsonObj.get("partitioning").isJsonNull()) && !jsonObj.get("partitioning").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `partitioning` to be a primitive type in the JSON string but got `%s`", jsonObj.get("partitioning").toString())); + } + // validate the required field `properties` + FieldPropertiesDto.validateJsonElement(jsonObj.get("properties")); + if (jsonObj.get("nested") != null && !jsonObj.get("nested").isJsonNull()) { + JsonArray jsonArraynested = jsonObj.getAsJsonArray("nested"); + if (jsonArraynested != null) { + // ensure the json data is an array + if (!jsonObj.get("nested").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `nested` to be an array in the JSON string but got `%s`", jsonObj.get("nested").toString())); + } + + // validate the optional field `nested` (array) + for (int i = 0; i < jsonArraynested.size(); i++) { + UpsertSchemaNestedFieldDto.validateJsonElement(jsonArraynested.get(i)); + }; } + } + } - /** - *

Defines if the field is locked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isLocked(Boolean isLocked) { - this.isLocked = Optional.of(isLocked); - return this; - } - - @Override - @JsonSetter(value = "isLocked", nulls = Nulls.SKIP) - public _FinalStage isLocked(Optional isLocked) { - this.isLocked = isLocked; - return this; - } - - /** - *

Defines if the field is hidden.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isHidden(Boolean isHidden) { - this.isHidden = Optional.of(isHidden); - return this; - } - - @Override - @JsonSetter(value = "isHidden", nulls = Nulls.SKIP) - public _FinalStage isHidden(Optional isHidden) { - this.isHidden = isHidden; - return this; - } - - @Override - public UpsertSchemaFieldDto build() { - return new UpsertSchemaFieldDto(name, isHidden, isLocked, isDisabled, partitioning, properties, nested); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertSchemaFieldDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertSchemaFieldDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpsertSchemaFieldDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertSchemaFieldDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpsertSchemaFieldDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpsertSchemaFieldDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertSchemaFieldDto + * @throws IOException if the JSON string is invalid with respect to UpsertSchemaFieldDto + */ + public static UpsertSchemaFieldDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertSchemaFieldDto.class); + } + + /** + * Convert an instance of UpsertSchemaFieldDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java b/src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java index 5a35707..0e2f818 100644 --- a/src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java +++ b/src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java @@ -1,238 +1,305 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UpsertSchemaNestedFieldDto.Builder.class) -public final class UpsertSchemaNestedFieldDto { - private final String name; - private final Optional isHidden; - private final Optional isLocked; - - private final Optional isDisabled; - - private final FieldPropertiesDto properties; - - private UpsertSchemaNestedFieldDto( - String name, - Optional isHidden, - Optional isLocked, - Optional isDisabled, - FieldPropertiesDto properties) { - this.name = name; - this.isHidden = isHidden; - this.isLocked = isLocked; - this.isDisabled = isDisabled; - this.properties = properties; - } - - /** - * @return The name of the field. Must be unique within the schema. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - /** - * @return Defines if the field is hidden. - */ - @JsonProperty("isHidden") - public Optional getIsHidden() { - return isHidden; - } - - /** - * @return Defines if the field is locked. - */ - @JsonProperty("isLocked") - public Optional getIsLocked() { - return isLocked; - } - - /** - * @return Defines if the field is disabled. - */ - @JsonProperty("isDisabled") - public Optional getIsDisabled() { - return isDisabled; - } - - /** - * @return The field properties. - */ - @JsonProperty("properties") - public FieldPropertiesDto getProperties() { - return properties; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpsertSchemaNestedFieldDto && equalTo((UpsertSchemaNestedFieldDto) other); - } - - private boolean equalTo(UpsertSchemaNestedFieldDto other) { - return name.equals(other.name) - && isHidden.equals(other.isHidden) - && isLocked.equals(other.isLocked) - && isDisabled.equals(other.isDisabled) - && properties.equals(other.properties); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.isHidden, this.isLocked, this.isDisabled, this.properties); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface NameStage { - PropertiesStage name(String name); +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.squidex.api.types.FieldPropertiesDto; +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.squidex.api.core.JSON; - Builder from(UpsertSchemaNestedFieldDto other); +/** + * UpsertSchemaNestedFieldDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UpsertSchemaNestedFieldDto { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_IS_HIDDEN = "isHidden"; + @SerializedName(SERIALIZED_NAME_IS_HIDDEN) + private Boolean isHidden; + public static final String SERIALIZED_NAME_IS_LOCKED = "isLocked"; + @SerializedName(SERIALIZED_NAME_IS_LOCKED) + private Boolean isLocked; + public static final String SERIALIZED_NAME_IS_DISABLED = "isDisabled"; + @SerializedName(SERIALIZED_NAME_IS_DISABLED) + private Boolean isDisabled; + public static final String SERIALIZED_NAME_PROPERTIES = "properties"; + @SerializedName(SERIALIZED_NAME_PROPERTIES) + private FieldPropertiesDto properties; + public UpsertSchemaNestedFieldDto() { + } + public UpsertSchemaNestedFieldDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the field. Must be unique within the schema. + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public UpsertSchemaNestedFieldDto isHidden(Boolean isHidden) { + this.isHidden = isHidden; + return this; + } + + /** + * Defines if the field is hidden. + * @return isHidden + */ + @javax.annotation.Nullable + public Boolean getIsHidden() { + return isHidden; + } + + public void setIsHidden(Boolean isHidden) { + this.isHidden = isHidden; + } + public UpsertSchemaNestedFieldDto isLocked(Boolean isLocked) { + this.isLocked = isLocked; + return this; + } + + /** + * Defines if the field is locked. + * @return isLocked + */ + @javax.annotation.Nullable + public Boolean getIsLocked() { + return isLocked; + } + + public void setIsLocked(Boolean isLocked) { + this.isLocked = isLocked; + } + public UpsertSchemaNestedFieldDto isDisabled(Boolean isDisabled) { + this.isDisabled = isDisabled; + return this; + } + + /** + * Defines if the field is disabled. + * @return isDisabled + */ + @javax.annotation.Nullable + public Boolean getIsDisabled() { + return isDisabled; + } + + public void setIsDisabled(Boolean isDisabled) { + this.isDisabled = isDisabled; + } + public UpsertSchemaNestedFieldDto properties(FieldPropertiesDto properties) { + this.properties = properties; + return this; + } + + /** + * Get properties + * @return properties + */ + @javax.annotation.Nonnull + public FieldPropertiesDto getProperties() { + return properties; + } + + public void setProperties(FieldPropertiesDto properties) { + this.properties = properties; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface PropertiesStage { - _FinalStage properties(FieldPropertiesDto properties); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - UpsertSchemaNestedFieldDto build(); - - _FinalStage isHidden(Optional isHidden); - - _FinalStage isHidden(Boolean isHidden); - - _FinalStage isLocked(Optional isLocked); - - _FinalStage isLocked(Boolean isLocked); - - _FinalStage isDisabled(Optional isDisabled); - - _FinalStage isDisabled(Boolean isDisabled); + UpsertSchemaNestedFieldDto upsertSchemaNestedFieldDto = (UpsertSchemaNestedFieldDto) o; + return Objects.equals(this.name, upsertSchemaNestedFieldDto.name) && + Objects.equals(this.isHidden, upsertSchemaNestedFieldDto.isHidden) && + Objects.equals(this.isLocked, upsertSchemaNestedFieldDto.isLocked) && + Objects.equals(this.isDisabled, upsertSchemaNestedFieldDto.isDisabled) && + Objects.equals(this.properties, upsertSchemaNestedFieldDto.properties); + } + + @Override + public int hashCode() { + return Objects.hash(name, isHidden, isLocked, isDisabled, properties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UpsertSchemaNestedFieldDto {\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" isHidden: ").append(toIndentedString(isHidden)).append("\n"); + sb.append(" isLocked: ").append(toIndentedString(isLocked)).append("\n"); + sb.append(" isDisabled: ").append(toIndentedString(isDisabled)).append("\n"); + sb.append(" properties: ").append(toIndentedString(properties)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, PropertiesStage, _FinalStage { - private String name; - - private FieldPropertiesDto properties; - - private Optional isDisabled = Optional.empty(); - - private Optional isLocked = Optional.empty(); - - private Optional isHidden = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UpsertSchemaNestedFieldDto other) { - name(other.getName()); - isHidden(other.getIsHidden()); - isLocked(other.getIsLocked()); - isDisabled(other.getIsDisabled()); - properties(other.getProperties()); - return this; - } - - /** - *

The name of the field. Must be unique within the schema.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("name") - public PropertiesStage name(String name) { - this.name = name; - return this; - } - - /** - *

The field properties.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("properties") - public _FinalStage properties(FieldPropertiesDto properties) { - this.properties = properties; - return this; - } - - /** - *

Defines if the field is disabled.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isDisabled(Boolean isDisabled) { - this.isDisabled = Optional.of(isDisabled); - return this; - } - - @Override - @JsonSetter(value = "isDisabled", nulls = Nulls.SKIP) - public _FinalStage isDisabled(Optional isDisabled) { - this.isDisabled = isDisabled; - return this; - } - - /** - *

Defines if the field is locked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isLocked(Boolean isLocked) { - this.isLocked = Optional.of(isLocked); - return this; - } - - @Override - @JsonSetter(value = "isLocked", nulls = Nulls.SKIP) - public _FinalStage isLocked(Optional isLocked) { - this.isLocked = isLocked; - return this; - } - - /** - *

Defines if the field is hidden.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage isHidden(Boolean isHidden) { - this.isHidden = Optional.of(isHidden); - return this; + return o.toString().replace("\n", "\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("isHidden"); + openapiFields.add("isLocked"); + openapiFields.add("isDisabled"); + openapiFields.add("properties"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + openapiRequiredFields.add("properties"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UpsertSchemaNestedFieldDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UpsertSchemaNestedFieldDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UpsertSchemaNestedFieldDto is not found in the empty JSON string", UpsertSchemaNestedFieldDto.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter(value = "isHidden", nulls = Nulls.SKIP) - public _FinalStage isHidden(Optional isHidden) { - this.isHidden = isHidden; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UpsertSchemaNestedFieldDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UpsertSchemaNestedFieldDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public UpsertSchemaNestedFieldDto build() { - return new UpsertSchemaNestedFieldDto(name, isHidden, isLocked, isDisabled, properties); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UpsertSchemaNestedFieldDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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())); + } + // validate the required field `properties` + FieldPropertiesDto.validateJsonElement(jsonObj.get("properties")); + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UpsertSchemaNestedFieldDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UpsertSchemaNestedFieldDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UpsertSchemaNestedFieldDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UpsertSchemaNestedFieldDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UpsertSchemaNestedFieldDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of UpsertSchemaNestedFieldDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UpsertSchemaNestedFieldDto + * @throws IOException if the JSON string is invalid with respect to UpsertSchemaNestedFieldDto + */ + public static UpsertSchemaNestedFieldDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UpsertSchemaNestedFieldDto.class); + } + + /** + * Convert an instance of UpsertSchemaNestedFieldDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java b/src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java index 2e9efd2..a30438c 100644 --- a/src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java +++ b/src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java @@ -1,130 +1,247 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UsageRuleTriggerDto.Builder.class) -public final class UsageRuleTriggerDto { - private final int limit; - - private final Optional numDays; - - private UsageRuleTriggerDto(int limit, Optional numDays) { - this.limit = limit; - this.numDays = numDays; - } - - /** - * @return The number of monthly api calls. - */ - @JsonProperty("limit") - public int getLimit() { - return limit; - } - - /** - * @return The number of days to check or null for the current month. - */ - @JsonProperty("numDays") - public Optional getNumDays() { - return numDays; - } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageRuleTriggerDto && equalTo((UsageRuleTriggerDto) other); - } - private boolean equalTo(UsageRuleTriggerDto other) { - return limit == other.limit && numDays.equals(other.numDays); - } +package com.squidex.api.types; - @Override - public int hashCode() { - return Objects.hash(this.limit, this.numDays); - } +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.squidex.api.types.RuleTriggerDto; +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.squidex.api.core.JSON; - @Override - public String toString() { - return ObjectMappers.stringify(this); +/** + * UsageRuleTriggerDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UsageRuleTriggerDto extends RuleTriggerDto { + public static final String SERIALIZED_NAME_LIMIT = "limit"; + @SerializedName(SERIALIZED_NAME_LIMIT) + private Integer limit; + public static final String SERIALIZED_NAME_NUM_DAYS = "numDays"; + @SerializedName(SERIALIZED_NAME_NUM_DAYS) + private Integer numDays; + public UsageRuleTriggerDto() { + } + public UsageRuleTriggerDto limit(Integer limit) { + this.limit = limit; + return this; + } + + /** + * The number of monthly api calls. + * @return limit + */ + @javax.annotation.Nonnull + public Integer getLimit() { + return limit; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + public UsageRuleTriggerDto numDays(Integer numDays) { + this.numDays = numDays; + return this; + } + + /** + * The number of days to check or null for the current month. + * minimum: 1 + * maximum: 30 + * @return numDays + */ + @javax.annotation.Nullable + public Integer getNumDays() { + return numDays; + } + + public void setNumDays(Integer numDays) { + this.numDays = numDays; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public static LimitStage builder() { - return new Builder(); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface LimitStage { - _FinalStage limit(int limit); - - Builder from(UsageRuleTriggerDto other); + UsageRuleTriggerDto usageRuleTriggerDto = (UsageRuleTriggerDto) o; + return Objects.equals(this.limit, usageRuleTriggerDto.limit) && + Objects.equals(this.numDays, usageRuleTriggerDto.numDays) && + super.equals(o); + } + + 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(limit, numDays, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - UsageRuleTriggerDto build(); - - _FinalStage numDays(Optional numDays); - - _FinalStage numDays(Integer numDays); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsageRuleTriggerDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" limit: ").append(toIndentedString(limit)).append("\n"); + sb.append(" numDays: ").append(toIndentedString(numDays)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements LimitStage, _FinalStage { - private int limit; - - private Optional numDays = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(UsageRuleTriggerDto other) { - limit(other.getLimit()); - numDays(other.getNumDays()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("triggerType"); + openapiFields.add("limit"); + openapiFields.add("numDays"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("limit"); + openapiRequiredFields.add("triggerType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UsageRuleTriggerDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UsageRuleTriggerDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UsageRuleTriggerDto is not found in the empty JSON string", UsageRuleTriggerDto.openapiRequiredFields.toString())); } + } - /** - *

The number of monthly api calls.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("limit") - public _FinalStage limit(int limit) { - this.limit = limit; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UsageRuleTriggerDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UsageRuleTriggerDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The number of days to check or null for the current month.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage numDays(Integer numDays) { - this.numDays = Optional.of(numDays); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UsageRuleTriggerDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - @Override - @JsonSetter(value = "numDays", nulls = Nulls.SKIP) - public _FinalStage numDays(Optional numDays) { - this.numDays = numDays; - return this; - } - - @Override - public UsageRuleTriggerDto build() { - return new UsageRuleTriggerDto(limit, numDays); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UsageRuleTriggerDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UsageRuleTriggerDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UsageRuleTriggerDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UsageRuleTriggerDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UsageRuleTriggerDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of UsageRuleTriggerDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UsageRuleTriggerDto + * @throws IOException if the JSON string is invalid with respect to UsageRuleTriggerDto + */ + public static UsageRuleTriggerDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UsageRuleTriggerDto.class); + } + + /** + * Convert an instance of UsageRuleTriggerDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/UserDto.java b/src/main/java/com/squidex/api/types/UserDto.java index 9be39d1..f41afb0 100644 --- a/src/main/java/com/squidex/api/types/UserDto.java +++ b/src/main/java/com/squidex/api/types/UserDto.java @@ -1,293 +1,362 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UserDto.Builder.class) -public final class UserDto implements IResource { - private final Map links; - - private final String id; - - private final String email; - - private final String displayName; - - private final boolean isLocked; - - private final List permissions; - - private UserDto( - Map links, - String id, - String email, - String displayName, - boolean isLocked, - List permissions) { - this.links = links; - this.id = id; - this.email = email; - this.displayName = displayName; - this.isLocked = isLocked; - this.permissions = permissions; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The ID of the user. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The email of the user. Unique value. - */ - @JsonProperty("email") - public String getEmail() { - return email; - } - /** - * @return The display name (usually first name and last name) of the user. - */ - @JsonProperty("displayName") - public String getDisplayName() { - return displayName; - } - - /** - * @return Determines if the user is locked. - */ - @JsonProperty("isLocked") - public boolean getIsLocked() { - return isLocked; - } - - /** - * @return Additional permissions for the user. - */ - @JsonProperty("permissions") - public List getPermissions() { - return permissions; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UserDto && equalTo((UserDto) other); - } - - private boolean equalTo(UserDto other) { - return links.equals(other.links) - && id.equals(other.id) - && email.equals(other.email) - && displayName.equals(other.displayName) - && isLocked == other.isLocked - && permissions.equals(other.permissions); - } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.id, this.email, this.displayName, this.isLocked, this.permissions); - } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - public interface IdStage { - EmailStage id(String id); +import com.squidex.api.core.JSON; - Builder from(UserDto other); +/** + * UserDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UserDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_EMAIL = "email"; + @SerializedName(SERIALIZED_NAME_EMAIL) + private String email; + public static final String SERIALIZED_NAME_DISPLAY_NAME = "displayName"; + @SerializedName(SERIALIZED_NAME_DISPLAY_NAME) + private String displayName; + public static final String SERIALIZED_NAME_IS_LOCKED = "isLocked"; + @SerializedName(SERIALIZED_NAME_IS_LOCKED) + private Boolean isLocked; + public static final String SERIALIZED_NAME_PERMISSIONS = "permissions"; + @SerializedName(SERIALIZED_NAME_PERMISSIONS) + private List permissions = new ArrayList<>(); + public UserDto() { + } + public UserDto links(Map links) { + this.links = links; + return this; + } + + public UserDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - public interface EmailStage { - DisplayNameStage email(String email); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public UserDto id(String id) { + this.id = id; + return this; + } + + /** + * The ID of the user. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public UserDto email(String email) { + this.email = email; + return this; + } + + /** + * The email of the user. Unique value. + * @return email + */ + @javax.annotation.Nonnull + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + public UserDto displayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * The display name (usually first name and last name) of the user. + * @return displayName + */ + @javax.annotation.Nonnull + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + public UserDto isLocked(Boolean isLocked) { + this.isLocked = isLocked; + return this; + } + + /** + * Determines if the user is locked. + * @return isLocked + */ + @javax.annotation.Nonnull + public Boolean getIsLocked() { + return isLocked; + } + + public void setIsLocked(Boolean isLocked) { + this.isLocked = isLocked; + } + public UserDto permissions(List permissions) { + this.permissions = permissions; + return this; + } + + public UserDto addPermissionsItem(String permissionsItem) { + if (this.permissions == null) { + this.permissions = new ArrayList<>(); } - - public interface DisplayNameStage { - IsLockedStage displayName(String displayName); + this.permissions.add(permissionsItem); + return this; + } + + /** + * Additional permissions for the user. + * @return permissions + */ + @javax.annotation.Nonnull + public List getPermissions() { + return permissions; + } + + public void setPermissions(List permissions) { + this.permissions = permissions; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface IsLockedStage { - _FinalStage isLocked(boolean isLocked); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - UserDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage permissions(List permissions); - - _FinalStage addPermissions(String permissions); - - _FinalStage addAllPermissions(List permissions); + UserDto userDto = (UserDto) o; + return Objects.equals(this.links, userDto.links) && + Objects.equals(this.id, userDto.id) && + Objects.equals(this.email, userDto.email) && + Objects.equals(this.displayName, userDto.displayName) && + Objects.equals(this.isLocked, userDto.isLocked) && + Objects.equals(this.permissions, userDto.permissions); + } + + @Override + public int hashCode() { + return Objects.hash(links, id, email, displayName, isLocked, permissions); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" email: ").append(toIndentedString(email)).append("\n"); + sb.append(" displayName: ").append(toIndentedString(displayName)).append("\n"); + sb.append(" isLocked: ").append(toIndentedString(isLocked)).append("\n"); + sb.append(" permissions: ").append(toIndentedString(permissions)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, EmailStage, DisplayNameStage, IsLockedStage, _FinalStage { - private String id; - - private String email; - - private String displayName; - - private boolean isLocked; - - private List permissions = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(UserDto other) { - links(other.getLinks()); - id(other.getId()); - email(other.getEmail()); - displayName(other.getDisplayName()); - isLocked(other.getIsLocked()); - permissions(other.getPermissions()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("id"); + openapiFields.add("email"); + openapiFields.add("displayName"); + openapiFields.add("isLocked"); + openapiFields.add("permissions"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("email"); + openapiRequiredFields.add("displayName"); + openapiRequiredFields.add("isLocked"); + openapiRequiredFields.add("permissions"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UserDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserDto is not found in the empty JSON string", UserDto.openapiRequiredFields.toString())); } + } - /** - *

The ID of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public EmailStage id(String id) { - this.id = id; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The email of the user. Unique value.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("email") - public DisplayNameStage email(String email) { - this.email = email; - return this; - } - - /** - *

The display name (usually first name and last name) of the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("displayName") - public IsLockedStage displayName(String displayName) { - this.displayName = displayName; - return this; - } - - /** - *

Determines if the user is locked.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("isLocked") - public _FinalStage isLocked(boolean isLocked) { - this.isLocked = isLocked; - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllPermissions(List permissions) { - this.permissions.addAll(permissions); - return this; - } - - /** - *

Additional permissions for the user.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addPermissions(String permissions) { - this.permissions.add(permissions); - return this; - } - - @Override - @JsonSetter(value = "permissions", nulls = Nulls.SKIP) - public _FinalStage permissions(List permissions) { - this.permissions.clear(); - this.permissions.addAll(permissions); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public UserDto build() { - return new UserDto(links, id, email, displayName, isLocked, permissions); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("email").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `email` to be a primitive type in the JSON string but got `%s`", jsonObj.get("email").toString())); + } + if (!jsonObj.get("displayName").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `displayName` to be a primitive type in the JSON string but got `%s`", jsonObj.get("displayName").toString())); + } + // ensure the required json array is present + if (jsonObj.get("permissions") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("permissions").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `permissions` to be an array in the JSON string but got `%s`", jsonObj.get("permissions").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UserDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of UserDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserDto + * @throws IOException if the JSON string is invalid with respect to UserDto + */ + public static UserDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserDto.class); + } + + /** + * Convert an instance of UserDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/UserProperty.java b/src/main/java/com/squidex/api/types/UserProperty.java index 805412a..aba154a 100644 --- a/src/main/java/com/squidex/api/types/UserProperty.java +++ b/src/main/java/com/squidex/api/types/UserProperty.java @@ -1,108 +1,236 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UserProperty.Builder.class) -public final class UserProperty { - private final String name; - - private final String value; - - private UserProperty(String name, String value) { - this.name = name; - this.value = value; - } - - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("value") - public String getValue() { - return value; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UserProperty && equalTo((UserProperty) other); - } - - private boolean equalTo(UserProperty other) { - return name.equals(other.name) && value.equals(other.value); - } - - @Override - public int hashCode() { - return Objects.hash(this.name, this.value); - } - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - public static NameStage builder() { - return new Builder(); - } +package com.squidex.api.types; - public interface NameStage { - ValueStage name(String name); +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.squidex.api.core.JSON; - Builder from(UserProperty other); +/** + * UserProperty + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UserProperty { + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_VALUE = "value"; + @SerializedName(SERIALIZED_NAME_VALUE) + private String value; + public UserProperty() { + } + public UserProperty name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + */ + @javax.annotation.Nonnull + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public UserProperty value(String value) { + this.value = value; + return this; + } + + /** + * Get value + * @return value + */ + @javax.annotation.Nonnull + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface ValueStage { - _FinalStage value(String value); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface _FinalStage { - UserProperty build(); + UserProperty userProperty = (UserProperty) o; + return Objects.equals(this.name, userProperty.name) && + Objects.equals(this.value, userProperty.value); + } + + @Override + public int hashCode() { + return Objects.hash(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UserProperty {\n"); + sb.append(" name: ").append(toIndentedString(name)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements NameStage, ValueStage, _FinalStage { - private String name; - - private String value; - - private Builder() {} - - @Override - public Builder from(UserProperty other) { - name(other.getName()); - value(other.getValue()); - return this; - } - - @Override - @JsonSetter("name") - public ValueStage name(String name) { - this.name = name; - return this; + return o.toString().replace("\n", "\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("value"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("name"); + 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 UserProperty + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UserProperty.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UserProperty is not found in the empty JSON string", UserProperty.openapiRequiredFields.toString())); } + } - @Override - @JsonSetter("value") - public _FinalStage value(String value) { - this.value = value; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UserProperty.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UserProperty` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - @Override - public UserProperty build() { - return new UserProperty(name, value); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UserProperty.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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 (!UserProperty.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UserProperty' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UserProperty.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UserProperty value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UserProperty read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of UserProperty given an JSON string + * + * @param jsonString JSON string + * @return An instance of UserProperty + * @throws IOException if the JSON string is invalid with respect to UserProperty + */ + public static UserProperty fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UserProperty.class); + } + + /** + * Convert an instance of UserProperty to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/UsersDto.java b/src/main/java/com/squidex/api/types/UsersDto.java index 39b31a3..5942280 100644 --- a/src/main/java/com/squidex/api/types/UsersDto.java +++ b/src/main/java/com/squidex/api/types/UsersDto.java @@ -1,195 +1,286 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.UserDto; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = UsersDto.Builder.class) -public final class UsersDto implements IResource { - private final Map links; - - private final int total; - private final List items; - - private UsersDto(Map links, int total, List items) { - this.links = links; - this.total = total; - this.items = items; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The total number of users. - */ - @JsonProperty("total") - public int getTotal() { - return total; - } +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - /** - * @return The users. - */ - @JsonProperty("items") - public List getItems() { - return items; - } +import com.squidex.api.core.JSON; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsersDto && equalTo((UsersDto) other); +/** + * UsersDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class UsersDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_TOTAL = "total"; + @SerializedName(SERIALIZED_NAME_TOTAL) + private Long total; + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public UsersDto() { + } + public UsersDto links(Map links) { + this.links = links; + return this; + } + + public UsersDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - private boolean equalTo(UsersDto other) { - return links.equals(other.links) && total == other.total && items.equals(other.items); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public UsersDto total(Long total) { + this.total = total; + return this; + } + + /** + * The total number of users. + * @return total + */ + @javax.annotation.Nonnull + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + public UsersDto items(List items) { + this.items = items; + return this; + } + + public UsersDto addItemsItem(UserDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.total, this.items); + this.items.add(itemsItem); + return this; + } + + /** + * The users. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + if (o == null || getClass() != o.getClass()) { + return false; } - - public static TotalStage builder() { - return new Builder(); + UsersDto usersDto = (UsersDto) o; + return Objects.equals(this.links, usersDto.links) && + Objects.equals(this.total, usersDto.total) && + Objects.equals(this.items, usersDto.items); + } + + @Override + public int hashCode() { + return Objects.hash(links, total, items); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class UsersDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" total: ").append(toIndentedString(total)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).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"; } - - public interface TotalStage { - _FinalStage total(int total); - - Builder from(UsersDto other); - } - - public interface _FinalStage { - UsersDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage items(List items); - - _FinalStage addItems(UserDto items); - - _FinalStage addAllItems(List items); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements TotalStage, _FinalStage { - private int total; - - private List items = new ArrayList<>(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(UsersDto other) { - links(other.getLinks()); - total(other.getTotal()); - items(other.getItems()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("total"); + openapiFields.add("items"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("total"); + openapiRequiredFields.add("items"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to UsersDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!UsersDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in UsersDto is not found in the empty JSON string", UsersDto.openapiRequiredFields.toString())); } + } - /** - *

The total number of users.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!UsersDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `UsersDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The users.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addAllItems(List items) { - this.items.addAll(items); - return this; - } - - /** - *

The users.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage addItems(UserDto items) { - this.items.add(items); - return this; - } - - @Override - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public _FinalStage items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public UsersDto build() { - return new UsersDto(links, total, items); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : UsersDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } + + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + UserDto.validateJsonElement(jsonArrayitems.get(i)); + }; + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!UsersDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'UsersDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(UsersDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, UsersDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public UsersDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of UsersDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of UsersDto + * @throws IOException if the JSON string is invalid with respect to UsersDto + */ + public static UsersDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, UsersDto.class); + } + + /** + * Convert an instance of UsersDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/WebhookMethod.java b/src/main/java/com/squidex/api/types/WebhookMethod.java index 2b34e7e..f38c6f8 100644 --- a/src/main/java/com/squidex/api/types/WebhookMethod.java +++ b/src/main/java/com/squidex/api/types/WebhookMethod.java @@ -1,30 +1,84 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +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; + +/** + * + */ +@JsonAdapter(WebhookMethod.Adapter.class) public enum WebhookMethod { - POST("POST"), + + POST("POST"), + + PUT("PUT"), + + GET("GET"), + + DELETE("DELETE"), + + PATCH("PATCH"); - PUT("PUT"), + private String value; - GET("GET"), + WebhookMethod(String value) { + this.value = value; + } - DELETE("DELETE"), + public String getValue() { + return value; + } - PATCH("PATCH"); + @Override + public String toString() { + return String.valueOf(value); + } - private final String value; + public static WebhookMethod fromValue(String value) { + for (WebhookMethod b : WebhookMethod.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } - WebhookMethod(String value) { - this.value = value; + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final WebhookMethod enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); } - @JsonValue @Override - public String toString() { - return this.value; + public WebhookMethod read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return WebhookMethod.fromValue(value); } + } + + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + String value = jsonElement.getAsString(); + WebhookMethod.fromValue(value); + } } + diff --git a/src/main/java/com/squidex/api/types/WebhookRuleActionDto.java b/src/main/java/com/squidex/api/types/WebhookRuleActionDto.java index 618ea52..9b3ee24 100644 --- a/src/main/java/com/squidex/api/types/WebhookRuleActionDto.java +++ b/src/main/java/com/squidex/api/types/WebhookRuleActionDto.java @@ -1,275 +1,340 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; - -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = WebhookRuleActionDto.Builder.class) -public final class WebhookRuleActionDto { - private final String url; - - private final WebhookMethod method; - - private final Optional payload; - - private final Optional payloadType; - - private final Optional headers; - - private final Optional sharedSecret; - private WebhookRuleActionDto( - String url, - WebhookMethod method, - Optional payload, - Optional payloadType, - Optional headers, - Optional sharedSecret) { - this.url = url; - this.method = method; - this.payload = payload; - this.payloadType = payloadType; - this.headers = headers; - this.sharedSecret = sharedSecret; - } - - /** - * @return The url to the webhook. - */ - @JsonProperty("url") - public String getUrl() { - return url; - } - - /** - * @return The type of the request. - */ - @JsonProperty("method") - public WebhookMethod getMethod() { - return method; - } - - /** - * @return Leave it empty to use the full event as body. - */ - @JsonProperty("payload") - public Optional getPayload() { - return payload; - } - - /** - * @return The mime type of the payload. - */ - @JsonProperty("payloadType") - public Optional getPayloadType() { - return payloadType; - } - /** - * @return The message headers in the format '[Key]=[Value]', one entry per line. - */ - @JsonProperty("headers") - public Optional getHeaders() { - return headers; - } - - /** - * @return The shared secret that is used to calculate the payload signature. - */ - @JsonProperty("sharedSecret") - public Optional getSharedSecret() { - return sharedSecret; - } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WebhookRuleActionDto && equalTo((WebhookRuleActionDto) other); - } - - private boolean equalTo(WebhookRuleActionDto other) { - return url.equals(other.url) - && method.equals(other.method) - && payload.equals(other.payload) - && payloadType.equals(other.payloadType) - && headers.equals(other.headers) - && sharedSecret.equals(other.sharedSecret); - } - - @Override - public int hashCode() { - return Objects.hash(this.url, this.method, this.payload, this.payloadType, this.headers, this.sharedSecret); - } +package com.squidex.api.types; - @Override - public String toString() { - return ObjectMappers.stringify(this); - } +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.squidex.api.types.RuleActionDto; +import com.squidex.api.types.WebhookMethod; +import java.io.IOException; +import java.net.URI; +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.squidex.api.core.JSON; - public static UrlStage builder() { - return new Builder(); +/** + * WebhookRuleActionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class WebhookRuleActionDto extends RuleActionDto { + public static final String SERIALIZED_NAME_URL = "url"; + @SerializedName(SERIALIZED_NAME_URL) + private URI url; + public static final String SERIALIZED_NAME_METHOD = "method"; + @SerializedName(SERIALIZED_NAME_METHOD) + private WebhookMethod method; + public static final String SERIALIZED_NAME_PAYLOAD = "payload"; + @SerializedName(SERIALIZED_NAME_PAYLOAD) + private String payload; + public static final String SERIALIZED_NAME_PAYLOAD_TYPE = "payloadType"; + @SerializedName(SERIALIZED_NAME_PAYLOAD_TYPE) + private String payloadType; + public static final String SERIALIZED_NAME_HEADERS = "headers"; + @SerializedName(SERIALIZED_NAME_HEADERS) + private String headers; + public static final String SERIALIZED_NAME_SHARED_SECRET = "sharedSecret"; + @SerializedName(SERIALIZED_NAME_SHARED_SECRET) + private String sharedSecret; + public WebhookRuleActionDto() { + } + public WebhookRuleActionDto url(URI url) { + this.url = url; + return this; + } + + /** + * The url to the webhook. + * @return url + */ + @javax.annotation.Nonnull + public URI getUrl() { + return url; + } + + public void setUrl(URI url) { + this.url = url; + } + public WebhookRuleActionDto method(WebhookMethod method) { + this.method = method; + return this; + } + + /** + * Get method + * @return method + */ + @javax.annotation.Nonnull + public WebhookMethod getMethod() { + return method; + } + + public void setMethod(WebhookMethod method) { + this.method = method; + } + public WebhookRuleActionDto payload(String payload) { + this.payload = payload; + return this; + } + + /** + * Leave it empty to use the full event as body. + * @return payload + */ + @javax.annotation.Nullable + public String getPayload() { + return payload; + } + + public void setPayload(String payload) { + this.payload = payload; + } + public WebhookRuleActionDto payloadType(String payloadType) { + this.payloadType = payloadType; + return this; + } + + /** + * The mime type of the payload. + * @return payloadType + */ + @javax.annotation.Nullable + public String getPayloadType() { + return payloadType; + } + + public void setPayloadType(String payloadType) { + this.payloadType = payloadType; + } + public WebhookRuleActionDto headers(String headers) { + this.headers = headers; + return this; + } + + /** + * The message headers in the format '[Key]=[Value]', one entry per line. + * @return headers + */ + @javax.annotation.Nullable + public String getHeaders() { + return headers; + } + + public void setHeaders(String headers) { + this.headers = headers; + } + public WebhookRuleActionDto sharedSecret(String sharedSecret) { + this.sharedSecret = sharedSecret; + return this; + } + + /** + * The shared secret that is used to calculate the payload signature. + * @return sharedSecret + */ + @javax.annotation.Nullable + public String getSharedSecret() { + return sharedSecret; + } + + public void setSharedSecret(String sharedSecret) { + this.sharedSecret = sharedSecret; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface UrlStage { - MethodStage url(String url); - - Builder from(WebhookRuleActionDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface MethodStage { - _FinalStage method(WebhookMethod method); + WebhookRuleActionDto webhookRuleActionDto = (WebhookRuleActionDto) o; + return Objects.equals(this.url, webhookRuleActionDto.url) && + Objects.equals(this.method, webhookRuleActionDto.method) && + Objects.equals(this.payload, webhookRuleActionDto.payload) && + Objects.equals(this.payloadType, webhookRuleActionDto.payloadType) && + Objects.equals(this.headers, webhookRuleActionDto.headers) && + Objects.equals(this.sharedSecret, webhookRuleActionDto.sharedSecret) && + super.equals(o); + } + + 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(url, method, payload, payloadType, headers, sharedSecret, super.hashCode()); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - WebhookRuleActionDto build(); - - _FinalStage payload(Optional payload); - - _FinalStage payload(String payload); - - _FinalStage payloadType(Optional payloadType); - - _FinalStage payloadType(String payloadType); - - _FinalStage headers(Optional headers); - - _FinalStage headers(String headers); - - _FinalStage sharedSecret(Optional sharedSecret); - - _FinalStage sharedSecret(String sharedSecret); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WebhookRuleActionDto {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" url: ").append(toIndentedString(url)).append("\n"); + sb.append(" method: ").append(toIndentedString(method)).append("\n"); + sb.append(" payload: ").append(toIndentedString(payload)).append("\n"); + sb.append(" payloadType: ").append(toIndentedString(payloadType)).append("\n"); + sb.append(" headers: ").append(toIndentedString(headers)).append("\n"); + sb.append(" sharedSecret: ").append(toIndentedString(sharedSecret)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements UrlStage, MethodStage, _FinalStage { - private String url; - - private WebhookMethod method; - - private Optional sharedSecret = Optional.empty(); - - private Optional headers = Optional.empty(); - - private Optional payloadType = Optional.empty(); - - private Optional payload = Optional.empty(); - - private Builder() {} - - @Override - public Builder from(WebhookRuleActionDto other) { - url(other.getUrl()); - method(other.getMethod()); - payload(other.getPayload()); - payloadType(other.getPayloadType()); - headers(other.getHeaders()); - sharedSecret(other.getSharedSecret()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("actionType"); + openapiFields.add("url"); + openapiFields.add("method"); + openapiFields.add("payload"); + openapiFields.add("payloadType"); + openapiFields.add("headers"); + openapiFields.add("sharedSecret"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("url"); + openapiRequiredFields.add("method"); + openapiRequiredFields.add("actionType"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WebhookRuleActionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WebhookRuleActionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WebhookRuleActionDto is not found in the empty JSON string", WebhookRuleActionDto.openapiRequiredFields.toString())); } + } - /** - *

The url to the webhook.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("url") - public MethodStage url(String url) { - this.url = url; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WebhookRuleActionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WebhookRuleActionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The type of the request.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("method") - public _FinalStage method(WebhookMethod method) { - this.method = method; - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WebhookRuleActionDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); } + } + } - /** - *

The shared secret that is used to calculate the payload signature.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage sharedSecret(String sharedSecret) { - this.sharedSecret = Optional.of(sharedSecret); - return this; - } - - @Override - @JsonSetter(value = "sharedSecret", nulls = Nulls.SKIP) - public _FinalStage sharedSecret(Optional sharedSecret) { - this.sharedSecret = sharedSecret; - return this; - } - - /** - *

The message headers in the format '[Key]=[Value]', one entry per line.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage headers(String headers) { - this.headers = Optional.of(headers); - return this; - } - - @Override - @JsonSetter(value = "headers", nulls = Nulls.SKIP) - public _FinalStage headers(Optional headers) { - this.headers = headers; - return this; - } - - /** - *

The mime type of the payload.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage payloadType(String payloadType) { - this.payloadType = Optional.of(payloadType); - return this; - } - - @Override - @JsonSetter(value = "payloadType", nulls = Nulls.SKIP) - public _FinalStage payloadType(Optional payloadType) { - this.payloadType = payloadType; - return this; - } - - /** - *

Leave it empty to use the full event as body.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage payload(String payload) { - this.payload = Optional.of(payload); - return this; - } - - @Override - @JsonSetter(value = "payload", nulls = Nulls.SKIP) - public _FinalStage payload(Optional payload) { - this.payload = payload; - return this; - } - - @Override - public WebhookRuleActionDto build() { - return new WebhookRuleActionDto(url, method, payload, payloadType, headers, sharedSecret); - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WebhookRuleActionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WebhookRuleActionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WebhookRuleActionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WebhookRuleActionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WebhookRuleActionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of WebhookRuleActionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of WebhookRuleActionDto + * @throws IOException if the JSON string is invalid with respect to WebhookRuleActionDto + */ + public static WebhookRuleActionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WebhookRuleActionDto.class); + } + + /** + * Convert an instance of WebhookRuleActionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/WorkflowDto.java b/src/main/java/com/squidex/api/types/WorkflowDto.java index 4902175..a643983 100644 --- a/src/main/java/com/squidex/api/types/WorkflowDto.java +++ b/src/main/java/com/squidex/api/types/WorkflowDto.java @@ -1,305 +1,379 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.LinkedHashMap; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.WorkflowStepDto; +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.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = WorkflowDto.Builder.class) -public final class WorkflowDto implements IResource { - private final Map links; - - private final String id; - - private final Optional name; - - private final Map steps; - - private final Optional> schemaIds; - - private final String initial; - - private WorkflowDto( - Map links, - String id, - Optional name, - Map steps, - Optional> schemaIds, - String initial) { - this.links = links; - this.id = id; - this.name = name; - this.steps = steps; - this.schemaIds = schemaIds; - this.initial = initial; - } - - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; - } - - /** - * @return The workflow id. - */ - @JsonProperty("id") - public String getId() { - return id; - } - - /** - * @return The name of the workflow. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return The workflow steps. - */ - @JsonProperty("steps") - public Map getSteps() { - return steps; - } - - /** - * @return The schema ids. - */ - @JsonProperty("schemaIds") - public Optional> getSchemaIds() { - return schemaIds; - } - - /** - * @return The initial step. - */ - @JsonProperty("initial") - public String getInitial() { - return initial; - } +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; - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WorkflowDto && equalTo((WorkflowDto) other); - } +import com.squidex.api.core.JSON; - private boolean equalTo(WorkflowDto other) { - return links.equals(other.links) - && id.equals(other.id) - && name.equals(other.name) - && steps.equals(other.steps) - && schemaIds.equals(other.schemaIds) - && initial.equals(other.initial); +/** + * WorkflowDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class WorkflowDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ID = "id"; + @SerializedName(SERIALIZED_NAME_ID) + private String id; + public static final String SERIALIZED_NAME_NAME = "name"; + @SerializedName(SERIALIZED_NAME_NAME) + private String name; + public static final String SERIALIZED_NAME_STEPS = "steps"; + @SerializedName(SERIALIZED_NAME_STEPS) + private Map steps = new HashMap<>(); + public static final String SERIALIZED_NAME_SCHEMA_IDS = "schemaIds"; + @SerializedName(SERIALIZED_NAME_SCHEMA_IDS) + private List schemaIds; + public static final String SERIALIZED_NAME_INITIAL = "initial"; + @SerializedName(SERIALIZED_NAME_INITIAL) + private String initial; + public WorkflowDto() { + } + public WorkflowDto links(Map links) { + this.links = links; + return this; + } + + public WorkflowDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } - - @Override - public int hashCode() { - return Objects.hash(this.links, this.id, this.name, this.steps, this.schemaIds, this.initial); + this.links.put(key, linksItem); + return this; + } + + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } + + public void setLinks(Map links) { + this.links = links; + } + public WorkflowDto id(String id) { + this.id = id; + return this; + } + + /** + * The workflow id. + * @return id + */ + @javax.annotation.Nonnull + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + public WorkflowDto name(String name) { + this.name = name; + return this; + } + + /** + * The name of the workflow. + * @return name + */ + @javax.annotation.Nullable + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + public WorkflowDto steps(Map steps) { + this.steps = steps; + return this; + } + + public WorkflowDto putStepsItem(String key, WorkflowStepDto stepsItem) { + if (this.steps == null) { + this.steps = new HashMap<>(); } - - @Override - public String toString() { - return ObjectMappers.stringify(this); + this.steps.put(key, stepsItem); + return this; + } + + /** + * The workflow steps. + * @return steps + */ + @javax.annotation.Nonnull + public Map getSteps() { + return steps; + } + + public void setSteps(Map steps) { + this.steps = steps; + } + public WorkflowDto schemaIds(List schemaIds) { + this.schemaIds = schemaIds; + return this; + } + + public WorkflowDto addSchemaIdsItem(String schemaIdsItem) { + if (this.schemaIds == null) { + this.schemaIds = new ArrayList<>(); } - - public static IdStage builder() { - return new Builder(); + this.schemaIds.add(schemaIdsItem); + return this; + } + + /** + * The schema ids. + * @return schemaIds + */ + @javax.annotation.Nullable + public List getSchemaIds() { + return schemaIds; + } + + public void setSchemaIds(List schemaIds) { + this.schemaIds = schemaIds; + } + public WorkflowDto initial(String initial) { + this.initial = initial; + return this; + } + + /** + * The initial step. + * @return initial + */ + @javax.annotation.Nonnull + public String getInitial() { + return initial; + } + + public void setInitial(String initial) { + this.initial = initial; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - public interface IdStage { - InitialStage id(String id); - - Builder from(WorkflowDto other); + if (o == null || getClass() != o.getClass()) { + return false; } - - public interface InitialStage { - _FinalStage initial(String initial); + WorkflowDto workflowDto = (WorkflowDto) o; + return Objects.equals(this.links, workflowDto.links) && + Objects.equals(this.id, workflowDto.id) && + Objects.equals(this.name, workflowDto.name) && + Objects.equals(this.steps, workflowDto.steps) && + Objects.equals(this.schemaIds, workflowDto.schemaIds) && + Objects.equals(this.initial, workflowDto.initial); + } + + 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(links, id, name, steps, schemaIds, initial); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - public interface _FinalStage { - WorkflowDto build(); - - _FinalStage links(Map links); - - _FinalStage putAllLinks(Map links); - - _FinalStage links(String key, ResourceLink value); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage steps(Map steps); - - _FinalStage putAllSteps(Map steps); - - _FinalStage steps(String key, WorkflowStepDto value); - - _FinalStage schemaIds(Optional> schemaIds); - - _FinalStage schemaIds(List schemaIds); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" id: ").append(toIndentedString(id)).append("\n"); + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" steps: ").append(toIndentedString(steps)).append("\n"); + sb.append(" schemaIds: ").append(toIndentedString(schemaIds)).append("\n"); + sb.append(" initial: ").append(toIndentedString(initial)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder implements IdStage, InitialStage, _FinalStage { - private String id; - - private String initial; - - private Optional> schemaIds = Optional.empty(); - - private Map steps = new LinkedHashMap<>(); - - private Optional name = Optional.empty(); - - private Map links = new LinkedHashMap<>(); - - private Builder() {} - - @Override - public Builder from(WorkflowDto other) { - links(other.getLinks()); - id(other.getId()); - name(other.getName()); - steps(other.getSteps()); - schemaIds(other.getSchemaIds()); - initial(other.getInitial()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("id"); + openapiFields.add("name"); + openapiFields.add("steps"); + openapiFields.add("schemaIds"); + openapiFields.add("initial"); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("id"); + openapiRequiredFields.add("steps"); + openapiRequiredFields.add("initial"); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WorkflowDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WorkflowDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WorkflowDto is not found in the empty JSON string", WorkflowDto.openapiRequiredFields.toString())); } + } - /** - *

The workflow id.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("id") - public InitialStage id(String id) { - this.id = id; - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WorkflowDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WorkflowDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - /** - *

The initial step.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - @JsonSetter("initial") - public _FinalStage initial(String initial) { - this.initial = initial; - return this; - } - - /** - *

The schema ids.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage schemaIds(List schemaIds) { - this.schemaIds = Optional.of(schemaIds); - return this; - } - - @Override - @JsonSetter(value = "schemaIds", nulls = Nulls.SKIP) - public _FinalStage schemaIds(Optional> schemaIds) { - this.schemaIds = schemaIds; - return this; - } - - /** - *

The workflow steps.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage steps(String key, WorkflowStepDto value) { - this.steps.put(key, value); - return this; - } - - /** - *

The workflow steps.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllSteps(Map steps) { - this.steps.putAll(steps); - return this; - } - - @Override - @JsonSetter(value = "steps", nulls = Nulls.SKIP) - public _FinalStage steps(Map steps) { - this.steps.clear(); - this.steps.putAll(steps); - return this; - } - - /** - *

The name of the workflow.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage name(String name) { - this.name = Optional.of(name); - return this; - } - - @Override - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage links(String key, ResourceLink value) { - this.links.put(key, value); - return this; - } - - /** - *

The links.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @Override - public _FinalStage putAllLinks(Map links) { - this.links.putAll(links); - return this; - } - - @Override - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public _FinalStage links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } - - @Override - public WorkflowDto build() { - return new WorkflowDto(links, id, name, steps, schemaIds, initial); + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WorkflowDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("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("schemaIds") != null && !jsonObj.get("schemaIds").isJsonNull() && !jsonObj.get("schemaIds").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `schemaIds` to be an array in the JSON string but got `%s`", jsonObj.get("schemaIds").toString())); + } + if (!jsonObj.get("initial").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `initial` to be a primitive type in the JSON string but got `%s`", jsonObj.get("initial").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WorkflowDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WorkflowDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WorkflowDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WorkflowDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WorkflowDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of WorkflowDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of WorkflowDto + * @throws IOException if the JSON string is invalid with respect to WorkflowDto + */ + public static WorkflowDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WorkflowDto.class); + } + + /** + * Convert an instance of WorkflowDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/WorkflowStepDto.java b/src/main/java/com/squidex/api/types/WorkflowStepDto.java index 1dfc6a0..f15e62d 100644 --- a/src/main/java/com/squidex/api/types/WorkflowStepDto.java +++ b/src/main/java/com/squidex/api/types/WorkflowStepDto.java @@ -1,227 +1,356 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.WorkflowTransitionDto; +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.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = WorkflowStepDto.Builder.class) -public final class WorkflowStepDto { - private final Optional> transitions; - - private final Optional color; - - private final Optional validate; - - private final Optional noUpdate; - - private final Optional noUpdateExpression; - - private final Optional> noUpdateRoles; - - private WorkflowStepDto( - Optional> transitions, - Optional color, - Optional validate, - Optional noUpdate, - Optional noUpdateExpression, - Optional> noUpdateRoles) { - this.transitions = transitions; - this.color = color; - this.validate = validate; - this.noUpdate = noUpdate; - this.noUpdateExpression = noUpdateExpression; - this.noUpdateRoles = noUpdateRoles; - } - - /** - * @return The transitions. - */ - @JsonProperty("transitions") - public Optional> getTransitions() { - return transitions; - } - - /** - * @return The optional color. - */ - @JsonProperty("color") - public Optional getColor() { - return color; - } +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; - /** - * @return True if the content should be validated when moving to this step. - */ - @JsonProperty("validate") - public Optional getValidate() { - return validate; - } +import com.squidex.api.core.JSON; - /** - * @return Indicates if updates should not be allowed. - */ - @JsonProperty("noUpdate") - public Optional getNoUpdate() { - return noUpdate; +/** + * WorkflowStepDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class WorkflowStepDto { + public static final String SERIALIZED_NAME_TRANSITIONS = "transitions"; + @SerializedName(SERIALIZED_NAME_TRANSITIONS) + private Map transitions = new HashMap<>(); + public static final String SERIALIZED_NAME_COLOR = "color"; + @SerializedName(SERIALIZED_NAME_COLOR) + private String color; + public static final String SERIALIZED_NAME_VALIDATE = "validate"; + @SerializedName(SERIALIZED_NAME_VALIDATE) + private Boolean validate; + public static final String SERIALIZED_NAME_NO_UPDATE = "noUpdate"; + @SerializedName(SERIALIZED_NAME_NO_UPDATE) + private Boolean noUpdate; + public static final String SERIALIZED_NAME_NO_UPDATE_EXPRESSION = "noUpdateExpression"; + @SerializedName(SERIALIZED_NAME_NO_UPDATE_EXPRESSION) + private String noUpdateExpression; + public static final String SERIALIZED_NAME_NO_UPDATE_ROLES = "noUpdateRoles"; + @SerializedName(SERIALIZED_NAME_NO_UPDATE_ROLES) + private List noUpdateRoles; + public WorkflowStepDto() { + } + public WorkflowStepDto transitions(Map transitions) { + this.transitions = transitions; + return this; + } + + public WorkflowStepDto putTransitionsItem(String key, WorkflowTransitionDto transitionsItem) { + if (this.transitions == null) { + this.transitions = new HashMap<>(); } - - /** - * @return Optional expression that must evaluate to true when you want to prevent updates. - */ - @JsonProperty("noUpdateExpression") - public Optional getNoUpdateExpression() { - return noUpdateExpression; + this.transitions.put(key, transitionsItem); + return this; + } + + /** + * The transitions. + * @return transitions + */ + @javax.annotation.Nullable + public Map getTransitions() { + return transitions; + } + + public void setTransitions(Map transitions) { + this.transitions = transitions; + } + public WorkflowStepDto color(String color) { + this.color = color; + return this; + } + + /** + * The optional color. + * @return color + */ + @javax.annotation.Nullable + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + public WorkflowStepDto validate(Boolean validate) { + this.validate = validate; + return this; + } + + /** + * True if the content should be validated when moving to this step. + * @return validate + */ + @javax.annotation.Nullable + public Boolean getValidate() { + return validate; + } + + public void setValidate(Boolean validate) { + this.validate = validate; + } + public WorkflowStepDto noUpdate(Boolean noUpdate) { + this.noUpdate = noUpdate; + return this; + } + + /** + * Indicates if updates should not be allowed. + * @return noUpdate + */ + @javax.annotation.Nullable + public Boolean getNoUpdate() { + return noUpdate; + } + + public void setNoUpdate(Boolean noUpdate) { + this.noUpdate = noUpdate; + } + public WorkflowStepDto noUpdateExpression(String noUpdateExpression) { + this.noUpdateExpression = noUpdateExpression; + return this; + } + + /** + * Optional expression that must evaluate to true when you want to prevent updates. + * @return noUpdateExpression + */ + @javax.annotation.Nullable + public String getNoUpdateExpression() { + return noUpdateExpression; + } + + public void setNoUpdateExpression(String noUpdateExpression) { + this.noUpdateExpression = noUpdateExpression; + } + public WorkflowStepDto noUpdateRoles(List noUpdateRoles) { + this.noUpdateRoles = noUpdateRoles; + return this; + } + + public WorkflowStepDto addNoUpdateRolesItem(String noUpdateRolesItem) { + if (this.noUpdateRoles == null) { + this.noUpdateRoles = new ArrayList<>(); } - - /** - * @return Optional list of roles to restrict the updates for users with these roles. - */ - @JsonProperty("noUpdateRoles") - public Optional> getNoUpdateRoles() { - return noUpdateRoles; + this.noUpdateRoles.add(noUpdateRolesItem); + return this; + } + + /** + * Optional list of roles to restrict the updates for users with these roles. + * @return noUpdateRoles + */ + @javax.annotation.Nullable + public List getNoUpdateRoles() { + return noUpdateRoles; + } + + public void setNoUpdateRoles(List noUpdateRoles) { + this.noUpdateRoles = noUpdateRoles; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WorkflowStepDto && equalTo((WorkflowStepDto) other); + if (o == null || getClass() != o.getClass()) { + return false; } - - private boolean equalTo(WorkflowStepDto other) { - return transitions.equals(other.transitions) - && color.equals(other.color) - && validate.equals(other.validate) - && noUpdate.equals(other.noUpdate) - && noUpdateExpression.equals(other.noUpdateExpression) - && noUpdateRoles.equals(other.noUpdateRoles); - } - - @Override - public int hashCode() { - return Objects.hash( - this.transitions, - this.color, - this.validate, - this.noUpdate, - this.noUpdateExpression, - this.noUpdateRoles); + WorkflowStepDto workflowStepDto = (WorkflowStepDto) o; + return Objects.equals(this.transitions, workflowStepDto.transitions) && + Objects.equals(this.color, workflowStepDto.color) && + Objects.equals(this.validate, workflowStepDto.validate) && + Objects.equals(this.noUpdate, workflowStepDto.noUpdate) && + Objects.equals(this.noUpdateExpression, workflowStepDto.noUpdateExpression) && + Objects.equals(this.noUpdateRoles, workflowStepDto.noUpdateRoles); + } + + 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(transitions, color, validate, noUpdate, noUpdateExpression, noUpdateRoles); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowStepDto {\n"); + sb.append(" transitions: ").append(toIndentedString(transitions)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).append("\n"); + sb.append(" validate: ").append(toIndentedString(validate)).append("\n"); + sb.append(" noUpdate: ").append(toIndentedString(noUpdate)).append("\n"); + sb.append(" noUpdateExpression: ").append(toIndentedString(noUpdateExpression)).append("\n"); + sb.append(" noUpdateRoles: ").append(toIndentedString(noUpdateRoles)).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"; } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional> transitions = Optional.empty(); - - private Optional color = Optional.empty(); - - private Optional validate = Optional.empty(); - - private Optional noUpdate = Optional.empty(); - - private Optional noUpdateExpression = Optional.empty(); - - private Optional> noUpdateRoles = Optional.empty(); - - private Builder() {} - - public Builder from(WorkflowStepDto other) { - transitions(other.getTransitions()); - color(other.getColor()); - validate(other.getValidate()); - noUpdate(other.getNoUpdate()); - noUpdateExpression(other.getNoUpdateExpression()); - noUpdateRoles(other.getNoUpdateRoles()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("transitions"); + openapiFields.add("color"); + openapiFields.add("validate"); + openapiFields.add("noUpdate"); + openapiFields.add("noUpdateExpression"); + openapiFields.add("noUpdateRoles"); + + // 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 WorkflowStepDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WorkflowStepDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WorkflowStepDto is not found in the empty JSON string", WorkflowStepDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "transitions", nulls = Nulls.SKIP) - public Builder transitions(Optional> transitions) { - this.transitions = transitions; - return this; - } - - public Builder transitions(Map transitions) { - this.transitions = Optional.of(transitions); - return this; - } - - @JsonSetter(value = "color", nulls = Nulls.SKIP) - public Builder color(Optional color) { - this.color = color; - return this; - } - - public Builder color(String color) { - this.color = Optional.of(color); - return this; - } - - @JsonSetter(value = "validate", nulls = Nulls.SKIP) - public Builder validate(Optional validate) { - this.validate = validate; - return this; - } - - public Builder validate(Boolean validate) { - this.validate = Optional.of(validate); - return this; - } - - @JsonSetter(value = "noUpdate", nulls = Nulls.SKIP) - public Builder noUpdate(Optional noUpdate) { - this.noUpdate = noUpdate; - return this; - } - - public Builder noUpdate(Boolean noUpdate) { - this.noUpdate = Optional.of(noUpdate); - return this; - } - - @JsonSetter(value = "noUpdateExpression", nulls = Nulls.SKIP) - public Builder noUpdateExpression(Optional noUpdateExpression) { - this.noUpdateExpression = noUpdateExpression; - return this; - } - - public Builder noUpdateExpression(String noUpdateExpression) { - this.noUpdateExpression = Optional.of(noUpdateExpression); - return this; - } - - @JsonSetter(value = "noUpdateRoles", nulls = Nulls.SKIP) - public Builder noUpdateRoles(Optional> noUpdateRoles) { - this.noUpdateRoles = noUpdateRoles; - return this; - } - - public Builder noUpdateRoles(List noUpdateRoles) { - this.noUpdateRoles = Optional.of(noUpdateRoles); - return this; - } - - public WorkflowStepDto build() { - return new WorkflowStepDto(transitions, color, validate, noUpdate, noUpdateExpression, noUpdateRoles); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WorkflowStepDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WorkflowStepDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("color") != null && !jsonObj.get("color").isJsonNull()) && !jsonObj.get("color").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `color` to be a primitive type in the JSON string but got `%s`", jsonObj.get("color").toString())); + } + if ((jsonObj.get("noUpdateExpression") != null && !jsonObj.get("noUpdateExpression").isJsonNull()) && !jsonObj.get("noUpdateExpression").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `noUpdateExpression` to be a primitive type in the JSON string but got `%s`", jsonObj.get("noUpdateExpression").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("noUpdateRoles") != null && !jsonObj.get("noUpdateRoles").isJsonNull() && !jsonObj.get("noUpdateRoles").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `noUpdateRoles` to be an array in the JSON string but got `%s`", jsonObj.get("noUpdateRoles").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WorkflowStepDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WorkflowStepDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WorkflowStepDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WorkflowStepDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WorkflowStepDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of WorkflowStepDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of WorkflowStepDto + * @throws IOException if the JSON string is invalid with respect to WorkflowStepDto + */ + public static WorkflowStepDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WorkflowStepDto.class); + } + + /** + * Convert an instance of WorkflowStepDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/WorkflowTransitionDto.java b/src/main/java/com/squidex/api/types/WorkflowTransitionDto.java index c67f8c8..d10f215 100644 --- a/src/main/java/com/squidex/api/types/WorkflowTransitionDto.java +++ b/src/main/java/com/squidex/api/types/WorkflowTransitionDto.java @@ -1,109 +1,250 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; -import java.util.List; -import java.util.Objects; -import java.util.Optional; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = WorkflowTransitionDto.Builder.class) -public final class WorkflowTransitionDto { - private final Optional expression; +package com.squidex.api.types; - private final Optional> roles; +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.ArrayList; +import java.util.Arrays; +import java.util.List; +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; - private WorkflowTransitionDto(Optional expression, Optional> roles) { - this.expression = expression; - this.roles = roles; - } +import com.squidex.api.core.JSON; - /** - * @return The optional expression. - */ - @JsonProperty("expression") - public Optional getExpression() { - return expression; +/** + * WorkflowTransitionDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class WorkflowTransitionDto { + public static final String SERIALIZED_NAME_EXPRESSION = "expression"; + @SerializedName(SERIALIZED_NAME_EXPRESSION) + private String expression; + public static final String SERIALIZED_NAME_ROLES = "roles"; + @SerializedName(SERIALIZED_NAME_ROLES) + private List roles; + public WorkflowTransitionDto() { + } + public WorkflowTransitionDto expression(String expression) { + this.expression = expression; + return this; + } + + /** + * The optional expression. + * @return expression + */ + @javax.annotation.Nullable + public String getExpression() { + return expression; + } + + public void setExpression(String expression) { + this.expression = expression; + } + public WorkflowTransitionDto roles(List roles) { + this.roles = roles; + return this; + } + + public WorkflowTransitionDto addRolesItem(String rolesItem) { + if (this.roles == null) { + this.roles = new ArrayList<>(); } - - /** - * @return The optional restricted role. - */ - @JsonProperty("roles") - public Optional> getRoles() { - return roles; + this.roles.add(rolesItem); + return this; + } + + /** + * The optional restricted role. + * @return roles + */ + @javax.annotation.Nullable + public List getRoles() { + return roles; + } + + public void setRoles(List roles) { + this.roles = roles; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WorkflowTransitionDto && equalTo((WorkflowTransitionDto) other); + if (o == null || getClass() != o.getClass()) { + return false; } - - private boolean equalTo(WorkflowTransitionDto other) { - return expression.equals(other.expression) && roles.equals(other.roles); + WorkflowTransitionDto workflowTransitionDto = (WorkflowTransitionDto) o; + return Objects.equals(this.expression, workflowTransitionDto.expression) && + Objects.equals(this.roles, workflowTransitionDto.roles); + } + + 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(expression, roles); + } + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; } - - @Override - public int hashCode() { - return Objects.hash(this.expression, this.roles); + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowTransitionDto {\n"); + sb.append(" expression: ").append(toIndentedString(expression)).append("\n"); + sb.append(" roles: ").append(toIndentedString(roles)).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"; } - - @Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional expression = Optional.empty(); - - private Optional> roles = Optional.empty(); - - private Builder() {} - - public Builder from(WorkflowTransitionDto other) { - expression(other.getExpression()); - roles(other.getRoles()); - return this; + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("expression"); + openapiFields.add("roles"); + + // 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 WorkflowTransitionDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WorkflowTransitionDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WorkflowTransitionDto is not found in the empty JSON string", WorkflowTransitionDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "expression", nulls = Nulls.SKIP) - public Builder expression(Optional expression) { - this.expression = expression; - return this; - } - - public Builder expression(String expression) { - this.expression = Optional.of(expression); - return this; - } - - @JsonSetter(value = "roles", nulls = Nulls.SKIP) - public Builder roles(Optional> roles) { - this.roles = roles; - return this; - } - - public Builder roles(List roles) { - this.roles = Optional.of(roles); - return this; - } - - public WorkflowTransitionDto build() { - return new WorkflowTransitionDto(expression, roles); + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WorkflowTransitionDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WorkflowTransitionDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("expression") != null && !jsonObj.get("expression").isJsonNull()) && !jsonObj.get("expression").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `expression` to be a primitive type in the JSON string but got `%s`", jsonObj.get("expression").toString())); + } + // ensure the optional json data is an array if present + if (jsonObj.get("roles") != null && !jsonObj.get("roles").isJsonNull() && !jsonObj.get("roles").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `roles` to be an array in the JSON string but got `%s`", jsonObj.get("roles").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WorkflowTransitionDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WorkflowTransitionDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WorkflowTransitionDto.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WorkflowTransitionDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } + + @Override + public WorkflowTransitionDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } + + }.nullSafe(); } + } + + /** + * Create an instance of WorkflowTransitionDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of WorkflowTransitionDto + * @throws IOException if the JSON string is invalid with respect to WorkflowTransitionDto + */ + public static WorkflowTransitionDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WorkflowTransitionDto.class); + } + + /** + * Convert an instance of WorkflowTransitionDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/main/java/com/squidex/api/types/WorkflowsDto.java b/src/main/java/com/squidex/api/types/WorkflowsDto.java index 9a5f1f0..589360e 100644 --- a/src/main/java/com/squidex/api/types/WorkflowsDto.java +++ b/src/main/java/com/squidex/api/types/WorkflowsDto.java @@ -1,155 +1,300 @@ -/** - * This file was auto-generated by Fern from our API Definition. +/* + * Squidex API + * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + * + * The version of the OpenAPI document: 1.0.0.0 + * + * + * 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.squidex.api.types; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.squidex.api.core.ObjectMappers; +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.squidex.api.types.ResourceLink; +import com.squidex.api.types.WorkflowDto; +import java.io.IOException; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@JsonDeserialize(builder = WorkflowsDto.Builder.class) -public final class WorkflowsDto implements IResource { - private final Map links; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; - private final List items; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; - private final List errors; +import com.squidex.api.core.JSON; - private WorkflowsDto(Map links, List items, List errors) { - this.links = links; - this.items = items; - this.errors = errors; - } +/** + * WorkflowsDto + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0-SNAPSHOT") +public class WorkflowsDto { + public static final String SERIALIZED_NAME_LINKS = "_links"; + @SerializedName(SERIALIZED_NAME_LINKS) + private Map links = new HashMap<>(); + public static final String SERIALIZED_NAME_ITEMS = "items"; + @SerializedName(SERIALIZED_NAME_ITEMS) + private List items = new ArrayList<>(); + public static final String SERIALIZED_NAME_ERRORS = "errors"; + @SerializedName(SERIALIZED_NAME_ERRORS) + private List errors = new ArrayList<>(); + public WorkflowsDto() { + } + public WorkflowsDto links(Map links) { + this.links = links; + return this; + } - /** - * @return The links. - */ - @JsonProperty("_links") - @Override - public Map getLinks() { - return links; + public WorkflowsDto putLinksItem(String key, ResourceLink linksItem) { + if (this.links == null) { + this.links = new HashMap<>(); } + this.links.put(key, linksItem); + return this; + } - /** - * @return The workflow. - */ - @JsonProperty("items") - public List getItems() { - return items; - } + /** + * The links. + * @return links + */ + @javax.annotation.Nonnull + public Map getLinks() { + return links; + } - /** - * @return The errros that should be fixed. - */ - @JsonProperty("errors") - public List getErrors() { - return errors; - } + public void setLinks(Map links) { + this.links = links; + } + public WorkflowsDto items(List items) { + this.items = items; + return this; + } - @Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof WorkflowsDto && equalTo((WorkflowsDto) other); + public WorkflowsDto addItemsItem(WorkflowDto itemsItem) { + if (this.items == null) { + this.items = new ArrayList<>(); } + this.items.add(itemsItem); + return this; + } - private boolean equalTo(WorkflowsDto other) { - return links.equals(other.links) && items.equals(other.items) && errors.equals(other.errors); - } + /** + * The workflow. + * @return items + */ + @javax.annotation.Nonnull + public List getItems() { + return items; + } - @Override - public int hashCode() { - return Objects.hash(this.links, this.items, this.errors); - } + public void setItems(List items) { + this.items = items; + } + public WorkflowsDto errors(List errors) { + this.errors = errors; + return this; + } - @Override - public String toString() { - return ObjectMappers.stringify(this); + public WorkflowsDto addErrorsItem(String errorsItem) { + if (this.errors == null) { + this.errors = new ArrayList<>(); } + this.errors.add(errorsItem); + return this; + } + + /** + * The errros that should be fixed. + * @return errors + */ + @javax.annotation.Nonnull + public List getErrors() { + return errors; + } + + public void setErrors(List errors) { + this.errors = errors; + } - public static Builder builder() { - return new Builder(); + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; } + WorkflowsDto workflowsDto = (WorkflowsDto) o; + return Objects.equals(this.links, workflowsDto.links) && + Objects.equals(this.items, workflowsDto.items) && + Objects.equals(this.errors, workflowsDto.errors); + } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Map links = new LinkedHashMap<>(); + @Override + public int hashCode() { + return Objects.hash(links, items, errors); + } - private List items = new ArrayList<>(); + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class WorkflowsDto {\n"); + sb.append(" links: ").append(toIndentedString(links)).append("\n"); + sb.append(" items: ").append(toIndentedString(items)).append("\n"); + sb.append(" errors: ").append(toIndentedString(errors)).append("\n"); + sb.append("}"); + return sb.toString(); + } - private List errors = new ArrayList<>(); + /** + * 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 "); + } - private Builder() {} - public Builder from(WorkflowsDto other) { - links(other.getLinks()); - items(other.getItems()); - errors(other.getErrors()); - return this; - } + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; - @JsonSetter(value = "_links", nulls = Nulls.SKIP) - public Builder links(Map links) { - this.links.clear(); - this.links.putAll(links); - return this; - } + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + openapiFields.add("_links"); + openapiFields.add("items"); + openapiFields.add("errors"); - public Builder putAllLinks(Map links) { - this.links.putAll(links); - return this; - } + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + openapiRequiredFields.add("_links"); + openapiRequiredFields.add("items"); + openapiRequiredFields.add("errors"); + } - public Builder links(String key, ResourceLink value) { - this.links.put(key, value); - return this; + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to WorkflowsDto + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!WorkflowsDto.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in WorkflowsDto is not found in the empty JSON string", WorkflowsDto.openapiRequiredFields.toString())); } + } - @JsonSetter(value = "items", nulls = Nulls.SKIP) - public Builder items(List items) { - this.items.clear(); - this.items.addAll(items); - return this; + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!WorkflowsDto.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `WorkflowsDto` properties. JSON: %s", entry.getKey(), jsonElement.toString())); } + } - public Builder addItems(WorkflowDto items) { - this.items.add(items); - return this; + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : WorkflowsDto.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + 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("items").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `items` to be an array in the JSON string but got `%s`", jsonObj.get("items").toString())); + } - public Builder addAllItems(List items) { - this.items.addAll(items); - return this; - } + JsonArray jsonArrayitems = jsonObj.getAsJsonArray("items"); + // validate the required field `items` (array) + for (int i = 0; i < jsonArrayitems.size(); i++) { + WorkflowDto.validateJsonElement(jsonArrayitems.get(i)); + }; + // ensure the required json array is present + if (jsonObj.get("errors") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else 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())); + } + } - @JsonSetter(value = "errors", nulls = Nulls.SKIP) - public Builder errors(List errors) { - this.errors.clear(); - this.errors.addAll(errors); - return this; - } + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!WorkflowsDto.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'WorkflowsDto' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(WorkflowsDto.class)); - public Builder addErrors(String errors) { - this.errors.add(errors); - return this; - } + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, WorkflowsDto value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + elementAdapter.write(out, obj); + } - public Builder addAllErrors(List errors) { - this.errors.addAll(errors); - return this; - } + @Override + public WorkflowsDto read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + return thisAdapter.fromJsonTree(jsonElement); + } - public WorkflowsDto build() { - return new WorkflowsDto(links, items, errors); - } + }.nullSafe(); } + } + + /** + * Create an instance of WorkflowsDto given an JSON string + * + * @param jsonString JSON string + * @return An instance of WorkflowsDto + * @throws IOException if the JSON string is invalid with respect to WorkflowsDto + */ + public static WorkflowsDto fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, WorkflowsDto.class); + } + + /** + * Convert an instance of WorkflowsDto to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } } diff --git a/src/test/java/com/squidex/api/AssetsTests.java b/src/test/java/com/squidex/api/AssetsTests.java index 0293d0d..d10522f 100644 --- a/src/test/java/com/squidex/api/AssetsTests.java +++ b/src/test/java/com/squidex/api/AssetsTests.java @@ -1,29 +1,27 @@ package com.squidex.api; -import com.squidex.api.resources.assets.requests.AssetsGetAssetContentRequest; -import com.squidex.api.resources.assets.requests.AssetsPostAssetRequest; -import com.squidex.api.types.AssetDto; import org.junit.jupiter.api.Test; import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.file.Files; -import java.nio.file.Path; import static org.junit.jupiter.api.Assertions.assertEquals; +import com.squidex.api.types.AssetDto; + public class AssetsTests extends TestBase { private static final SquidexClient client = Utils.getClient().client(); @Test public void Should_upload_and_fetch_asset() { + // STEP 1: Upload asset. File file = new File("src/test/resources/logo-wide.png"); - AssetDto createdAsset = client.assets().postAsset(file, AssetsPostAssetRequest.builder().build()); + AssetDto createdAsset = client.assets().postAsset().file(file).execute(); + + // STEP 2: Query asset. + AssetDto asset = client.assets().getAsset(createdAsset.getId()).execute(); + - AssetDto asset = client.assets().getAsset(createdAsset.getId()); assertEquals(createdAsset.getId(), asset.getId()); assertEquals(file.length(), asset.getFileSize()); assertEquals(file.getName(), asset.getFileName()); @@ -31,24 +29,15 @@ public void Should_upload_and_fetch_asset() { } @Test - public void Should_upload_and_download_asset() throws IOException { + public void Should_upload_and_download_asset() { + // STEP 1: Upload asset. File file = new File("src/test/resources/logo-wide.png"); - AssetDto createdAsset = client.assets().postAsset(file, AssetsPostAssetRequest.builder().build()); - - InputStream asset = client.assets().getAssetContent(createdAsset.getId(), AssetsGetAssetContentRequest.builder().build()); - - // Store the asset in the temp folder. - Path tempFilePath = Files.createTempFile("temp-", ".tmp"); + AssetDto createdAsset = client.assets().postAsset().file(file).execute(); - try (OutputStream outputStream = Files.newOutputStream(tempFilePath)) { - byte[] buffer = new byte[1024]; - int bytesRead; - while ((bytesRead = asset.read(buffer)) != -1) { - outputStream.write(buffer, 0, bytesRead); - } - } + // STEP 2: Download asset + File assetQueried = client.assets().getAssetContentBySlug(createdAsset.getId()).execute(); - assertEquals(tempFilePath.toFile().length(), createdAsset.getFileSize()); + assertEquals(assetQueried.length(), createdAsset.getFileSize()); } } diff --git a/src/test/java/com/squidex/api/ClientProvider.java b/src/test/java/com/squidex/api/ClientProvider.java index e2742f9..fb877e8 100644 --- a/src/test/java/com/squidex/api/ClientProvider.java +++ b/src/test/java/com/squidex/api/ClientProvider.java @@ -1,5 +1,6 @@ package com.squidex.api; +@SuppressWarnings("ClassCanBeRecord") public final class ClientProvider { private final SquidexClientBuilder builder; private final SquidexClient client; @@ -9,14 +10,14 @@ public ClientProvider(SquidexClientBuilder builder, SquidexClient client) { this.client = client; } - public SquidexClient client(String appName) { - return this.builder.appName(appName).build(); - } - public SquidexClient client() { return client; } + public SquidexClient client(String appName) { + return this.builder.appName(appName).build(); + } + public SquidexClientBuilder builder() { return builder; } diff --git a/src/test/java/com/squidex/api/ContentsTests.java b/src/test/java/com/squidex/api/ContentsTests.java index e2b6d21..906601b 100644 --- a/src/test/java/com/squidex/api/ContentsTests.java +++ b/src/test/java/com/squidex/api/ContentsTests.java @@ -1,86 +1,78 @@ package com.squidex.api; -import com.squidex.api.resources.contents.requests.ContentsGetContentRequest; -import com.squidex.api.resources.contents.requests.ContentsPostContentRequest; -import com.squidex.api.resources.schemas.requests.CreateSchemaDto; import com.squidex.api.types.*; + import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import java.util.Collections; -import java.util.HashMap; import java.util.Map; import java.util.UUID; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -@SuppressWarnings("unchecked") +@SuppressWarnings({"unchecked", "ConstantConditions"}) public class ContentsTests extends TestBase { private static final SquidexClient client = Utils.getClient().client(); private static SchemaDto schema; @BeforeAll public static void setup() { - CreateSchemaDto request = CreateSchemaDto.builder() - .name(String.format("schema-%s", UUID.randomUUID())) - .fields(Collections.singletonList( - UpsertSchemaFieldDto.builder() - .name("field1") - .properties(FieldPropertiesDto.string(StringFieldPropertiesDto.builder().build())) - .build() - ) - ) - .isPublished(true) - .build(); - - schema = client.schemas().postSchema(request); + CreateSchemaDto request = new CreateSchemaDto() + .name(String.format("schema-%s", UUID.randomUUID())) + .fields(Collections.singletonList( + new UpsertSchemaFieldDto() + .name("field1") + .properties(new StringFieldPropertiesDto()))) + .isPublished(true); + + schema = client.schemas().postSchema(request).execute(); } @Test public void should_create_and_fetch_content() { UUID id = UUID.randomUUID(); - Map> dataItem = new HashMap<>(); - Map dataField = new HashMap<>(); - dataItem.put("field1", dataField); - dataField.put("iv", id); + // STEP 1: Create content + Map> dataItem = Map.of( + "field1", Map.of( + "iv", (Object) id.toString() + ) + ); - ContentsPostContentRequest request = - ContentsPostContentRequest.builder() - .body(dataItem) - .publish(true) - .build(); + ContentDto createdContent = client.contents().postContent(schema.getName(), dataItem).publish(true).execute(); - ContentDto createdContent = client.contents().postContent(schema.getName(), request); + // STEP 2: Get content + ContentDto contentItem = client.contents().getContent(schema.getName(), createdContent.getId()).execute(); + Map> contentData = (Map>) contentItem.getData(); - ContentDto content = client.contents().getContent(schema.getName(), createdContent.getId()); - assertEquals(id.toString(), ((Map>) content.getData()).get("field1").get("iv")); - assertNotNull(content.getLastModified()); - assertNotNull(content.getLastModifiedBy()); - assertEquals("Published", content.getStatus()); + assertEquals(id.toString(), contentData.get("field1").get("iv")); + assertNotNull(contentItem.getLastModified()); + assertNotNull(contentItem.getLastModifiedBy()); + assertEquals("Published", contentItem.getStatus()); } @Test public void Should_create_and_fetch_unpublished_content() { UUID id = UUID.randomUUID(); - Map> dataItem = new HashMap<>(); - Map dataField = new HashMap<>(); - dataItem.put("field1", dataField); - dataField.put("iv", id); + // STEP 1: Create content + Map> dataItem = Map.of( + "field1", Map.of( + "iv", (Object) id.toString() + ) + ); - ContentsPostContentRequest request = - ContentsPostContentRequest.builder() - .body(dataItem) - .build(); + ContentDto createdContent = client.contents().postContent(schema.getName(), dataItem).execute(); - ContentDto createdContent = client.contents().postContent(schema.getName(), request); + // STEP 2: Get content + ContentDto contentItem = client.contents().getContent(schema.getName(), createdContent.getId()).unpublished(true).execute(); + Map> contentData = (Map>) contentItem.getData(); - ContentDto content = client.contents().getContent(schema.getName(), createdContent.getId(), ContentsGetContentRequest.builder().unpublished(true).build()); - assertEquals(id.toString(), ((Map>) content.getData()).get("field1").get("iv")); - assertNotNull(content.getLastModified()); - assertNotNull(content.getLastModifiedBy()); - assertEquals("Draft", content.getStatus()); + assertEquals(id.toString(), contentData.get("field1").get("iv")); + assertNotNull(contentItem.getLastModified()); + assertNotNull(contentItem.getLastModifiedBy()); + assertEquals("Draft", contentItem.getStatus()); } } diff --git a/src/test/java/com/squidex/api/SchemasTests.java b/src/test/java/com/squidex/api/SchemasTests.java index 0003eb0..ebd1141 100644 --- a/src/test/java/com/squidex/api/SchemasTests.java +++ b/src/test/java/com/squidex/api/SchemasTests.java @@ -1,37 +1,44 @@ package com.squidex.api; -import com.squidex.api.resources.schemas.requests.CreateSchemaDto; -import com.squidex.api.types.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.squidex.api.core.ApiException; +import com.squidex.api.types.CreateSchemaDto; +import com.squidex.api.types.SchemaDto; +import com.squidex.api.types.SchemaType; +import com.squidex.api.types.StringFieldPropertiesDto; +import com.squidex.api.types.UpsertSchemaFieldDto; + import org.junit.jupiter.api.Test; import java.util.Collections; import java.util.UUID; -import static org.junit.jupiter.api.Assertions.*; - +@SuppressWarnings({"ConstantConditions"}) public class SchemasTests extends TestBase { private static final SquidexClient client = Utils.getClient().client(); @Test - public void should_create_and_fetch_schema() { - CreateSchemaDto request = CreateSchemaDto.builder() + public void should_create_and_fetch_schema() throws ApiException { + // STEP: Create schema. + CreateSchemaDto request = new CreateSchemaDto() .name(String.format("schema-%s", UUID.randomUUID())) .fields(Collections.singletonList( - UpsertSchemaFieldDto.builder() - .name("field1") - .properties(FieldPropertiesDto.string(StringFieldPropertiesDto.builder().build())) - .build() - ) - ) - .isPublished(true) - .build(); - - SchemaDto createdSchema = client.schemas().postSchema(request); - - SchemaDto schema = client.schemas().getSchema(createdSchema.getId()); - assertFalse(createdSchema.getFields().isEmpty()); - assertEquals(request.getName(), createdSchema.getName()); - assertEquals(request.getFields().get().get(0).getProperties().getClass(), createdSchema.getFields().get(0).getProperties().getClass()); + new UpsertSchemaFieldDto() + .name("field1") + .properties(new StringFieldPropertiesDto()))) + .isPublished(true); + + SchemaDto schemaCreated = client.schemas().postSchema(request).execute(); + + // STEP 2: Query schema. + SchemaDto schema = client.schemas().getSchema(schemaCreated.getId()).execute(); + + assertFalse(schemaCreated.getFields().isEmpty()); + assertEquals(request.getName(), schemaCreated.getName()); + assertEquals(request.getFields().get(0).getProperties().getClass(), schemaCreated.getFields().get(0).getProperties().getClass()); assertEquals(SchemaType.DEFAULT, schema.getType()); assertTrue(schema.getIsPublished()); } diff --git a/src/test/java/com/squidex/api/TestSetup.java b/src/test/java/com/squidex/api/TestSetup.java index e633a79..0654cbd 100644 --- a/src/test/java/com/squidex/api/TestSetup.java +++ b/src/test/java/com/squidex/api/TestSetup.java @@ -1,7 +1,8 @@ package com.squidex.api; -import com.squidex.api.core.ApiError; -import com.squidex.api.resources.apps.requests.CreateAppDto; +import com.squidex.api.core.ApiException; +import com.squidex.api.types.CreateAppDto; + import org.junit.jupiter.api.extension.BeforeAllCallback; import org.junit.jupiter.api.extension.ExtensionContext; @@ -11,23 +12,23 @@ public class TestSetup implements BeforeAllCallback { @Override public void beforeAll(ExtensionContext context) throws Exception { - ClientProvider client = Utils.getClient(); + SquidexClient client = Utils.getClient().client(); System.out.println("SETUP"); - System.out.printf("Using =<%s>%n", client.client().clientOptions.appName()); - System.out.printf("Using =<%s>%n", client.builder().clientId()); - System.out.printf("Using =<%s>%n", client.builder().clientSecret()); - System.out.printf("Using =<%s>%n", client.client().clientOptions.environment().getUrl()); + System.out.printf("Using =<%s>%n", client.getAppName()); + System.out.printf("Using =<%s>%n", client.getClientId()); + System.out.printf("Using =<%s>%n", client.getClientSecret()); + System.out.printf("Using =<%s>%n", client.getBaseUrl()); this.waitForServer(); try { - client.client().apps().postApp( - CreateAppDto.builder() - .name(client.client().clientOptions.appName()) - .build()); - } catch (ApiError ex) { - if (ex.statusCode() == 400) { + CreateAppDto app = new CreateAppDto() + .name(client.getAppName()); + + client.apps().postApp(app).execute(); + } catch (ApiException ex) { + if (ex.getCode() == 400) { System.out.println("App probably already exists."); return; } else { diff --git a/src/test/java/com/squidex/api/UserManagementTests.java b/src/test/java/com/squidex/api/UserManagementTests.java index ba3b42b..7bb540e 100644 --- a/src/test/java/com/squidex/api/UserManagementTests.java +++ b/src/test/java/com/squidex/api/UserManagementTests.java @@ -1,9 +1,11 @@ package com.squidex.api; -import com.squidex.api.resources.usermanagement.requests.CreateUserDto; +import com.squidex.api.types.CreateUserDto; import com.squidex.api.types.UserDto; + import org.junit.jupiter.api.Test; +import java.util.Collections; import java.util.UUID; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -15,17 +17,17 @@ public class UserManagementTests extends TestBase { public void Should_create_and_fetch_user() { String email = String.format("user%s@email.com", UUID.randomUUID()); - CreateUserDto request = CreateUserDto.builder() + // STEP 1: Create User. + CreateUserDto request = new CreateUserDto() .email(email) .displayName("Jane Smith") .password("1q2w3e$R") - .addPermissions("permission1") - .addPermissions("permission2") - .build(); + .permissions(Collections.singletonList("permission1")); - UserDto createUser = client.userManagement().postUser(request); + UserDto createUser = client.userManagement().postUser(request).execute(); - UserDto user = client.userManagement().getUser(createUser.getId()); + // STEP 2: Query User. + UserDto user = client.userManagement().getUser(createUser.getId()).execute(); assertEquals(email, user.getEmail()); assertEquals(createUser.getDisplayName(), user.getDisplayName()); } diff --git a/src/test/java/com/squidex/api/Utils.java b/src/test/java/com/squidex/api/Utils.java index c0d4ad3..2947423 100644 --- a/src/test/java/com/squidex/api/Utils.java +++ b/src/test/java/com/squidex/api/Utils.java @@ -33,11 +33,11 @@ public static ClientProvider getClient() { } SquidexClientBuilder builder = SquidexClient.builder() - .trustAllCerts() + .trustAllCerts(true) .appName(appName) .clientId(clientId) .clientSecret(clientSecret) - .url(environment); + .baseUrl(environment); singleClient = new ClientProvider(builder, builder.build()); diff --git a/templates/JSON.mustache b/templates/JSON.mustache new file mode 100644 index 0000000..5a186ac --- /dev/null +++ b/templates/JSON.mustache @@ -0,0 +1,552 @@ +{{>licenseInfo}} + +package {{invokerPackage}}; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +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.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import io.gsonfire.GsonFireBuilder; +import io.gsonfire.PostProcessor; +import io.gsonfire.TypeSelector; +{{#joda}} +import org.joda.time.DateTime; +import org.joda.time.LocalDate; +import org.joda.time.format.DateTimeFormatter; +import org.joda.time.format.DateTimeFormatterBuilder; +import org.joda.time.format.ISODateTimeFormat; +{{/joda}} + +import okio.ByteString; + +import java.io.IOException; +import java.io.StringReader; +import java.lang.reflect.Type; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.time.LocalDate; +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; + +/* + * A JSON utility class + * + * NOTE: in the future, this class may be converted to static, which may break + * backward-compatibility + */ +public class JSON { + private static Gson gson; + private static boolean isLenientOnJson = false; + private static DateTypeAdapter dateTypeAdapter = new DateTypeAdapter(); + private static SqlDateTypeAdapter sqlDateTypeAdapter = new SqlDateTypeAdapter(); + {{#joda}} + private static DateTimeTypeAdapter dateTimeTypeAdapter = new DateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + {{/joda}} + {{#jsr310}} + private static OffsetDateTimeTypeAdapter offsetDateTimeTypeAdapter = new OffsetDateTimeTypeAdapter(); + private static LocalDateTypeAdapter localDateTypeAdapter = new LocalDateTypeAdapter(); + {{/jsr310}} + private static ByteArrayAdapter byteArrayAdapter = new ByteArrayAdapter(); + + @SuppressWarnings("unchecked") + public static GsonBuilder createGson() { + GsonFireBuilder fireBuilder = new GsonFireBuilder() + {{#models}} + {{#model}} + {{#discriminator}} + {{#mappedModels}} + .registerPostProcessor({{modelPackage}}.{{modelName}}.class, new PostProcessor<{{modelPackage}}.{{modelName}}>() { + @Override + public void postDeserialize({{modelPackage}}.{{modelName}} result, JsonElement src, Gson gson) { + } + + @Override + public void postSerialize(JsonElement result, {{modelPackage}}.{{modelName}} src, Gson gson) { + if (result instanceof JsonObject) { + ((JsonObject)result).add("{{{propertyBaseName}}}", new JsonPrimitive("{{mappingName}}")); + } + } + }) + {{/mappedModels}} + {{#mappedModels.size}} + .registerTypeSelector({{modelPackage}}.{{classname}}.class, new TypeSelector<{{modelPackage}}.{{classname}}>() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + {{#mappedModels}} + classByDiscriminatorValue.put("{{mappingName}}"{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}, {{modelPackage}}.{{modelName}}.class); + {{/mappedModels}} + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "{{{propertyBaseName}}}")); + } + }) + {{/mappedModels.size}} + {{/discriminator}} + {{/model}} + {{/models}} + ; + GsonBuilder builder = fireBuilder.createGsonBuilder(); + {{#disableHtmlEscaping}} + builder.disableHtmlEscaping(); + {{/disableHtmlEscaping}} + return builder; + } + + private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { + JsonElement element = readElement.getAsJsonObject().get(discriminatorField); + if (null == element) { + throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); + } + return element.getAsString(); + } + + /** + * 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. + * @return The Java class that implements the OpenAPI schema + */ + private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue{{^discriminatorCaseSensitive}}.toUpperCase(Locale.ROOT){{/discriminatorCaseSensitive}}); + if (null == clazz) { + throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); + } + return clazz; + } + + static { + GsonBuilder gsonBuilder = createGson(); + gsonBuilder.registerTypeAdapter(Date.class, dateTypeAdapter); + gsonBuilder.registerTypeAdapter(java.sql.Date.class, sqlDateTypeAdapter); + {{#joda}} + gsonBuilder.registerTypeAdapter(DateTime.class, dateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + {{/joda}} + {{#jsr310}} + gsonBuilder.registerTypeAdapter(OffsetDateTime.class, offsetDateTimeTypeAdapter); + gsonBuilder.registerTypeAdapter(LocalDate.class, localDateTypeAdapter); + {{/jsr310}} + gsonBuilder.registerTypeAdapter(byte[].class, byteArrayAdapter); + {{#models}} + {{#model}} + {{^isEnum}} + {{^hasChildren}} + gsonBuilder.registerTypeAdapterFactory(new {{modelPackage}}.{{{classname}}}.CustomTypeAdapterFactory()); + {{/hasChildren}} + {{/isEnum}} + {{/model}} + {{/models}} + gson = gsonBuilder.create(); + } + + /** + * Get Gson. + * + * @return Gson + */ + public static Gson getGson() { + return gson; + } + + /** + * Set Gson. + * + * @param gson Gson + */ + public static void setGson(Gson gson) { + JSON.gson = gson; + } + + public static void setLenientOnJson(boolean lenientOnJson) { + isLenientOnJson = lenientOnJson; + } + + /** + * Serialize the given Java object into JSON string. + * + * @param obj Object + * @return String representation of the JSON + */ + public static String serialize(Object obj) { + return gson.toJson(obj); + } + + /** + * Deserialize the given JSON string to Java object. + * + * @param Type + * @param body The JSON string + * @param returnType The type to deserialize into + * @return The deserialized Java object + */ + @SuppressWarnings("unchecked") + 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 { + return gson.fromJson(body, returnType); + } + } 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 { + throw (e); + } + } + } + + /** + * Gson TypeAdapter for Byte Array type + */ + public static class ByteArrayAdapter extends TypeAdapter { + + @Override + public void write(JsonWriter out, byte[] value) throws IOException { + if (value == null) { + out.nullValue(); + } else { + out.value(ByteString.of(value).base64()); + } + } + + @Override + public byte[] read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String bytesAsBase64 = in.nextString(); + ByteString byteString = ByteString.decodeBase64(bytesAsBase64); + return byteString.toByteArray(); + } + } + } + + {{#joda}} + /** + * Gson TypeAdapter for Joda DateTime type + */ + public static class DateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public DateTimeTypeAdapter() { + this(new DateTimeFormatterBuilder() + .append(ISODateTimeFormat.dateTime().getPrinter(), ISODateTimeFormat.dateOptionalTimeParser().getParser()) + .toFormatter()); + } + + public DateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, DateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public DateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseDateTime(date); + } + } + } + + /** + * Gson TypeAdapter for Joda LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(ISODateTimeFormat.date()); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.print(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return formatter.parseLocalDate(date); + } + } + } + + public static void setDateTimeFormat(DateTimeFormatter dateFormat) { + dateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + {{/joda}} + {{#jsr310}} + /** + * Gson TypeAdapter for JSR310 OffsetDateTime type + */ + public static class OffsetDateTimeTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public OffsetDateTimeTypeAdapter() { + this(DateTimeFormatter.ISO_OFFSET_DATE_TIME); + } + + public OffsetDateTimeTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, OffsetDateTime date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public OffsetDateTime read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + if (date.endsWith("+0000")) { + date = date.substring(0, date.length()-5) + "Z"; + } + return OffsetDateTime.parse(date, formatter); + } + } + } + + /** + * Gson TypeAdapter for JSR310 LocalDate type + */ + public static class LocalDateTypeAdapter extends TypeAdapter { + + private DateTimeFormatter formatter; + + public LocalDateTypeAdapter() { + this(DateTimeFormatter.ISO_LOCAL_DATE); + } + + public LocalDateTypeAdapter(DateTimeFormatter formatter) { + this.formatter = formatter; + } + + public void setFormat(DateTimeFormatter dateFormat) { + this.formatter = dateFormat; + } + + @Override + public void write(JsonWriter out, LocalDate date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + out.value(formatter.format(date)); + } + } + + @Override + public LocalDate read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + return LocalDate.parse(date, formatter); + } + } + } + + public static void setOffsetDateTimeFormat(DateTimeFormatter dateFormat) { + offsetDateTimeTypeAdapter.setFormat(dateFormat); + } + + public static void setLocalDateFormat(DateTimeFormatter dateFormat) { + localDateTypeAdapter.setFormat(dateFormat); + } + + {{/jsr310}} + /** + * Gson TypeAdapter for java.sql.Date type + * If the dateFormat is null, a simple "yyyy-MM-dd" format will be used + * (more efficient than SimpleDateFormat). + */ + public static class SqlDateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public SqlDateTypeAdapter() {} + + public SqlDateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, java.sql.Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = date.toString(); + } + out.value(value); + } + } + + @Override + public java.sql.Date read(JsonReader in) throws IOException { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + 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) { + throw new JsonParseException(e); + } + } + } + } + + /** + * Gson TypeAdapter for java.util.Date type + * If the dateFormat is null, ISO8601Utils will be used. + */ + public static class DateTypeAdapter extends TypeAdapter { + + private DateFormat dateFormat; + + public DateTypeAdapter() {} + + public DateTypeAdapter(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + public void setFormat(DateFormat dateFormat) { + this.dateFormat = dateFormat; + } + + @Override + public void write(JsonWriter out, Date date) throws IOException { + if (date == null) { + out.nullValue(); + } else { + String value; + if (dateFormat != null) { + value = dateFormat.format(date); + } else { + value = ISO8601Utils.format(date, true); + } + out.value(value); + } + } + + @Override + public Date read(JsonReader in) throws IOException { + try { + switch (in.peek()) { + case NULL: + in.nextNull(); + return null; + default: + String date = in.nextString(); + try { + if (dateFormat != null) { + return dateFormat.parse(date); + } + return ISO8601Utils.parse(date, new ParsePosition(0)); + } catch (ParseException e) { + throw new JsonParseException(e); + } + } + } catch (IllegalArgumentException e) { + throw new JsonParseException(e); + } + } + } + + public static void setDateFormat(DateFormat dateFormat) { + dateTypeAdapter.setFormat(dateFormat); + } + + public static void setSqlDateFormat(DateFormat dateFormat) { + sqlDateTypeAdapter.setFormat(dateFormat); + } +} \ No newline at end of file diff --git a/templates/api.mustache b/templates/api.mustache new file mode 100644 index 0000000..eb62334 --- /dev/null +++ b/templates/api.mustache @@ -0,0 +1,598 @@ +{{>licenseInfo}} + +package {{package}}; + +import {{invokerPackage}}.ApiCallback; +import {{invokerPackage}}.ApiClient; +import {{invokerPackage}}.ApiException; +{{#dynamicOperations}} +import {{invokerPackage}}.ApiOperation; +{{/dynamicOperations}} +import {{invokerPackage}}.ApiResponse; +import {{invokerPackage}}.Configuration; +import {{invokerPackage}}.Pair; +import {{invokerPackage}}.ProgressRequestBody; +import {{invokerPackage}}.ProgressResponseBody; +{{#performBeanValidation}} +import {{invokerPackage}}.BeanValidationException; +{{/performBeanValidation}} + +import com.google.gson.reflect.TypeToken; +{{#dynamicOperations}} +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.parameters.Parameter; +{{/dynamicOperations}} + +import java.io.IOException; + +{{#useBeanValidation}} +import jakarta.validation.constraints.*; +import jakarta.validation.Valid; +{{/useBeanValidation}} +{{#performBeanValidation}} +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validation; +import jakarta.validation.ValidatorFactory; +import jakarta.validation.executable.ExecutableValidator; +import java.util.Set; +import java.lang.reflect.Method; +import java.lang.reflect.Type; +{{/performBeanValidation}} + +{{#imports}}import {{import}}; +{{/imports}} + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{#supportStreaming}} +import java.io.InputStream; +{{/supportStreaming}} + +{{#operations}} + +@SuppressWarnings("ALL") +public class {{classname}} { + private ApiClient localVarApiClient; + private int localHostIndex; + private String localCustomBaseUrl; + + public {{classname}}() { + this(Configuration.getDefaultApiClient()); + } + + public {{classname}}(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; + } + + {{#operation}} + {{^vendorExtensions.x-group-parameters}}/** + * Build call for {{vendorExtensions.x-method-name}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @param _callback Callback for upload/download progress + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{vendorExtensions.x-method-name}}Call({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + String basePath = null; + // Operation Servers + String[] localBasePaths = new String[] { {{#servers}}"{{{url}}}"{{^-last}}, {{/-last}}{{/servers}} }; + + // Determine Base Path to Use + if (localCustomBaseUrl != null){ + basePath = localCustomBaseUrl; + } else if ( localBasePaths.length > 0 ) { + basePath = localBasePaths[localHostIndex]; + } else { + basePath = null; + } + + Object localVarPostBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}}; + + // create path and map variables + {{^dynamicOperations}} + String localVarPath = "{{{path}}}"{{#pathParams}} + .replace("{" + "{{baseName}}" + "}", localVarApiClient.escapeString({{#collectionFormat}}localVarApiClient.collectionPathParameterToString("{{{collectionFormat}}}", {{{paramName}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}.toString(){{/collectionFormat}})){{/pathParams}}; + {{/dynamicOperations}} + {{#dynamicOperations}} + ApiOperation apiOperation = localVarApiClient.getOperationLookupMap().get("{{{vendorExtensions.x-method-name}}}"); + if (apiOperation == null) { + throw new ApiException("Operation not found in OAS"); + } + Operation operation = apiOperation.getOperation(); + String localVarPath = apiOperation.getPath(); + Map paramMap = new HashMap<>(); + {{#allParams}} + {{^isFormParam}} + {{^isBodyParam}} + paramMap.put("{{baseName}}", {{paramName}}); + {{/isBodyParam}} + {{/isFormParam}} + {{/allParams}} + {{/dynamicOperations}} + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarCookieParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + {{#formParams}} + if ({{paramName}} != null) { + localVarFormParams.put("{{baseName}}", {{paramName}}); + } + + {{/formParams}} + {{^dynamicOperations}} + {{#queryParams}} + if ({{paramName}} != null) { + {{#isFreeFormObject}}localVarQueryParams.addAll(localVarApiClient.freeFormParameterToPairs({{paramName}}));{{/isFreeFormObject}}{{^isFreeFormObject}}{{#collectionFormat}}localVarCollectionQueryParams.addAll(localVarApiClient.parameterToPairs("{{{.}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll(localVarApiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}}));{{/isFreeFormObject}} + } + + {{/queryParams}} + {{#constantParams}} + {{#isQueryParam}} + // Set client side default value of Query Param "{{baseName}}". + localVarCollectionQueryParams.add(new Pair("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}})); + + {{/isQueryParam}} + {{/constantParams}} + {{#headerParams}} + if ({{paramName}} != null) { + localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + } + + {{/headerParams}} + {{#constantParams}} + {{#isHeaderParam}} + // Set client side default value of Header Param "{{baseName}}". + localVarHeaderParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}}); + + {{/isHeaderParam}} + {{/constantParams}} + {{#cookieParams}} + if ({{paramName}} != null) { + localVarCookieParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + } + + {{/cookieParams}} + {{#constantParams}} + {{#isCookieParam}} + // Set client side default value of Cookie Param "{{baseName}}". + localVarCookieParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}}); + + {{/isCookieParam}} + {{/constantParams}} + {{/dynamicOperations}} + {{#dynamicOperations}} + localVarPath = localVarApiClient.fillParametersFromOperation(operation, paramMap, localVarPath, localVarQueryParams, localVarCollectionQueryParams, localVarHeaderParams, localVarCookieParams); + + {{/dynamicOperations}} + final String[] localVarAccepts = { + {{#produces}} + "{{{mediaType}}}"{{^-last}},{{/-last}} + {{/produces}} + }; + final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } + + final String[] localVarContentTypes = { + {{#consumes}} + "{{{mediaType}}}"{{^-last}},{{/-last}} + {{/consumes}} + }; + final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); + if (localVarContentType != null) { + localVarHeaderParams.put("Content-Type", localVarContentType); + } + + String[] localVarAuthNames = new String[] { {{#withAWSV4Signature}}"AWS4Auth"{{/withAWSV4Signature}}{{#authMethods}}{{#-first}}{{#withAWSV4Signature}}, {{/withAWSV4Signature}}{{/-first}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} }; + return localVarApiClient.buildCall(basePath, localVarPath, {{^dynamicOperations}}"{{httpMethod}}"{{/dynamicOperations}}{{#dynamicOperations}}apiOperation.getMethod(){{/dynamicOperations}}, localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); + } + + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + @SuppressWarnings("rawtypes") + private okhttp3.Call {{vendorExtensions.x-method-name}}ValidateBeforeCall({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback _callback) throws ApiException { + {{^performBeanValidation}} + {{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if ({{paramName}} == null) { + throw new ApiException("Missing the required parameter '{{paramName}}' when calling {{vendorExtensions.x-method-name}}(Async)"); + } + + {{/required}} + {{/allParams}} + return {{vendorExtensions.x-method-name}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + + {{/performBeanValidation}} + {{#performBeanValidation}} + try { + ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); + ExecutableValidator executableValidator = factory.getValidator().forExecutables(); + + Object[] parameterValues = { {{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}} }; + Method method = this.getClass().getMethod("{{vendorExtensions.x-method-name}}WithHttpInfo"{{#allParams}}, {{#isArray}}java.util.List{{/isArray}}{{#isMap}}java.util.Map{{/isMap}}{{^isArray}}{{^isMap}}{{{dataType}}}{{/isMap}}{{/isArray}}.class{{/allParams}}); + Set> violations = executableValidator.validateParameters(this, method, + parameterValues); + + if (violations.size() == 0) { + return {{vendorExtensions.x-method-name}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + } else { + throw new BeanValidationException((Set) violations); + } + } catch (NoSuchMethodException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } catch (SecurityException e) { + e.printStackTrace(); + throw new ApiException(e.getMessage()); + } + {{/performBeanValidation}} + } + + {{^vendorExtensions.x-group-parameters}} + /** + * {{summary}} + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} + * @return {{.}}{{/returnType}} + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + {{#vendorExtensions.x-streaming}} + public {{#returnType}}InputStream {{/returnType}}{{^returnType}}void {{/returnType}}{{vendorExtensions.x-method-name}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}InputStream localVarResp = {{/returnType}}{{vendorExtensions.x-method-name}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp;{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + {{^vendorExtensions.x-streaming}} + public {{#returnType}}{{{.}}} {{/returnType}}{{^returnType}}void {{/returnType}}{{vendorExtensions.x-method-name}}({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{vendorExtensions.x-method-name}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp.getData();{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + {{/vendorExtensions.x-group-parameters}} + + {{^vendorExtensions.x-group-parameters}}/** + * {{summary}} + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-streaming}} InputStream {{vendorExtensions.x-method-name}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + okhttp3.Call localVarCall = {{vendorExtensions.x-method-name}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); + {{#returnType}} + {{#errorObjectType}} + try { + Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.executeStream(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}>(){}.getType())); + throw e; + } + {{/errorObjectType}} + {{^errorObjectType}} + Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.executeStream(localVarCall, localVarReturnType); + {{/errorObjectType}} + {{/returnType}} + } + {{/vendorExtensions.x-streaming}}{{^vendorExtensions.x-streaming}} ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{vendorExtensions.x-method-name}}WithHttpInfo({{#allParams}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) throws ApiException { + okhttp3.Call localVarCall = {{vendorExtensions.x-method-name}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}null); + {{^returnType}} + return localVarApiClient.execute(localVarCall); + {{/returnType}} + {{#returnType}} + {{#errorObjectType}} + try { + Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + } catch (ApiException e) { + e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<{{{errorObjectType}}}>(){}.getType())); + throw e; + } + {{/errorObjectType}} + {{^errorObjectType}} + Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + return localVarApiClient.execute(localVarCall, localVarReturnType); + {{/errorObjectType}} + {{/returnType}} + } + {{/vendorExtensions.x-streaming}} + + {{^vendorExtensions.x-group-parameters}}/** + * {{summary}} (asynchronously) + * {{notes}}{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} + * @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 + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}private{{/vendorExtensions.x-group-parameters}} okhttp3.Call {{vendorExtensions.x-method-name}}Async({{#allParams}}{{{dataType}}} {{paramName}}, {{/allParams}}final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { + + okhttp3.Call localVarCall = {{vendorExtensions.x-method-name}}ValidateBeforeCall({{#allParams}}{{paramName}}, {{/allParams}}_callback); + {{#returnType}}Type localVarReturnType = new TypeToken<{{{returnType}}}>(){}.getType(); + localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);{{/returnType}}{{^returnType}}localVarApiClient.executeAsync(localVarCall, _callback);{{/returnType}} + return localVarCall; + } + {{#vendorExtensions.x-group-parameters}} + + public class API{{operationId}}Request { + {{#requiredParams}} + private final {{{dataType}}} {{paramName}}; + {{/requiredParams}} + {{#optionalParams}} + private {{{dataType}}} {{paramName}}; + {{/optionalParams}} + + private API{{operationId}}Request({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { + {{#requiredParams}} + this.{{paramName}} = {{paramName}}; + {{/requiredParams}} + } + + {{#optionalParams}} + /** + * Set {{paramName}} + * @param {{paramName}} {{description}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}) + * @return API{{operationId}}Request + */ + public API{{operationId}}Request {{paramName}}({{{dataType}}} {{paramName}}) { + this.{{paramName}} = {{paramName}}; + return this; + } + + {{/optionalParams}} + /** + * Build call for {{vendorExtensions.x-method-name}} + * @param _callback ApiCallback API callback + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public okhttp3.Call buildCall(final ApiCallback _callback) throws ApiException { + return {{vendorExtensions.x-method-name}}Call({{#allParams}}{{paramName}}, {{/allParams}}_callback); + } + + /** + * Execute {{vendorExtensions.x-method-name}} request{{#returnType}} + * @return {{.}}{{/returnType}} + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + {{^vendorExtensions.x-streaming}} + public {{{returnType}}}{{^returnType}}void{{/returnType}} execute() throws ApiException { + {{#returnType}}ApiResponse<{{{.}}}> localVarResp = {{/returnType}}{{vendorExtensions.x-method-name}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}});{{#returnType}} + return localVarResp.getData();{{/returnType}} + } + {{/vendorExtensions.x-streaming}} + {{#vendorExtensions.x-streaming}} + public InputStream execute() throws ApiException { + return {{vendorExtensions.x-method-name}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + {{/vendorExtensions.x-streaming}} + + /** + * Execute {{vendorExtensions.x-method-name}} request with HTTP info returned + * @return ApiResponse<{{returnType}}{{^returnType}}Void{{/returnType}}> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + {{^vendorExtensions.x-streaming}} + public ApiResponse<{{{returnType}}}{{^returnType}}Void{{/returnType}}> executeWithHttpInfo() throws ApiException { + return {{vendorExtensions.x-method-name}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + {{/vendorExtensions.x-streaming}} + {{#vendorExtensions.x-streaming}} + public InputStream executeWithHttpInfo() throws ApiException { + return {{vendorExtensions.x-method-name}}WithHttpInfo({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}); + } + {{/vendorExtensions.x-streaming}} + + /** + * Execute {{vendorExtensions.x-method-name}} request (asynchronously) + * @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 + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public okhttp3.Call executeAsync(final ApiCallback<{{{returnType}}}{{^returnType}}Void{{/returnType}}> _callback) throws ApiException { + return {{vendorExtensions.x-method-name}}Async({{#allParams}}{{paramName}}, {{/allParams}}_callback); + } + } + + /** + * {{summary}} + * {{notes}}{{#requiredParams}} + * @param {{paramName}} {{description}} (required){{/requiredParams}} + * @return API{{operationId}}Request + {{#responses.0}} + * @http.response.details + + + {{#responses}} + + {{/responses}} +
Status Code Description Response Headers
{{code}} {{message}} {{#headers}} * {{baseName}} - {{description}}
{{/headers}}{{^headers.0}} - {{/headers.0}}
+ {{/responses.0}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + {{#externalDocs}} + * {{description}} + * @see {{summary}} Documentation + {{/externalDocs}} + */ + {{#isDeprecated}} + @Deprecated + {{/isDeprecated}} + public API{{operationId}}Request {{vendorExtensions.x-method-name}}({{#requiredParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}) { + return new API{{operationId}}Request({{#requiredParams}}{{paramName}}{{^-last}}, {{/-last}}{{/requiredParams}}); + } + {{/vendorExtensions.x-group-parameters}} + {{/operation}} +} +{{/operations}} \ No newline at end of file diff --git a/templates/pojo.mustache b/templates/pojo.mustache new file mode 100644 index 0000000..0d973d0 --- /dev/null +++ b/templates/pojo.mustache @@ -0,0 +1,595 @@ +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import {{invokerPackage}}.JSON; + +/** + * {{description}}{{^description}}{{classname}}{{/description}}{{#isDeprecated}} + * @deprecated{{/isDeprecated}} + */{{#isDeprecated}} +@Deprecated{{/isDeprecated}} +{{#swagger1AnnotationLibrary}} +{{#description}} +@ApiModel(description = "{{{.}}}") +{{/description}} +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} +{{#description}} +@Schema(description = "{{{.}}}") +{{/description}} +{{/swagger2AnnotationLibrary}} +{{>additionalModelTypeAnnotations}}{{>generatedAnnotation}}{{#discriminator}}{{>typeInfoAnnotation}}{{/discriminator}}{{>xmlAnnotation}} +{{#vendorExtensions.x-class-extra-annotation}} +{{{vendorExtensions.x-class-extra-annotation}}} +{{/vendorExtensions.x-class-extra-annotation}} +public class {{classname}} {{#parent}}extends {{{.}}} {{/parent}}{{#vendorExtensions.x-implements}}{{#-first}}implements {{{.}}}{{/-first}}{{^-first}}, {{{.}}}{{/-first}}{{#-last}} {{/-last}}{{/vendorExtensions.x-implements}}{ +{{#serializableModel}} + private static final long serialVersionUID = 1L; + +{{/serializableModel}} + {{#vars}} + {{^isDiscriminator}} + {{#isEnum}} + {{^isContainer}} +{{>modelInnerEnum}} + {{/isContainer}} + {{#isContainer}} + {{#mostInnerItems}} +{{>modelInnerEnum}} + {{/mostInnerItems}} + {{/isContainer}} + {{/isEnum}} + public static final String SERIALIZED_NAME_{{nameInSnakeCase}} = "{{baseName}}"; + {{#withXml}} + @Xml{{#isXmlAttribute}}Attribute{{/isXmlAttribute}}{{^isXmlAttribute}}Element{{/isXmlAttribute}}(name = "{{items.xmlName}}{{^items.xmlName}}{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{#isXmlWrapped}} + @XmlElementWrapper(name = "{{xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{#xmlNamespace}}, namespace = "{{.}}"{{/xmlNamespace}}) + {{/isXmlWrapped}} + {{/withXml}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + @SerializedName(SERIALIZED_NAME_{{nameInSnakeCase}}) + {{#vendorExtensions.x-field-extra-annotation}} + {{{vendorExtensions.x-field-extra-annotation}}} + {{/vendorExtensions.x-field-extra-annotation}} + {{#isDiscriminator}}protected{{/isDiscriminator}}{{^isDiscriminator}}private{{/isDiscriminator}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; + {{/isDiscriminator}} + {{/vars}} + public {{classname}}() { + {{#parent}} + {{#parcelableModel}} + super(); + {{/parcelableModel}} + {{/parent}} + } + {{#vendorExtensions.x-has-readonly-properties}} + {{^withXml}} + + public {{classname}}( + {{#readOnlyVars}} + {{{datatypeWithEnum}}} {{name}}{{^-last}}, {{/-last}} + {{/readOnlyVars}} + ) { + this(); + {{#readOnlyVars}} + this.{{name}} = {{name}}; + {{/readOnlyVars}} + } + {{/withXml}} + {{/vendorExtensions.x-has-readonly-properties}} + {{#vars}} + {{^isDiscriminator}} + {{^isReadOnly}} + {{#deprecated}} + @Deprecated + {{/deprecated}} + public {{classname}} {{name}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + return this; + } + {{#isArray}} + + public {{classname}} add{{nameInPascalCase}}Item({{{items.datatypeWithEnum}}} {{name}}Item) { + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new {{#uniqueItems}}LinkedHashSet{{/uniqueItems}}{{^uniqueItems}}ArrayList{{/uniqueItems}}<>(){{/defaultValue}}; + } + this.{{name}}.add({{name}}Item); + return this; + } + {{/isArray}} + {{#isMap}} + + public {{classname}} put{{nameInPascalCase}}Item(String key, {{{items.datatypeWithEnum}}} {{name}}Item) { + if (this.{{name}} == null) { + this.{{name}} = {{{defaultValue}}}{{^defaultValue}}new HashMap<>(){{/defaultValue}}; + } + this.{{name}}.put(key, {{name}}Item); + return this; + } + {{/isMap}} + + {{/isReadOnly}} + /** + {{#description}} + * {{.}} + {{/description}} + {{^description}} + * Get {{name}} + {{/description}} + {{#minimum}} + * minimum: {{.}} + {{/minimum}} + {{#maximum}} + * maximum: {{.}} + {{/maximum}} + * @return {{name}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ +{{#deprecated}} + @Deprecated +{{/deprecated}} +{{#required}} +{{#isNullable}} + @{{javaxPackage}}.annotation.Nullable +{{/isNullable}} +{{^isNullable}} + @{{javaxPackage}}.annotation.Nonnull +{{/isNullable}} +{{/required}} +{{^required}} + @{{javaxPackage}}.annotation.Nullable +{{/required}} +{{#useBeanValidation}} +{{>beanValidation}} +{{/useBeanValidation}} +{{#swagger1AnnotationLibrary}} + @ApiModelProperty({{#example}}example = "{{{.}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") +{{/swagger1AnnotationLibrary}} +{{#swagger2AnnotationLibrary}} + @Schema({{#example}}example = "{{{.}}}", {{/example}}requiredMode = {{#required}}Schema.RequiredMode.REQUIRED{{/required}}{{^required}}Schema.RequiredMode.NOT_REQUIRED{{/required}}, description = "{{{description}}}") +{{/swagger2AnnotationLibrary}} +{{#vendorExtensions.x-extra-annotation}} + {{{vendorExtensions.x-extra-annotation}}} +{{/vendorExtensions.x-extra-annotation}} + public {{{datatypeWithEnum}}} {{getter}}() { + return {{name}}; + } + + {{^isReadOnly}} +{{#vendorExtensions.x-setter-extra-annotation}} {{{vendorExtensions.x-setter-extra-annotation}}} +{{/vendorExtensions.x-setter-extra-annotation}}{{#deprecated}} @Deprecated +{{/deprecated}} public void {{setter}}({{{datatypeWithEnum}}} {{name}}) { + this.{{name}} = {{name}}; + } + {{/isReadOnly}} + {{/isDiscriminator}} + {{/vars}} +{{>libraries/okhttp-gson/additional_properties}} + + @Override + public boolean equals(Object o) { + {{#useReflectionEqualsHashCode}} + return EqualsBuilder.reflectionEquals(this, o, false, null, true); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + }{{#hasVars}} + {{classname}} {{classVarName}} = ({{classname}}) o; + return {{#vars}}{{^isDiscriminator}}{{#isByteArray}}Arrays{{/isByteArray}}{{^isByteArray}}Objects{{/isByteArray}}.equals(this.{{name}}, {{classVarName}}.{{name}}){{^-last}} && + {{/-last}}{{/isDiscriminator}}{{#isDiscriminator}}true{{/isDiscriminator}}{{/vars}}{{#isAdditionalPropertiesTrue}}&& + Objects.equals(this.additionalProperties, {{classVarName}}.additionalProperties){{/isAdditionalPropertiesTrue}}{{#parent}} && + super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}} + return {{#parent}}super.equals(o){{/parent}}{{^parent}}true{{/parent}};{{/hasVars}} + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + 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())); + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public int hashCode() { + {{#useReflectionEqualsHashCode}} + return HashCodeBuilder.reflectionHashCode(this); + {{/useReflectionEqualsHashCode}} + {{^useReflectionEqualsHashCode}} + return Objects.hash({{#vars}}{{^isDiscriminator}}{{^isByteArray}}{{name}}{{/isByteArray}}{{#isByteArray}}Arrays.hashCode({{name}}){{/isByteArray}}{{^-last}}, {{/-last}}{{/isDiscriminator}}{{#isDiscriminator}}true{{/isDiscriminator}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}}{{#isAdditionalPropertiesTrue}}{{#hasVars}}, {{/hasVars}}{{^hasVars}}{{#parent}}, {{/parent}}{{/hasVars}}additionalProperties{{/isAdditionalPropertiesTrue}}); + {{/useReflectionEqualsHashCode}} + }{{#vendorExtensions.x-jackson-optional-nullable-helpers}} + + private static int hashCodeNullable(JsonNullable a) { + if (a == null) { + return 1; + } + return a.isPresent() ? Arrays.deepHashCode(new Object[]{a.get()}) : 31; + }{{/vendorExtensions.x-jackson-optional-nullable-helpers}} + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class {{classname}} {\n"); + {{#parent}} + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + {{/parent}} + {{#vars}} + {{^isDiscriminator}} + sb.append(" {{name}}: ").append({{#isPassword}}"*"{{/isPassword}}{{^isPassword}}toIndentedString({{name}}){{/isPassword}}).append("\n"); + {{/isDiscriminator}} + {{/vars}} +{{#isAdditionalPropertiesTrue}} + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); +{{/isAdditionalPropertiesTrue}} + 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 "); + } + +{{#parcelableModel}} + + public void writeToParcel(Parcel out, int flags) { +{{#model}} +{{#isArray}} + out.writeList(this); +{{/isArray}} +{{^isArray}} +{{#parent}} + super.writeToParcel(out, flags); +{{/parent}} +{{#vars}} +{{^isDiscriminator}} + out.writeValue({{name}}); +{{/isDiscriminator}} +{{/vars}} +{{/isArray}} +{{/model}} + } + + {{classname}}(Parcel in) { +{{#isArray}} + in.readTypedList(this, {{arrayModelType}}.CREATOR); +{{/isArray}} +{{^isArray}} +{{#parent}} + super(in); +{{/parent}} +{{#vars}} +{{^isDiscriminator}} +{{#isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue(null); +{{/isPrimitiveType}} +{{^isPrimitiveType}} + {{name}} = ({{{datatypeWithEnum}}})in.readValue({{complexType}}.class.getClassLoader()); +{{/isPrimitiveType}} +{{/isDiscriminator}} +{{/vars}} +{{/isArray}} + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator<{{classname}}> CREATOR = new Parcelable.Creator<{{classname}}>() { + public {{classname}} createFromParcel(Parcel in) { +{{#model}} +{{#isArray}} + {{classname}} result = new {{classname}}(); + result.addAll(in.readArrayList({{arrayModelType}}.class.getClassLoader())); + return result; +{{/isArray}} +{{^isArray}} + return new {{classname}}(in); +{{/isArray}} +{{/model}} + } + public {{classname}}[] newArray(int size) { + return new {{classname}}[size]; + } + }; +{{/parcelableModel}} + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(); + {{#allVars}} + openapiFields.add("{{baseName}}"); + {{/allVars}} + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(); + {{#requiredVars}} + openapiRequiredFields.add("{{baseName}}"); + {{/requiredVars}} + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to {{classname}} + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!{{classname}}.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format("The required field(s) %s in {{{classname}}} is not found in the empty JSON string", {{classname}}.openapiRequiredFields.toString())); + } + } + {{^hasChildren}} + {{^isAdditionalPropertiesTrue}} + + Set> entries = jsonElement.getAsJsonObject().entrySet(); + // check to see if the JSON string contains additional fields + for (Map.Entry entry : entries) { + if (!{{classname}}.openapiFields.contains(entry.getKey())) { + throw new IllegalArgumentException(String.format("The field `%s` in the JSON string is not defined in the `{{classname}}` properties. JSON: %s", entry.getKey(), jsonElement.toString())); + } + } + {{/isAdditionalPropertiesTrue}} + {{#requiredVars}} + {{#-first}} + + // check to make sure all required properties/fields are present in the JSON string + for (String requiredField : {{classname}}.openapiRequiredFields) { + if (jsonElement.getAsJsonObject().get(requiredField) == null) { + throw new IllegalArgumentException(String.format("The required field `%s` is not found in the JSON string: %s", requiredField, jsonElement.toString())); + } + } + {{/-first}} + {{/requiredVars}} + {{/hasChildren}} + {{^discriminator}} + {{#hasVars}} + JsonObject jsonObj = jsonElement.getAsJsonObject(); + {{/hasVars}} + {{#vars}} + {{^isDiscriminator}} + {{#isArray}} + {{#items.isModel}} + {{#required}} + // ensure the json data is an array + if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + + JsonArray jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}"); + // validate the required field `{{{baseName}}}` (array) + for (int i = 0; i < jsonArray{{name}}.size(); i++) { + {{{items.dataType}}}.validateJsonElement(jsonArray{{name}}.get(i)); + }; + {{/required}} + {{^required}} + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + JsonArray jsonArray{{name}} = jsonObj.getAsJsonArray("{{{baseName}}}"); + if (jsonArray{{name}} != null) { + // ensure the json data is an array + if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + + // validate the optional field `{{{baseName}}}` (array) + for (int i = 0; i < jsonArray{{name}}.size(); i++) { + {{{items.dataType}}}.validateJsonElement(jsonArray{{name}}.get(i)); + }; + } + } + {{/required}} + {{/items.isModel}} + {{^items.isModel}} + {{^required}} + // ensure the optional json data is an array if present + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull() && !jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/required}} + {{#required}} + // ensure the required json array is present + if (jsonObj.get("{{{baseName}}}") == null) { + throw new IllegalArgumentException("Expected the field `linkedContent` to be an array in the JSON string but got `null`"); + } else if (!jsonObj.get("{{{baseName}}}").isJsonArray()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be an array in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/required}} + {{/items.isModel}} + {{/isArray}} + {{^isContainer}} + {{#isString}} + if ({{#notRequiredOrIsNullable}}(jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) && {{/notRequiredOrIsNullable}}!jsonObj.get("{{{baseName}}}").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format("Expected the field `{{{baseName}}}` to be a primitive type in the JSON string but got `%s`", jsonObj.get("{{{baseName}}}").toString())); + } + {{/isString}} + {{#isModel}} + {{#required}} + // validate the required field `{{{baseName}}}` + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + } + {{/required}} + {{/isModel}} + {{#isEnum}} + {{#required}} + // validate the required field `{{{baseName}}}` + {{{datatypeWithEnum}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{{datatypeWithEnum}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + } + {{/required}} + {{/isEnum}} + {{#isEnumRef}} + {{#required}} + // validate the required field `{{{baseName}}}` + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + {{/required}} + {{^required}} + // validate the optional field `{{{baseName}}}` + if (jsonObj.get("{{{baseName}}}") != null && !jsonObj.get("{{{baseName}}}").isJsonNull()) { + {{{dataType}}}.validateJsonElement(jsonObj.get("{{{baseName}}}")); + } + {{/required}} + {{/isEnumRef}} + {{/isContainer}} + {{/isDiscriminator}} + {{/vars}} + {{/discriminator}} + {{#hasChildren}} + {{#discriminator}} + + String discriminatorValue = jsonElement.getAsJsonObject().get("{{{propertyBaseName}}}").getAsString(); + switch (discriminatorValue) { + {{#mappedModels}} + case "{{mappingName}}": + {{modelName}}.validateJsonElement(jsonElement); + break; + {{/mappedModels}} + default: + throw new IllegalArgumentException(String.format("The value of the `{{{propertyBaseName}}}` field `%s` does not match any key defined in the discriminator's mapping.", discriminatorValue)); + } + {{/discriminator}} + {{/hasChildren}} + } + +{{^hasChildren}} + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!{{classname}}.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes '{{classname}}' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter<{{classname}}> thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get({{classname}}.class)); + + return (TypeAdapter) new TypeAdapter<{{classname}}>() { + @Override + public void write(JsonWriter out, {{classname}} value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + {{#isAdditionalPropertiesTrue}} + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + {{/isAdditionalPropertiesTrue}} + elementAdapter.write(out, obj); + } + + @Override + public {{classname}} read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + {{#isAdditionalPropertiesTrue}} + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + {{classname}} instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format("The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + {{/isAdditionalPropertiesTrue}} + {{^isAdditionalPropertiesTrue}} + return thisAdapter.fromJsonTree(jsonElement); + {{/isAdditionalPropertiesTrue}} + } + + }.nullSafe(); + } + } +{{/hasChildren}} + + /** + * Create an instance of {{classname}} given an JSON string + * + * @param jsonString JSON string + * @return An instance of {{classname}} + * @throws IOException if the JSON string is invalid with respect to {{classname}} + */ + public static {{{classname}}} fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, {{{classname}}}.class); + } + + /** + * Convert an instance of {{classname}} to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} \ No newline at end of file From 2bcb84d0aa15b3df697395d883709a53f602229d Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 1 Sep 2024 15:13:21 +0200 Subject: [PATCH 2/9] Document the changes in templates. --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f42d50..b3c3256 100644 --- a/README.md +++ b/README.md @@ -48,11 +48,27 @@ RulesDto rules = squidex.rules().getRules(); System.out.println("Received response from Squidex: " + rules); ``` -## Staged Builders +## Staged Builders (v1.X) The generated builders all follow the staged builder pattern. Read more [here](https://immutables.github.io/immutable.html#staged-builder). Staged builders only allow you to build the object once all required properties have been specified. +## Custom Templates + +### `api.mustache` + +* Use `vendorExtensions.x-method-name` for the actual method name. +* Use `vendorExtensions.f-field-name` for the actual header name. + +### `models.mustache` + +* Remove all code where properties for the discriminator is generated. + +### `JSON.mustache` + +* Fix the serialization with `registerTypeSelector` to select the type based on the discriminator mapping. +* Fix the serialization with `registerPostProcessor` to add the discriminator properties to the generated JSON. + ## Contributing While we value open-source contributions to this SDK, this library is generated programmatically. From d4a6620a1db798465cc2217285d3970f0530d926 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 1 Sep 2024 16:03:38 +0200 Subject: [PATCH 3/9] Rename UiFieldPropertiesDto.java to UIFieldPropertiesDto.java --- .../{UiFieldPropertiesDto.java => UIFieldPropertiesDto.java} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/java/com/squidex/api/types/{UiFieldPropertiesDto.java => UIFieldPropertiesDto.java} (100%) diff --git a/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/UIFieldPropertiesDto.java similarity index 100% rename from src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java rename to src/main/java/com/squidex/api/types/UIFieldPropertiesDto.java From 582a99990e33a51a0a07ae97c85a43703844e25e Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 1 Sep 2024 16:30:31 +0200 Subject: [PATCH 4/9] Simplify build. --- .github/workflows/ci.yml | 37 ++++--------------------------------- README.md | 13 ++++++++++--- 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34754ae..da9dd9c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,25 +20,11 @@ jobs: - name: Compile run: ./gradlew compileJava - test: - needs: [ compile ] - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Set up Java - id: setup-jre - uses: actions/setup-java@v1 - with: - java-version: "11" - architecture: x64 - - name: Test - Start Compose - run: docker-compose up -d + run: docker compose up -d working-directory: tests - - name: Test + - name: Test - RUN run: ./gradlew test env: CONFIG__WAIT: 60 @@ -54,26 +40,11 @@ jobs: - name: Test - Cleanup if: always() - run: docker-compose down + run: docker compose down working-directory: tests - - publish: - needs: [ compile, test ] - if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - - name: Set up Java - id: setup-jre - uses: actions/setup-java@v1 - with: - java-version: "11" - architecture: x64 - name: Publish to maven + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') run: | ./gradlew publish env: diff --git a/README.md b/README.md index b3c3256..0ae63bd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Squidex Java Library -[![Maven Central](https://img.shields.io/maven-central/v/io.squidex/squidex)](https://central.sonatype.com/artifact/io.squidex/squidex) -[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern) +[![Maven Central](https://img.shields.io/maven-central/v/io.squidex/squidex)](https://central.sonatype.com/artifact/io.squidex/squidex) The Squidex Java SDK provides convenient access to the Squidex API from Java. @@ -51,7 +50,15 @@ System.out.println("Received response from Squidex: " + rules); ## Staged Builders (v1.X) The generated builders all follow the staged builder pattern. Read more [here](https://immutables.github.io/immutable.html#staged-builder). -Staged builders only allow you to build the object once all required properties have been specified. +Staged builders only allow you to build the object once all required properties have been specified. + +## Major changes in 2.0 + +This SDK is mainly based on code generation, based on the OpenAPI specification from the Squidex API. + +The initial version was built with fern: https://www.buildwithfern.com/. The main reason was the overall code quality and the support for discriminators. When the 1.0 version was released fern has not defined the pricing yet and unfortunately the current pricing is too expensive. + +Therefore the SDK code generation was moved to OpenAPI Generator: (https://openapi-generator.tech/). The goal was to be as close to the previous version as possible without doing too much changes to the code generation templates. It was not possible to provide the same method signatures. ## Custom Templates From 3ea81b8c0b772604708810f3a96781ee12e457f2 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 1 Sep 2024 16:48:53 +0200 Subject: [PATCH 5/9] Fix API. --- openapi-config.yml | 11 +- .../com/squidex/api/core/api/AssetsApi.java | 8 +- .../com/squidex/api/core/api/ContentsApi.java | 128 +++++++++--------- templates/api.mustache | 4 +- 4 files changed, 71 insertions(+), 80 deletions(-) diff --git a/openapi-config.yml b/openapi-config.yml index 1a7dbb2..a8ba745 100644 --- a/openapi-config.yml +++ b/openapi-config.yml @@ -12,13 +12,4 @@ additionalProperties: invokerPackage: com.squidex.api.core modelPackage: com.squidex.api.types useRuntimeException: true - useSingleRequestParameter: true - -nameMappings: - file2: uploadFile - X-Fields: fields - X-Flatten: flatten - X-Languages: languages - X-NoSlowTotal: noSlowTotal - X-NoTotal: noTotal - X-Unpublished: unpublished \ No newline at end of file + useSingleRequestParameter: true \ No newline at end of file diff --git a/src/main/java/com/squidex/api/core/api/AssetsApi.java b/src/main/java/com/squidex/api/core/api/AssetsApi.java index 228ba58..c2df53f 100644 --- a/src/main/java/com/squidex/api/core/api/AssetsApi.java +++ b/src/main/java/com/squidex/api/core/api/AssetsApi.java @@ -2320,11 +2320,11 @@ private okhttp3.Call getAssetsCall(String parentId, String ids, String q, BigDec } if (noTotal != null) { - localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + localVarHeaderParams.put("X-NoTotal", localVarApiClient.parameterToString(noTotal)); } if (noSlowTotal != null) { - localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + localVarHeaderParams.put("X-NoSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); } final String[] localVarAccepts = { @@ -2580,11 +2580,11 @@ private okhttp3.Call getAssetsPostCall(QueryDto queryDto, Boolean noTotal, Boole Map localVarFormParams = new HashMap(); if (noTotal != null) { - localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + localVarHeaderParams.put("X-NoTotal", localVarApiClient.parameterToString(noTotal)); } if (noSlowTotal != null) { - localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + localVarHeaderParams.put("X-NoSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); } final String[] localVarAccepts = { diff --git a/src/main/java/com/squidex/api/core/api/ContentsApi.java b/src/main/java/com/squidex/api/core/api/ContentsApi.java index 0ddfe5d..bb1e95b 100644 --- a/src/main/java/com/squidex/api/core/api/ContentsApi.java +++ b/src/main/java/com/squidex/api/core/api/ContentsApi.java @@ -289,11 +289,11 @@ private okhttp3.Call createDraftCall(String schema, String id, Boolean unpublish Map localVarFormParams = new HashMap(); if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } final String[] localVarAccepts = { @@ -697,11 +697,11 @@ private okhttp3.Call deleteContentStatusCall(String schema, String id, Boolean u Map localVarFormParams = new HashMap(); if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } final String[] localVarAccepts = { @@ -903,11 +903,11 @@ private okhttp3.Call deleteVersionCall(String schema, String id, Boolean unpubli Map localVarFormParams = new HashMap(); if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } final String[] localVarAccepts = { @@ -1113,19 +1113,19 @@ private okhttp3.Call getContentCall(String schema, String id, Long version, Stri } if (fields != null) { - localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + localVarHeaderParams.put("X-Fields", localVarApiClient.parameterToString(fields)); } if (flatten != null) { - localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + localVarHeaderParams.put("X-Flatten", localVarApiClient.parameterToString(flatten)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } final String[] localVarAccepts = { @@ -1528,11 +1528,11 @@ private okhttp3.Call getContentVersionCall(String schema, String id, Integer ver Map localVarFormParams = new HashMap(); if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } final String[] localVarAccepts = { @@ -1776,27 +1776,27 @@ private okhttp3.Call getContentsCall(String schema, String ids, String q, String } if (fields != null) { - localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + localVarHeaderParams.put("X-Fields", localVarApiClient.parameterToString(fields)); } if (flatten != null) { - localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + localVarHeaderParams.put("X-Flatten", localVarApiClient.parameterToString(flatten)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } if (noSlowTotal != null) { - localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + localVarHeaderParams.put("X-NoSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); } if (noTotal != null) { - localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + localVarHeaderParams.put("X-NoTotal", localVarApiClient.parameterToString(noTotal)); } if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } final String[] localVarAccepts = { @@ -2105,27 +2105,27 @@ private okhttp3.Call getContentsPostCall(String schema, QueryDto queryDto, Strin Map localVarFormParams = new HashMap(); if (fields != null) { - localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + localVarHeaderParams.put("X-Fields", localVarApiClient.parameterToString(fields)); } if (flatten != null) { - localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + localVarHeaderParams.put("X-Flatten", localVarApiClient.parameterToString(flatten)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } if (noSlowTotal != null) { - localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + localVarHeaderParams.put("X-NoSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); } if (noTotal != null) { - localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + localVarHeaderParams.put("X-NoTotal", localVarApiClient.parameterToString(noTotal)); } if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } final String[] localVarAccepts = { @@ -2376,27 +2376,27 @@ private okhttp3.Call getReferencesCall(String schema, String id, String q, Strin } if (fields != null) { - localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + localVarHeaderParams.put("X-Fields", localVarApiClient.parameterToString(fields)); } if (flatten != null) { - localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + localVarHeaderParams.put("X-Flatten", localVarApiClient.parameterToString(flatten)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } if (noSlowTotal != null) { - localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + localVarHeaderParams.put("X-NoSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); } if (noTotal != null) { - localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + localVarHeaderParams.put("X-NoTotal", localVarApiClient.parameterToString(noTotal)); } final String[] localVarAccepts = { @@ -2652,27 +2652,27 @@ private okhttp3.Call getReferencingCall(String schema, String id, String q, Stri } if (fields != null) { - localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + localVarHeaderParams.put("X-Fields", localVarApiClient.parameterToString(fields)); } if (flatten != null) { - localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + localVarHeaderParams.put("X-Flatten", localVarApiClient.parameterToString(flatten)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } if (noSlowTotal != null) { - localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + localVarHeaderParams.put("X-NoSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); } if (noTotal != null) { - localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + localVarHeaderParams.put("X-NoTotal", localVarApiClient.parameterToString(noTotal)); } final String[] localVarAccepts = { @@ -2924,11 +2924,11 @@ private okhttp3.Call patchContentCall(String schema, String id, Map localVarFormParams = new HashMap(); if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } final String[] localVarAccepts = { @@ -3150,11 +3150,11 @@ private okhttp3.Call postContentCall(String schema, Map localVarFormParams = new HashMap(); if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } final String[] localVarAccepts = { @@ -4722,27 +4722,27 @@ private okhttp3.Call getAllContentsCall(String ids, OffsetDateTime scheduleFrom, } if (fields != null) { - localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + localVarHeaderParams.put("X-Fields", localVarApiClient.parameterToString(fields)); } if (flatten != null) { - localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + localVarHeaderParams.put("X-Flatten", localVarApiClient.parameterToString(flatten)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } if (noSlowTotal != null) { - localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + localVarHeaderParams.put("X-NoSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); } if (noTotal != null) { - localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + localVarHeaderParams.put("X-NoTotal", localVarApiClient.parameterToString(noTotal)); } if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } final String[] localVarAccepts = { @@ -5031,27 +5031,27 @@ private okhttp3.Call getAllContentsPostCall(AllContentsByPostDto allContentsByPo Map localVarFormParams = new HashMap(); if (fields != null) { - localVarHeaderParams.put("fields", localVarApiClient.parameterToString(fields)); + localVarHeaderParams.put("X-Fields", localVarApiClient.parameterToString(fields)); } if (flatten != null) { - localVarHeaderParams.put("flatten", localVarApiClient.parameterToString(flatten)); + localVarHeaderParams.put("X-Flatten", localVarApiClient.parameterToString(flatten)); } if (languages != null) { - localVarHeaderParams.put("languages", localVarApiClient.parameterToString(languages)); + localVarHeaderParams.put("X-Languages", localVarApiClient.parameterToString(languages)); } if (noSlowTotal != null) { - localVarHeaderParams.put("noSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); + localVarHeaderParams.put("X-NoSlowTotal", localVarApiClient.parameterToString(noSlowTotal)); } if (noTotal != null) { - localVarHeaderParams.put("noTotal", localVarApiClient.parameterToString(noTotal)); + localVarHeaderParams.put("X-NoTotal", localVarApiClient.parameterToString(noTotal)); } if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } final String[] localVarAccepts = { @@ -5300,7 +5300,7 @@ private okhttp3.Call getGraphQLCall(String theQueryString, String variables, Str } if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } final String[] localVarAccepts = { @@ -5513,7 +5513,7 @@ private okhttp3.Call getGraphQLBatchCall(String theQueryString, String variables } if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } final String[] localVarAccepts = { @@ -5714,7 +5714,7 @@ private okhttp3.Call postGraphQLCall(Boolean unpublished, Object body, final Api Map localVarFormParams = new HashMap(); if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } final String[] localVarAccepts = { @@ -5899,7 +5899,7 @@ private okhttp3.Call postGraphQLBatchCall(Boolean unpublished, Object body, fina Map localVarFormParams = new HashMap(); if (unpublished != null) { - localVarHeaderParams.put("unpublished", localVarApiClient.parameterToString(unpublished)); + localVarHeaderParams.put("X-Unpublished", localVarApiClient.parameterToString(unpublished)); } final String[] localVarAccepts = { diff --git a/templates/api.mustache b/templates/api.mustache index eb62334..a417e00 100644 --- a/templates/api.mustache +++ b/templates/api.mustache @@ -184,14 +184,14 @@ public class {{classname}} { {{/constantParams}} {{#headerParams}} if ({{paramName}} != null) { - localVarHeaderParams.put("{{baseName}}", localVarApiClient.parameterToString({{paramName}})); + localVarHeaderParams.put("{{vendorExtensions.x-header-name}}", localVarApiClient.parameterToString({{paramName}})); } {{/headerParams}} {{#constantParams}} {{#isHeaderParam}} // Set client side default value of Header Param "{{baseName}}". - localVarHeaderParams.put("{{baseName}}", {{#_enum}}"{{{.}}}"{{/_enum}}); + localVarHeaderParams.put("{{vendorExtensions.x-header-name}}", {{#_enum}}"{{{.}}}"{{/_enum}}); {{/isHeaderParam}} {{/constantParams}} From ba6860ac27b01f082d62cb1a68143153ef668240 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 1 Sep 2024 18:04:26 +0200 Subject: [PATCH 6/9] Only run manually. --- .github/workflows/check-updates.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/check-updates.yml b/.github/workflows/check-updates.yml index 813c791..3394741 100644 --- a/.github/workflows/check-updates.yml +++ b/.github/workflows/check-updates.yml @@ -3,9 +3,6 @@ concurrency: check on: workflow_dispatch: - schedule: - # Automatically run on every Sunday - - cron: '0 0 * * 0' jobs: build: From 9739500004b296c62ea0c7d26d33211abe334f27 Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 1 Sep 2024 20:41:22 +0200 Subject: [PATCH 7/9] T --- build.gradle | 194 +++++++++++++-------------------------------------- 1 file changed, 50 insertions(+), 144 deletions(-) diff --git a/build.gradle b/build.gradle index 02181b6..11f951e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,167 +1,73 @@ -apply plugin: 'idea' -apply plugin: 'eclipse' -apply plugin: 'java' -apply plugin: 'com.diffplug.spotless' - -group = 'com.squidex.api' -version = '1.0.0.0' - -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:2.3.+' - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.11.0' - } +plugins { + id 'java-library' + id 'maven-publish' + id 'com.diffplug.spotless' version '6.11.0' } repositories { mavenCentral() -} -sourceSets { - main.java.srcDirs = ['src/main/java'] -} - -if(hasProperty('target') && target == 'android') { - - apply plugin: 'com.android.library' - apply plugin: 'com.github.dcendents.android-maven' - - android { - compileSdkVersion 25 - buildToolsVersion '25.0.2' - defaultConfig { - minSdkVersion 14 - targetSdkVersion 25 - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - // Rename the aar correctly - libraryVariants.all { variant -> - variant.outputs.each { output -> - def outputFile = output.outputFile - if (outputFile != null && outputFile.name.endsWith('.aar')) { - def fileName = "${project.name}-${variant.baseName}-${version}.aar" - output.outputFile = new File(outputFile.parent, fileName) - } - } - } - - dependencies { - provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - } - } - - afterEvaluate { - android.libraryVariants.all { variant -> - def task = project.tasks.create "jar${variant.name.capitalize()}", Jar - task.description = "Create jar artifact for ${variant.name}" - task.dependsOn variant.javaCompile - task.from variant.javaCompile.destinationDirectory - task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") - task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" - artifacts.add('archives', task) - } - } - - task sourcesJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - classifier = 'sources' - } - - artifacts { - archives sourcesJar - } - -} else { - - apply plugin: 'java' - apply plugin: 'maven-publish' - - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - - publishing { - publications { - maven(MavenPublication) { - artifactId = 'openapi-java-client' - from components.java - } - } + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' } - - task execute(type:JavaExec) { - main = System.getProperty('mainClass') - classpath = sourceSets.main.runtimeClasspath - } -} - -ext { - jakarta_annotation_version = "1.3.5" } dependencies { - implementation 'io.swagger:swagger-annotations:1.6.8' - implementation "com.google.code.findbugs:jsr305:3.0.2" - implementation 'com.squareup.okhttp3:okhttp:4.12.0' - implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0' - implementation 'com.google.code.gson:gson:2.9.1' - implementation 'io.gsonfire:gson-fire:1.9.0' - implementation 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6' - implementation 'org.openapitools:jackson-databind-nullable:0.2.6' - implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0' - implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" - testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.3' - testImplementation 'org.mockito:mockito-core:3.12.4' - testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.3' + api 'com.google.code.findbugs:jsr305:3.0.2' + api 'com.google.code.gson:gson:2.9.1' + api 'com.squareup.okhttp3:logging-interceptor:4.12.0' + api 'com.squareup.okhttp3:okhttp:4.12.0' + api 'io.gsonfire:gson-fire:1.9.0' + api 'io.swagger:swagger-annotations:1.6.8' + api 'jakarta.annotation:jakarta.annotation-api:1.3.5' + api 'jakarta.ws.rs:jakarta.ws.rs-api:2.1.6' + api 'org.openapitools:jackson-databind-nullable:0.2.6' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' } -javadoc { - options.tags = [ "http.response.details:a:Http Response Details" ] -} - -// Use spotless plugin to automatically format code, remove unused import, etc -// To apply changes directly to the file, run `gradlew spotlessApply` -// Ref: https://github.com/diffplug/spotless/tree/main/plugin-gradle spotless { - // comment out below to run spotless as part of the `check` task - enforceCheck false - - format 'misc', { - // define the files (e.g. '*.gradle', '*.md') to apply `misc` to - target '.gitignore' - - // define the steps to apply to those files - trimTrailingWhitespace() - indentWithSpaces() // Takes an integer argument if you don't like 4 - endWithNewline() - } java { - // don't need to set target, it is inferred from java + palantirJavaFormat() + } +} + +java { + withSourcesJar() + withJavadocJar() +} - // apply a specific flavor of google-java-format - googleJavaFormat('1.8').aosp().reflowLongStrings() +javadoc { + options.tags = ["http.response.details:a:Http Response Details"] - removeUnusedImports() - importOrder() + if (JavaVersion.current().isJava8Compatible()) { + options.addStringOption('Xdoclint:none', '-quiet') } } test { - // Enable JUnit 5 (Gradle 4.6+). useJUnitPlatform() - - // Always run tests, even when nothing changed. - dependsOn 'cleanTest' - - // Show test results. testLogging { - events "passed", "skipped", "failed" + showStandardStreams = true } +} +publishing { + publications { + maven(MavenPublication) { + groupId = 'io.squidex' + artifactId = 'squidex' + version = '1.0.0' + from components.java + } + } + repositories { + maven { + url '$System.env.MAVEN_PUBLISH_REGISTRY_URL' + credentials { + username '$System.env.MAVEN_USERNAME' + password '$System.env.MAVEN_PASSWORD' + } + } + } } + From 4a3962f2368088d3a4c9158064e06a9b70c866fa Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 1 Sep 2024 20:44:27 +0200 Subject: [PATCH 8/9] Generate again. --- .openapi-generator-ignore | 2 ++ .openapi-generator/FILES | 2 -- build.sbt | 27 --------------------------- 3 files changed, 2 insertions(+), 29 deletions(-) delete mode 100644 build.sbt diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore index c251ce9..9d4ebbe 100644 --- a/.openapi-generator-ignore +++ b/.openapi-generator-ignore @@ -18,5 +18,7 @@ openapi.yml gradle.properties gradlew gradlew.bat +build.gradle +build.sbt README.md \ No newline at end of file diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 3644d0b..92d0a17 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,5 +1,3 @@ -build.gradle -build.sbt gradle/wrapper/gradle-wrapper.jar gradle/wrapper/gradle-wrapper.properties settings.gradle diff --git a/build.sbt b/build.sbt deleted file mode 100644 index 1e76c3b..0000000 --- a/build.sbt +++ /dev/null @@ -1,27 +0,0 @@ -lazy val root = (project in file(".")). - settings( - organization := "com.squidex.api", - name := "openapi-java-client", - version := "1.0.0.0", - scalaVersion := "2.11.4", - scalacOptions ++= Seq("-feature"), - javacOptions in compile ++= Seq("-Xlint:deprecation"), - publishArtifact in (Compile, packageDoc) := false, - resolvers += Resolver.mavenLocal, - libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.6.5", - "com.squareup.okhttp3" % "okhttp" % "4.12.0", - "com.squareup.okhttp3" % "logging-interceptor" % "4.12.0", - "com.google.code.gson" % "gson" % "2.9.1", - "org.apache.commons" % "commons-lang3" % "3.12.0", - "jakarta.ws.rs" % "jakarta.ws.rs-api" % "2.1.6", - "org.openapitools" % "jackson-databind-nullable" % "0.2.6", - "io.gsonfire" % "gson-fire" % "1.9.0" % "compile", - "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "com.google.code.findbugs" % "jsr305" % "3.0.2" % "compile", - "jakarta.annotation" % "jakarta.annotation-api" % "1.3.5" % "compile", - "org.junit.jupiter" % "junit-jupiter-api" % "5.10.3" % "test", - "com.novocode" % "junit-interface" % "0.10" % "test", - "org.mockito" % "mockito-core" % "3.12.4" % "test" - ) - ) From 6b2a94af5be38ef7a1e7fbea408d7c1abbabbbcc Mon Sep 17 00:00:00 2001 From: Sebastian Stehle Date: Sun, 1 Sep 2024 20:51:09 +0200 Subject: [PATCH 9/9] Fix build. --- src/test/java/com/squidex/api/Utils.java | 35 ++++++++++-------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/test/java/com/squidex/api/Utils.java b/src/test/java/com/squidex/api/Utils.java index 2947423..f9476fe 100644 --- a/src/test/java/com/squidex/api/Utils.java +++ b/src/test/java/com/squidex/api/Utils.java @@ -11,37 +11,30 @@ public static ClientProvider getClient() { return singleClient; } - String appName = System.getenv("CONFIG__APP__NAME"); - String clientId = System.getenv("CONFIG__CLIENT_ID"); - String clientSecret = System.getenv("CONFIG__CLIENT_SECRET"); - String environment = System.getenv("CONFIG__SERVER__URL"); - - if (appName == null) { - appName = "integration-tests"; - } - - if (clientId == null) { - clientId = "root"; - } - - if (clientSecret == null) { - clientSecret = "xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0="; - } - - if (environment == null) { - environment = "https://localhost:5001"; - } + String appName = getEnvOrDefault("CONFIG__APP__NAME", "integration-tests"); + String clientId = getEnvOrDefault("CONFIG__CLIENT_ID", "root"); + String clientSecret = getEnvOrDefault("CONFIG__CLIENT_SECRET", "xeLd6jFxqbXJrfmNLlO2j1apagGGGSyZJhFnIuHp4I0="); + String url = getEnvOrDefault("CONFIG__SERVER__URL", "https://localhost:5001"); SquidexClientBuilder builder = SquidexClient.builder() .trustAllCerts(true) .appName(appName) .clientId(clientId) .clientSecret(clientSecret) - .baseUrl(environment); + .url(url); singleClient = new ClientProvider(builder, builder.build()); return singleClient; } + + private static String getEnvOrDefault(String key, String defaultValue) { + String result = System.getenv(key); + if (result == null || result.isEmpty()) { + result = defaultValue; + } + + return result; + } }