From 2f6d6c5efbe9b398c44ffa1df6431be3ff352d3b Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Sun, 6 Aug 2023 22:13:18 +0000 Subject: [PATCH] Release 0.0.5 --- .fernignore | 1 + .github/workflows/ci.yml | 45 + .gitignore | 24 + build.gradle | 51 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59821 bytes gradle/wrapper/gradle-wrapper.properties | 5 + gradlew | 234 ++++ gradlew.bat | 89 ++ sample-app/build.gradle | 15 + sample-app/src/main/java/sample/App.java | 9 + settings.gradle | 1 + .../com/squidex/api/SquidexApiClient.java | 193 +++ .../squidex/api/SquidexApiClientBuilder.java | 35 + .../com/squidex/api/core/ClientOptions.java | 92 ++ .../com/squidex/api/core/Environment.java | 19 + .../com/squidex/api/core/ObjectMappers.java | 17 + .../com/squidex/api/core/RequestOptions.java | 37 + .../java/com/squidex/api/core/Suppliers.java | 20 + .../api/resources/apps/AppsClient.java | 1242 +++++++++++++++++ .../apps/requests/AddLanguageDto.java | 89 ++ .../resources/apps/requests/AddRoleDto.java | 89 ++ .../apps/requests/AddWorkflowDto.java | 89 ++ .../apps/requests/AppsUploadImageRequest.java | 16 + .../resources/apps/requests/CreateAppDto.java | 126 ++ .../apps/requests/CreateClientDto.java | 89 ++ .../apps/requests/TransferToTeamDto.java | 79 ++ .../resources/apps/requests/UpdateAppDto.java | 104 ++ .../apps/requests/UpdateAppSettingsDto.java | 178 +++ .../apps/requests/UpdateAssetScriptsDto.java | 243 ++++ .../apps/requests/UpdateClientDto.java | 189 +++ .../apps/requests/UpdateLanguageDto.java | 134 ++ .../apps/requests/UpdateRoleDto.java | 113 ++ .../apps/requests/UpdateWorkflowDto.java | 221 +++ .../api/resources/assets/AssetsClient.java | 874 ++++++++++++ .../assets/requests/AnnotateAssetDto.java | 191 +++ .../requests/AssetsDeleteAssetRequest.java | 104 ++ .../AssetsGetAssetContentBySlugRequest.java | 453 ++++++ .../AssetsGetAssetContentRequest.java | 452 ++++++ .../AssetsGetAssetFoldersRequest.java | 105 ++ .../requests/AssetsGetAssetsPostRequest.java | 156 +++ .../requests/AssetsGetAssetsRequest.java | 307 ++++ .../requests/AssetsPostAssetRequest.java | 129 ++ .../AssetsPostUpsertAssetRequest.java | 104 ++ .../AssetsPutAssetContentRequest.java | 16 + .../assets/requests/BulkUpdateAssetsDto.java | 164 +++ .../assets/requests/CreateAssetFolderDto.java | 126 ++ .../assets/requests/MoveAssetDto.java | 79 ++ .../assets/requests/MoveAssetFolderDto.java | 79 ++ .../assets/requests/RenameAssetFolderDto.java | 89 ++ .../assets/requests/RenameTagDto.java | 89 ++ .../api/resources/backups/BackupsClient.java | 238 ++++ .../BackupsGetBackupContentV2Request.java | 104 ++ .../backups/requests/RestoreRequestDto.java | 126 ++ .../resources/comments/CommentsClient.java | 195 +++ .../requests/CommentsGetCommentsRequest.java | 79 ++ .../resources/contents/ContentsClient.java | 899 ++++++++++++ .../requests/BulkUpdateContentsDto.java | 267 ++++ .../contents/requests/ChangeStatusDto.java | 242 ++++ .../requests/ContentsCreateDraftRequest.java | 104 ++ .../ContentsDeleteContentRequest.java | 105 ++ .../ContentsDeleteContentStatusRequest.java | 106 ++ .../ContentsDeleteVersionRequest.java | 104 ++ .../requests/ContentsGetContentRequest.java | 162 +++ .../ContentsGetContentVersionRequest.java | 104 ++ .../ContentsGetContentsPostRequest.java | 273 ++++ .../requests/ContentsGetContentsRequest.java | 393 ++++++ .../ContentsGetReferencesRequest.java | 216 +++ .../ContentsGetReferencingRequest.java | 217 +++ .../requests/ContentsPatchContentRequest.java | 136 ++ .../requests/ContentsPostContentRequest.java | 221 +++ .../ContentsPostUpsertContentRequest.java | 221 +++ .../requests/ContentsPutContentRequest.java | 136 ++ .../contents/requests/ImportContentsDto.java | 171 +++ .../diagnostics/DiagnosticsClient.java | 66 + .../eventconsumers/EventConsumersClient.java | 129 ++ .../api/resources/history/HistoryClient.java | 90 ++ .../requests/HistoryGetAppHistoryRequest.java | 79 ++ .../HistoryGetTeamHistoryRequest.java | 79 ++ .../resources/languages/LanguagesClient.java | 47 + .../api/resources/news/NewsClient.java | 50 + .../news/requests/NewsGetNewsRequest.java | 79 ++ .../notifications/NotificationsClient.java | 81 ++ .../NotificationsGetNotificationsRequest.java | 80 ++ .../api/resources/ping/PingClient.java | 97 ++ .../api/resources/plans/PlansClient.java | 148 ++ .../api/resources/rules/RulesClient.java | 619 ++++++++ .../rules/requests/RulesGetEventsRequest.java | 129 ++ .../requests/RulesPutRuleRunRequest.java | 79 ++ .../rules/requests/UpdateRuleDto.java | 158 +++ .../api/resources/schemas/SchemasClient.java | 1155 +++++++++++++++ .../schemas/requests/ChangeCategoryDto.java | 79 ++ .../requests/ConfigureFieldRulesDto.java | 81 ++ .../requests/ConfigureUiFieldsDto.java | 106 ++ .../schemas/requests/CreateSchemaDto.java | 522 +++++++ .../requests/SynchronizeSchemaDto.java | 386 +++++ .../schemas/requests/UpdateSchemaDto.java | 253 ++++ .../api/resources/search/SearchClient.java | 56 + .../SearchGetSearchResultsRequest.java | 79 ++ .../statistics/StatisticsClient.java | 231 +++ .../api/resources/teams/TeamsClient.java | 275 ++++ .../teams/requests/CreateTeamDto.java | 89 ++ .../teams/requests/UpdateTeamDto.java | 89 ++ .../resources/templates/TemplatesClient.java | 72 + .../translations/TranslationsClient.java | 65 + .../translations/requests/TranslateDto.java | 158 +++ .../usermanagement/UserManagementClient.java | 252 ++++ .../requests/CreateUserDto.java | 202 +++ .../requests/UpdateUserDto.java | 209 +++ .../UserManagementGetUsersRequest.java | 129 ++ .../api/resources/users/UsersClient.java | 136 ++ .../users/requests/UsersGetUsersRequest.java | 79 ++ .../com/squidex/api/types/ActionTypeEnum.java | 23 + .../com/squidex/api/types/AddFieldDto.java | 151 ++ .../api/types/AlgoliaRuleActionDto.java | 225 +++ .../api/types/AllContentsByPostDto.java | 244 ++++ .../java/com/squidex/api/types/AppDto.java | 622 +++++++++ .../com/squidex/api/types/AppLanguageDto.java | 291 ++++ .../squidex/api/types/AppLanguagesDto.java | 120 ++ .../com/squidex/api/types/AppSettingsDto.java | 312 +++++ .../api/types/ArrayFieldPropertiesDto.java | 134 ++ .../api/types/AssetChangedRuleTriggerDto.java | 79 ++ .../java/com/squidex/api/types/AssetDto.java | 976 +++++++++++++ .../com/squidex/api/types/AssetFolderDto.java | 234 ++++ .../squidex/api/types/AssetFolderScope.java | 23 + .../squidex/api/types/AssetFoldersDto.java | 244 ++++ .../java/com/squidex/api/types/AssetMeta.java | 89 ++ .../squidex/api/types/AssetPreviewMode.java | 23 + .../squidex/api/types/AssetScriptsDto.java | 415 ++++++ .../java/com/squidex/api/types/AssetType.java | 25 + .../java/com/squidex/api/types/AssetsDto.java | 191 +++ .../api/types/AssetsFieldPropertiesDto.java | 662 +++++++++ .../api/types/AssignContributorDto.java | 162 +++ .../api/types/AzureQueueRuleActionDto.java | 158 +++ .../com/squidex/api/types/BackupJobDto.java | 304 ++++ .../com/squidex/api/types/BackupJobsDto.java | 120 ++ .../squidex/api/types/BooleanFieldEditor.java | 21 + .../api/types/BooleanFieldPropertiesDto.java | 157 +++ .../com/squidex/api/types/BulkResultDto.java | 193 +++ .../api/types/BulkUpdateAssetType.java | 23 + .../api/types/BulkUpdateAssetsJobDto.java | 335 +++++ .../api/types/BulkUpdateContentType.java | 31 + .../api/types/BulkUpdateContentsJobDto.java | 358 +++++ .../squidex/api/types/CallsUsageDtoDto.java | 391 ++++++ .../api/types/CallsUsagePerDateDto.java | 181 +++ .../com/squidex/api/types/ChangePlanDto.java | 89 ++ .../java/com/squidex/api/types/ClientDto.java | 354 +++++ .../com/squidex/api/types/ClientsDto.java | 120 ++ .../com/squidex/api/types/CommentDto.java | 219 +++ .../api/types/CommentRuleActionDto.java | 126 ++ .../api/types/CommentRuleTriggerDto.java | 79 ++ .../com/squidex/api/types/CommentsDto.java | 205 +++ .../types/ComponentFieldPropertiesDto.java | 80 ++ .../types/ComponentsFieldPropertiesDto.java | 163 +++ .../types/ContentChangedRuleTriggerDto.java | 168 +++ .../com/squidex/api/types/ContentDto.java | 790 +++++++++++ .../com/squidex/api/types/ContentsDto.java | 244 ++++ .../com/squidex/api/types/ContributorDto.java | 246 ++++ .../squidex/api/types/ContributorsDto.java | 228 +++ .../api/types/ContributorsMetadata.java | 89 ++ .../api/types/CreateContentRuleActionDto.java | 180 +++ .../com/squidex/api/types/CreateRuleDto.java | 104 ++ .../squidex/api/types/CurrentStorageDto.java | 118 ++ .../types/DateTimeCalculatedDefaultValue.java | 21 + .../api/types/DateTimeFieldEditor.java | 21 + .../api/types/DateTimeFieldPropertiesDto.java | 245 ++++ .../api/types/DiscourseRuleActionDto.java | 297 ++++ .../java/com/squidex/api/types/EditorDto.java | 118 ++ .../api/types/ElasticSearchRuleActionDto.java | 272 ++++ .../squidex/api/types/EmailRuleActionDto.java | 335 +++++ .../java/com/squidex/api/types/ErrorDto.java | 273 ++++ .../squidex/api/types/EventConsumerDto.java | 314 +++++ .../squidex/api/types/EventConsumersDto.java | 120 ++ .../api/types/FastlyRuleActionDto.java | 118 ++ .../com/squidex/api/types/FeatureDto.java | 118 ++ .../com/squidex/api/types/FeaturesDto.java | 140 ++ .../java/com/squidex/api/types/FieldDto.java | 381 +++++ .../squidex/api/types/FieldPropertiesDto.java | 815 +++++++++++ .../squidex/api/types/FieldRuleAction.java | 23 + .../com/squidex/api/types/FieldRuleDto.java | 148 ++ .../types/GeolocationFieldPropertiesDto.java | 76 + .../squidex/api/types/HistoryEventDto.java | 243 ++++ .../java/com/squidex/api/types/IResource.java | 7 + .../squidex/api/types/IUpsertSchemaDto.java | 25 + .../com/squidex/api/types/ImageFormat.java | 33 + .../java/com/squidex/api/types/JobStatus.java | 25 + .../api/types/JsonFieldPropertiesDto.java | 79 ++ .../com/squidex/api/types/LanguageDto.java | 150 ++ .../com/squidex/api/types/LogDownloadDto.java | 79 ++ .../api/types/ManualRuleTriggerDto.java | 16 + .../api/types/MediumRuleActionDto.java | 305 ++++ .../com/squidex/api/types/NestedFieldDto.java | 302 ++++ .../api/types/NotificationRuleActionDto.java | 194 +++ .../squidex/api/types/NumberFieldEditor.java | 25 + .../api/types/NumberFieldPropertiesDto.java | 276 ++++ .../api/types/OpenSearchRuleActionDto.java | 272 ++++ .../com/squidex/api/types/PatternDto.java | 155 ++ .../com/squidex/api/types/PlanChangedDto.java | 79 ++ .../java/com/squidex/api/types/PlanDto.java | 459 ++++++ .../java/com/squidex/api/types/PlansDto.java | 280 ++++ .../squidex/api/types/PlansLockedReason.java | 25 + .../api/types/PrerenderRuleActionDto.java | 118 ++ .../java/com/squidex/api/types/QueryDto.java | 156 +++ .../com/squidex/api/types/QueryJsonDto.java | 249 ++++ .../api/types/ReferencesFieldEditor.java | 27 + .../types/ReferencesFieldPropertiesDto.java | 313 +++++ .../com/squidex/api/types/ReferralInfo.java | 126 ++ .../squidex/api/types/ReorderFieldsDto.java | 86 ++ .../com/squidex/api/types/ResizeMode.java | 31 + .../java/com/squidex/api/types/Resource.java | 87 ++ .../com/squidex/api/types/ResourceLink.java | 155 ++ .../com/squidex/api/types/ResourcesDto.java | 87 ++ .../com/squidex/api/types/RestoreJobDto.java | 234 ++++ .../java/com/squidex/api/types/RoleDto.java | 349 +++++ .../java/com/squidex/api/types/RolesDto.java | 120 ++ .../com/squidex/api/types/RuleActionDto.java | 1100 +++++++++++++++ .../java/com/squidex/api/types/RuleDto.java | 560 ++++++++ .../com/squidex/api/types/RuleElementDto.java | 332 +++++ .../api/types/RuleElementPropertyDto.java | 294 ++++ .../com/squidex/api/types/RuleEventDto.java | 413 ++++++ .../com/squidex/api/types/RuleEventsDto.java | 191 +++ .../squidex/api/types/RuleFieldEditor.java | 35 + .../com/squidex/api/types/RuleJobResult.java | 27 + .../com/squidex/api/types/RuleResult.java | 25 + .../com/squidex/api/types/RuleTriggerDto.java | 428 ++++++ .../java/com/squidex/api/types/RulesDto.java | 146 ++ .../com/squidex/api/types/ScheduleJobDto.java | 212 +++ .../types/SchemaChangedRuleTriggerDto.java | 79 ++ .../squidex/api/types/SchemaCondition.java | 112 ++ .../java/com/squidex/api/types/SchemaDto.java | 811 +++++++++++ .../api/types/SchemaPropertiesDto.java | 325 +++++ .../squidex/api/types/SchemaScriptsDto.java | 216 +++ .../com/squidex/api/types/SchemaType.java | 23 + .../com/squidex/api/types/SchemasDto.java | 120 ++ .../api/types/ScriptRuleActionDto.java | 89 ++ .../squidex/api/types/SearchResultDto.java | 204 +++ .../squidex/api/types/SearchResultType.java | 29 + .../api/types/SignalRRuleActionDto.java | 261 ++++ .../api/types/SimulatedRuleEventDto.java | 383 +++++ .../api/types/SimulatedRuleEventsDto.java | 191 +++ .../com/squidex/api/types/SkipReason.java | 39 + .../squidex/api/types/SlackRuleActionDto.java | 118 ++ .../java/com/squidex/api/types/SortNode.java | 122 ++ .../java/com/squidex/api/types/SortOrder.java | 21 + .../com/squidex/api/types/StatusInfoDto.java | 118 ++ .../api/types/StorageUsagePerDateDto.java | 148 ++ .../squidex/api/types/StringContentType.java | 23 + .../squidex/api/types/StringFieldEditor.java | 37 + .../api/types/StringFieldPropertiesDto.java | 603 ++++++++ .../squidex/api/types/TagsFieldEditor.java | 23 + .../api/types/TagsFieldPropertiesDto.java | 248 ++++ .../java/com/squidex/api/types/TeamDto.java | 310 ++++ .../squidex/api/types/TemplateDetailsDto.java | 141 ++ .../com/squidex/api/types/TemplateDto.java | 234 ++++ .../com/squidex/api/types/TemplatesDto.java | 120 ++ .../com/squidex/api/types/TranslationDto.java | 119 ++ .../api/types/TranslationResultCode.java | 29 + .../squidex/api/types/TweetRuleActionDto.java | 150 ++ .../api/types/TypesenseRuleActionDto.java | 225 +++ .../api/types/UiFieldPropertiesDto.java | 76 + .../com/squidex/api/types/UiSettingsDto.java | 118 ++ .../com/squidex/api/types/UpdateFieldDto.java | 82 ++ .../squidex/api/types/UpdateSettingDto.java | 82 ++ .../squidex/api/types/UpsertCommentDto.java | 126 ++ .../squidex/api/types/UpsertSchemaDto.java | 322 +++++ .../api/types/UpsertSchemaFieldDto.java | 311 +++++ .../api/types/UpsertSchemaNestedFieldDto.java | 228 +++ .../api/types/UsageRuleTriggerDto.java | 126 ++ .../java/com/squidex/api/types/UserDto.java | 290 ++++ .../com/squidex/api/types/UserProperty.java | 118 ++ .../java/com/squidex/api/types/UsersDto.java | 191 +++ .../com/squidex/api/types/WebhookMethod.java | 27 + .../api/types/WebhookRuleActionDto.java | 265 ++++ .../com/squidex/api/types/WorkflowDto.java | 302 ++++ .../squidex/api/types/WorkflowStepDto.java | 225 +++ .../api/types/WorkflowTransitionDto.java | 105 ++ .../com/squidex/api/types/WorkflowsDto.java | 151 ++ 276 files changed, 51637 insertions(+) create mode 100644 .fernignore create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 build.gradle create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 sample-app/build.gradle create mode 100644 sample-app/src/main/java/sample/App.java create mode 100644 settings.gradle create mode 100644 src/main/java/com/squidex/api/SquidexApiClient.java create mode 100644 src/main/java/com/squidex/api/SquidexApiClientBuilder.java create mode 100644 src/main/java/com/squidex/api/core/ClientOptions.java create mode 100644 src/main/java/com/squidex/api/core/Environment.java create mode 100644 src/main/java/com/squidex/api/core/ObjectMappers.java create mode 100644 src/main/java/com/squidex/api/core/RequestOptions.java create mode 100644 src/main/java/com/squidex/api/core/Suppliers.java create mode 100644 src/main/java/com/squidex/api/resources/apps/AppsClient.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/AddLanguageDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/AddRoleDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/AddWorkflowDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/AppsUploadImageRequest.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/CreateAppDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/CreateClientDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/TransferToTeamDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateAppDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateAppSettingsDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateAssetScriptsDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateClientDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateLanguageDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateRoleDto.java create mode 100644 src/main/java/com/squidex/api/resources/apps/requests/UpdateWorkflowDto.java create mode 100644 src/main/java/com/squidex/api/resources/assets/AssetsClient.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AnnotateAssetDto.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsDeleteAssetRequest.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentBySlugRequest.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentRequest.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetFoldersRequest.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsPostRequest.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsRequest.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsPostAssetRequest.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsPostUpsertAssetRequest.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/AssetsPutAssetContentRequest.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/BulkUpdateAssetsDto.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/CreateAssetFolderDto.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/MoveAssetDto.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/MoveAssetFolderDto.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/RenameAssetFolderDto.java create mode 100644 src/main/java/com/squidex/api/resources/assets/requests/RenameTagDto.java create mode 100644 src/main/java/com/squidex/api/resources/backups/BackupsClient.java create mode 100644 src/main/java/com/squidex/api/resources/backups/requests/BackupsGetBackupContentV2Request.java create mode 100644 src/main/java/com/squidex/api/resources/backups/requests/RestoreRequestDto.java create mode 100644 src/main/java/com/squidex/api/resources/comments/CommentsClient.java create mode 100644 src/main/java/com/squidex/api/resources/comments/requests/CommentsGetCommentsRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/ContentsClient.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/BulkUpdateContentsDto.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ChangeStatusDto.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsCreateDraftRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentStatusRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteVersionRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentVersionRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsPostRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencesRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencingRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsPatchContentRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsPostContentRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsPostUpsertContentRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ContentsPutContentRequest.java create mode 100644 src/main/java/com/squidex/api/resources/contents/requests/ImportContentsDto.java create mode 100644 src/main/java/com/squidex/api/resources/diagnostics/DiagnosticsClient.java create mode 100644 src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java create mode 100644 src/main/java/com/squidex/api/resources/history/HistoryClient.java create mode 100644 src/main/java/com/squidex/api/resources/history/requests/HistoryGetAppHistoryRequest.java create mode 100644 src/main/java/com/squidex/api/resources/history/requests/HistoryGetTeamHistoryRequest.java create mode 100644 src/main/java/com/squidex/api/resources/languages/LanguagesClient.java create mode 100644 src/main/java/com/squidex/api/resources/news/NewsClient.java create mode 100644 src/main/java/com/squidex/api/resources/news/requests/NewsGetNewsRequest.java create mode 100644 src/main/java/com/squidex/api/resources/notifications/NotificationsClient.java create mode 100644 src/main/java/com/squidex/api/resources/notifications/requests/NotificationsGetNotificationsRequest.java create mode 100644 src/main/java/com/squidex/api/resources/ping/PingClient.java create mode 100644 src/main/java/com/squidex/api/resources/plans/PlansClient.java create mode 100644 src/main/java/com/squidex/api/resources/rules/RulesClient.java create mode 100644 src/main/java/com/squidex/api/resources/rules/requests/RulesGetEventsRequest.java create mode 100644 src/main/java/com/squidex/api/resources/rules/requests/RulesPutRuleRunRequest.java create mode 100644 src/main/java/com/squidex/api/resources/rules/requests/UpdateRuleDto.java create mode 100644 src/main/java/com/squidex/api/resources/schemas/SchemasClient.java create mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/ChangeCategoryDto.java create mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/ConfigureFieldRulesDto.java create mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/ConfigureUiFieldsDto.java create mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/CreateSchemaDto.java create mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/SynchronizeSchemaDto.java create mode 100644 src/main/java/com/squidex/api/resources/schemas/requests/UpdateSchemaDto.java create mode 100644 src/main/java/com/squidex/api/resources/search/SearchClient.java create mode 100644 src/main/java/com/squidex/api/resources/search/requests/SearchGetSearchResultsRequest.java create mode 100644 src/main/java/com/squidex/api/resources/statistics/StatisticsClient.java create mode 100644 src/main/java/com/squidex/api/resources/teams/TeamsClient.java create mode 100644 src/main/java/com/squidex/api/resources/teams/requests/CreateTeamDto.java create mode 100644 src/main/java/com/squidex/api/resources/teams/requests/UpdateTeamDto.java create mode 100644 src/main/java/com/squidex/api/resources/templates/TemplatesClient.java create mode 100644 src/main/java/com/squidex/api/resources/translations/TranslationsClient.java create mode 100644 src/main/java/com/squidex/api/resources/translations/requests/TranslateDto.java create mode 100644 src/main/java/com/squidex/api/resources/usermanagement/UserManagementClient.java create mode 100644 src/main/java/com/squidex/api/resources/usermanagement/requests/CreateUserDto.java create mode 100644 src/main/java/com/squidex/api/resources/usermanagement/requests/UpdateUserDto.java create mode 100644 src/main/java/com/squidex/api/resources/usermanagement/requests/UserManagementGetUsersRequest.java create mode 100644 src/main/java/com/squidex/api/resources/users/UsersClient.java create mode 100644 src/main/java/com/squidex/api/resources/users/requests/UsersGetUsersRequest.java create mode 100644 src/main/java/com/squidex/api/types/ActionTypeEnum.java create mode 100644 src/main/java/com/squidex/api/types/AddFieldDto.java create mode 100644 src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/AllContentsByPostDto.java create mode 100644 src/main/java/com/squidex/api/types/AppDto.java create mode 100644 src/main/java/com/squidex/api/types/AppLanguageDto.java create mode 100644 src/main/java/com/squidex/api/types/AppLanguagesDto.java create mode 100644 src/main/java/com/squidex/api/types/AppSettingsDto.java create mode 100644 src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java create mode 100644 src/main/java/com/squidex/api/types/AssetDto.java create mode 100644 src/main/java/com/squidex/api/types/AssetFolderDto.java create mode 100644 src/main/java/com/squidex/api/types/AssetFolderScope.java create mode 100644 src/main/java/com/squidex/api/types/AssetFoldersDto.java create mode 100644 src/main/java/com/squidex/api/types/AssetMeta.java create mode 100644 src/main/java/com/squidex/api/types/AssetPreviewMode.java create mode 100644 src/main/java/com/squidex/api/types/AssetScriptsDto.java create mode 100644 src/main/java/com/squidex/api/types/AssetType.java create mode 100644 src/main/java/com/squidex/api/types/AssetsDto.java create mode 100644 src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/AssignContributorDto.java create mode 100644 src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/BackupJobDto.java create mode 100644 src/main/java/com/squidex/api/types/BackupJobsDto.java create mode 100644 src/main/java/com/squidex/api/types/BooleanFieldEditor.java create mode 100644 src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/BulkResultDto.java create mode 100644 src/main/java/com/squidex/api/types/BulkUpdateAssetType.java create mode 100644 src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java create mode 100644 src/main/java/com/squidex/api/types/BulkUpdateContentType.java create mode 100644 src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java create mode 100644 src/main/java/com/squidex/api/types/CallsUsageDtoDto.java create mode 100644 src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java create mode 100644 src/main/java/com/squidex/api/types/ChangePlanDto.java create mode 100644 src/main/java/com/squidex/api/types/ClientDto.java create mode 100644 src/main/java/com/squidex/api/types/ClientsDto.java create mode 100644 src/main/java/com/squidex/api/types/CommentDto.java create mode 100644 src/main/java/com/squidex/api/types/CommentRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java create mode 100644 src/main/java/com/squidex/api/types/CommentsDto.java create mode 100644 src/main/java/com/squidex/api/types/ComponentFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java create mode 100644 src/main/java/com/squidex/api/types/ContentDto.java create mode 100644 src/main/java/com/squidex/api/types/ContentsDto.java create mode 100644 src/main/java/com/squidex/api/types/ContributorDto.java create mode 100644 src/main/java/com/squidex/api/types/ContributorsDto.java create mode 100644 src/main/java/com/squidex/api/types/ContributorsMetadata.java create mode 100644 src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/CreateRuleDto.java create mode 100644 src/main/java/com/squidex/api/types/CurrentStorageDto.java create mode 100644 src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java create mode 100644 src/main/java/com/squidex/api/types/DateTimeFieldEditor.java create mode 100644 src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/EditorDto.java create mode 100644 src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/EmailRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/ErrorDto.java create mode 100644 src/main/java/com/squidex/api/types/EventConsumerDto.java create mode 100644 src/main/java/com/squidex/api/types/EventConsumersDto.java create mode 100644 src/main/java/com/squidex/api/types/FastlyRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/FeatureDto.java create mode 100644 src/main/java/com/squidex/api/types/FeaturesDto.java create mode 100644 src/main/java/com/squidex/api/types/FieldDto.java create mode 100644 src/main/java/com/squidex/api/types/FieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/FieldRuleAction.java create mode 100644 src/main/java/com/squidex/api/types/FieldRuleDto.java create mode 100644 src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/HistoryEventDto.java create mode 100644 src/main/java/com/squidex/api/types/IResource.java create mode 100644 src/main/java/com/squidex/api/types/IUpsertSchemaDto.java create mode 100644 src/main/java/com/squidex/api/types/ImageFormat.java create mode 100644 src/main/java/com/squidex/api/types/JobStatus.java create mode 100644 src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/LanguageDto.java create mode 100644 src/main/java/com/squidex/api/types/LogDownloadDto.java create mode 100644 src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java create mode 100644 src/main/java/com/squidex/api/types/MediumRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/NestedFieldDto.java create mode 100644 src/main/java/com/squidex/api/types/NotificationRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/NumberFieldEditor.java create mode 100644 src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/PatternDto.java create mode 100644 src/main/java/com/squidex/api/types/PlanChangedDto.java create mode 100644 src/main/java/com/squidex/api/types/PlanDto.java create mode 100644 src/main/java/com/squidex/api/types/PlansDto.java create mode 100644 src/main/java/com/squidex/api/types/PlansLockedReason.java create mode 100644 src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/QueryDto.java create mode 100644 src/main/java/com/squidex/api/types/QueryJsonDto.java create mode 100644 src/main/java/com/squidex/api/types/ReferencesFieldEditor.java create mode 100644 src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/ReferralInfo.java create mode 100644 src/main/java/com/squidex/api/types/ReorderFieldsDto.java create mode 100644 src/main/java/com/squidex/api/types/ResizeMode.java create mode 100644 src/main/java/com/squidex/api/types/Resource.java create mode 100644 src/main/java/com/squidex/api/types/ResourceLink.java create mode 100644 src/main/java/com/squidex/api/types/ResourcesDto.java create mode 100644 src/main/java/com/squidex/api/types/RestoreJobDto.java create mode 100644 src/main/java/com/squidex/api/types/RoleDto.java create mode 100644 src/main/java/com/squidex/api/types/RolesDto.java create mode 100644 src/main/java/com/squidex/api/types/RuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/RuleDto.java create mode 100644 src/main/java/com/squidex/api/types/RuleElementDto.java create mode 100644 src/main/java/com/squidex/api/types/RuleElementPropertyDto.java create mode 100644 src/main/java/com/squidex/api/types/RuleEventDto.java create mode 100644 src/main/java/com/squidex/api/types/RuleEventsDto.java create mode 100644 src/main/java/com/squidex/api/types/RuleFieldEditor.java create mode 100644 src/main/java/com/squidex/api/types/RuleJobResult.java create mode 100644 src/main/java/com/squidex/api/types/RuleResult.java create mode 100644 src/main/java/com/squidex/api/types/RuleTriggerDto.java create mode 100644 src/main/java/com/squidex/api/types/RulesDto.java create mode 100644 src/main/java/com/squidex/api/types/ScheduleJobDto.java create mode 100644 src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java create mode 100644 src/main/java/com/squidex/api/types/SchemaCondition.java create mode 100644 src/main/java/com/squidex/api/types/SchemaDto.java create mode 100644 src/main/java/com/squidex/api/types/SchemaPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/SchemaScriptsDto.java create mode 100644 src/main/java/com/squidex/api/types/SchemaType.java create mode 100644 src/main/java/com/squidex/api/types/SchemasDto.java create mode 100644 src/main/java/com/squidex/api/types/ScriptRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/SearchResultDto.java create mode 100644 src/main/java/com/squidex/api/types/SearchResultType.java create mode 100644 src/main/java/com/squidex/api/types/SignalRRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java create mode 100644 src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java create mode 100644 src/main/java/com/squidex/api/types/SkipReason.java create mode 100644 src/main/java/com/squidex/api/types/SlackRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/SortNode.java create mode 100644 src/main/java/com/squidex/api/types/SortOrder.java create mode 100644 src/main/java/com/squidex/api/types/StatusInfoDto.java create mode 100644 src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java create mode 100644 src/main/java/com/squidex/api/types/StringContentType.java create mode 100644 src/main/java/com/squidex/api/types/StringFieldEditor.java create mode 100644 src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/TagsFieldEditor.java create mode 100644 src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/TeamDto.java create mode 100644 src/main/java/com/squidex/api/types/TemplateDetailsDto.java create mode 100644 src/main/java/com/squidex/api/types/TemplateDto.java create mode 100644 src/main/java/com/squidex/api/types/TemplatesDto.java create mode 100644 src/main/java/com/squidex/api/types/TranslationDto.java create mode 100644 src/main/java/com/squidex/api/types/TranslationResultCode.java create mode 100644 src/main/java/com/squidex/api/types/TweetRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java create mode 100644 src/main/java/com/squidex/api/types/UiSettingsDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateFieldDto.java create mode 100644 src/main/java/com/squidex/api/types/UpdateSettingDto.java create mode 100644 src/main/java/com/squidex/api/types/UpsertCommentDto.java create mode 100644 src/main/java/com/squidex/api/types/UpsertSchemaDto.java create mode 100644 src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java create mode 100644 src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java create mode 100644 src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java create mode 100644 src/main/java/com/squidex/api/types/UserDto.java create mode 100644 src/main/java/com/squidex/api/types/UserProperty.java create mode 100644 src/main/java/com/squidex/api/types/UsersDto.java create mode 100644 src/main/java/com/squidex/api/types/WebhookMethod.java create mode 100644 src/main/java/com/squidex/api/types/WebhookRuleActionDto.java create mode 100644 src/main/java/com/squidex/api/types/WorkflowDto.java create mode 100644 src/main/java/com/squidex/api/types/WorkflowStepDto.java create mode 100644 src/main/java/com/squidex/api/types/WorkflowTransitionDto.java create mode 100644 src/main/java/com/squidex/api/types/WorkflowsDto.java diff --git a/.fernignore b/.fernignore new file mode 100644 index 0000000..084a8eb --- /dev/null +++ b/.fernignore @@ -0,0 +1 @@ +# Specify files that shouldn't be modified by Fern diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f7c5f89 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,45 @@ +name: ci + +on: [push] + +jobs: + 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: Compile + run: ./gradlew compileJava + + publish: + needs: [ compile ] + 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 + run: | + ./gradlew publish + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + MAVEN_PUBLISH_REGISTRY_URL: "https://s01.oss.sonatype.org/content/repositories/releases/" \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d4199ab --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +*.class +.project +.gradle +? +.classpath +.checkstyle +.settings +.node +build + +# IntelliJ +*.iml +*.ipr +*.iws +.idea/ +out/ + +# Eclipse/IntelliJ APT +generated_src/ +generated_testSrc/ +generated/ + +bin +build \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..35632d8 --- /dev/null +++ b/build.gradle @@ -0,0 +1,51 @@ +plugins { + id 'java-library' + id 'maven-publish' + id 'com.diffplug.spotless' version '6.11.0' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +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' +} + +spotless { + java { + palantirJavaFormat() + } +} + +java { + withSourcesJar() + withJavadocJar() +} + +publishing { + publications { + maven(MavenPublication) { + groupId = 'io.squidex' + artifactId = 'squidex' + version = '0.0.5' + from components.java + } + } + repositories { + maven { + url "$System.env.MAVEN_PUBLISH_REGISTRY_URL" + credentials { + username "$System.env.MAVEN_USERNAME" + password "$System.env.MAVEN_PASSWORD" + } + } + } +} + diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..41d9927a4d4fb3f96a785543079b8df6723c946b GIT binary patch literal 59821 zcma&NV|1p`(k7gaZQHhOJ9%QKV?D8LCmq{1JGRYE(y=?XJw0>InKkE~^UnAEs2gk5 zUVGPCwX3dOb!}xiFmPB95NK!+5D<~S0s;d1zn&lrfAn7 zC?Nb-LFlib|DTEqB8oDS5&$(u1<5;wsY!V`2F7^=IR@I9so5q~=3i_(hqqG<9SbL8Q(LqDrz+aNtGYWGJ2;p*{a-^;C>BfGzkz_@fPsK8{pTT~_VzB$E`P@> z7+V1WF2+tSW=`ZRj3&0m&d#x_lfXq`bb-Y-SC-O{dkN2EVM7@!n|{s+2=xSEMtW7( zz~A!cBpDMpQu{FP=y;sO4Le}Z)I$wuFwpugEY3vEGfVAHGqZ-<{vaMv-5_^uO%a{n zE_Zw46^M|0*dZ`;t%^3C19hr=8FvVdDp1>SY>KvG!UfD`O_@weQH~;~W=fXK_!Yc> z`EY^PDJ&C&7LC;CgQJeXH2 zjfM}2(1i5Syj)Jj4EaRyiIl#@&lC5xD{8hS4Wko7>J)6AYPC-(ROpVE-;|Z&u(o=X z2j!*>XJ|>Lo+8T?PQm;SH_St1wxQPz)b)Z^C(KDEN$|-6{A>P7r4J1R-=R7|FX*@! zmA{Ja?XE;AvisJy6;cr9Q5ovphdXR{gE_7EF`ji;n|RokAJ30Zo5;|v!xtJr+}qbW zY!NI6_Wk#6pWFX~t$rAUWi?bAOv-oL6N#1>C~S|7_e4 zF}b9(&a*gHk+4@J26&xpiWYf2HN>P;4p|TD4f586umA2t@cO1=Fx+qd@1Ae#Le>{-?m!PnbuF->g3u)7(n^llJfVI%Q2rMvetfV5 z6g|sGf}pV)3_`$QiKQnqQ<&ghOWz4_{`rA1+7*M0X{y(+?$|{n zs;FEW>YzUWg{sO*+D2l6&qd+$JJP_1Tm;To<@ZE%5iug8vCN3yH{!6u5Hm=#3HJ6J zmS(4nG@PI^7l6AW+cWAo9sFmE`VRcM`sP7X$^vQY(NBqBYU8B|n-PrZdNv8?K?kUTT3|IE`-A8V*eEM2=u*kDhhKsmVPWGns z8QvBk=BPjvu!QLtlF0qW(k+4i+?H&L*qf262G#fks9}D5-L{yiaD10~a;-j!p!>5K zl@Lh+(9D{ePo_S4F&QXv|q_yT`GIPEWNHDD8KEcF*2DdZD;=J6u z|8ICSoT~5Wd!>g%2ovFh`!lTZhAwpIbtchDc{$N%<~e$E<7GWsD42UdJh1fD($89f2on`W`9XZJmr*7lRjAA8K0!(t8-u>2H*xn5cy1EG{J;w;Q-H8Yyx+WW(qoZZM7p(KQx^2-yI6Sw?k<=lVOVwYn zY*eDm%~=|`c{tUupZ^oNwIr!o9T;H3Fr|>NE#By8SvHb&#;cyBmY1LwdXqZwi;qn8 zK+&z{{95(SOPXAl%EdJ3jC5yV^|^}nOT@M0)|$iOcq8G{#*OH7=DlfOb; z#tRO#tcrc*yQB5!{l5AF3(U4>e}nEvkoE_XCX=a3&A6Atwnr&`r&f2d%lDr8f?hBB zr1dKNypE$CFbT9I?n){q<1zHmY>C=5>9_phi79pLJG)f=#dKdQ7We8emMjwR*qIMF zE_P-T*$hX#FUa%bjv4Vm=;oxxv`B*`weqUn}K=^TXjJG=UxdFMSj-QV6fu~;- z|IsUq`#|73M%Yn;VHJUbt<0UHRzbaF{X@76=8*-IRx~bYgSf*H(t?KH=?D@wk*E{| z2@U%jKlmf~C^YxD=|&H?(g~R9-jzEb^y|N5d`p#2-@?BUcHys({pUz4Zto7XwKq2X zSB~|KQGgv_Mh@M!*{nl~2~VV_te&E7K39|WYH zCxfd|v_4!h$Ps2@atm+gj14Ru)DhivY&(e_`eA)!O1>nkGq|F-#-6oo5|XKEfF4hR z%{U%ar7Z8~B!foCd_VRHr;Z1c0Et~y8>ZyVVo9>LLi(qb^bxVkbq-Jq9IF7!FT`(- zTMrf6I*|SIznJLRtlP)_7tQ>J`Um>@pP=TSfaPB(bto$G1C zx#z0$=zNpP-~R);kM4O)9Mqn@5Myv5MmmXOJln312kq#_94)bpSd%fcEo7cD#&|<` zrcal$(1Xv(nDEquG#`{&9Ci~W)-zd_HbH-@2F6+|a4v}P!w!Q*h$#Zu+EcZeY>u&?hn#DCfC zVuye5@Ygr+T)0O2R1*Hvlt>%rez)P2wS}N-i{~IQItGZkp&aeY^;>^m7JT|O^{`78 z$KaK0quwcajja;LU%N|{`2o&QH@u%jtH+j!haGj;*ZCR*`UgOXWE>qpXqHc?g&vA& zt-?_g8k%ZS|D;()0Lf!>7KzTSo-8hUh%OA~i76HKRLudaNiwo*E9HxmzN4y>YpZNO zUE%Q|H_R_UmX=*f=2g=xyP)l-DP}kB@PX|(Ye$NOGN{h+fI6HVw`~Cd0cKqO;s6aiYLy7sl~%gs`~XaL z^KrZ9QeRA{O*#iNmB7_P!=*^pZiJ5O@iE&X2UmUCPz!)`2G3)5;H?d~3#P|)O(OQ_ zua+ZzwWGkWflk4j^Lb=x56M75_p9M*Q50#(+!aT01y80x#rs9##!;b-BH?2Fu&vx} za%4!~GAEDsB54X9wCF~juV@aU}fp_(a<`Ig0Pip8IjpRe#BR?-niYcz@jI+QY zBU9!8dAfq@%p;FX)X=E7?B=qJJNXlJ&7FBsz;4&|*z{^kEE!XbA)(G_O6I9GVzMAF z8)+Un(6od`W7O!!M=0Z)AJuNyN8q>jNaOdC-zAZ31$Iq%{c_SYZe+(~_R`a@ zOFiE*&*o5XG;~UjsuW*ja-0}}rJdd@^VnQD!z2O~+k-OSF%?hqcFPa4e{mV1UOY#J zTf!PM=KMNAzbf(+|AL%K~$ahX0Ol zbAxKu3;v#P{Qia{_WzHl`!@!8c#62XSegM{tW1nu?Ee{sQq(t{0TSq67YfG;KrZ$n z*$S-+R2G?aa*6kRiTvVxqgUhJ{ASSgtepG3hb<3hlM|r>Hr~v_DQ>|Nc%&)r0A9go z&F3Ao!PWKVq~aWOzLQIy&R*xo>}{UTr}?`)KS&2$3NR@a+>+hqK*6r6Uu-H};ZG^| zfq_Vl%YE1*uGwtJ>H*Y(Q9E6kOfLJRlrDNv`N;jnag&f<4#UErM0ECf$8DASxMFF& zK=mZgu)xBz6lXJ~WZR7OYw;4&?v3Kk-QTs;v1r%XhgzSWVf|`Sre2XGdJb}l1!a~z zP92YjnfI7OnF@4~g*LF>G9IZ5c+tifpcm6#m)+BmnZ1kz+pM8iUhwag`_gqr(bnpy zl-noA2L@2+?*7`ZO{P7&UL~ahldjl`r3=HIdo~Hq#d+&Q;)LHZ4&5zuDNug@9-uk; z<2&m#0Um`s=B}_}9s&70Tv_~Va@WJ$n~s`7tVxi^s&_nPI0`QX=JnItlOu*Tn;T@> zXsVNAHd&K?*u~a@u8MWX17VaWuE0=6B93P2IQ{S$-WmT+Yp!9eA>@n~=s>?uDQ4*X zC(SxlKap@0R^z1p9C(VKM>nX8-|84nvIQJ-;9ei0qs{}X>?f%&E#%-)Bpv_p;s4R+ z;PMpG5*rvN&l;i{^~&wKnEhT!S!LQ>udPzta#Hc9)S8EUHK=%x+z@iq!O{)*XM}aI zBJE)vokFFXTeG<2Pq}5Na+kKnu?Ch|YoxdPb&Z{07nq!yzj0=xjzZj@3XvwLF0}Pa zn;x^HW504NNfLY~w!}5>`z=e{nzGB>t4ntE>R}r7*hJF3OoEx}&6LvZz4``m{AZxC zz6V+^73YbuY>6i9ulu)2`ozP(XBY5n$!kiAE_Vf4}Ih)tlOjgF3HW|DF+q-jI_0p%6Voc^e;g28* z;Sr4X{n(X7eEnACWRGNsHqQ_OfWhAHwnSQ87@PvPcpa!xr9`9+{QRn;bh^jgO8q@v zLekO@-cdc&eOKsvXs-eMCH8Y{*~3Iy!+CANy+(WXYS&6XB$&1+tB?!qcL@@) zS7XQ|5=o1fr8yM7r1AyAD~c@Mo`^i~hjx{N17%pDX?j@2bdBEbxY}YZxz!h#)q^1x zpc_RnoC3`V?L|G2R1QbR6pI{Am?yW?4Gy`G-xBYfebXvZ=(nTD7u?OEw>;vQICdPJBmi~;xhVV zisVvnE!bxI5|@IIlDRolo_^tc1{m)XTbIX^<{TQfsUA1Wv(KjJED^nj`r!JjEA%MaEGqPB z9YVt~ol3%e`PaqjZt&-)Fl^NeGmZ)nbL;92cOeLM2H*r-zA@d->H5T_8_;Jut0Q_G zBM2((-VHy2&eNkztIpHk&1H3M3@&wvvU9+$RO%fSEa_d5-qZ!<`-5?L9lQ1@AEpo* z3}Zz~R6&^i9KfRM8WGc6fTFD%PGdruE}`X$tP_*A)_7(uI5{k|LYc-WY*%GJ6JMmw zNBT%^E#IhekpA(i zcB$!EB}#>{^=G%rQ~2;gbObT9PQ{~aVx_W6?(j@)S$&Ja1s}aLT%A*mP}NiG5G93- z_DaRGP77PzLv0s32{UFm##C2LsU!w{vHdKTM1X)}W%OyZ&{3d^2Zu-zw?fT=+zi*q z^fu6CXQ!i?=ljsqSUzw>g#PMk>(^#ejrYp(C)7+@Z1=Mw$Rw!l8c9}+$Uz;9NUO(kCd#A1DX4Lbis0k; z?~pO(;@I6Ajp}PL;&`3+;OVkr3A^dQ(j?`by@A!qQam@_5(w6fG>PvhO`#P(y~2ue zW1BH_GqUY&>PggMhhi@8kAY;XWmj>y1M@c`0v+l~l0&~Kd8ZSg5#46wTLPo*Aom-5 z>qRXyWl}Yda=e@hJ%`x=?I42(B0lRiR~w>n6p8SHN~B6Y>W(MOxLpv>aB)E<1oEcw z%X;#DJpeDaD;CJRLX%u!t23F|cv0ZaE183LXxMq*uWn)cD_ zp!@i5zsmcxb!5uhp^@>U;K>$B|8U@3$65CmhuLlZ2(lF#hHq-<<+7ZN9m3-hFAPgA zKi;jMBa*59ficc#TRbH_l`2r>z(Bm_XEY}rAwyp~c8L>{A<0@Q)j*uXns^q5z~>KI z)43=nMhcU1ZaF;CaBo>hl6;@(2#9yXZ7_BwS4u>gN%SBS<;j{{+p}tbD8y_DFu1#0 zx)h&?`_`=ti_6L>VDH3>PPAc@?wg=Omdoip5j-2{$T;E9m)o2noyFW$5dXb{9CZ?c z);zf3U526r3Fl+{82!z)aHkZV6GM@%OKJB5mS~JcDjieFaVn}}M5rtPnHQVw0Stn- zEHs_gqfT8(0b-5ZCk1%1{QQaY3%b>wU z7lyE?lYGuPmB6jnMI6s$1uxN{Tf_n7H~nKu+h7=%60WK-C&kEIq_d4`wU(*~rJsW< zo^D$-(b0~uNVgC+$J3MUK)(>6*k?92mLgpod{Pd?{os+yHr&t+9ZgM*9;dCQBzE!V zk6e6)9U6Bq$^_`E1xd}d;5O8^6?@bK>QB&7l{vAy^P6FOEO^l7wK4K=lLA45gQ3$X z=$N{GR1{cxO)j;ZxKI*1kZIT9p>%FhoFbRK;M(m&bL?SaN zzkZS9xMf={o@gpG%wE857u@9dq>UKvbaM1SNtMA9EFOp7$BjJQVkIm$wU?-yOOs{i z1^(E(WwZZG{_#aIzfpGc@g5-AtK^?Q&vY#CtVpfLbW?g0{BEX4Vlk(`AO1{-D@31J zce}#=$?Gq+FZG-SD^z)-;wQg9`qEO}Dvo+S9*PUB*JcU)@S;UVIpN7rOqXmEIerWo zP_lk!@RQvyds&zF$Rt>N#_=!?5{XI`Dbo0<@>fIVgcU*9Y+ z)}K(Y&fdgve3ruT{WCNs$XtParmvV;rjr&R(V&_#?ob1LzO0RW3?8_kSw)bjom#0; zeNllfz(HlOJw012B}rgCUF5o|Xp#HLC~of%lg+!pr(g^n;wCX@Yk~SQOss!j9f(KL zDiI1h#k{po=Irl)8N*KU*6*n)A8&i9Wf#7;HUR^5*6+Bzh;I*1cICa|`&`e{pgrdc zs}ita0AXb$c6{tu&hxmT0faMG0GFc)unG8tssRJd%&?^62!_h_kn^HU_kBgp$bSew zqu)M3jTn;)tipv9Wt4Ll#1bmO2n?^)t^ZPxjveoOuK89$oy4(8Ujw{nd*Rs*<+xFi z{k*9v%sl?wS{aBSMMWdazhs0#gX9Has=pi?DhG&_0|cIyRG7c`OBiVG6W#JjYf7-n zIQU*Jc+SYnI8oG^Q8So9SP_-w;Y00$p5+LZ{l+81>v7|qa#Cn->312n=YQd$PaVz8 zL*s?ZU*t-RxoR~4I7e^c!8TA4g>w@R5F4JnEWJpy>|m5la2b#F4d*uoz!m=i1;`L` zB(f>1fAd~;*wf%GEbE8`EA>IO9o6TdgbIC%+en!}(C5PGYqS0{pa?PD)5?ds=j9{w za9^@WBXMZ|D&(yfc~)tnrDd#*;u;0?8=lh4%b-lFPR3ItwVJp};HMdEw#SXg>f-zU zEiaj5H=jzRSy(sWVd%hnLZE{SUj~$xk&TfheSch#23)YTcjrB+IVe0jJqsdz__n{- zC~7L`DG}-Dgrinzf7Jr)e&^tdQ}8v7F+~eF*<`~Vph=MIB|YxNEtLo1jXt#9#UG5` zQ$OSk`u!US+Z!=>dGL>%i#uV<5*F?pivBH@@1idFrzVAzttp5~>Y?D0LV;8Yv`wAa{hewVjlhhBM z_mJhU9yWz9Jexg@G~dq6EW5^nDXe(sU^5{}qbd0*yW2Xq6G37f8{{X&Z>G~dUGDFu zgmsDDZZ5ZmtiBw58CERFPrEG>*)*`_B75!MDsOoK`T1aJ4GZ1avI?Z3OX|Hg?P(xy zSPgO$alKZuXd=pHP6UZy0G>#BFm(np+dekv0l6gd=36FijlT8^kI5; zw?Z*FPsibF2d9T$_L@uX9iw*>y_w9HSh8c=Rm}f>%W+8OS=Hj_wsH-^actull3c@!z@R4NQ4qpytnwMaY z)>!;FUeY?h2N9tD(othc7Q=(dF zZAX&Y1ac1~0n(z}!9{J2kPPnru1?qteJPvA2m!@3Zh%+f1VQt~@leK^$&ZudOpS!+ zw#L0usf!?Df1tB?9=zPZ@q2sG!A#9 zKZL`2cs%|Jf}wG=_rJkwh|5Idb;&}z)JQuMVCZSH9kkG%zvQO01wBN)c4Q`*xnto3 zi7TscilQ>t_SLij{@Fepen*a(`upw#RJAx|JYYXvP1v8f)dTHv9pc3ZUwx!0tOH?c z^Hn=gfjUyo!;+3vZhxNE?LJgP`qYJ`J)umMXT@b z{nU(a^xFfofcxfHN-!Jn*{Dp5NZ&i9#9r{)s^lUFCzs5LQL9~HgxvmU#W|iNs0<3O z%Y2FEgvts4t({%lfX1uJ$w{JwfpV|HsO{ZDl2|Q$-Q?UJd`@SLBsMKGjFFrJ(s?t^ z2Llf`deAe@YaGJf)k2e&ryg*m8R|pcjct@rOXa=64#V9!sp=6tC#~QvYh&M~zmJ;% zr*A}V)Ka^3JE!1pcF5G}b&jdrt;bM^+J;G^#R08x@{|ZWy|547&L|k6)HLG|sN<~o z?y`%kbfRN_vc}pwS!Zr}*q6DG7;be0qmxn)eOcD%s3Wk`=@GM>U3ojhAW&WRppi0e zudTj{ufwO~H7izZJmLJD3uPHtjAJvo6H=)&SJ_2%qRRECN#HEU_RGa(Pefk*HIvOH zW7{=Tt(Q(LZ6&WX_Z9vpen}jqge|wCCaLYpiw@f_%9+-!l{kYi&gT@Cj#D*&rz1%e z@*b1W13bN8^j7IpAi$>`_0c!aVzLe*01DY-AcvwE;kW}=Z{3RJLR|O~^iOS(dNEnL zJJ?Dv^ab++s2v!4Oa_WFDLc4fMspglkh;+vzg)4;LS{%CR*>VwyP4>1Tly+!fA-k? z6$bg!*>wKtg!qGO6GQ=cAmM_RC&hKg$~(m2LdP{{*M+*OVf07P$OHp*4SSj9H;)1p z^b1_4p4@C;8G7cBCB6XC{i@vTB3#55iRBZiml^jc4sYnepCKUD+~k}TiuA;HWC6V3 zV{L5uUAU9CdoU+qsFszEwp;@d^!6XnX~KI|!o|=r?qhs`(-Y{GfO4^d6?8BC0xonf zKtZc1C@dNu$~+p#m%JW*J7alfz^$x`U~)1{c7svkIgQ3~RK2LZ5;2TAx=H<4AjC8{ z;)}8OfkZy7pSzVsdX|wzLe=SLg$W1+`Isf=o&}npxWdVR(i8Rr{uzE516a@28VhVr zVgZ3L&X(Q}J0R2{V(}bbNwCDD5K)<5h9CLM*~!xmGTl{Mq$@;~+|U*O#nc^oHnFOy z9Kz%AS*=iTBY_bSZAAY6wXCI?EaE>8^}WF@|}O@I#i69ljjWQPBJVk zQ_rt#J56_wGXiyItvAShJpLEMtW_)V5JZAuK#BAp6bV3K;IkS zK0AL(3ia99!vUPL#j>?<>mA~Q!mC@F-9I$9Z!96ZCSJO8FDz1SP3gF~m`1c#y!efq8QN}eHd+BHwtm%M5586jlU8&e!CmOC z^N_{YV$1`II$~cTxt*dV{-yp61nUuX5z?N8GNBuZZR}Uy_Y3_~@Y3db#~-&0TX644OuG^D3w_`?Yci{gTaPWST8`LdE)HK5OYv>a=6B%R zw|}>ngvSTE1rh`#1Rey0?LXTq;bCIy>TKm^CTV4BCSqdpx1pzC3^ca*S3fUBbKMzF z6X%OSdtt50)yJw*V_HE`hnBA)1yVN3Ruq3l@lY;%Bu+Q&hYLf_Z@fCUVQY-h4M3)- zE_G|moU)Ne0TMjhg?tscN7#ME6!Rb+y#Kd&-`!9gZ06o3I-VX1d4b1O=bpRG-tDK0 zSEa9y46s7QI%LmhbU3P`RO?w#FDM(}k8T`&>OCU3xD=s5N7}w$GntXF;?jdVfg5w9OR8VPxp5{uw zD+_;Gb}@7Vo_d3UV7PS65%_pBUeEwX_Hwfe2e6Qmyq$%0i8Ewn%F7i%=CNEV)Qg`r|&+$ zP6^Vl(MmgvFq`Zb715wYD>a#si;o+b4j^VuhuN>+sNOq6Qc~Y;Y=T&!Q4>(&^>Z6* zwliz!_16EDLTT;v$@W(s7s0s zi*%p>q#t)`S4j=Ox_IcjcllyT38C4hr&mlr6qX-c;qVa~k$MG;UqdnzKX0wo0Xe-_)b zrHu1&21O$y5828UIHI@N;}J@-9cpxob}zqO#!U%Q*ybZ?BH#~^fOT_|8&xAs_rX24 z^nqn{UWqR?MlY~klh)#Rz-*%&e~9agOg*fIN`P&v!@gcO25Mec23}PhzImkdwVT|@ zFR9dYYmf&HiUF4xO9@t#u=uTBS@k*97Z!&hu@|xQnQDkLd!*N`!0JN7{EUoH%OD85 z@aQ2(w-N)1_M{;FV)C#(a4p!ofIA3XG(XZ2E#%j_(=`IWlJAHWkYM2&(+yY|^2TB0 z>wfC-+I}`)LFOJ%KeBb1?eNxGKeq?AI_eBE!M~$wYR~bB)J3=WvVlT8ZlF2EzIFZt zkaeyj#vmBTGkIL9mM3cEz@Yf>j=82+KgvJ-u_{bBOxE5zoRNQW3+Ahx+eMGem|8xo zL3ORKxY_R{k=f~M5oi-Z>5fgqjEtzC&xJEDQ@`<)*Gh3UsftBJno-y5Je^!D?Im{j za*I>RQ=IvU@5WKsIr?kC$DT+2bgR>8rOf3mtXeMVB~sm%X7W5`s=Tp>FR544tuQ>9qLt|aUSv^io&z93luW$_OYE^sf8DB?gx z4&k;dHMWph>Z{iuhhFJr+PCZ#SiZ9e5xM$A#0yPtVC>yk&_b9I676n|oAH?VeTe*1 z@tDK}QM-%J^3Ns6=_vh*I8hE?+=6n9nUU`}EX|;Mkr?6@NXy8&B0i6h?7%D=%M*Er zivG61Wk7e=v;<%t*G+HKBqz{;0Biv7F+WxGirONRxJij zon5~(a`UR%uUzfEma99QGbIxD(d}~oa|exU5Y27#4k@N|=hE%Y?Y3H%rcT zHmNO#ZJ7nPHRG#y-(-FSzaZ2S{`itkdYY^ZUvyw<7yMBkNG+>$Rfm{iN!gz7eASN9-B3g%LIEyRev|3)kSl;JL zX7MaUL_@~4ot3$woD0UA49)wUeu7#lj77M4ar8+myvO$B5LZS$!-ZXw3w;l#0anYz zDc_RQ0Ome}_i+o~H=CkzEa&r~M$1GC!-~WBiHiDq9Sdg{m|G?o7g`R%f(Zvby5q4; z=cvn`M>RFO%i_S@h3^#3wImmWI4}2x4skPNL9Am{c!WxR_spQX3+;fo!y(&~Palyjt~Xo0uy6d%sX&I`e>zv6CRSm)rc^w!;Y6iVBb3x@Y=`hl9jft zXm5vilB4IhImY5b->x{!MIdCermpyLbsalx8;hIUia%*+WEo4<2yZ6`OyG1Wp%1s$ zh<|KrHMv~XJ9dC8&EXJ`t3ETz>a|zLMx|MyJE54RU(@?K&p2d#x?eJC*WKO9^d17# zdTTKx-Os3k%^=58Sz|J28aCJ}X2-?YV3T7ee?*FoDLOC214J4|^*EX`?cy%+7Kb3(@0@!Q?p zk>>6dWjF~y(eyRPqjXqDOT`4^Qv-%G#Zb2G?&LS-EmO|ixxt79JZlMgd^~j)7XYQ; z62rGGXA=gLfgy{M-%1gR87hbhxq-fL)GSfEAm{yLQP!~m-{4i_jG*JsvUdqAkoc#q6Yd&>=;4udAh#?xa2L z7mFvCjz(hN7eV&cyFb%(U*30H@bQ8-b7mkm!=wh2|;+_4vo=tyHPQ0hL=NR`jbsSiBWtG ztMPPBgHj(JTK#0VcP36Z`?P|AN~ybm=jNbU=^3dK=|rLE+40>w+MWQW%4gJ`>K!^- zx4kM*XZLd(E4WsolMCRsdvTGC=37FofIyCZCj{v3{wqy4OXX-dZl@g`Dv>p2`l|H^ zS_@(8)7gA62{Qfft>vx71stILMuyV4uKb7BbCstG@|e*KWl{P1$=1xg(7E8MRRCWQ1g)>|QPAZot~|FYz_J0T+r zTWTB3AatKyUsTXR7{Uu) z$1J5SSqoJWt(@@L5a)#Q6bj$KvuC->J-q1!nYS6K5&e7vNdtj- zj9;qwbODLgIcObqNRGs1l{8>&7W?BbDd!87=@YD75B2ep?IY|gE~t)$`?XJ45MG@2 zz|H}f?qtEb_p^Xs$4{?nA=Qko3Lc~WrAS`M%9N60FKqL7XI+v_5H-UDiCbRm`fEmv z$pMVH*#@wQqml~MZe+)e4Ts3Gl^!Z0W3y$;|9hI?9(iw29b7en0>Kt2pjFXk@!@-g zTb4}Kw!@u|V!wzk0|qM*zj$*-*}e*ZXs#Y<6E_!BR}3^YtjI_byo{F+w9H9?f%mnBh(uE~!Um7)tgp2Ye;XYdVD95qt1I-fc@X zXHM)BfJ?^g(s3K|{N8B^hamrWAW|zis$`6|iA>M-`0f+vq(FLWgC&KnBDsM)_ez1# zPCTfN8{s^K`_bum2i5SWOn)B7JB0tzH5blC?|x;N{|@ch(8Uy-O{B2)OsfB$q0@FR z27m3YkcVi$KL;;4I*S;Z#6VfZcZFn!D2Npv5pio)sz-`_H*#}ROd7*y4i(y(YlH<4 zh4MmqBe^QV_$)VvzWgMXFy`M(vzyR2u!xx&%&{^*AcVLrGa8J9ycbynjKR~G6zC0e zlEU>zt7yQtMhz>XMnz>ewXS#{Bulz$6HETn?qD5v3td>`qGD;Y8&RmkvN=24=^6Q@DYY zxMt}uh2cSToMkkIWo1_Lp^FOn$+47JXJ*#q=JaeiIBUHEw#IiXz8cStEsw{UYCA5v_%cF@#m^Y!=+qttuH4u}r6gMvO4EAvjBURtLf& z6k!C|OU@hv_!*qear3KJ?VzVXDKqvKRtugefa7^^MSWl0fXXZR$Xb!b6`eY4A1#pk zAVoZvb_4dZ{f~M8fk3o?{xno^znH1t;;E6K#9?erW~7cs%EV|h^K>@&3Im}c7nm%Y zbLozFrwM&tSNp|46)OhP%MJ(5PydzR>8)X%i3!^L%3HCoCF#Y0#9vPI5l&MK*_ z6G8Y>$`~c)VvQle_4L_AewDGh@!bKkJeEs_NTz(yilnM!t}7jz>fmJb89jQo6~)%% z@GNIJ@AShd&K%UdQ5vR#yT<-goR+D@Tg;PuvcZ*2AzSWN&wW$Xc+~vW)pww~O|6hL zBxX?hOyA~S;3rAEfI&jmMT4f!-eVm%n^KF_QT=>!A<5tgXgi~VNBXqsFI(iI$Tu3x0L{<_-%|HMG4Cn?Xs zq~fvBhu;SDOCD7K5(l&i7Py-;Czx5byV*3y%#-Of9rtz?M_owXc2}$OIY~)EZ&2?r zLQ(onz~I7U!w?B%LtfDz)*X=CscqH!UE=mO?d&oYvtj|(u)^yomS;Cd>Men|#2yuD zg&tf(*iSHyo;^A03p&_j*QXay9d}qZ0CgU@rnFNDIT5xLhC5_tlugv()+w%`7;ICf z>;<#L4m@{1}Og76*e zHWFm~;n@B1GqO8s%=qu)+^MR|jp(ULUOi~v;wE8SB6^mK@adSb=o+A_>Itjn13AF& zDZe+wUF9G!JFv|dpj1#d+}BO~s*QTe3381TxA%Q>P*J#z%( z5*8N^QWxgF73^cTKkkvgvIzf*cLEyyKw)Wf{#$n{uS#(rAA~>TS#!asqQ2m_izXe3 z7$Oh=rR;sdmVx3G)s}eImsb<@r2~5?vcw*Q4LU~FFh!y4r*>~S7slAE6)W3Up2OHr z2R)+O<0kKo<3+5vB}v!lB*`%}gFldc+79iahqEx#&Im@NCQU$@PyCZbcTt?K{;o@4 z312O9GB)?X&wAB}*-NEU zn@6`)G`FhT8O^=Cz3y+XtbwO{5+{4-&?z!esFts-C zypwgI^4#tZ74KC+_IW|E@kMI=1pSJkvg$9G3Va(!reMnJ$kcMiZ=30dTJ%(Ws>eUf z;|l--TFDqL!PZbLc_O(XP0QornpP;!)hdT#Ts7tZ9fcQeH&rhP_1L|Z_ha#JOroe^qcsLi`+AoBWHPM7}gD z+mHuPXd14M?nkp|nu9G8hPk;3=JXE-a204Fg!BK|$MX`k-qPeD$2OOqvF;C(l8wm13?>i(pz7kRyYm zM$IEzf`$}B%ezr!$(UO#uWExn%nTCTIZzq&8@i8sP#6r8 z*QMUzZV(LEWZb)wbmf|Li;UpiP;PlTQ(X4zreD`|`RG!7_wc6J^MFD!A=#K*ze>Jg z?9v?p(M=fg_VB0+c?!M$L>5FIfD(KD5ku*djwCp+5GVIs9^=}kM2RFsxx0_5DE%BF zykxwjWvs=rbi4xKIt!z$&v(`msFrl4n>a%NO_4`iSyb!UiAE&mDa+apc zPe)#!ToRW~rqi2e1bdO1RLN5*uUM@{S`KLJhhY-@TvC&5D(c?a(2$mW-&N%h5IfEM zdFI6`6KJiJQIHvFiG-34^BtO3%*$(-Ht_JU*(KddiUYoM{coadlG&LVvke&*p>Cac z^BPy2Zteiq1@ulw0e)e*ot7@A$RJui0$l^{lsCt%R;$){>zuRv9#w@;m=#d%%TJmm zC#%eFOoy$V)|3*d<OC1iP+4R7D z8FE$E8l2Y?(o-i6wG=BKBh0-I?i3WF%hqdD7VCd;vpk|LFP!Et8$@voH>l>U8BY`Q zC*G;&y6|!p=7`G$*+hxCv!@^#+QD3m>^azyZoLS^;o_|plQaj-wx^ zRV&$HcY~p)2|Zqp0SYU?W3zV87s6JP-@D~$t0 zvd;-YL~JWc*8mtHz_s(cXus#XYJc5zdC=&!4MeZ;N3TQ>^I|Pd=HPjVP*j^45rs(n zzB{U4-44=oQ4rNN6@>qYVMH4|GmMIz#z@3UW-1_y#eNa+Q%(41oJ5i(DzvMO^%|?L z^r_+MZtw0DZ0=BT-@?hUtA)Ijk~Kh-N8?~X5%KnRH7cb!?Yrd8gtiEo!v{sGrQk{X zvV>h{8-DqTyuAxIE(hb}jMVtga$;FIrrKm>ye5t%M;p!jcH1(Bbux>4D#MVhgZGd> z=c=nVb%^9T?iDgM&9G(mV5xShc-lBLi*6RShenDqB%`-2;I*;IHg6>#ovKQ$M}dDb z<$USN%LMqa5_5DR7g7@(oAoQ%!~<1KSQr$rmS{UFQJs5&qBhgTEM_Y7|0Wv?fbP`z z)`8~=v;B)+>Jh`V*|$dTxKe`HTBkho^-!!K#@i{9FLn-XqX&fQcGsEAXp)BV7(`Lk zC{4&+Pe-0&<)C0kAa(MTnb|L;ZB5i|b#L1o;J)+?SV8T*U9$Vxhy}dm3%!A}SK9l_6(#5(e*>8|;4gNKk7o_%m_ zEaS=Z(ewk}hBJ>v`jtR=$pm_Wq3d&DU+6`BACU4%qdhH1o^m8hT2&j<4Z8!v=rMCk z-I*?48{2H*&+r<{2?wp$kh@L@=rj8c`EaS~J>W?)trc?zP&4bsNagS4yafuDoXpi5`!{BVqJ1$ZC3`pf$`LIZ(`0&Ik+!_Xa=NJW`R2 zd#Ntgwz`JVwC4A61$FZ&kP)-{T|rGO59`h#1enAa`cWxRR8bKVvvN6jBzAYePrc&5 z+*zr3en|LYB2>qJp479rEALk5d*X-dfKn6|kuNm;2-U2+P3_rma!nWjZQ-y*q3JS? zBE}zE-!1ZBR~G%v!$l#dZ*$UV4$7q}xct}=on+Ba8{b>Y9h*f-GW0D0o#vJ0%ALg( ztG2+AjWlG#d;myA(i&dh8Gp?y9HD@`CTaDAy?c&0unZ%*LbLIg4;m{Kc?)ws3^>M+ zt5>R)%KIJV*MRUg{0$#nW=Lj{#8?dD$yhjBOrAeR#4$H_Dc(eyA4dNjZEz1Xk+Bqt zB&pPl+?R{w8GPv%VI`x`IFOj320F1=cV4aq0(*()Tx!VVxCjua;)t}gTr=b?zY+U! zkb}xjXZ?hMJN{Hjw?w&?gz8Ow`htX z@}WG*_4<%ff8(!S6bf3)p+8h2!Rory>@aob$gY#fYJ=LiW0`+~l7GI%EX_=8 z{(;0&lJ%9)M9{;wty=XvHbIx|-$g4HFij`J$-z~`mW)*IK^MWVN+*>uTNqaDmi!M8 zurj6DGd)g1g(f`A-K^v)3KSOEoZXImXT06apJum-dO_%oR)z6Bam-QC&CNWh7kLOE zcxLdVjYLNO2V?IXWa-ys30Jbxw(Xm?U1{4kDs9`gZQHh8X{*w9=H&Zz&-6RL?uq#R zxN+k~JaL|gdsdvY_u6}}MHC?a@ElFeipA1Lud#M~)pp2SnG#K{a@tSpvXM;A8gz9> zRVDV5T1%%!LsNRDOw~LIuiAiKcj<%7WpgjP7G6mMU1#pFo6a-1>0I5ZdhxnkMX&#L z=Vm}?SDlb_LArobqpnU!WLQE*yVGWgs^4RRy4rrJwoUUWoA~ZJUx$mK>J6}7{CyC4 zv=8W)kKl7TmAnM%m;anEDPv5tzT{A{ON9#FPYF6c=QIc*OrPp96tiY&^Qs+#A1H>Y z<{XtWt2eDwuqM zQ_BI#UIP;2-olOL4LsZ`vTPv-eILtuB7oWosoSefWdM}BcP>iH^HmimR`G`|+9waCO z&M375o@;_My(qYvPNz;N8FBZaoaw3$b#x`yTBJLc8iIP z--la{bzK>YPP|@Mke!{Km{vT8Z4|#An*f=EmL34?!GJfHaDS#41j~8c5KGKmj!GTh&QIH+DjEI*BdbSS2~6VTt}t zhAwNQNT6%c{G`If3?|~Fp7iwee(LaUS)X9@I29cIb61} z$@YBq4hSplr&liE@ye!y&7+7n$fb+8nS~co#^n@oCjCwuKD61x$5|0ShDxhQES5MP z(gH|FO-s6#$++AxnkQR!3YMgKcF)!&aqr^a3^{gAVT`(tY9@tqgY7@ z>>ul3LYy`R({OY7*^Mf}UgJl(N7yyo$ag;RIpYHa_^HKx?DD`%Vf1D0s^ zjk#OCM5oSzuEz(7X`5u~C-Y~n4B}_3*`5B&8tEdND@&h;H{R`o%IFpIJ4~Kw!kUjehGT8W!CD7?d8sg_$KKp%@*dW)#fI1#R<}kvzBVpaog_2&W%c_jJfP` z6)wE+$3+Hdn^4G}(ymPyasc1<*a7s2yL%=3LgtZLXGuA^jdM^{`KDb%%}lr|ONDsl zy~~jEuK|XJ2y<`R{^F)Gx7DJVMvpT>gF<4O%$cbsJqK1;v@GKXm*9l3*~8^_xj*Gs z=Z#2VQ6`H@^~#5Pv##@CddHfm;lbxiQnqy7AYEH(35pTg^;u&J2xs-F#jGLuDw2%z z`a>=0sVMM+oKx4%OnC9zWdbpq*#5^yM;og*EQKpv`^n~-mO_vj=EgFxYnga(7jO?G z`^C87B4-jfB_RgN2FP|IrjOi;W9AM1qS}9W@&1a9Us>PKFQ9~YE!I~wTbl!m3$Th? z)~GjFxmhyyGxN}t*G#1^KGVXm#o(K0xJyverPe}mS=QgJ$#D}emQDw+dHyPu^&Uv> z4O=3gK*HLFZPBY|!VGq60Of6QrAdj`nj1h!$?&a;Hgaj{oo{l0P3TzpJK_q_eW8Ng zP6QF}1{V;xlolCs?pGegPoCSxx@bshb#3ng4Fkp4!7B0=&+1%187izf@}tvsjZ6{m z4;K>sR5rm97HJrJ`w}Y`-MZN$Wv2N%X4KW(N$v2@R1RkRJH2q1Ozs0H`@ zd5)X-{!{<+4Nyd=hQ8Wm3CCd}ujm*a?L79ztfT7@&(?B|!pU5&%9Rl!`i;suAg0+A zxb&UYpo-z}u6CLIndtH~C|yz&!OV_I*L;H#C7ie_5uB1fNRyH*<^d=ww=gxvE%P$p zRHKI{^{nQlB9nLhp9yj-so1is{4^`{Xd>Jl&;dX;J)#- z=fmE5GiV?-&3kcjM1+XG7&tSq;q9Oi4NUuRrIpoyp*Fn&nVNFdUuGQ_g)g>VzXGdneB7`;!aTUE$t* z5iH+8XPxrYl)vFo~+vmcU-2) zq!6R(T0SsoDnB>Mmvr^k*{34_BAK+I=DAGu){p)(ndZqOFT%%^_y;X(w3q-L``N<6 zw9=M zoQ8Lyp>L_j$T20UUUCzYn2-xdN}{e@$8-3vLDN?GbfJ>7*qky{n!wC#1NcYQr~d51 zy;H!am=EI#*S&TCuP{FA3CO)b0AAiN*tLnDbvKwxtMw-l;G2T@EGH)YU?-B`+Y=!$ zypvDn@5V1Tr~y~U0s$ee2+CL3xm_BmxD3w}d_Pd@S%ft#v~_j;6sC6cy%E|dJy@wj z`+(YSh2CrXMxI;yVy*=O@DE2~i5$>nuzZ$wYHs$y`TAtB-ck4fQ!B8a;M=CxY^Nf{ z+UQhn0jopOzvbl(uZZ1R-(IFaprC$9hYK~b=57@ zAJ8*pH%|Tjotzu5(oxZyCQ{5MAw+6L4)NI!9H&XM$Eui-DIoDa@GpNI=I4}m>Hr^r zZjT?xDOea}7cq+TP#wK1p3}sbMK{BV%(h`?R#zNGIP+7u@dV5#zyMau+w}VC1uQ@p zrFUjrJAx6+9%pMhv(IOT52}Dq{B9njh_R`>&j&5Sbub&r*hf4es)_^FTYdDX$8NRk zMi=%I`)hN@N9>X&Gu2RmjKVsUbU>TRUM`gwd?CrL*0zxu-g#uNNnnicYw=kZ{7Vz3 zULaFQ)H=7%Lm5|Z#k?<{ux{o4T{v-e zTLj?F(_qp{FXUzOfJxEyKO15Nr!LQYHF&^jMMBs z`P-}WCyUYIv>K`~)oP$Z85zZr4gw>%aug1V1A)1H(r!8l&5J?ia1x_}Wh)FXTxZUE zs=kI}Ix2cK%Bi_Hc4?mF^m`sr6m8M(n?E+k7Tm^Gn}Kf= zfnqoyVU^*yLypz?s+-XV5(*oOBwn-uhwco5b(@B(hD|vtT8y7#W{>RomA_KchB&Cd zcFNAD9mmqR<341sq+j+2Ra}N5-3wx5IZqg6Wmi6CNO#pLvYPGNER}Q8+PjvIJ42|n zc5r@T*p)R^U=d{cT2AszQcC6SkWiE|hdK)m{7ul^mU+ED1R8G#)#X}A9JSP_ubF5p z8Xxcl;jlGjPwow^p+-f_-a~S;$lztguPE6SceeUCfmRo=Qg zKHTY*O_ z;pXl@z&7hniVYVbGgp+Nj#XP^Aln2T!D*{(Td8h{8Dc?C)KFfjPybiC`Va?Rf)X>y z;5?B{bAhPtbmOMUsAy2Y0RNDQ3K`v`gq)#ns_C&ec-)6cq)d^{5938T`Sr@|7nLl; zcyewuiSUh7Z}q8iIJ@$)L3)m)(D|MbJm_h&tj^;iNk%7K-YR}+J|S?KR|29K?z-$c z<+C4uA43yfSWBv*%z=-0lI{ev`C6JxJ};A5N;lmoR(g{4cjCEn33 z-ef#x^uc%cM-f^_+*dzE?U;5EtEe;&8EOK^K}xITa?GH`tz2F9N$O5;)`Uof4~l+t z#n_M(KkcVP*yMYlk_~5h89o zlf#^qjYG8Wovx+f%x7M7_>@r7xaXa2uXb?_*=QOEe_>ErS(v5-i)mrT3&^`Oqr4c9 zDjP_6T&NQMD`{l#K&sHTm@;}ed_sQ88X3y`ON<=$<8Qq{dOPA&WAc2>EQ+U8%>yWR zK%(whl8tB;{C)yRw|@Gn4%RhT=bbpgMZ6erACc>l5^p)9tR`(2W-D*?Ph6;2=Fr|G- zdF^R&aCqyxqWy#P7#G8>+aUG`pP*ow93N=A?pA=aW0^^+?~#zRWcf_zlKL8q8-80n zqGUm=S8+%4_LA7qrV4Eq{FHm9#9X15%ld`@UKyR7uc1X*>Ebr0+2yCye6b?i=r{MPoqnTnYnq z^?HWgl+G&@OcVx4$(y;{m^TkB5Tnhx2O%yPI=r*4H2f_6Gfyasq&PN^W{#)_Gu7e= zVHBQ8R5W6j;N6P3O(jsRU;hkmLG(Xs_8=F&xh@`*|l{~0OjUVlgm z7opltSHg7Mb%mYamGs*v1-#iW^QMT**f+Nq*AzIvFT~Ur3KTD26OhIw1WQsL(6nGg znHUo-4e15cXBIiyqN};5ydNYJ6zznECVVR44%(P0oW!yQ!YH)FPY?^k{IrtrLo7Zo`?sg%%oMP9E^+H@JLXicr zi?eoI?LODRPcMLl90MH32rf8btf69)ZE~&4d%(&D{C45egC6bF-XQ;6QKkbmqW>_H z{86XDZvjiN2wr&ZPfi;^SM6W+IP0);50m>qBhzx+docpBkkiY@2bSvtPVj~E`CfEu zhQG5G>~J@dni5M5Jmv7GD&@%UR`k3ru-W$$onI259jM&nZ)*d3QFF?Mu?{`+nVzkx z=R*_VH=;yeU?9TzQ3dP)q;P)4sAo&k;{*Eky1+Z!10J<(cJC3zY9>bP=znA=<-0RR zMnt#<9^X7BQ0wKVBV{}oaV=?JA=>R0$az^XE%4WZcA^Em>`m_obQyKbmf-GA;!S-z zK5+y5{xbkdA?2NgZ0MQYF-cfOwV0?3Tzh8tcBE{u%Uy?Ky4^tn^>X}p>4&S(L7amF zpWEio8VBNeZ=l!%RY>oVGOtZh7<>v3?`NcHlYDPUBRzgg z0OXEivCkw<>F(>1x@Zk=IbSOn+frQ^+jI*&qdtf4bbydk-jgVmLAd?5ImK+Sigh?X zgaGUlbf^b-MH2@QbqCawa$H1Vb+uhu{zUG9268pa{5>O&Vq8__Xk5LXDaR1z$g;s~;+Ae82wq#l;wo08tX(9uUX6NJWq1vZLh3QbP$# zL`udY|Qp*4ER`_;$%)2 zmcJLj|FD`(;ts0bD{}Ghq6UAVpEm#>j`S$wHi0-D_|)bEZ}#6) zIiqH7Co;TB`<6KrZi1SF9=lO+>-_3=Hm%Rr7|Zu-EzWLSF{9d(H1v*|UZDWiiqX3} zmx~oQ6%9~$=KjPV_ejzz7aPSvTo+3@-a(OCCoF_u#2dHY&I?`nk zQ@t8#epxAv@t=RUM09u?qnPr6=Y5Pj;^4=7GJ`2)Oq~H)2V)M1sC^S;w?hOB|0zXT zQdf8$)jslO>Q}(4RQ$DPUF#QUJm-k9ysZFEGi9xN*_KqCs9Ng(&<;XONBDe1Joku? z*W!lx(i&gvfXZ4U(AE@)c0FI2UqrFLOO$&Yic|`L;Vyy-kcm49hJ^Mj^H9uY8Fdm2 z?=U1U_5GE_JT;Tx$2#I3rAAs(q@oebIK=19a$N?HNQ4jw0ljtyGJ#D}z3^^Y=hf^Bb--297h6LQxi0-`TB|QY2QPg92TAq$cEQdWE ze)ltSTVMYe0K4wte6;^tE+^>|a>Hit_3QDlFo!3Jd`GQYTwlR#{<^MzG zK!vW&))~RTKq4u29bc<+VOcg7fdorq-kwHaaCQe6tLB{|gW1_W_KtgOD0^$^|`V4C# z*D_S9Dt_DIxpjk3my5cBFdiYaq||#0&0&%_LEN}BOxkb3v*d$4L|S|z z!cZZmfe~_Y`46v=zul=aixZTQCOzb(jx>8&a%S%!(;x{M2!*$od2!Pwfs>RZ-a%GOZdO88rS)ZW~{$656GgW)$Q=@!x;&Nn~!K)lr4gF*%qVO=hlodHA@2)keS2 zC}7O=_64#g&=zY?(zhzFO3)f5=+`dpuyM!Q)zS&otpYB@hhn$lm*iK2DRt+#1n|L%zjM}nB*$uAY^2JIw zV_P)*HCVq%F))^)iaZD#R9n^{sAxBZ?Yvi1SVc*`;8|F2X%bz^+s=yS&AXjysDny)YaU5RMotF-tt~FndTK ziRve_5b!``^ZRLG_ks}y_ye0PKyKQSsQCJuK5()b2ThnKPFU?An4;dK>)T^4J+XjD zEUsW~H?Q&l%K4<1f5^?|?lyCQe(O3?!~OU{_Wxs#|Ff8?a_WPQUKvP7?>1()Cy6oLeA zjEF^d#$6Wb${opCc^%%DjOjll%N2=GeS6D-w=Ap$Ux2+0v#s#Z&s6K*)_h{KFfgKjzO17@p1nKcC4NIgt+3t}&}F z@cV; zZ1r#~?R@ZdSwbFNV(fFl2lWI(Zf#nxa<6f!nBZD>*K)nI&Fun@ngq@Ge!N$O< zySt*mY&0moUXNPe~Fg=%gIu)tJ;asscQ!-AujR@VJBRoNZNk;z4hs4T>Ud!y=1NwGs-k zlTNeBOe}=)Epw=}+dfX;kZ32h$t&7q%Xqdt-&tlYEWc>>c3(hVylsG{Ybh_M8>Cz0ZT_6B|3!_(RwEJus9{;u-mq zW|!`{BCtnao4;kCT8cr@yeV~#rf76=%QQs(J{>Mj?>aISwp3{^BjBO zLV>XSRK+o=oVDBnbv?Y@iK)MiFSl{5HLN@k%SQZ}yhPiu_2jrnI?Kk?HtCv>wN$OM zSe#}2@He9bDZ27hX_fZey=64#SNU#1~=icK`D>a;V-&Km>V6ZdVNj7d2 z-NmAoOQm_aIZ2lXpJhlUeJ95eZt~4_S zIfrDs)S$4UjyxKSaTi#9KGs2P zfSD>(y~r+bU4*#|r`q+be_dopJzKK5JNJ#rR978ikHyJKD>SD@^Bk$~D0*U38Y*IpYcH>aaMdZq|YzQ-Ixd(_KZK!+VL@MWGl zG!k=<%Y-KeqK%``uhx}0#X^@wS+mX@6Ul@90#nmYaKh}?uw>U;GS4fn3|X%AcV@iY z8v+ePk)HxSQ7ZYDtlYj#zJ?5uJ8CeCg3efmc#|a%2=u>+vrGGRg$S@^mk~0f;mIu! zWMA13H1<@hSOVE*o0S5D8y=}RiL#jQpUq42D}vW$z*)VB*FB%C?wl%(3>ANaY)bO@ zW$VFutemwy5Q*&*9HJ603;mJJkB$qp6yxNOY0o_4*y?2`qbN{m&*l{)YMG_QHXXa2 z+hTmlA;=mYwg{Bfusl zyF&}ib2J;#q5tN^e)D62fWW*Lv;Rnb3GO-JVtYG0CgR4jGujFo$Waw zSNLhc{>P~>{KVZE1Vl1!z)|HFuN@J7{`xIp_)6>*5Z27BHg6QIgqLqDJTmKDM+ON* zK0Fh=EG`q13l z+m--9UH0{ZGQ%j=OLO8G2WM*tgfY}bV~>3Grcrpehjj z6Xe<$gNJyD8td3EhkHjpKk}7?k55Tu7?#;5`Qcm~ki;BeOlNr+#PK{kjV>qfE?1No zMA07}b>}Dv!uaS8Hym0TgzxBxh$*RX+Fab6Gm02!mr6u}f$_G4C|^GSXJMniy^b`G z74OC=83m0G7L_dS99qv3a0BU({t$zHQsB-RI_jn1^uK9ka_%aQuE2+~J2o!7`735Z zb?+sTe}Gd??VEkz|KAPMfj(1b{om89p5GIJ^#Aics_6DD%WnNGWAW`I<7jT|Af|8g zZA0^)`p8i#oBvX2|I&`HC8Pn&0>jRuMF4i0s=}2NYLmgkZb=0w9tvpnGiU-gTUQhJ zR6o4W6ZWONuBZAiN77#7;TR1^RKE(>>OL>YU`Yy_;5oj<*}ac99DI(qGCtn6`949f ziMpY4k>$aVfffm{dNH=-=rMg|u?&GIToq-u;@1-W&B2(UOhC-O2N5_px&cF-C^tWp zXvChm9@GXEcxd;+Q6}u;TKy}$JF$B`Ty?|Y3tP$N@Rtoy(*05Wj-Ks32|2y2ZM>bM zi8v8E1os!yorR!FSeP)QxtjIKh=F1ElfR8U7StE#Ika;h{q?b?Q+>%78z^>gTU5+> zxQ$a^rECmETF@Jl8fg>MApu>btHGJ*Q99(tMqsZcG+dZ6Yikx7@V09jWCiQH&nnAv zY)4iR$Ro223F+c3Q%KPyP9^iyzZsP%R%-i^MKxmXQHnW6#6n7%VD{gG$E;7*g86G< zu$h=RN_L2(YHO3@`B<^L(q@^W_0#U%mLC9Q^XEo3LTp*~(I%?P_klu-c~WJxY1zTI z^PqntLIEmdtK~E-v8yc&%U+jVxW5VuA{VMA4Ru1sk#*Srj0Pk#tZuXxkS=5H9?8eb z)t38?JNdP@#xb*yn=<*_pK9^lx%;&yH6XkD6-JXgdddZty8@Mfr9UpGE!I<37ZHUe z_Rd+LKsNH^O)+NW8Ni-V%`@J_QGKA9ZCAMSnsN>Ych9VW zCE7R_1FVy}r@MlkbxZ*TRIGXu`ema##OkqCM9{wkWQJg^%3H${!vUT&vv2250jAWN zw=h)C!b2s`QbWhBMSIYmWqZ_~ReRW;)U#@C&ThctSd_V!=HA=kdGO-Hl57an|M1XC?~3f0{7pyjWY}0mChU z2Fj2(B*r(UpCKm-#(2(ZJD#Y|Or*Vc5VyLpJ8gO1;fCm@EM~{DqpJS5FaZ5%|ALw) zyumBl!i@T57I4ITCFmdbxhaOYud}i!0YkdiNRaQ%5$T5>*HRBhyB~<%-5nj*b8=i= z(8g(LA50%0Zi_eQe}Xypk|bt5e6X{aI^jU2*c?!p*$bGk=?t z+17R){lx~Z{!B34Zip~|A;8l@%*Gc}kT|kC0*Ny$&fI3@%M! zqk_zvN}7bM`x@jqFOtaxI?*^Im5ix@=`QEv;__i;Tek-&7kGm6yP17QANVL>*d0B=4>i^;HKb$k8?DYFMr38IX4azK zBbwjF%$>PqXhJh=*7{zH5=+gi$!nc%SqFZlwRm zmpctOjZh3bwt!Oc>qVJhWQf>`HTwMH2ibK^eE*j!&Z`-bs8=A`Yvnb^?p;5+U=Fb8 z@h>j_3hhazd$y^Z-bt%3%E3vica%nYnLxW+4+?w{%|M_=w^04U{a6^22>M_?{@mXP zS|Qjcn4&F%WN7Z?u&I3fU(UQVw4msFehxR*80dSb=a&UG4zDQp&?r2UGPy@G?0FbY zVUQ?uU9-c;f9z06$O5FO1TOn|P{pLcDGP?rfdt`&uw|(Pm@$n+A?)8 zP$nG(VG&aRU*(_5z#{+yVnntu`6tEq>%9~n^*ao}`F6ph_@6_8|AfAXtFfWee_14` zKKURYV}4}=UJmxv7{RSz5QlwZtzbYQs0;t3?kx*7S%nf-aY&lJ@h?-BAn%~0&&@j) zQd_6TUOLXErJ`A3vE?DJIbLE;s~s%eVt(%fMzUq^UfZV9c?YuhO&6pwKt>j(=2CkgTNEq7&c zfeGN+%5DS@b9HO>zsoRXv@}(EiA|t5LPi}*R3?(-=iASADny<{D0WiQG>*-BSROk4vI6%$R>q64J&v-T+(D<_(b!LD z9GL;DV;;N3!pZYg23mcg81tx>7)=e%f|i{6Mx0GczVpc}{}Mg(W_^=Wh0Rp+xXgX` z@hw|5=Je&nz^Xa>>vclstYt;8c2PY)87Ap;z&S&`yRN>yQVV#K{4&diVR7Rm;S{6m z6<+;jwbm`==`JuC6--u6W7A@o4&ZpJV%5+H)}toy0afF*!)AaG5=pz_i9}@OG%?$O z2cec6#@=%xE3K8;^ps<2{t4SnqH+#607gAHP-G4^+PBiC1s>MXf&bQ|Pa;WBIiErV z?3VFpR9JFl9(W$7p3#xe(Bd?Z93Uu~jHJFo7U3K_x4Ej-=N#=a@f;kPV$>;hiN9i9 z<6elJl?bLI$o=|d6jlihA4~bG;Fm2eEnlGxZL`#H%Cdes>uJfMJ4>@1SGGeQ81DwxGxy7L5 zm05Ik*WpSgZvHh@Wpv|2i|Y#FG?Y$hbRM5ZF0Z7FB3cY0+ei#km9mDSPI}^!<<`vr zuv$SPg2vU{wa)6&QMY)h1hbbxvR2cc_6WcWR`SH& z&KuUQcgu}!iW2Wqvp~|&&LSec9>t(UR_|f$;f-fC&tSO-^-eE0B~Frttnf+XN(#T) z^PsuFV#(pE#6ztaI8(;ywN%CtZh?w&;_)w_s@{JiA-SMjf&pQk+Bw<}f@Q8-xCQMwfaf zMgHsAPU=>>Kw~uDFS(IVRN{$ak(SV(hrO!UqhJ?l{lNnA1>U24!=>|q_p404Xd>M# z7?lh^C&-IfeIr`Dri9If+bc%oU0?|Rh8)%BND5;_9@9tuM)h5Kcw6}$Ca7H_n)nOf0pd`boCXItb`o11 zb`)@}l6I_h>n+;`g+b^RkYs7;voBz&Gv6FLmyvY|2pS)z#P;t8k;lS>49a$XeVDc4 z(tx2Pe3N%Gd(!wM`E7WRBZy)~vh_vRGt&esDa0NCua)rH#_39*H0!gIXpd>~{rGx+ zJKAeXAZ-z5n=mMVqlM5Km;b;B&KSJlScD8n?2t}kS4Wf9@MjIZSJ2R?&=zQn zs_`=+5J$47&mP4s{Y{TU=~O_LzSrXvEP6W?^pz<#Y*6Fxg@$yUGp31d(h+4x>xpb< zH+R639oDST6F*0iH<9NHC^Ep*8D4-%p2^n-kD6YEI<6GYta6-I;V^ZH3n5}syTD=P z3b6z=jBsdP=FlXcUe@I|%=tY4J_2j!EVNEzph_42iO3yfir|Dh>nFl&Lu9!;`!zJB zCis9?_(%DI?$CA(00pkzw^Up`O;>AnPc(uE$C^a9868t$m?5Q)CR%!crI$YZpiYK6m= z!jv}82He`QKF;10{9@roL2Q7CF)OeY{~dBp>J~X#c-Z~{YLAxNmn~kWQW|2u!Yq00 zl5LKbzl39sVCTpm9eDW_T>Z{x@s6#RH|P zA~_lYas7B@SqI`N=>x50Vj@S)QxouKC(f6Aj zz}7e5e*5n?j@GO;mCYEo^Jp_*BmLt3!N)(T>f#L$XHQWzZEVlJo(>qH@7;c%fy zS-jm^Adju9Sm8rOKTxfTU^!&bg2R!7C_-t+#mKb_K?0R72%26ASF;JWA_prJ8_SVW zOSC7C&CpSrgfXRp8r)QK34g<~!1|poTS7F;)NseFsbwO$YfzEeG3oo!qe#iSxQ2S# z1=Fxc9J;2)pCab-9o-m8%BLjf(*mk#JJX3k9}S7Oq)dV0jG)SOMbw7V^Z<5Q0Cy$< z^U0QUVd4(96W03OA1j|x%{sd&BRqIERDb6W{u1p1{J(a;fd6lnWzjeS`d?L3-0#o7 z{Qv&L7!Tm`9|}u=|IbwS_jgH(_V@o`S*R(-XC$O)DVwF~B&5c~m!zl14ydT6sK+Ly zn+}2hQ4RTC^8YvrQ~vk$f9u=pTN{5H_yTOcza9SVE&nt_{`ZC8zkmFji=UyD`G4~f zUfSTR=Kju>6u+y&|Bylb*W&^P|8fvEbQH3+w*DrKq|9xMzq2OiZyM=;(?>~4+O|jn zC_Et05oc>e%}w4ye2Fm%RIR??VvofwZS-}BL@X=_4jdHp}FlMhW_IW?Zh`4$z*Wr!IzQHa3^?1|);~VaWmsIcmc6 zJs{k0YW}OpkfdoTtr4?9F6IX6$!>hhA+^y_y@vvA_Gr7u8T+i-< zDX(~W5W{8mfbbM-en&U%{mINU#Q8GA`byo)iLF7rMVU#wXXY`a3ji3m{4;x53216i z`zA8ap?>_}`tQj7-%$K78uR}R$|@C2)qgop$}o=g(jOv0ishl!E(R73N=i0~%S)6+ z1xFP7|H0yt3Z_Re*_#C2m3_X{=zi1C&3CM7e?9-Y5lCtAlA%RFG9PDD=Quw1dfYnZ zdUL)#+m`hKx@PT`r;mIx_RQ6Txbti+&;xQorP;$H=R2r)gPMO9>l+!p*Mt04VH$$M zSLwJ81IFjQ5N!S#;MyBD^IS`2n04kuYbZ2~4%3%tp0jn^**BZQ05ELp zY%yntZ=52s6U5Y93Aao)v~M3y?6h7mZcVGp63pK*d&!TRjW99rUU;@s#3kYB76Bs$|LRwkH>L!0Xe zE=dz1o}phhnOVYZFsajQsRA^}IYZnk9Wehvo>gHPA=TPI?2A`plIm8=F1%QiHx*Zn zi)*Y@)$aXW0v1J|#+R2=$ysooHZ&NoA|Wa}htd`=Eud!(HD7JlT8ug|yeBZmpry(W z)pS>^1$N#nuo3PnK*>Thmaxz4pLcY?PP2r3AlhJ7jw(TI8V#c}>Ym;$iPaw+83L+* z!_QWpYs{UWYcl0u z(&(bT0Q*S_uUX9$jC;Vk%oUXw=A-1I+!c18ij1CiUlP@pfP9}CHAVm{!P6AEJ(7Dn z?}u#}g`Q?`*|*_0Rrnu8{l4PP?yCI28qC~&zlwgLH2AkfQt1?B#3AOQjW&10%@@)Q zDG?`6$8?Nz(-sChL8mRs#3z^uOA>~G=ZIG*mgUibWmgd{a|Tn4nkRK9O^37E(()Q% zPR0#M4e2Q-)>}RSt1^UOCGuv?dn|IT3#oW_$S(YR+jxAzxCD_L25p_dt|^>g+6Kgj zJhC8n)@wY;Y7JI6?wjU$MQU|_Gw*FIC)x~^Eq1k41BjLmr}U>6#_wxP0-2Ka?uK14u5M-lAFSX$K1K{WH!M1&q}((MWWUp#Uhl#n_yT5dFs4X`>vmM& z*1!p0lACUVqp&sZG1GWATvZEENs^0_7Ymwem~PlFN3hTHVBv(sDuP;+8iH07a)s(# z%a7+p1QM)YkS7>kbo${k2N1&*%jFP*7UABJ2d||c!eSXWM*<4(_uD7;1XFDod@cT$ zP>IC%^fbC${^QrUXy$f)yBwY^g@}}kngZKa1US!lAa+D=G4wklukaY8AEW%GL zh40pnuv*6D>9`_e14@wWD^o#JvxYVG-~P)+<)0fW zP()DuJN?O*3+Ab!CP-tGr8S4;JN-Ye^9D%(%8d{vb_pK#S1z)nZzE^ezD&%L6nYbZ z*62>?u)xQe(Akd=e?vZbyb5)MMNS?RheZDHU?HK<9;PBHdC~r{MvF__%T)-9ifM#cR#2~BjVJYbA>xbPyl9yNX zX)iFVvv-lfm`d?tbfh^j*A|nw)RszyD<#e>llO8X zou=q3$1|M@Ob;F|o4H0554`&y9T&QTa3{yn=w0BLN~l;XhoslF-$4KGNUdRe?-lcV zS4_WmftU*XpP}*wFM^oKT!D%_$HMT#V*j;9weoOq0mjbl1271$F)`Q(C z76*PAw3_TE{vntIkd=|(zw)j^!@j ^tV@s0U~V+mu)vv`xgL$Z9NQLnuRdZ;95D|1)!0Aybwv}XCE#xz1k?ZC zxAU)v@!$Sm*?)t2mWrkevNFbILU9&znoek=d7jn*k+~ptQ)6z`h6e4B&g?Q;IK+aH z)X(BH`n2DOS1#{AJD-a?uL)@Vl+`B=6X3gF(BCm>Q(9+?IMX%?CqgpsvK+b_de%Q> zj-GtHKf!t@p2;Gu*~#}kF@Q2HMevg~?0{^cPxCRh!gdg7MXsS}BLtG_a0IY0G1DVm z2F&O-$Dzzc#M~iN`!j38gAn`6*~h~AP=s_gy2-#LMFoNZ0<3q+=q)a|4}ur7F#><%j1lnr=F42Mbti zi-LYs85K{%NP8wE1*r4Mm+ZuZ8qjovmB;f##!E*M{*A(4^~vg!bblYi1M@7tq^L8- zH7tf_70iWXqcSQgENGdEjvLiSLicUi3l0H*sx=K!!HLxDg^K|s1G}6Tam|KBV>%YeU)Q>zxQe;ddnDTWJZ~^g-kNeycQ?u242mZs`i8cP)9qW`cwqk)Jf?Re0=SD=2z;Gafh(^X-=WJ$i7Z9$Pao56bTwb+?p>L3bi9 zP|qi@;H^1iT+qnNHBp~X>dd=Us6v#FPDTQLb9KTk%z{&OWmkx3uY(c6JYyK3w|z#Q zMY%FPv%ZNg#w^NaW6lZBU+}Znwc|KF(+X0RO~Q6*O{T-P*fi@5cPGLnzWMSyoOPe3 z(J;R#q}3?z5Ve%crTPZQFLTW81cNY-finw!LH9wr$(C)p_@v?(y#b-R^Pv!}_#7t+A?pHEUMY zoQZIwSETTKeS!W{H$lyB1^!jn4gTD{_mgG?#l1Hx2h^HrpCXo95f3utP-b&%w80F} zXFs@Jp$lbIL64@gc?k*gJ;OForPaapOH7zNMB60FdNP<*9<@hEXJk9Rt=XhHR-5_$Ck-R?+1py&J3Y9^sBBZuj?GwSzua;C@9)@JZpaI zE?x6{H8@j9P06%K_m%9#nnp0Li;QAt{jf-7X%Pd2jHoI4As-9!UR=h6Rjc z!3{UPWiSeLG&>1V5RlM@;5HhQW_&-wL2?%k@dvRS<+@B6Yaj*NG>qE5L*w~1ATP$D zmWu6(OE=*EHqy{($~U4zjxAwpPn42_%bdH9dMphiUU|) z*+V@lHaf%*GcXP079>vy5na3h^>X=n;xc;VFx)`AJEk zYZFlS#Nc-GIHc}j06;cOU@ zAD7Egkw<2a8TOcfO9jCp4U4oI*`|jpbqMWo(={gG3BjuM3QTGDG`%y|xithFck}0J zG}N#LyhCr$IYP`#;}tdm-7^9=72+CBfBsOZ0lI=LC_a%U@(t3J_I1t(UdiJ^@NubM zvvA0mGvTC%{fj53M^|Ywv$KbW;n8B-x{9}Z!K6v-tw&Xe_D2{7tX?eVk$sA*0826( zuGz!K7$O#;K;1w<38Tjegl)PmRso`fc&>fAT5s z7hzQe-_`lx`}2=c)jz6;yn(~F6#M@z_7@Z(@GWbIAo6A2&;aFf&>CVHpqoPh5#~=G zav`rZ3mSL2qwNL+Pg>aQv;%V&41e|YU$!fQ9Ksle!XZERpjAowHtX zi#0lnw{(zmk&}t`iFEMmx-y7FWaE*vA{Hh&>ieZg{5u0-3@a8BY)Z47E`j-H$dadu zIP|PXw1gjO@%aSz*O{GqZs_{ke|&S6hV{-dPkl*V|3U4LpqhG0eVdqfeNX28hrafI zE13WOsRE|o?24#`gQJs@v*EwL{@3>Ffa;knvI4@VEG2I>t-L(KRS0ShZ9N!bwXa}e zI0}@2#PwFA&Y9o}>6(ZaSaz>kw{U=@;d{|dYJ~lyjh~@bBL>n}#@KjvXUOhrZ`DbnAtf5bz3LD@0RpmAyC-4cgu<7rZo&C3~A_jA*0)v|Ctcdu} zt@c7nQ6hSDC@76c4hI&*v|5A0Mj4eQ4kVb0$5j^*$@psB zdouR@B?l6E%a-9%i(*YWUAhxTQ(b@z&Z#jmIb9`8bZ3Um3UW!@w4%t0#nxsc;*YrG z@x$D9Yj3EiA(-@|IIzi@!E$N)j?gedGJpW!7wr*7zKZwIFa>j|cy<(1`VV_GzWN=1 zc%OO)o*RRobvTZE<9n1s$#V+~5u8ZwmDaysD^&^cxynksn!_ypmx)Mg^8$jXu5lMo zK3K_8GJh#+7HA1rO2AM8cK(#sXd2e?%3h2D9GD7!hxOEKJZK&T`ZS0e*c9c36Y-6yz2D0>Kvqy(EuiQtUQH^~M*HY!$e z20PGLb2Xq{3Ceg^sn+99K6w)TkprP)YyNU(+^PGU8}4&Vdw*u;(`Bw!Um76gL_aMT z>*82nmA8Tp;~hwi0d3S{vCwD};P(%AVaBr=yJ zqB?DktZ#)_VFh_X69lAHQw(ZNE~ZRo2fZOIP;N6fD)J*3u^YGdgwO(HnI4pb$H#9) zizJ<>qI*a6{+z=j+SibowDLKYI*Je2Y>~=*fL@i*f&8**s~4l&B&}$~nwhtbOTr=G zFx>{y6)dpJPqv={_@*!q0=jgw3^j`qi@!wiWiT_$1`SPUgaG&9z9u9=m5C8`GpMaM zyMRSv2llS4F}L?233!)f?mvcYIZ~U z7mPng^=p)@Z*Fp9owSYA`Fe4OjLiJ`rdM`-U(&z1B1`S`ufK_#T@_BvenxDQU`deH$X5eMVO=;I4EJjh6?kkG2oc6AYF6|(t)L0$ukG}Zn=c+R`Oq;nC)W^ z{ek!A?!nCsfd_5>d&ozG%OJmhmnCOtARwOq&p!FzWl7M))YjqK8|;6sOAc$w2%k|E z`^~kpT!j+Y1lvE0B)mc$Ez_4Rq~df#vC-FmW;n#7E)>@kMA6K30!MdiC19qYFnxQ* z?BKegU_6T37%s`~Gi2^ewVbciy-m5%1P3$88r^`xN-+VdhhyUj4Kzg2 zlKZ|FLUHiJCZL8&<=e=F2A!j@3D@_VN%z?J;uw9MquL`V*f^kYTrpoWZ6iFq00uO+ zD~Zwrs!e4cqGedAtYxZ76Bq3Ur>-h(m1~@{x@^*YExmS*vw9!Suxjlaxyk9P#xaZK z)|opA2v#h=O*T42z>Mub2O3Okd3GL86KZM2zlfbS z{Vps`OO&3efvt->OOSpMx~i7J@GsRtoOfQ%vo&jZ6^?7VhBMbPUo-V^Znt%-4k{I# z8&X)=KY{3lXlQg4^FH^{jw0%t#2%skLNMJ}hvvyd>?_AO#MtdvH;M^Y?OUWU6BdMX zJ(h;PM9mlo@i)lWX&#E@d4h zj4Z0Czj{+ipPeW$Qtz_A52HA<4$F9Qe4CiNQSNE2Q-d1OPObk4?7-&`={{yod5Iy3kB=PK3%0oYSr`Gca120>CHbC#SqE*ivL2R(YmI1A|nAT?JmK*2qj_3p#?0h)$#ixdmP?UejCg9%AS2 z8I(=_QP(a(s)re5bu-kcNQc-&2{QZ%KE*`NBx|v%K2?bK@Ihz_e<5Y(o(gQ-h+s&+ zjpV>uj~?rfJ!UW5Mop~ro^|FP3Z`@B6A=@f{Wn78cm`)3&VJ!QE+P9&$;3SDNH>hI z_88;?|LHr%1kTX0t*xzG-6BU=LRpJFZucRBQ<^zy?O5iH$t>o}C}Fc+kM1EZu$hm% zTTFKrJkXmCylFgrA;QAA(fX5Sia5TNo z?=Ujz7$Q?P%kM$RKqRQisOexvV&L+bolR%`u`k;~!o(HqgzV9I6w9|g*5SVZN6+kT9H$-3@%h%k7BBnB zPn+wmPYNG)V2Jv`&$LoI*6d0EO^&Nh`E* z&1V^!!Szd`8_uf%OK?fuj~! z%p9QLJ?V*T^)72<6p1ONqpmD?Wm((40>W?rhjCDOz?#Ei^sXRt|GM3ULLnoa8cABQ zA)gCqJ%Q5J%D&nJqypG-OX1`JLT+d`R^|0KtfGQU+jw79la&$GHTjKF>*8BI z0}l6TC@XB6`>7<&{6WX2kX4k+0SaI`$I8{{mMHB}tVo*(&H2SmZLmW* z+P8N>(r}tR?f!O)?)df>HIu>$U~e~tflVmwk*+B1;TuqJ+q_^`jwGwCbCgSevBqj$ z<`Fj*izeO)_~fq%wZ0Jfvi6<3v{Afz;l5C^C7!i^(W>%5!R=Ic7nm(0gJ~9NOvHyA zqWH2-6w^YmOy(DY{VrN6ErvZREuUMko@lVbdLDq*{A+_%F>!@6Z)X9kR1VI1+Ler+ zLUPtth=u~23=CqZoAbQ`uGE_91kR(8Ie$mq1p`q|ilkJ`Y-ob_=Nl(RF=o7k{47*I)F%_XMBz9uwRH8q1o$TkV@8Pwl zzi`^7i;K6Ak7o58a_D-V0AWp;H8pSjbEs$4BxoJkkC6UF@QNL)0$NU;Wv0*5 z0Ld;6tm7eR%u=`hnUb)gjHbE2cP?qpo3f4w%5qM0J*W_Kl6&z4YKX?iD@=McR!gTyhpGGYj!ljQm@2GL^J70`q~4CzPv@sz`s80FgiuxjAZ zLq61rHv1O>>w1qOEbVBwGu4%LGS!!muKHJ#JjfT>g`aSn>83Af<9gM3XBdY)Yql|{ zUds}u*;5wuus)D>HmexkC?;R&*Z`yB4;k;4T*(823M&52{pOd1yXvPJ3PPK{Zs>6w zztXy*HSH0scZHn7qIsZ8y-zftJ*uIW;%&-Ka0ExdpijI&xInDg-Bv-Q#Islcbz+R! zq|xz?3}G5W@*7jSd`Hv9q^5N*yN=4?Lh=LXS^5KJC=j|AJ5Y(f_fC-c4YQNtvAvn|(uP9@5Co{dL z?7|=jqTzD8>(6Wr&(XYUEzT~-VVErf@|KeFpKjh=v51iDYN_`Kg&XLOIG;ZI8*U$@ zKig{dy?1H}UbW%3jp@7EVSD>6c%#abQ^YfcO(`)*HuvNc|j( zyUbYozBR15$nNU$0ZAE%ivo4viW?@EprUZr6oX=4Sc!-WvrpJdF`3SwopKPyX~F>L zJ>N>v=_plttTSUq6bYu({&rkq)d94m5n~Sk_MO*gY*tlkPFd2m=Pi>MK)ObVV@Sgs zmXMNMvvcAuz+<$GLR2!j4w&;{)HEkxl{$B^*)lUKIn&p5_huD6+%WDoH4`p}9mkw$ zXCPw6Y7tc%rn$o_vy>%UNBC`0@+Ih-#T05AT)ooKt?94^ROI5;6m2pIM@@tdT=&WP z{u09xEVdD}{(3v}8AYUyT82;LV%P%TaJa%f)c36?=90z>Dzk5mF2}Gs0jYCmufihid8(VFcZWs8#59;JCn{!tHu5kSBbm zL`F{COgE01gg-qcP2Lt~M9}mALg@i?TZp&i9ZM^G<3`WSDh}+Ceb3Q!QecJ|N;Xrs z{wH{D8wQ2+mEfBX#M8)-32+~q4MRVr1UaSPtw}`iwx@x=1Xv-?UT{t}w}W(J&WKAC zrZ%hssvf*T!rs}}#atryn?LB=>0U%PLwA9IQZt$$UYrSw`7++}WR7tfE~*Qg)vRrM zT;(1>Zzka?wIIz8vfrG86oc^rjM@P7^i8D~b(S23AoKYj9HBC(6kq9g`1gN@|9^xO z{~h zbxGMHqGZ@eJ17bgES?HQnwp|G#7I>@p~o2zxWkgZUYSUeB*KT{1Q z*J3xZdWt`eBsA}7(bAHNcMPZf_BZC(WUR5B8wUQa=UV^e21>|yp+uop;$+#JwXD!> zunhJVCIKgaol0AM_AwJNl}_k&q|uD?aTE@{Q*&hxZ=k_>jcwp}KwG6mb5J*pV@K+- zj*`r0WuEU_8O=m&1!|rj9FG7ad<2px63;Gl z9lJrXx$~mPnuiqIH&n$jSt*ReG}1_?r4x&iV#3e_z+B4QbhHwdjiGu^J3vcazPi`| zaty}NFSWe=TDry*a*4XB)F;KDI$5i9!!(5p@5ra4*iW;FlGFV0P;OZXF!HCQ!oLm1 zsK+rY-FnJ?+yTBd0}{*Y6su|hul)wJ>RNQ{eau*;wWM{vWM`d0dTC-}Vwx6@cd#P? zx$Qyk^2*+_ZnMC}q0)+hE-q)PKoox#;pc%DNJ&D5+if6X4j~p$A7-s&AjDkSEV)aM z(<3UOw*&f)+^5F0Mpzw3zB1ZHl*B?C~Cx) zuNg*>5RM9F5{EpU@a2E7hAE`m<89wbQ2Lz&?Egu-^sglNXG5Q;{9n(%&*kEb0vApd zRHrY@22=pkFN81%x)~acZeu`yvK zovAVJNykgxqkEr^hZksHkpxm>2I8FTu2%+XLs@?ym0n;;A~X>i32{g6NOB@o4lk8{ zB}7Z2MNAJi>9u=y%s4QUXaNdt@SlAZr54!S6^ETWoik6gw=k-itu_}Yl_M9!l+Rbv z(S&WD`{_|SE@@(|Wp7bq1Zq}mc4JAG?mr2WN~6}~u`7M_F@J9`sr0frzxfuqSF~mA z$m$(TWAuCIE99yLSwi%R)8geQhs;6VBlRhJb(4Cx zu)QIF%_W9+21xI45U>JknBRaZ9nYkgAcK6~E|Zxo!B&z9zQhjsi^fgwZI%K@rYbMq znWBXg1uCZ+ljGJrsW7@x3h2 z;kn!J!bwCeOrBx;oPkZ}FeP%wExyf4=XMp)N8*lct~SyfK~4^-75EZFpHYO5AnuRM z!>u?>Vj3+j=uiHc<=cD~JWRphDSwxFaINB42-{@ZJTWe85>-RcQ&U%?wK)vjz z5u5fJYkck##j(bP7W0*RdW#BmAIK`D3=(U~?b`cJ&U2jHj}?w6 z_4BM)#EoJ6)2?pcR4AqBd)qAUn@RtNQq})FIQoBK4ie+GB(Vih2D|Ds>RJo2zE~C- z7mI)7p)5(-O6JRh6a@VZ5~piVC+Xv=O-)=0eTMSJsRE^c1@bPQWlr}E31VqO-%739 zdcmE{`1m;5LH8w|7euK>>>U#Iod8l1yivC>;YWsg=z#07E%cU9x1yw#3l6AcIm%79 zGi^zH6rM#CZMow(S(8dcOq#5$kbHnQV6s?MRsU3et!!YK5H?OV9vf2qy-UHCn>}2d zTwI(A_fzmmCtE@10yAGgU7R&|Fl$unZJ_^0BgCEDE6(B*SzfkapE9#0N6adc>}dtH zJ#nt^F~@JMJg4=Pv}OdUHyPt-<<9Z&c0@H@^4U?KwZM&6q0XjXc$>K3c&3iXLD9_%(?)?2kmZ=Ykb;)M`Tw=%_d=e@9eheGG zk0<`4so}r={C{zr|6+_1mA_=a56(XyJq||g6Es1E6%fPg#l{r+vk9;)r6VB7D84nu zE0Z1EIxH{Y@}hT+|#$0xn+CdMy6Uhh80eK~nfMEIpM z`|G1v!USmx81nY8XkhEOSWto}pc#{Ut#`Pqb}9j$FpzkQ7`0<-@5D_!mrLah98Mpr zz(R7;ZcaR-$aKqUaO!j z=7QT;Bu0cvYBi+LDfE_WZ`e@YaE_8CCxoRc?Y_!Xjnz~Gl|aYjN2&NtT5v4#q3od2 zkCQZHe#bn(5P#J**Fj4Py%SaaAKJsmV6}F_6Z7V&n6QAu8UQ#9{gkq+tB=VF_Q6~^ zf(hXvhJ#tC(eYm6g|I>;55Lq-;yY*COpTp4?J}hGQ42MIVI9CgEC{3hYw#CZfFKVG zgD(steIg8veyqX%pYMoulq zMUmbj8I`t>mC`!kZ@A>@PYXy*@NprM@e}W2Q+s?XIRM-U1FHVLM~c60(yz1<46-*j zW*FjTnBh$EzI|B|MRU11^McTPIGVJrzozlv$1nah_|t4~u}Ht^S1@V8r@IXAkN;lH z_s|WHlN90k4X}*#neR5bX%}?;G`X!1#U~@X6bbhgDYKJK17~oFF0&-UB#()c$&V<0 z7o~Pfye$P@$)Lj%T;axz+G1L_YQ*#(qO zQND$QTz(~8EF1c3<%;>dAiD$>8j@7WS$G_+ktE|Z?Cx<}HJb=!aChR&4z ziD&FwsiZ)wxS4k6KTLn>d~!DJ^78yb>?Trmx;GLHrbCBy|Bip<@sWdAfP0I~;(Ybr zoc-@j?wA!$ zIP0m3;LZy+>dl#&Ymws@7|{i1+OFLYf@+8+)w}n?mHUBCqg2=-Hb_sBb?=q))N7Ej zDIL9%@xQFOA!(EQmchHiDN%Omrr;WvlPIN5gW;u#ByV)x2aiOd2smy&;vA2+V!u|D zc~K(OVI8} z0t|e0OQ7h23e01O;%SJ}Q#yeDh`|jZR7j-mL(T4E;{w^}2hzmf_6PF|`gWVj{I?^2T3MBK>{?nMXed4kgNox2DP!jvP9v`;pa6AV)OD zDt*Vd-x7s{-;E?E5}3p-V;Y#dB-@c5vTWfS7<=>E+tN$ME`Z7K$px@!%{5{uV`cH80|IzU! zDs9=$%75P^QKCRQ`mW7$q9U?mU@vrFMvx)NNDrI(uk>xwO;^($EUvqVev#{W&GdtR z0ew;Iwa}(-5D28zABlC{WnN{heSY5Eq5Fc=TN^9X#R}0z53!xP85#@;2E=&oNYHyo z46~#Sf!1M1X!rh}ioe`>G2SkPH{5nCoP`GT@}rH;-LP1Q7U_ypw4+lwsqiBql80aA zJE<(88yw$`xzNiSnU(hsyJqHGac<}{Av)x9lQ=&py9djsh0uc}6QkmKN3{P!TEy;P zzLDVQj4>+0r<9B0owxBt5Uz`!M_VSS|{(?`_e+qD9b=vZHoo6>?u;!IP zM7sqoyP>kWY|=v06gkhaGRUrO8n@zE?Yh8$om@8%=1}*!2wdIWsbrCg@;6HfF?TEN z+B_xtSvT6H3in#8e~jvD7eE|LTQhO_>3b823&O_l$R$CFvP@3~)L7;_A}JpgN@ax{ z2d9Ra)~Yh%75wsmHK8e87yAn-ZMiLo6#=<&PgdFsJw1bby-j&3%&4=9dQFltFR(VB z@=6XmyNN4yr^^o$ON8d{PQ=!OX17^CrdM~7D-;ZrC!||<+FEOxI_WI3 zCA<35va%4v>gcEX-@h8esj=a4szW7x z{0g$hwoWRQG$yK{@3mqd-jYiVofJE!Wok1*nV7Gm&Ssq#hFuvj1sRyHg(6PFA5U*Q z8Rx>-blOs=lb`qa{zFy&n4xY;sd$fE+<3EI##W$P9M{B3c3Si9gw^jlPU-JqD~Cye z;wr=XkV7BSv#6}DrsXWFJ3eUNrc%7{=^sP>rp)BWKA9<}^R9g!0q7yWlh;gr_TEOD|#BmGq<@IV;ue zg+D2}cjpp+dPf&Q(36sFU&K8}hA85U61faW&{lB`9HUl-WWCG|<1XANN3JVAkRYvr5U z4q6;!G*MTdSUt*Mi=z_y3B1A9j-@aK{lNvxK%p23>M&=KTCgR!Ee8c?DAO2_R?Bkaqr6^BSP!8dHXxj%N1l+V$_%vzHjq zvu7p@%Nl6;>y*S}M!B=pz=aqUV#`;h%M0rUHfcog>kv3UZAEB*g7Er@t6CF8kHDmK zTjO@rejA^ULqn!`LwrEwOVmHx^;g|5PHm#B6~YD=gjJ!043F+&#_;D*mz%Q60=L9O zve|$gU&~As5^uz@2-BfQ!bW)Khn}G+Wyjw-19qI#oB(RSNydn0t~;tAmK!P-d{b-@ z@E5|cdgOS#!>%#Rj6ynkMvaW@37E>@hJP^82zk8VXx|3mR^JCcWdA|t{0nPmYFOxN z55#^-rlqobcr==<)bi?E?SPymF*a5oDDeSdO0gx?#KMoOd&G(2O@*W)HgX6y_aa6i zMCl^~`{@UR`nMQE`>n_{_aY5nA}vqU8mt8H`oa=g0SyiLd~BxAj2~l$zRSDHxvDs; zI4>+M$W`HbJ|g&P+$!U7-PHX4RAcR0szJ*(e-417=bO2q{492SWrqDK+L3#ChUHtz z*@MP)e^%@>_&#Yk^1|tv@j4%3T)diEXATx4K*hcO`sY$jk#jN5WD<=C3nvuVs zRh||qDHnc~;Kf59zr0;c7VkVSUPD%NnnJC_l3F^#f_rDu8l}l8qcAz0FFa)EAt32I zUy_JLIhU_J^l~FRH&6-iv zSpG2PRqzDdMWft>Zc(c)#tb%wgmWN%>IOPmZi-noqS!^Ft zb81pRcQi`X#UhWK70hy4tGW1mz|+vI8c*h@fFGJtW3r>qV>1Z0r|L>7I3un^gcep$ zAAWfZHRvB|E*kktY$qQP_$YG60C z@X~tTQjB3%@`uz!qxtxF+LE!+=nrS^07hn`EgAp!h|r03h7B!$#OZW#ACD+M;-5J!W+{h z|6I;5cNnE(Y863%1(oH}_FTW})8zYb$7czPg~Szk1+_NTm6SJ0MS_|oSz%e(S~P-& zSFp;!k?uFayytV$8HPwuyELSXOs^27XvK-DOx-Dl!P|28DK6iX>p#Yb%3`A&CG0X2 zS43FjN%IB}q(!hC$fG}yl1y9W&W&I@KTg6@K^kpH8=yFuP+vI^+59|3%Zqnb5lTDAykf9S#X`3N(X^SpdMyWQGOQRjhiwlj!0W-yD<3aEj^ z&X%=?`6lCy~?`&WSWt?U~EKFcCG_RJ(Qp7j=$I%H8t)Z@6Vj zA#>1f@EYiS8MRHZphpMA_5`znM=pzUpBPO)pXGYpQ6gkine{ z6u_o!P@Q+NKJ}k!_X7u|qfpAyIJb$_#3@wJ<1SE2Edkfk9C!0t%}8Yio09^F`YGzp zaJHGk*-ffsn85@)%4@`;Fv^8q(-Wk7r=Q8pT&hD`5(f?M{gfzGbbwh8(}G#|#fDuk z7v1W)5H9wkorE0ZZjL0Q1=NRGY>zwgfm81DdoaVwNH;or{{e zSyybt)m<=zXoA^RALYG-2touH|L*BLvmm9cdMmn+KGopyR@4*=&0 z&4g|FLoreZOhRmh=)R0bg~T2(8V_q7~42-zvb)+y959OAv!V$u(O z3)%Es0M@CRFmG{5sovIq4%8Ahjk#*5w{+)+MWQoJI_r$HxL5km1#6(e@{lK3Udc~n z0@g`g$s?VrnQJ$!oPnb?IHh-1qA`Rz$)Ai<6w$-MJW-gKNvOhL+XMbE7&mFt`x1KY z>k4(!KbbpZ`>`K@1J<(#vVbjx@Z@(6Q}MF#Mnbr-f55)vXj=^j+#)=s+ThMaV~E`B z8V=|W_fZWDwiso8tNMTNse)RNBGi=gVwgg%bOg8>mbRN%7^Um-7oj4=6`$|(K7!+t^90a{$1 z8Z>}<#!bm%ZEFQ{X(yBZMc>lCz0f1I2w9SquGh<9<=AO&g6BZte6hn>Qmvv;Rt)*c zJfTr2=~EnGD8P$v3R|&1RCl&7)b+`=QGapiPbLg_pxm`+HZurtFZ;wZ=`Vk*do~$wBxoW&=j0OTbQ=Q%S8XJ%~qoa3Ea|au5 zo}_(P;=!y z-AjFrERh%8la!z6Fn@lR?^E~H12D? z8#ht=1F;7@o4$Q8GDj;sSC%Jfn01xgL&%F2wG1|5ikb^qHv&9hT8w83+yv&BQXOQy zMVJSBL(Ky~p)gU3#%|blG?I zR9rP^zUbs7rOA0X52Ao=GRt@C&zlyjNLv-}9?*x{y(`509qhCV*B47f2hLrGl^<@S zuRGR!KwHei?!CM10pBKpDIoBNyRuO*>3FU?HjipIE#B~y3FSfOsMfj~F9PNr*H?0o zHyYB^G(YyNh{SxcE(Y-`x5jFMKb~HO*m+R%rq|ic4fzJ#USpTm;X7K+E%xsT_3VHK ze?*uc4-FsILUH;kL>_okY(w`VU*8+l>o>JmiU#?2^`>arnsl#)*R&nf_%>A+qwl%o z{l(u)M?DK1^mf260_oteV3#E_>6Y4!_hhVDM8AI6MM2V*^_M^sQ0dmHu11fy^kOqX zqzps-c5efIKWG`=Es(9&S@K@)ZjA{lj3ea7_MBPk(|hBFRjHVMN!sNUkrB;(cTP)T97M$ z0Dtc&UXSec<+q?y>5=)}S~{Z@ua;1xt@=T5I7{`Z=z_X*no8s>mY;>BvEXK%b`a6(DTS6t&b!vf_z#HM{Uoy z_5fiB(zpkF{})ruka$iX*~pq1ZxD?q68dIoIZSVls9kFGsTwvr4{T_LidcWtt$u{k zJlW7moRaH6+A5hW&;;2O#$oKyEN8kx z`LmG)Wfq4ykh+q{I3|RfVpkR&QH_x;t41UwxzRFXt^E2B$domKT@|nNW`EHwyj>&< zJatrLQ=_3X%vd%nHh^z@vIk(<5%IRAa&Hjzw`TSyVMLV^L$N5Kk_i3ey6byDt)F^U zuM+Ub4*8+XZpnnPUSBgu^ijLtQD>}K;eDpe1bNOh=fvIfk`&B61+S8ND<(KC%>y&? z>opCnY*r5M+!UrWKxv0_QvTlJc>X#AaI^xoaRXL}t5Ej_Z$y*|w*$6D+A?Lw-CO-$ zitm^{2Ct82-<0IW)0KMNvJHgBrdsIR0v~=H?n6^}l{D``Me90`^o|q!olsF?UX3YS zq^6Vu>Ijm>>PaZI8G@<^NGw{Cx&%|PwYrfwR!gX_%AR=L3BFsf8LxI|K^J}deh0Zd zV?$3r--FEX`#INxsOG6_=!v)DI>0q|BxT)z-G6kzA01M?rba+G_mwNMQD1mbVbNTW zmBi*{s_v_Ft9m2Avg!^78(QFu&n6mbRJ2bAv!b;%yo{g*9l2)>tsZJOOp}U~8VUH`}$8p_}t*XIOehezolNa-a2x0BS})Y9}& z*TPgua{Ewn-=wVrmJUeU39EKx+%w%=ixQWKDLpwaNJs65#6o7Ln7~~X+p_o2BR1g~ zVCfxLzxA{HlWAI6^H;`juI=&r1jQrUv_q0Z1Ja-tjdktrrP>GOC*#p?*xfQU5MqjM zsBe!9lh(u8)w$e@Z|>aUHI5o;MGw*|Myiz3-f0;pHg~Q#%*Kx8MxH%AluVXjG2C$) zWL-K63@Q`#y9_k_+}eR(x4~dp7oV-ek0H>Igy8p#i4GN{>#v=pFYUQT(g&b$OeTy- zX_#FDgNF8XyfGY6R!>inYn8IR2RDa&O!(6NIHrC0H+Qpam1bNa=(`SRKjixBTtm&e z`j9porEci!zdlg1RI0Jw#b(_Tb@RQK1Zxr_%7SUeH6=TrXt3J@js`4iDD0=I zoHhK~I7^W8^Rcp~Yaf>2wVe|Hh1bXa_A{oZ9eG$he;_xYvTbTD#moBy zY57-f2Ef1TP^lBi&p5_s7WGG9|0T}dlfxOxXvScJO1Cnq`c`~{Dp;{;l<-KkCDE+p zmexJkd}zCgE{eF=)K``-qC~IT6GcRog_)!X?fK^F8UDz$(zFUrwuR$qro5>qqn>+Z z%<5>;_*3pZ8QM|yv9CAtrAx;($>4l^_$_-L*&?(77!-=zvnCVW&kUcZMb6;2!83si z518Y%R*A3JZ8Is|kUCMu`!vxDgaWjs7^0j(iTaS4HhQ)ldR=r)_7vYFUr%THE}cPF z{0H45FJ5MQW^+W>P+eEX2kLp3zzFe*-pFVAdDZRybv?H|>`9f$AKVjFWJ=wegO7hO zOIYCtd?Vj{EYLT*^gl35|HbMX|NAEUf2ra9dy1=O;figB>La=~eA^#>O6n4?EMugV zbbt{Dbfef5l^(;}5kZ@!XaWwF8z0vUr6r|+QN*|WpF z^*osUHzOnE$lHuWYO$G7>}Y)bY0^9UY4eDV`E{s+{}Z$O$2*lMEYl zTA`ki(<0(Yrm~}15V-E^e2W6`*`%ydED-3G@$UFm6$ZtLx z+av`BhsHcAWqdxPWfu2*%{}|Sptax4_=NpDMeWy$* zZM6__s`enB$~0aT1BU^2k`J9F%+n+lL_|8JklWOCVYt*0%o*j4w1CsB_H^tVpYT_LLyKuyk=CV6~1M<7~^FylL*+AIFf3h>J=x$ygY-BG}4LJ z8XxYPY!v7dO3PVwEoY=`)6krokmR^|Mg5ztX_^#QR}ibr^X-|_St#rtv3gukh0(#A=};NPlNz57ZDFJ9hf#NP50zS)+Fo=StX)i@ zWS?W}i6LjB>kAB~lupAPyIjFb)izFgRq*iS*(Jt509jNr3r72{Gj`5DGoj;J&k5G@Rm!dJ($ox>SbxR)fc zz|Phug;~A7!p@?|mMva@rWuf2fSDK_ZxN3vVmlYz>rrf?LpiNs)^z!y{As@`55JC~ zS*GD3#N-ptY!2<613UelAJ;M4EEI$dm)`8#n$|o{ce^dlyoUY3bsy2hgnj-;ovubb zg2h1rZA6Ot}K_cpYBpIuF&CyK~5R0Wv;kG|3A^8K3nk{rw$Be8u@aos#qvKQKJyVU$cX6biw&Ep#+q7upFX z%qo&`WZ){<%zh@BTl{MO@v9#;t+cb7so0Uz49Fmo1e4>y!vUyIHadguZS0T7-x#_drMXz*16*c zymR0u^`ZQpXN}2ofegbpSedL%F9aypdQcrzjzPlBW0j zMlPzC&ePZ@Cq!?d%9oQNEg0`rHALm8l#lUdXMVEqDvb(AID~H(?H9z!e9G98fG@IzhajKr)3{L_Clu1(Bwg`RM!-(MOuZi zbeDsj9I3(~EITsE=3Z)a|l_rn8W92U0DB70gF7YYfO0j!)h?QobY1lSR>0 z_TVw@$eP~3k8r9;%g%RlZzCJ2%f}DvY`rsZ$;ak&^~-`i%B%+O!pnADeVyV!dHj|} zzOj#q4eRx9Q8c2Z7vy9L&fGLj+3_?fp}+8o`Xpwyi(81H|7P8#65%FIS*lOi={o&v z4NV$xu7az4Nb50dRGZv<tdZCx4Ek<_o3!mAT} zL5l*|K3Qr-)W8paaG z&R6{ped_4e2cy}ejD0!dt{*PaC*^L@eB%(1Fmc%Y#4)~!jF#lCGfj#E??4LG-T;!M z>Uha}f;W>ib_ZL-I7-v9KZQls^G!-JmL^w;=^}?!RXK;m4$#MwI2AH-l7M2-0 zVMK8k^+4+>2S0k^N_40EDa#`7c;2!&3-o6MHsnBfRnq@>E@)=hDulVq-g5SQWDWbt zj6H5?QS2gRZ^Zvbs~cW|8jagJV|;^zqC0e=D1oUsQPJ3MCb+eRGw(XgIY9y8v_tXq z9$(xWntWpx_Uronmvho{JfyYdV{L1N$^s^|-Nj`Ll`lUsiWTjm&8fadUGMXreJGw$ zQ**m+Tj|(XG}DyUKY~2?&9&n6SJ@9VKa9Hcayv{ar^pNr0WHy zP$bQv&8O!vd;GoT!pLwod-42qB^`m!b7nP@YTX}^+1hzA$}LSLh}Ln|?`%8xGMazw z8WT!LoYJ-Aq3=2p6ZSP~uMgSSWv3f`&-I06tU}WhZsA^6nr&r17hjQIZE>^pk=yZ% z06}dfR$85MjWJPq)T?OO(RxoaF+E#4{Z7)i9}Xsb;Nf+dzig61HO;@JX1Lf9)R5j9)Oi6vPL{H z&UQ9ln=$Q8jnh6-t;`hKM6pHftdd?$=1Aq16jty4-TF~`Gx=C&R242uxP{Y@Q~%O3 z*(16@x+vJsbW@^3tzY=-5MHi#(kB};CU%Ep`mVY1j$MAPpYJBB3x$ue`%t}wZ-@CG z(lBv36{2HMjxT)2$n%(UtHo{iW9>4HX4>)%k8QNnzIQYXrm-^M%#Qk%9odbUrZDz1YPdY`2Z4w~p!5tb^m(mUfk}kZ9+EsmenQ)5iwiaulcy zCJ#2o4Dz?@%)aAKfVXYMF;3t@aqNh2tBBlBkCdj`F31b=h93y(46zQ-YK@+zX5qM9 z&=KkN&3@Ptp*>UD$^q-WpG|9O)HBXz{D>p!`a36aPKkgz7uxEo0J>-o+4HHVD9!Hn z${LD0d{tuGsW*wvZoHc8mJroAs(3!FK@~<}Pz1+vY|Gw}Lwfxp{4DhgiQ_SSlV)E| zZWZxYZLu2EB1=g_y@(ieCQC_1?WNA0J0*}eMZfxCCs>oL;?kHdfMcKB+A)Qull$v( z2x6(38utR^-(?DG>d1GyU()8>ih3ud0@r&I$`ZSS<*1n6(76=OmP>r_JuNCdS|-8U zxGKXL1)Lc2kWY@`_kVBt^%7t9FyLVYX(g%a6>j=yURS1!V<9ieT$$5R+yT!I>}jI5 z?fem|T=Jq;BfZmsvqz_Ud*m5;&xE66*o*S22vf-L+MosmUPPA}~wy`kntf8rIeP-m;;{`xe}9E~G7J!PYoVH_$q~NzQab?F8vWUja5BJ!T5%5IpyqI#Dkps0B;gQ*z?c#N>spFw|wRE$gY?y4wQbJ zku2sVLh({KQz6e0yo+X!rV#8n8<;bHWd{ZLL_(*9Oi)&*`LBdGWz>h zx+p`Wi00u#V$f=CcMmEmgFjw+KnbK3`mbaKfoCsB{;Q^oJgj*LWnd_(dk9Kcssbj` z?*g8l`%{*LuY!Ls*|Tm`1Gv-tRparW8q4AK(5pfJFY5>@qO( zcY>pt*na>LlB^&O@YBDnWLE$x7>pMdSmb-?qMh79eB+Wa{)$%}^kX@Z3g>fytppz! zl%>pMD(Yw+5=!UgYHLD69JiJ;YhiGeEyZM$Au{ff;i zCBbNQfO{d!b7z^F732XX&qhEsJA1UZtJjJEIPyDq+F`LeAUU_4`%2aTX#3NG3%W8u zC!7OvlB?QJ4s2#Ok^_8SKcu&pBd}L?vLRT8Kow#xARt`5&Cg=ygYuz>>c z4)+Vv$;<$l=is&E{k&4Lf-Lzq#BHuWc;wDfm4Fbd5Sr!40s{UpKT$kzmUi{V0t1yp zPOf%H8ynE$x@dQ_!+ISaI}#%72UcYm7~|D*(Fp8xiFAj$CmQ4oH3C+Q8W=Y_9Sp|B z+k<%5=y{eW=YvTivV(*KvC?qxo)xqcEU9(Te=?ITts~;xA0Jph-vpd4@Zw#?r2!`? zB3#XtIY^wxrpjJv&(7Xjvm>$TIg2ZC&+^j(gT0R|&4cb)=92-2Hti1`& z=+M;*O%_j3>9zW|3h{0Tfh5i)Fa;clGNJpPRcUmgErzC{B+zACiPHbff3SmsCZ&X; zp=tgI=zW-t(5sXFL8;ITHw0?5FL3+*z5F-KcLN130l=jAU6%F=DClRPrzO|zY+HD`zlZ-)JT}X?2g!o zxg4Ld-mx6&*-N0-MQ(z+zJo8c`B39gf{-h2vqH<=^T&o1Dgd>4BnVht+JwLcrjJl1 zsP!8`>3-rSls07q2i1hScM&x0lQyBbk(U=#3hI7Bkh*kj6H*&^p+J?OMiT_3*vw5R zEl&p|QQHZq6f~TlAeDGy(^BC0vUK?V&#ezC0*#R-h}_8Cw8-*${mVfHssathC8%VA zUE^Qd!;Rvym%|f@?-!sEj|73Vg8!$$zj_QBZAOraF5HCFKl=(Ac|_p%-P;6z<2WSf zz(9jF2x7ZR{w+p)ETCW06PVt0YnZ>gW9^sr&~`%a_7j-Ful~*4=o|&TM@k@Px2z>^ t{*Ed16F~3V5p+(suF-++X8+nHtT~NSfJ>UC3v)>lEpV}<+rIR_{{yMcG_L>v literal 0 HcmV?d00001 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..aa991fc --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..1b6c787 --- /dev/null +++ b/gradlew @@ -0,0 +1,234 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +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" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit + +APP_NAME="Gradle" +APP_BASE_NAME=${0##*/} + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +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 + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# 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 +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + 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 new file mode 100644 index 0000000..ac1b06f --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@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=. +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%" == "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%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/sample-app/build.gradle b/sample-app/build.gradle new file mode 100644 index 0000000..9b29e67 --- /dev/null +++ b/sample-app/build.gradle @@ -0,0 +1,15 @@ +plugins { + id 'java-library' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + implementation rootProject +} + diff --git a/sample-app/src/main/java/sample/App.java b/sample-app/src/main/java/sample/App.java new file mode 100644 index 0000000..4e806ec --- /dev/null +++ b/sample-app/src/main/java/sample/App.java @@ -0,0 +1,9 @@ +package sample; + +import java.lang.String; + +public final class App { + public static void main(String[] args) { + // import com.squidex.api.SquidexApiClient + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..aed36fe --- /dev/null +++ b/settings.gradle @@ -0,0 +1 @@ +include 'sample-app' \ No newline at end of file diff --git a/src/main/java/com/squidex/api/SquidexApiClient.java b/src/main/java/com/squidex/api/SquidexApiClient.java new file mode 100644 index 0000000..45d20ba --- /dev/null +++ b/src/main/java/com/squidex/api/SquidexApiClient.java @@ -0,0 +1,193 @@ +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 new file mode 100644 index 0000000..fc6ea73 --- /dev/null +++ b/src/main/java/com/squidex/api/SquidexApiClientBuilder.java @@ -0,0 +1,35 @@ +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/core/ClientOptions.java b/src/main/java/com/squidex/api/core/ClientOptions.java new file mode 100644 index 0000000..d7072a3 --- /dev/null +++ b/src/main/java/com/squidex/api/core/ClientOptions.java @@ -0,0 +1,92 @@ +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 = headers; + 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 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 ClientOptions build() { + return new ClientOptions(environment, headers, headerSuppliers, new OkHttpClient(), this.appName); + } + } +} diff --git a/src/main/java/com/squidex/api/core/Environment.java b/src/main/java/com/squidex/api/core/Environment.java new file mode 100644 index 0000000..26e5194 --- /dev/null +++ b/src/main/java/com/squidex/api/core/Environment.java @@ -0,0 +1,19 @@ +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/ObjectMappers.java b/src/main/java/com/squidex/api/core/ObjectMappers.java new file mode 100644 index 0000000..5aa1c1e --- /dev/null +++ b/src/main/java/com/squidex/api/core/ObjectMappers.java @@ -0,0 +1,17 @@ +package com.squidex.api.core; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .build(); + + private ObjectMappers() {} +} diff --git a/src/main/java/com/squidex/api/core/RequestOptions.java b/src/main/java/com/squidex/api/core/RequestOptions.java new file mode 100644 index 0000000..368c13e --- /dev/null +++ b/src/main/java/com/squidex/api/core/RequestOptions.java @@ -0,0 +1,37 @@ +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/Suppliers.java b/src/main/java/com/squidex/api/core/Suppliers.java new file mode 100644 index 0000000..0e34ed1 --- /dev/null +++ b/src/main/java/com/squidex/api/core/Suppliers.java @@ -0,0 +1,20 @@ +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/resources/apps/AppsClient.java b/src/main/java/com/squidex/api/resources/apps/AppsClient.java new file mode 100644 index 0000000..c5767aa --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/AppsClient.java @@ -0,0 +1,1242 @@ +package com.squidex.api.resources.apps; + +import com.fasterxml.jackson.core.type.TypeReference; +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.InputStream; +import java.util.HashMap; +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 AppsClient { + protected final ClientOptions clientOptions; + + public AppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public AssetScriptsDto getAssetScripts() { + return getAssetScripts(null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetScriptsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetScriptsDto putAssetScripts(UpdateAssetScriptsDto request) { + return putAssetScripts(request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getQuery().isPresent()) { + _requestBodyProperties.put("query", request.getQuery()); + } + if (request.getQueryPre().isPresent()) { + _requestBodyProperties.put("queryPre", request.getQueryPre()); + } + if (request.getCreate().isPresent()) { + _requestBodyProperties.put("create", request.getCreate()); + } + if (request.getUpdate().isPresent()) { + _requestBodyProperties.put("update", request.getUpdate()); + } + if (request.getAnnotate().isPresent()) { + _requestBodyProperties.put("annotate", request.getAnnotate()); + } + if (request.getMove().isPresent()) { + _requestBodyProperties.put("move", request.getMove()); + } + if (request.getDelete().isPresent()) { + _requestBodyProperties.put("delete", request.getDelete()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetScriptsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ClientsDto getClients() { + return getClients(null); + } + + public ClientsDto getClients(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/apps") + .addPathSegment(clientOptions.appName()) + .addPathSegments("clients") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ClientsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ClientsDto postClient(CreateClientDto request) { + return postClient(request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("id", request.getId()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ClientsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ClientsDto putClient(String id, UpdateClientDto request) { + return putClient(id, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getName().isPresent()) { + _requestBodyProperties.put("name", request.getName()); + } + if (request.getRole().isPresent()) { + _requestBodyProperties.put("role", request.getRole()); + } + if (request.getAllowAnonymous().isPresent()) { + _requestBodyProperties.put("allowAnonymous", request.getAllowAnonymous()); + } + if (request.getApiCallsLimit().isPresent()) { + _requestBodyProperties.put("apiCallsLimit", request.getApiCallsLimit()); + } + if (request.getApiTrafficLimit().isPresent()) { + _requestBodyProperties.put("apiTrafficLimit", request.getApiTrafficLimit()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ClientsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ClientsDto deleteClient(String id) { + return deleteClient(id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ClientsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContributorsDto getContributors() { + return getContributors(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContributorsDto postContributor(AssignContributorDto request) { + return postContributor(request, 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContributorsDto deleteMyself() { + return deleteMyself(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContributorsDto deleteContributor(String id) { + return deleteContributor(id, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public InputStream getImage() { + return getImage(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return _response.body().byteStream(); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppDto uploadImage(File file, AppsUploadImageRequest request) { + return uploadImage(file, request, 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 _multipartBody = new MultipartBody.Builder().setType(MultipartBody.FORM); + _multipartBody.addFormDataPart("file", null, RequestBody.create(null, file)); + RequestBody _requestBody = _multipartBody.build(); + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppDto deleteImage() { + return deleteImage(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppLanguagesDto getLanguages() { + return getLanguages(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppLanguagesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppLanguagesDto postLanguage(AddLanguageDto request) { + return postLanguage(request, 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("language", request.getLanguage()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppLanguagesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppLanguagesDto putLanguage(String language, UpdateLanguageDto request) { + return putLanguage(language, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getIsMaster().isPresent()) { + _requestBodyProperties.put("isMaster", request.getIsMaster()); + } + if (request.getIsOptional().isPresent()) { + _requestBodyProperties.put("isOptional", request.getIsOptional()); + } + if (request.getFallback().isPresent()) { + _requestBodyProperties.put("fallback", request.getFallback()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppLanguagesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppLanguagesDto deleteLanguage(String language) { + return deleteLanguage(language, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppLanguagesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RolesDto getRoles() { + return getRoles(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RolesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RolesDto postRole(AddRoleDto request) { + return postRole(request, 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("name", request.getName()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RolesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getPermissions() { + return getPermissions(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RolesDto putRole(String roleName, UpdateRoleDto request) { + return putRole(roleName, request, 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("permissions", request.getPermissions()); + if (request.getProperties().isPresent()) { + _requestBodyProperties.put("properties", request.getProperties()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RolesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RolesDto deleteRole(String roleName) { + return deleteRole(roleName, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RolesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getApps() { + return getApps(null); + } + + public List getApps(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/apps") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppDto postApp(CreateAppDto request) { + return postApp(request, null); + } + + public AppDto postApp(CreateAppDto request, RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/apps") + .build(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("name", request.getName()); + if (request.getTemplate().isPresent()) { + _requestBodyProperties.put("template", request.getTemplate()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getTeamApps(String team) { + return getTeamApps(team, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppDto getApp() { + return getApp(null); + } + + public AppDto getApp(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/apps") + .addPathSegment(clientOptions.appName()) + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppDto putApp(UpdateAppDto request) { + return putApp(request, null); + } + + public AppDto putApp(UpdateAppDto request, RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/apps") + .addPathSegment(clientOptions.appName()) + .build(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getLabel().isPresent()) { + _requestBodyProperties.put("label", request.getLabel()); + } + if (request.getDescription().isPresent()) { + _requestBodyProperties.put("description", request.getDescription()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteApp() { + deleteApp(null); + } + + public void deleteApp(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/apps") + .addPathSegment(clientOptions.appName()) + .build(); + Request _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppDto putAppTeam(TransferToTeamDto request) { + return putAppTeam(request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getTeamId().isPresent()) { + _requestBodyProperties.put("teamId", request.getTeamId()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppSettingsDto getSettings() { + return getSettings(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppSettingsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AppSettingsDto putSettings(UpdateAppSettingsDto request) { + return putSettings(request, 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("patterns", request.getPatterns()); + _requestBodyProperties.put("editors", request.getEditors()); + if (request.getHideScheduler().isPresent()) { + _requestBodyProperties.put("hideScheduler", request.getHideScheduler()); + } + if (request.getHideDateTimeModeButton().isPresent()) { + _requestBodyProperties.put("hideDateTimeModeButton", request.getHideDateTimeModeButton()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AppSettingsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public WorkflowsDto getWorkflows() { + return getWorkflows(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), WorkflowsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public WorkflowsDto postWorkflow(AddWorkflowDto request) { + return postWorkflow(request, 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("name", request.getName()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), WorkflowsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public WorkflowsDto putWorkflow(String id, UpdateWorkflowDto request) { + return putWorkflow(id, 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getName().isPresent()) { + _requestBodyProperties.put("name", request.getName()); + } + _requestBodyProperties.put("steps", request.getSteps()); + if (request.getSchemaIds().isPresent()) { + _requestBodyProperties.put("schemaIds", request.getSchemaIds()); + } + _requestBodyProperties.put("initial", request.getInitial()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), WorkflowsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public WorkflowsDto deleteWorkflow(String id) { + return deleteWorkflow(id, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), WorkflowsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..5edc443 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/AddLanguageDto.java @@ -0,0 +1,89 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "AddLanguageDto{" + "language: " + language + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..ca99cd5 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/AddRoleDto.java @@ -0,0 +1,89 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "AddRoleDto{" + "name: " + name + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..085ecce --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/AddWorkflowDto.java @@ -0,0 +1,89 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "AddWorkflowDto{" + "name: " + name + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..4f409c3 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/AppsUploadImageRequest.java @@ -0,0 +1,16 @@ +package com.squidex.api.resources.apps.requests; + +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 "AppsUploadImageRequest{" + "}"; + } +} 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 new file mode 100644 index 0000000..1f2820e --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/CreateAppDto.java @@ -0,0 +1,126 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "CreateAppDto{" + "name: " + name + ", template: " + template + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..afd01b9 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/CreateClientDto.java @@ -0,0 +1,89 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "CreateClientDto{" + "id: " + id + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..108c045 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/TransferToTeamDto.java @@ -0,0 +1,79 @@ +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 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 "TransferToTeamDto{" + "teamId: " + teamId + "}"; + } + + 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 new file mode 100644 index 0000000..e707e07 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppDto.java @@ -0,0 +1,104 @@ +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 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 "UpdateAppDto{" + "label: " + label + ", description: " + description + "}"; + } + + 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 new file mode 100644 index 0000000..719d8d7 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/UpdateAppSettingsDto.java @@ -0,0 +1,178 @@ +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.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 "UpdateAppSettingsDto{" + "patterns: " + patterns + ", editors: " + editors + ", hideScheduler: " + + hideScheduler + ", hideDateTimeModeButton: " + hideDateTimeModeButton + "}"; + } + + 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 new file mode 100644 index 0000000..f3ab0cd --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/UpdateAssetScriptsDto.java @@ -0,0 +1,243 @@ +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 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 "UpdateAssetScriptsDto{" + "query: " + query + ", queryPre: " + queryPre + ", create: " + create + + ", update: " + update + ", annotate: " + annotate + ", move: " + move + ", delete: " + delete + "}"; + } + + 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 new file mode 100644 index 0000000..a0c7a84 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/UpdateClientDto.java @@ -0,0 +1,189 @@ +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 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 "UpdateClientDto{" + "name: " + name + ", role: " + role + ", allowAnonymous: " + allowAnonymous + + ", apiCallsLimit: " + apiCallsLimit + ", apiTrafficLimit: " + apiTrafficLimit + "}"; + } + + 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 new file mode 100644 index 0000000..9592780 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/UpdateLanguageDto.java @@ -0,0 +1,134 @@ +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 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 "UpdateLanguageDto{" + "isMaster: " + isMaster + ", isOptional: " + isOptional + ", fallback: " + + fallback + "}"; + } + + 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 new file mode 100644 index 0000000..a66b4da --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/UpdateRoleDto.java @@ -0,0 +1,113 @@ +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 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 "UpdateRoleDto{" + "permissions: " + permissions + ", properties: " + properties + "}"; + } + + 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 new file mode 100644 index 0000000..ee925c2 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/apps/requests/UpdateWorkflowDto.java @@ -0,0 +1,221 @@ +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.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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "UpdateWorkflowDto{" + "name: " + name + ", steps: " + steps + ", schemaIds: " + schemaIds + + ", initial: " + initial + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..991b436 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/AssetsClient.java @@ -0,0 +1,874 @@ +package com.squidex.api.resources.assets; + +import com.fasterxml.jackson.core.type.TypeReference; +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.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +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, Optional more, AssetsGetAssetContentBySlugRequest request) { + return getAssetContentBySlug(idOrSlug, more, request, null); + } + + public InputStream getAssetContentBySlug( + String idOrSlug, + Optional more, + AssetsGetAssetContentBySlugRequest request, + RequestOptions requestOptions) { + HttpUrl.Builder _httpUrl = HttpUrl.parse( + this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/assets") + .addPathSegment(clientOptions.appName()) + .addPathSegment(idOrSlug); + if (more.isPresent()) { + _httpUrl.addPathSegment(more.get()); + } + 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.getFormat().isPresent()) { + _httpUrl.addQueryParameter("format", request.getFormat().get().toString()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return _response.body().byteStream(); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public InputStream getAssetContent(String id, AssetsGetAssetContentRequest request) { + return getAssetContent(id, request, null); + } + + 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.getFormat().isPresent()) { + _httpUrl.addQueryParameter("format", request.getFormat().get().toString()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return _response.body().byteStream(); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetFoldersDto getAssetFolders(AssetsGetAssetFoldersRequest request) { + return getAssetFolders(request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetFoldersDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetFolderDto postAssetFolder(CreateAssetFolderDto request) { + return postAssetFolder(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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("folderName", request.getFolderName()); + if (request.getParentId().isPresent()) { + _requestBodyProperties.put("parentId", request.getParentId()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetFolderDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetFolderDto putAssetFolder(String id, RenameAssetFolderDto request) { + return putAssetFolder(id, 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("folderName", request.getFolderName()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetFolderDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteAssetFolder(String id) { + deleteAssetFolder(id, 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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetFolderDto putAssetFolderParent(String id, MoveAssetFolderDto request) { + return putAssetFolderParent(id, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getParentId().isPresent()) { + _requestBodyProperties.put("parentId", request.getParentId()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetFolderDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public Map getTags() { + return getTags(null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public Map putTag(String name, RenameTagDto request) { + return putTag(name, request, 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("tagName", request.getTagName()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetsDto getAssets(AssetsGetAssetsRequest request) { + return getAssets(request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetDto postAsset(File file, AssetsPostAssetRequest request) { + return postAsset(file, request, null); + } + + 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 _multipartBody = new MultipartBody.Builder().setType(MultipartBody.FORM); + _multipartBody.addFormDataPart("file", null, RequestBody.create(null, file)); + RequestBody _requestBody = _multipartBody.build(); + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetsDto getAssetsPost(AssetsGetAssetsPostRequest request) { + return getAssetsPost(request, null); + } + + 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 _requestBody; + try { + _requestBody = 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", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetDto getAsset(String id) { + return getAsset(id, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetDto postUpsertAsset(String id, File file, AssetsPostUpsertAssetRequest request) { + return postUpsertAsset(id, file, request, null); + } + + 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 _multipartBody = new MultipartBody.Builder().setType(MultipartBody.FORM); + _multipartBody.addFormDataPart("file", null, RequestBody.create(null, file)); + RequestBody _requestBody = _multipartBody.build(); + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetDto putAsset(String id, AnnotateAssetDto request) { + return putAsset(id, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getFileName().isPresent()) { + _requestBodyProperties.put("fileName", request.getFileName()); + } + if (request.getSlug().isPresent()) { + _requestBodyProperties.put("slug", request.getSlug()); + } + if (request.getIsProtected().isPresent()) { + _requestBodyProperties.put("isProtected", request.getIsProtected()); + } + if (request.getTags().isPresent()) { + _requestBodyProperties.put("tags", request.getTags()); + } + if (request.getMetadata().isPresent()) { + _requestBodyProperties.put("metadata", request.getMetadata()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteAsset(String id, AssetsDeleteAssetRequest request) { + deleteAsset(id, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("DELETE", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List bulkUpdateAssets(BulkUpdateAssetsDto request) { + return bulkUpdateAssets(request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getJobs().isPresent()) { + _requestBodyProperties.put("jobs", request.getJobs()); + } + if (request.getCheckReferrers().isPresent()) { + _requestBodyProperties.put("checkReferrers", request.getCheckReferrers()); + } + if (request.getOptimizeValidation().isPresent()) { + _requestBodyProperties.put("optimizeValidation", request.getOptimizeValidation()); + } + if (request.getDoNotScript().isPresent()) { + _requestBodyProperties.put("doNotScript", request.getDoNotScript()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetDto putAssetContent(String id, File file, AssetsPutAssetContentRequest request) { + return putAssetContent(id, file, request, null); + } + + 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 _multipartBody = new MultipartBody.Builder().setType(MultipartBody.FORM); + _multipartBody.addFormDataPart("file", null, RequestBody.create(null, file)); + RequestBody _requestBody = _multipartBody.build(); + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public AssetDto putAssetParent(String id, MoveAssetDto request) { + return putAssetParent(id, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getParentId().isPresent()) { + _requestBodyProperties.put("parentId", request.getParentId()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), AssetDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..665c5ea --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/AnnotateAssetDto.java @@ -0,0 +1,191 @@ +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 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 "AnnotateAssetDto{" + "fileName: " + fileName + ", slug: " + slug + ", isProtected: " + isProtected + + ", tags: " + tags + ", metadata: " + metadata + "}"; + } + + 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 new file mode 100644 index 0000000..0825689 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/AssetsDeleteAssetRequest.java @@ -0,0 +1,104 @@ +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 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 "AssetsDeleteAssetRequest{" + "checkReferrers: " + checkReferrers + ", permanent: " + permanent + "}"; + } + + 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 new file mode 100644 index 0000000..b52de26 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentBySlugRequest.java @@ -0,0 +1,453 @@ +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.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 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 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.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 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) + && 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.format); + } + + @Override + public String toString() { + return "AssetsGetAssetContentBySlugRequest{" + "version: " + version + ", cache: " + cache + ", download: " + + download + ", width: " + width + ", height: " + height + ", quality: " + quality + ", mode: " + mode + + ", bg: " + bg + ", focusX: " + focusX + ", focusY: " + focusY + ", nofocus: " + nofocus + ", auto: " + + auto + ", force: " + force + ", format: " + format + "}"; + } + + 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 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()); + 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 = "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, + 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 new file mode 100644 index 0000000..c77b5e8 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetContentRequest.java @@ -0,0 +1,452 @@ +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.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 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 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.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 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) + && 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.format); + } + + @Override + public String toString() { + return "AssetsGetAssetContentRequest{" + "version: " + version + ", cache: " + cache + ", download: " + download + + ", width: " + width + ", height: " + height + ", quality: " + quality + ", mode: " + mode + ", bg: " + + bg + ", focusX: " + focusX + ", focusY: " + focusY + ", nofocus: " + nofocus + ", auto: " + auto + + ", force: " + force + ", format: " + format + "}"; + } + + 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 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()); + 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 = "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, + 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 new file mode 100644 index 0000000..1d943f9 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetFoldersRequest.java @@ -0,0 +1,105 @@ +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.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 "AssetsGetAssetFoldersRequest{" + "parentId: " + parentId + ", scope: " + scope + "}"; + } + + 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 new file mode 100644 index 0000000..6774d37 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsPostRequest.java @@ -0,0 +1,156 @@ +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.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 "AssetsGetAssetsPostRequest{" + "noTotal: " + noTotal + ", noSlowTotal: " + noSlowTotal + ", body: " + + body + "}"; + } + + 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 new file mode 100644 index 0000000..d690730 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/AssetsGetAssetsRequest.java @@ -0,0 +1,307 @@ +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 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 "AssetsGetAssetsRequest{" + "noTotal: " + noTotal + ", noSlowTotal: " + noSlowTotal + ", parentId: " + + parentId + ", ids: " + ids + ", q: " + q + ", top: " + top + ", skip: " + skip + ", orderby: " + + orderby + ", filter: " + filter + "}"; + } + + 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 new file mode 100644 index 0000000..3592ab9 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostAssetRequest.java @@ -0,0 +1,129 @@ +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 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 "AssetsPostAssetRequest{" + "parentId: " + parentId + ", id: " + id + ", duplicate: " + duplicate + "}"; + } + + 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 new file mode 100644 index 0000000..aae2f66 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/AssetsPostUpsertAssetRequest.java @@ -0,0 +1,104 @@ +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 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 "AssetsPostUpsertAssetRequest{" + "parentId: " + parentId + ", duplicate: " + duplicate + "}"; + } + + 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 new file mode 100644 index 0000000..83f50cf --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/AssetsPutAssetContentRequest.java @@ -0,0 +1,16 @@ +package com.squidex.api.resources.assets.requests; + +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 "AssetsPutAssetContentRequest{" + "}"; + } +} 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 new file mode 100644 index 0000000..6bc3d8d --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/BulkUpdateAssetsDto.java @@ -0,0 +1,164 @@ +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.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 "BulkUpdateAssetsDto{" + "jobs: " + jobs + ", checkReferrers: " + checkReferrers + + ", optimizeValidation: " + optimizeValidation + ", doNotScript: " + doNotScript + "}"; + } + + 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 new file mode 100644 index 0000000..39dd78e --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/CreateAssetFolderDto.java @@ -0,0 +1,126 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "CreateAssetFolderDto{" + "folderName: " + folderName + ", parentId: " + parentId + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..21fdfa3 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetDto.java @@ -0,0 +1,79 @@ +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 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 "MoveAssetDto{" + "parentId: " + parentId + "}"; + } + + 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 new file mode 100644 index 0000000..55039ab --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/MoveAssetFolderDto.java @@ -0,0 +1,79 @@ +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 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 "MoveAssetFolderDto{" + "parentId: " + parentId + "}"; + } + + 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 new file mode 100644 index 0000000..20f38cc --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/RenameAssetFolderDto.java @@ -0,0 +1,89 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "RenameAssetFolderDto{" + "folderName: " + folderName + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..1e51ce3 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/assets/requests/RenameTagDto.java @@ -0,0 +1,89 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "RenameTagDto{" + "tagName: " + tagName + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..f4f4396 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/backups/BackupsClient.java @@ -0,0 +1,238 @@ +package com.squidex.api.resources.backups; + +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.InputStream; +import java.util.HashMap; +import java.util.Map; +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) { + return getBackupContent(id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return _response.body().byteStream(); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteBackup(String id) { + deleteBackup(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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public InputStream getBackupContentV2(String id, BackupsGetBackupContentV2Request request) { + return getBackupContentV2(id, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return _response.body().byteStream(); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public BackupJobsDto getBackups() { + return getBackups(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), BackupJobsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void postBackup() { + postBackup(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 _request = new Request.Builder() + .url(_httpUrl) + .method("POST", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RestoreJobDto getRestoreJob() { + return getRestoreJob(null); + } + + public RestoreJobDto getRestoreJob(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/apps/restore") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RestoreJobDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void postRestoreJob(RestoreRequestDto request) { + postRestoreJob(request, null); + } + + public void postRestoreJob(RestoreRequestDto request, RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/apps/restore") + .build(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getName().isPresent()) { + _requestBodyProperties.put("name", request.getName()); + } + _requestBodyProperties.put("url", request.getUrl()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..87ba311 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/backups/requests/BackupsGetBackupContentV2Request.java @@ -0,0 +1,104 @@ +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 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 "BackupsGetBackupContentV2Request{" + "appId: " + appId + ", app: " + app + "}"; + } + + 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 new file mode 100644 index 0000000..a069907 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/backups/requests/RestoreRequestDto.java @@ -0,0 +1,126 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "RestoreRequestDto{" + "name: " + name + ", url: " + url + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..d2c87e7 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/comments/CommentsClient.java @@ -0,0 +1,195 @@ +package com.squidex.api.resources.comments; + +import com.fasterxml.jackson.core.type.TypeReference; +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.util.List; +import java.util.Optional; +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(Optional resource) { + return getWatchingUsers(resource, null); + } + + public List getWatchingUsers(Optional resource, RequestOptions requestOptions) { + HttpUrl.Builder _httpUrl = HttpUrl.parse( + this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/apps") + .addPathSegment(clientOptions.appName()) + .addPathSegments("watching"); + if (resource.isPresent()) { + _httpUrl.addPathSegment(resource.get()); + } + Request _request = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public CommentsDto getComments(String commentsId, CommentsGetCommentsRequest request) { + return getComments(commentsId, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CommentsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public CommentDto postComment(String commentsId, UpsertCommentDto request) { + return postComment(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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CommentDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void putComment(String commentsId, String commentId, UpsertCommentDto request) { + putComment(commentsId, commentId, 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteComment(String commentsId, String commentId) { + deleteComment(commentsId, commentId, 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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..a70778f --- /dev/null +++ b/src/main/java/com/squidex/api/resources/comments/requests/CommentsGetCommentsRequest.java @@ -0,0 +1,79 @@ +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 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 "CommentsGetCommentsRequest{" + "version: " + version + "}"; + } + + 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 new file mode 100644 index 0000000..5e11ad7 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/ContentsClient.java @@ -0,0 +1,899 @@ +package com.squidex.api.resources.contents; + +import com.fasterxml.jackson.core.type.TypeReference; +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.BulkUpdateContentsDto; +import com.squidex.api.resources.contents.requests.ChangeStatusDto; +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.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.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.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.ContentDto; +import com.squidex.api.types.ContentsDto; +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; + } + + public ContentsDto getContents(String schema, ContentsGetContentsRequest request) { + return getContents(schema, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + 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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentDto postContent(String schema, ContentsPostContentRequest request) { + return postContent(schema, request, null); + } + + 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 _requestBody; + try { + _requestBody = 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", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentsDto getContentsPost(String schema, ContentsGetContentsPostRequest request) { + return getContentsPost(schema, request, null); + } + + 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 _requestBody; + try { + _requestBody = 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", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + 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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentDto getContent(String schema, String id, ContentsGetContentRequest request) { + return getContent(schema, id, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + 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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentDto postUpsertContent(String schema, String id, ContentsPostUpsertContentRequest request) { + return postUpsertContent(schema, id, request, null); + } + + 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 _requestBody; + try { + _requestBody = 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", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentDto putContent(String schema, String id, ContentsPutContentRequest request) { + return putContent(schema, id, request, null); + } + + 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 _requestBody; + try { + _requestBody = 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", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentDto patchContent(String schema, String id, ContentsPatchContentRequest request) { + return patchContent(schema, id, request, null); + } + + 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 _requestBody; + try { + _requestBody = 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", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteContent(String schema, String id, ContentsDeleteContentRequest request) { + deleteContent(schema, id, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("DELETE", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void getContentValidity(String schema, String id) { + getContentValidity(schema, id, null); + } + + 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 _request = new Request.Builder() + .url(_httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentsDto getReferences(String schema, String id, ContentsGetReferencesRequest request) { + return getReferences(schema, id, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + 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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentsDto getReferencing(String schema, String id, ContentsGetReferencingRequest request) { + return getReferencing(schema, id, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + 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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public InputStream getContentVersion( + String schema, String id, int version, ContentsGetContentVersionRequest request) { + return getContentVersion(schema, id, version, request, null); + } + + 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(); + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("GET", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return _response.body().byteStream(); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List postContents(String schema, ImportContentsDto request) { + return postContents(schema, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("datas", request.getDatas()); + if (request.getPublish().isPresent()) { + _requestBodyProperties.put("publish", request.getPublish()); + } + if (request.getDoNotScript().isPresent()) { + _requestBodyProperties.put("doNotScript", request.getDoNotScript()); + } + if (request.getOptimizeValidation().isPresent()) { + _requestBodyProperties.put("optimizeValidation", request.getOptimizeValidation()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List bulkUpdateContents(String schema, BulkUpdateContentsDto request) { + return bulkUpdateContents(schema, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("jobs", request.getJobs()); + if (request.getPublish().isPresent()) { + _requestBodyProperties.put("publish", request.getPublish()); + } + if (request.getDoNotScript().isPresent()) { + _requestBodyProperties.put("doNotScript", request.getDoNotScript()); + } + if (request.getDoNotValidate().isPresent()) { + _requestBodyProperties.put("doNotValidate", request.getDoNotValidate()); + } + if (request.getDoNotValidateWorkflow().isPresent()) { + _requestBodyProperties.put("doNotValidateWorkflow", request.getDoNotValidateWorkflow()); + } + if (request.getCheckReferrers().isPresent()) { + _requestBodyProperties.put("checkReferrers", request.getCheckReferrers()); + } + if (request.getOptimizeValidation().isPresent()) { + _requestBodyProperties.put("optimizeValidation", request.getOptimizeValidation()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentDto putContentStatus(String schema, String id, ChangeStatusDto request) { + return putContentStatus(schema, id, request, null); + } + + 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 _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("status", request.getStatus()); + if (request.getDueTime().isPresent()) { + _requestBodyProperties.put("dueTime", request.getDueTime()); + } + if (request.getCheckReferrers().isPresent()) { + _requestBodyProperties.put("checkReferrers", request.getCheckReferrers()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentDto deleteContentStatus(String schema, String id, ContentsDeleteContentStatusRequest request) { + return deleteContentStatus(schema, id, request, null); + } + + 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(); + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("DELETE", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentDto createDraft(String schema, String id, ContentsCreateDraftRequest request) { + return createDraft(schema, id, request, null); + } + + 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(); + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContentDto deleteVersion(String schema, String id, ContentsDeleteVersionRequest request) { + return deleteVersion(schema, id, request, null); + } + + 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(); + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("DELETE", _requestBody) + .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 _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContentDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/squidex/api/resources/contents/requests/BulkUpdateContentsDto.java b/src/main/java/com/squidex/api/resources/contents/requests/BulkUpdateContentsDto.java new file mode 100644 index 0000000..96fa0c6 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/BulkUpdateContentsDto.java @@ -0,0 +1,267 @@ +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.types.BulkUpdateContentsJobDto; +import java.util.ArrayList; +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; + } + + /** + * @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 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); + } + + @Override + public int hashCode() { + return Objects.hash( + this.jobs, + this.publish, + this.doNotScript, + this.doNotValidate, + this.doNotValidateWorkflow, + this.checkReferrers, + this.optimizeValidation); + } + + @Override + public String toString() { + return "BulkUpdateContentsDto{" + "jobs: " + jobs + ", publish: " + publish + ", doNotScript: " + doNotScript + + ", doNotValidate: " + doNotValidate + ", doNotValidateWorkflow: " + doNotValidateWorkflow + + ", checkReferrers: " + checkReferrers + ", optimizeValidation: " + optimizeValidation + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @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; + } + + public Builder addJobs(BulkUpdateContentsJobDto jobs) { + this.jobs.add(jobs); + return this; + } + + 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); + } + } +} 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 new file mode 100644 index 0000000..28e133f --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ChangeStatusDto.java @@ -0,0 +1,242 @@ +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 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 Only resolve these languages (comma-separated). + */ + @JsonProperty("X-Languages") + public Optional getLanguages() { + return languages; + } + + /** + * @return The new status. <span style="white-space: nowrap">non-empty</span> + */ + @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 "ChangeStatusDto{" + "unpublished: " + unpublished + ", languages: " + languages + ", status: " + status + + ", dueTime: " + dueTime + ", checkReferrers: " + checkReferrers + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

Only resolve these languages (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/ContentsCreateDraftRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsCreateDraftRequest.java new file mode 100644 index 0000000..8797e43 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsCreateDraftRequest.java @@ -0,0 +1,104 @@ +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 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 Only resolve these languages (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 "ContentsCreateDraftRequest{" + "unpublished: " + unpublished + ", languages: " + languages + "}"; + } + + 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 new file mode 100644 index 0000000..776a552 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentRequest.java @@ -0,0 +1,105 @@ +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 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 "ContentsDeleteContentRequest{" + "checkReferrers: " + checkReferrers + ", permanent: " + permanent + + "}"; + } + + 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 new file mode 100644 index 0000000..ff7eea5 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteContentStatusRequest.java @@ -0,0 +1,106 @@ +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 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 Only resolve these languages (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 "ContentsDeleteContentStatusRequest{" + "unpublished: " + unpublished + ", languages: " + languages + + "}"; + } + + 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 new file mode 100644 index 0000000..c027bdb --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsDeleteVersionRequest.java @@ -0,0 +1,104 @@ +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 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 Only resolve these languages (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 "ContentsDeleteVersionRequest{" + "unpublished: " + unpublished + ", languages: " + languages + "}"; + } + + 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/ContentsGetContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentRequest.java new file mode 100644 index 0000000..2db8ebd --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentRequest.java @@ -0,0 +1,162 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = ContentsGetContentRequest.Builder.class) +public final class ContentsGetContentRequest { + private final Optional flatten; + + private final Optional languages; + + private final Optional unpublished; + + private final Optional version; + + private ContentsGetContentRequest( + Optional flatten, + Optional languages, + Optional unpublished, + Optional version) { + this.flatten = flatten; + this.languages = languages; + this.unpublished = unpublished; + this.version = version; + } + + /** + * @return Provide the data as flat object. + */ + @JsonProperty("X-Flatten") + public Optional getFlatten() { + return flatten; + } + + /** + * @return Only resolve these languages (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 flatten.equals(other.flatten) + && languages.equals(other.languages) + && unpublished.equals(other.unpublished) + && version.equals(other.version); + } + + @Override + public int hashCode() { + return Objects.hash(this.flatten, this.languages, this.unpublished, this.version); + } + + @Override + public String toString() { + return "ContentsGetContentRequest{" + "flatten: " + flatten + ", languages: " + languages + ", unpublished: " + + unpublished + ", version: " + version + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + 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) { + flatten(other.getFlatten()); + languages(other.getLanguages()); + unpublished(other.getUnpublished()); + version(other.getVersion()); + 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(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 new file mode 100644 index 0000000..ba01ac9 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentVersionRequest.java @@ -0,0 +1,104 @@ +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 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 Only resolve these languages (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 "ContentsGetContentVersionRequest{" + "unpublished: " + unpublished + ", languages: " + languages + "}"; + } + + 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 new file mode 100644 index 0000000..526c6c3 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsPostRequest.java @@ -0,0 +1,273 @@ +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.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 flatten; + + private final Optional languages; + + private final Optional noSlowTotal; + + private final Optional noTotal; + + private final Optional unpublished; + + private final QueryDto body; + + private ContentsGetContentsPostRequest( + Optional flatten, + Optional languages, + Optional noSlowTotal, + Optional noTotal, + Optional unpublished, + QueryDto body) { + this.flatten = flatten; + this.languages = languages; + this.noSlowTotal = noSlowTotal; + this.noTotal = noTotal; + this.unpublished = unpublished; + this.body = body; + } + + /** + * @return Provide the data as flat object. + */ + @JsonProperty("X-Flatten") + public Optional getFlatten() { + return flatten; + } + + /** + * @return Only resolve these languages (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 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.flatten, this.languages, this.noSlowTotal, this.noTotal, this.unpublished, this.body); + } + + @Override + public String toString() { + return "ContentsGetContentsPostRequest{" + "flatten: " + flatten + ", languages: " + languages + + ", noSlowTotal: " + noSlowTotal + ", noTotal: " + noTotal + ", unpublished: " + unpublished + + ", body: " + body + "}"; + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(QueryDto body); + + Builder from(ContentsGetContentsPostRequest other); + } + + public interface _FinalStage { + ContentsGetContentsPostRequest build(); + + _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 Builder() {} + + @Override + public Builder from(ContentsGetContentsPostRequest other) { + 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; + } + + /** + *

Only resolve these languages (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; + } + + @Override + public ContentsGetContentsPostRequest build() { + return new ContentsGetContentsPostRequest(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 new file mode 100644 index 0000000..d4dc6ff --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetContentsRequest.java @@ -0,0 +1,393 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = ContentsGetContentsRequest.Builder.class) +public final class ContentsGetContentsRequest { + 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 flatten, + Optional languages, + Optional noSlowTotal, + Optional noTotal, + Optional unpublished, + Optional ids, + Optional q, + Optional search, + Optional top, + Optional skip, + Optional orderby, + Optional filter) { + 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 Provide the data as flat object. + */ + @JsonProperty("X-Flatten") + public Optional getFlatten() { + return flatten; + } + + /** + * @return Only resolve these languages (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 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.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 "ContentsGetContentsRequest{" + "flatten: " + flatten + ", languages: " + languages + ", noSlowTotal: " + + noSlowTotal + ", noTotal: " + noTotal + ", unpublished: " + unpublished + ", ids: " + ids + ", q: " + + q + ", search: " + search + ", top: " + top + ", skip: " + skip + ", orderby: " + orderby + + ", filter: " + filter + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + 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) { + 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-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( + flatten, languages, noSlowTotal, noTotal, unpublished, ids, q, search, top, skip, orderby, filter); + } + } +} 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 new file mode 100644 index 0000000..8cdf03b --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencesRequest.java @@ -0,0 +1,216 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = ContentsGetReferencesRequest.Builder.class) +public final class ContentsGetReferencesRequest { + 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 flatten, + Optional languages, + Optional unpublished, + Optional noSlowTotal, + Optional noTotal, + Optional q) { + this.flatten = flatten; + this.languages = languages; + this.unpublished = unpublished; + this.noSlowTotal = noSlowTotal; + this.noTotal = noTotal; + this.q = q; + } + + /** + * @return Provide the data as flat object. + */ + @JsonProperty("X-Flatten") + public Optional getFlatten() { + return flatten; + } + + /** + * @return Only resolve these languages (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 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.flatten, this.languages, this.unpublished, this.noSlowTotal, this.noTotal, this.q); + } + + @Override + public String toString() { + return "ContentsGetReferencesRequest{" + "flatten: " + flatten + ", languages: " + languages + ", unpublished: " + + unpublished + ", noSlowTotal: " + noSlowTotal + ", noTotal: " + noTotal + ", q: " + q + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + 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) { + flatten(other.getFlatten()); + languages(other.getLanguages()); + unpublished(other.getUnpublished()); + noSlowTotal(other.getNoSlowTotal()); + noTotal(other.getNoTotal()); + q(other.getQ()); + 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(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 new file mode 100644 index 0000000..d2c80e0 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsGetReferencingRequest.java @@ -0,0 +1,217 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = ContentsGetReferencingRequest.Builder.class) +public final class ContentsGetReferencingRequest { + 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 flatten, + Optional languages, + Optional unpublished, + Optional noSlowTotal, + Optional noTotal, + Optional q) { + this.flatten = flatten; + this.languages = languages; + this.unpublished = unpublished; + this.noSlowTotal = noSlowTotal; + this.noTotal = noTotal; + this.q = q; + } + + /** + * @return Provide the data as flat object. + */ + @JsonProperty("X-Flatten") + public Optional getFlatten() { + return flatten; + } + + /** + * @return Only resolve these languages (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 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.flatten, this.languages, this.unpublished, this.noSlowTotal, this.noTotal, this.q); + } + + @Override + public String toString() { + return "ContentsGetReferencingRequest{" + "flatten: " + flatten + ", languages: " + languages + + ", unpublished: " + unpublished + ", noSlowTotal: " + noSlowTotal + ", noTotal: " + noTotal + ", q: " + + q + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + 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) { + flatten(other.getFlatten()); + languages(other.getLanguages()); + unpublished(other.getUnpublished()); + noSlowTotal(other.getNoSlowTotal()); + noTotal(other.getNoTotal()); + q(other.getQ()); + 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(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 new file mode 100644 index 0000000..0eebad8 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPatchContentRequest.java @@ -0,0 +1,136 @@ +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 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 Only resolve these languages (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 "ContentsPatchContentRequest{" + "unpublished: " + unpublished + ", languages: " + languages + ", body: " + + body + "}"; + } + + 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 new file mode 100644 index 0000000..b141aae --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostContentRequest.java @@ -0,0 +1,221 @@ +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 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 Only resolve these languages (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 "ContentsPostContentRequest{" + "unpublished: " + unpublished + ", languages: " + languages + + ", status: " + status + ", id: " + id + ", publish: " + publish + ", body: " + body + "}"; + } + + 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/ContentsPostUpsertContentRequest.java b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostUpsertContentRequest.java new file mode 100644 index 0000000..b5af55a --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPostUpsertContentRequest.java @@ -0,0 +1,221 @@ +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 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 Only resolve these languages (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 "ContentsPostUpsertContentRequest{" + "unpublished: " + unpublished + ", languages: " + languages + + ", status: " + status + ", patch: " + patch + ", publish: " + publish + ", body: " + body + "}"; + } + + 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 new file mode 100644 index 0000000..08bae21 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ContentsPutContentRequest.java @@ -0,0 +1,136 @@ +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 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 Only resolve these languages (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 "ContentsPutContentRequest{" + "unpublished: " + unpublished + ", languages: " + languages + ", body: " + + body + "}"; + } + + 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 new file mode 100644 index 0000000..b46b1e3 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/contents/requests/ImportContentsDto.java @@ -0,0 +1,171 @@ +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 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 "ImportContentsDto{" + "datas: " + datas + ", publish: " + publish + ", doNotScript: " + doNotScript + + ", optimizeValidation: " + optimizeValidation + "}"; + } + + 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 new file mode 100644 index 0000000..2cc8518 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/diagnostics/DiagnosticsClient.java @@ -0,0 +1,66 @@ +package com.squidex.api.resources.diagnostics; + +import com.squidex.api.core.ClientOptions; +import com.squidex.api.core.RequestOptions; +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() { + getDump(null); + } + + public void getDump(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/diagnostics/dump") + .build(); + Request _request = new Request.Builder() + .url(_httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void getGcDump() { + getGcDump(null); + } + + public void getGcDump(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/diagnostics/gcdump") + .build(); + Request _request = new Request.Builder() + .url(_httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java b/src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java new file mode 100644 index 0000000..70d38e9 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/eventconsumers/EventConsumersClient.java @@ -0,0 +1,129 @@ +package com.squidex.api.resources.eventconsumers; + +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 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() { + return getEventConsumers(null); + } + + public EventConsumersDto getEventConsumers(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/event-consumers") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), EventConsumersDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public EventConsumerDto startEventConsumer(String consumerName) { + return startEventConsumer(consumerName, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), EventConsumerDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public EventConsumerDto stopEventConsumer(String consumerName) { + return stopEventConsumer(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), EventConsumerDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public EventConsumerDto resetEventConsumer(String consumerName) { + return resetEventConsumer(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), EventConsumerDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/squidex/api/resources/history/HistoryClient.java b/src/main/java/com/squidex/api/resources/history/HistoryClient.java new file mode 100644 index 0000000..209bd09 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/history/HistoryClient.java @@ -0,0 +1,90 @@ +package com.squidex.api.resources.history; + +import com.fasterxml.jackson.core.type.TypeReference; +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.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +public class HistoryClient { + protected final ClientOptions clientOptions; + + public HistoryClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public List getAppHistory(HistoryGetAppHistoryRequest request) { + return getAppHistory(request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getTeamHistory(String team, HistoryGetTeamHistoryRequest request) { + return getTeamHistory(team, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..4f58ff3 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/history/requests/HistoryGetAppHistoryRequest.java @@ -0,0 +1,79 @@ +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 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 "HistoryGetAppHistoryRequest{" + "channel: " + channel + "}"; + } + + 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 new file mode 100644 index 0000000..662c20e --- /dev/null +++ b/src/main/java/com/squidex/api/resources/history/requests/HistoryGetTeamHistoryRequest.java @@ -0,0 +1,79 @@ +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 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 "HistoryGetTeamHistoryRequest{" + "channel: " + channel + "}"; + } + + 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 new file mode 100644 index 0000000..3629a63 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/languages/LanguagesClient.java @@ -0,0 +1,47 @@ +package com.squidex.api.resources.languages; + +import com.fasterxml.jackson.core.type.TypeReference; +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.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; + } + + public List getLanguages() { + return getLanguages(null); + } + + public List getLanguages(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/languages") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/squidex/api/resources/news/NewsClient.java b/src/main/java/com/squidex/api/resources/news/NewsClient.java new file mode 100644 index 0000000..56a70e7 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/news/NewsClient.java @@ -0,0 +1,50 @@ +package com.squidex.api.resources.news; + +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 okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +public class NewsClient { + protected final ClientOptions clientOptions; + + public NewsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public FeaturesDto getNews(NewsGetNewsRequest request) { + return getNews(request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), FeaturesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..ec1655a --- /dev/null +++ b/src/main/java/com/squidex/api/resources/news/requests/NewsGetNewsRequest.java @@ -0,0 +1,79 @@ +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 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 "NewsGetNewsRequest{" + "version: " + version + "}"; + } + + 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 new file mode 100644 index 0000000..377bf15 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/notifications/NotificationsClient.java @@ -0,0 +1,81 @@ +package com.squidex.api.resources.notifications; + +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 okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +public class NotificationsClient { + protected final ClientOptions clientOptions; + + public NotificationsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CommentsDto getNotifications(String userId, NotificationsGetNotificationsRequest request) { + return getNotifications(userId, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CommentsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteComment(String userId, String commentId) { + deleteComment(userId, commentId, 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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..677915d --- /dev/null +++ b/src/main/java/com/squidex/api/resources/notifications/requests/NotificationsGetNotificationsRequest.java @@ -0,0 +1,80 @@ +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 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 "NotificationsGetNotificationsRequest{" + "version: " + version + "}"; + } + + 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 new file mode 100644 index 0000000..176dcfa --- /dev/null +++ b/src/main/java/com/squidex/api/resources/ping/PingClient.java @@ -0,0 +1,97 @@ +package com.squidex.api.resources.ping; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.squidex.api.core.ClientOptions; +import com.squidex.api.core.ObjectMappers; +import com.squidex.api.core.RequestOptions; +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() { + return getInfo(null); + } + + public Map getInfo(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/info") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void getPing() { + getPing(null); + } + + public void getPing(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/ping") + .build(); + Request _request = new Request.Builder() + .url(_httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void getAppPing() { + getAppPing(null); + } + + public void getAppPing(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/ping") + .addPathSegment(clientOptions.appName()) + .build(); + Request _request = new Request.Builder() + .url(_httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/squidex/api/resources/plans/PlansClient.java b/src/main/java/com/squidex/api/resources/plans/PlansClient.java new file mode 100644 index 0000000..00c27c6 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/plans/PlansClient.java @@ -0,0 +1,148 @@ +package com.squidex.api.resources.plans; + +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 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() { + return getPlans(null); + } + + public PlansDto getPlans(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/apps") + .addPathSegment(clientOptions.appName()) + .addPathSegments("plans") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), PlansDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public PlanChangedDto putPlan(ChangePlanDto request) { + return putPlan(request, 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), PlanChangedDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public PlansDto getTeamPlans(String team) { + return getTeamPlans(team, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), PlansDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public PlanChangedDto putTeamPlan(String team, ChangePlanDto request) { + return putTeamPlan(team, request, 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), PlanChangedDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/squidex/api/resources/rules/RulesClient.java b/src/main/java/com/squidex/api/resources/rules/RulesClient.java new file mode 100644 index 0000000..22aa278 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/rules/RulesClient.java @@ -0,0 +1,619 @@ +package com.squidex.api.resources.rules; + +import com.fasterxml.jackson.core.type.TypeReference; +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.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 RulesClient { + protected final ClientOptions clientOptions; + + public RulesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public Map getActions() { + return getActions(null); + } + + public Map getActions(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/rules/actions") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RulesDto getRules() { + return getRules(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RulesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RuleDto postRule(CreateRuleDto request) { + return postRule(request, 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RuleDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteRuleRun() { + deleteRuleRun(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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RuleDto putRule(String id, UpdateRuleDto request) { + return putRule(id, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getName().isPresent()) { + _requestBodyProperties.put("name", request.getName()); + } + if (request.getTrigger().isPresent()) { + _requestBodyProperties.put("trigger", request.getTrigger()); + } + if (request.getAction().isPresent()) { + _requestBodyProperties.put("action", request.getAction()); + } + if (request.getIsEnabled().isPresent()) { + _requestBodyProperties.put("isEnabled", request.getIsEnabled()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RuleDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteRule(String id) { + deleteRule(id, 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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RuleDto enableRule(String id) { + return enableRule(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RuleDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RuleDto disableRule(String id) { + return disableRule(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RuleDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void triggerRule(String id) { + triggerRule(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 _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void putRuleRun(String id, RulesPutRuleRunRequest request) { + putRuleRun(id, request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteRuleEvents(String id) { + deleteRuleEvents(id, 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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SimulatedRuleEventsDto simulatePost(CreateRuleDto request) { + return simulatePost(request, 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SimulatedRuleEventsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SimulatedRuleEventsDto simulateGet(String id) { + return simulateGet(id, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SimulatedRuleEventsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public RuleEventsDto getEvents(RulesGetEventsRequest request) { + return getEvents(request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), RuleEventsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteEvents() { + deleteEvents(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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void putEvent(String id) { + putEvent(id, 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 _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteEvent(String id) { + deleteEvent(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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getEventTypes() { + return getEventTypes(null); + } + + public List getEventTypes(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/rules/eventtypes") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public Object getEventSchema(String type) { + return getEventSchema(type, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), Object.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..36731dd --- /dev/null +++ b/src/main/java/com/squidex/api/resources/rules/requests/RulesGetEventsRequest.java @@ -0,0 +1,129 @@ +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 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 "RulesGetEventsRequest{" + "ruleId: " + ruleId + ", skip: " + skip + ", take: " + take + "}"; + } + + 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 new file mode 100644 index 0000000..403ddfe --- /dev/null +++ b/src/main/java/com/squidex/api/resources/rules/requests/RulesPutRuleRunRequest.java @@ -0,0 +1,79 @@ +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 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 "RulesPutRuleRunRequest{" + "fromSnapshots: " + fromSnapshots + "}"; + } + + 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 new file mode 100644 index 0000000..4abaa55 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/rules/requests/UpdateRuleDto.java @@ -0,0 +1,158 @@ +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.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; + } + + @JsonProperty("trigger") + public Optional getTrigger() { + return trigger; + } + + @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 "UpdateRuleDto{" + "name: " + name + ", trigger: " + trigger + ", action: " + action + ", isEnabled: " + + isEnabled + "}"; + } + + 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 new file mode 100644 index 0000000..793760c --- /dev/null +++ b/src/main/java/com/squidex/api/resources/schemas/SchemasClient.java @@ -0,0 +1,1155 @@ +package com.squidex.api.resources.schemas; + +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.util.HashMap; +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) { + return postField(schema, request, null); + } + + 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto postNestedField(String schema, int parentId, AddFieldDto request) { + return postNestedField(schema, parentId, 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto putSchemaUiFields(String schema, ConfigureUiFieldsDto request) { + return putSchemaUiFields(schema, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getFieldsInLists().isPresent()) { + _requestBodyProperties.put("fieldsInLists", request.getFieldsInLists()); + } + if (request.getFieldsInReferences().isPresent()) { + _requestBodyProperties.put("fieldsInReferences", request.getFieldsInReferences()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto putSchemaFieldOrdering(String schema, ReorderFieldsDto request) { + return putSchemaFieldOrdering(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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto putNestedFieldOrdering(String schema, int parentId, ReorderFieldsDto request) { + return putNestedFieldOrdering(schema, parentId, 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto putField(String schema, int id, UpdateFieldDto request) { + return putField(schema, id, 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto deleteField(String schema, int id) { + return deleteField(schema, id, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception 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 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto deleteNestedField(String schema, int parentId, int id) { + return deleteNestedField(schema, parentId, id, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto lockField(String schema, int id) { + return lockField(schema, id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto lockNestedField(String schema, int parentId, int id) { + return lockNestedField(schema, parentId, id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto hideField(String schema, int id) { + return hideField(schema, id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto hideNestedField(String schema, int parentId, int id) { + return hideNestedField(schema, parentId, id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto showField(String schema, int id) { + return showField(schema, id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto showNestedField(String schema, int parentId, int id) { + return showNestedField(schema, parentId, id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto enableField(String schema, int id) { + return enableField(schema, id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto enableNestedField(String schema, int parentId, int id) { + return enableNestedField(schema, parentId, id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto disableField(String schema, int id) { + return disableField(schema, id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto disableNestedField(String schema, int parentId, int id) { + return disableNestedField(schema, parentId, id, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemasDto getSchemas() { + return getSchemas(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemasDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto postSchema(CreateSchemaDto request) { + return postSchema(request, 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("name", request.getName()); + if (request.getType().isPresent()) { + _requestBodyProperties.put("type", request.getType()); + } + if (request.getIsSingleton().isPresent()) { + _requestBodyProperties.put("isSingleton", request.getIsSingleton()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto getSchema(String schema) { + return getSchema(schema, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto putSchema(String schema, UpdateSchemaDto request) { + return putSchema(schema, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getLabel().isPresent()) { + _requestBodyProperties.put("label", request.getLabel()); + } + if (request.getHints().isPresent()) { + _requestBodyProperties.put("hints", request.getHints()); + } + if (request.getContentsSidebarUrl().isPresent()) { + _requestBodyProperties.put("contentsSidebarUrl", request.getContentsSidebarUrl()); + } + if (request.getContentSidebarUrl().isPresent()) { + _requestBodyProperties.put("contentSidebarUrl", request.getContentSidebarUrl()); + } + if (request.getContentEditorUrl().isPresent()) { + _requestBodyProperties.put("contentEditorUrl", request.getContentEditorUrl()); + } + if (request.getValidateOnPublish().isPresent()) { + _requestBodyProperties.put("validateOnPublish", request.getValidateOnPublish()); + } + if (request.getTags().isPresent()) { + _requestBodyProperties.put("tags", request.getTags()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteSchema(String schema) { + deleteSchema(schema, 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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto putSchemaSync(String schema, SynchronizeSchemaDto request) { + return putSchemaSync(schema, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getNoFieldDeletion().isPresent()) { + _requestBodyProperties.put("noFieldDeletion", request.getNoFieldDeletion()); + } + if (request.getNoFieldRecreation().isPresent()) { + _requestBodyProperties.put("noFieldRecreation", request.getNoFieldRecreation()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto putCategory(String schema, ChangeCategoryDto request) { + return putCategory(schema, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getName().isPresent()) { + _requestBodyProperties.put("name", request.getName()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto putPreviewUrls(String schema, Map request) { + return putPreviewUrls(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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto putScripts(String schema, SchemaScriptsDto request) { + return putScripts(schema, request, null); + } + + 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto putRules(String schema, ConfigureFieldRulesDto request) { + return putRules(schema, request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + if (request.getFieldRules().isPresent()) { + _requestBodyProperties.put("fieldRules", request.getFieldRules()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto publishSchema(String schema) { + return publishSchema(schema, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public SchemaDto unpublishSchema(String schema) { + return unpublishSchema(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), SchemaDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..8e5ad6e --- /dev/null +++ b/src/main/java/com/squidex/api/resources/schemas/requests/ChangeCategoryDto.java @@ -0,0 +1,79 @@ +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 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 "ChangeCategoryDto{" + "name: " + name + "}"; + } + + 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 new file mode 100644 index 0000000..342e4c0 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureFieldRulesDto.java @@ -0,0 +1,81 @@ +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.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 "ConfigureFieldRulesDto{" + "fieldRules: " + fieldRules + "}"; + } + + 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 new file mode 100644 index 0000000..3b9e1cf --- /dev/null +++ b/src/main/java/com/squidex/api/resources/schemas/requests/ConfigureUiFieldsDto.java @@ -0,0 +1,106 @@ +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 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 "ConfigureUiFieldsDto{" + "fieldsInLists: " + fieldsInLists + ", fieldsInReferences: " + + fieldsInReferences + "}"; + } + + 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 new file mode 100644 index 0000000..772ac07 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/schemas/requests/CreateSchemaDto.java @@ -0,0 +1,522 @@ +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.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; + } + + @JsonProperty("properties") + @Override + public Optional getProperties() { + return properties; + } + + @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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @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 "CreateSchemaDto{" + "properties: " + properties + ", scripts: " + scripts + ", fieldsInReferences: " + + fieldsInReferences + ", fieldsInLists: " + fieldsInLists + ", fields: " + fields + ", previewUrls: " + + previewUrls + ", fieldRules: " + fieldRules + ", category: " + category + ", isPublished: " + + isPublished + ", name: " + name + ", type: " + type + ", isSingleton: " + isSingleton + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @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; + } + + @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; + } + + @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 new file mode 100644 index 0000000..a166bff --- /dev/null +++ b/src/main/java/com/squidex/api/resources/schemas/requests/SynchronizeSchemaDto.java @@ -0,0 +1,386 @@ +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.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; + } + + @JsonProperty("properties") + @Override + public Optional getProperties() { + return properties; + } + + @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 "SynchronizeSchemaDto{" + "properties: " + properties + ", scripts: " + scripts + + ", fieldsInReferences: " + fieldsInReferences + ", fieldsInLists: " + fieldsInLists + ", fields: " + + fields + ", previewUrls: " + previewUrls + ", fieldRules: " + fieldRules + ", category: " + category + + ", isPublished: " + isPublished + ", noFieldDeletion: " + noFieldDeletion + ", noFieldRecreation: " + + noFieldRecreation + "}"; + } + + 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 new file mode 100644 index 0000000..68eac75 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/schemas/requests/UpdateSchemaDto.java @@ -0,0 +1,253 @@ +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 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 "UpdateSchemaDto{" + "label: " + label + ", hints: " + hints + ", contentsSidebarUrl: " + + contentsSidebarUrl + ", contentSidebarUrl: " + contentSidebarUrl + ", contentEditorUrl: " + + contentEditorUrl + ", validateOnPublish: " + validateOnPublish + ", tags: " + tags + "}"; + } + + 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 new file mode 100644 index 0000000..d7e59da --- /dev/null +++ b/src/main/java/com/squidex/api/resources/search/SearchClient.java @@ -0,0 +1,56 @@ +package com.squidex.api.resources.search; + +import com.fasterxml.jackson.core.type.TypeReference; +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.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; + +public class SearchClient { + protected final ClientOptions clientOptions; + + public SearchClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public List getSearchResults(SearchGetSearchResultsRequest request) { + return getSearchResults(request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..b09f277 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/search/requests/SearchGetSearchResultsRequest.java @@ -0,0 +1,79 @@ +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 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 "SearchGetSearchResultsRequest{" + "query: " + query + "}"; + } + + 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 new file mode 100644 index 0000000..b5aa0e0 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/statistics/StatisticsClient.java @@ -0,0 +1,231 @@ +package com.squidex.api.resources.statistics; + +import com.fasterxml.jackson.core.type.TypeReference; +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.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() { + return getLog(null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), LogDownloadDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public CallsUsageDtoDto getUsages(String fromDate, String toDate) { + return getUsages(fromDate, toDate, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CallsUsageDtoDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public CallsUsageDtoDto getUsagesForTeam(String team, String fromDate, String toDate) { + return getUsagesForTeam(team, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CallsUsageDtoDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public CurrentStorageDto getCurrentStorageSize() { + return getCurrentStorageSize(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CurrentStorageDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public CurrentStorageDto getTeamCurrentStorageSizeForTeam(String team) { + return getTeamCurrentStorageSizeForTeam(team, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), CurrentStorageDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getStorageSizes(String fromDate, String toDate) { + return getStorageSizes(fromDate, toDate, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getStorageSizesForTeam(String team, String fromDate, String toDate) { + return getStorageSizesForTeam(team, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/squidex/api/resources/teams/TeamsClient.java b/src/main/java/com/squidex/api/resources/teams/TeamsClient.java new file mode 100644 index 0000000..dc9cca5 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/teams/TeamsClient.java @@ -0,0 +1,275 @@ +package com.squidex.api.resources.teams; + +import com.fasterxml.jackson.core.type.TypeReference; +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.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 TeamsClient { + protected final ClientOptions clientOptions; + + public TeamsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public ContributorsDto getContributors(String team) { + return getContributors(team, null); + } + + 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContributorsDto postContributor(String team, AssignContributorDto request) { + return postContributor(team, request, 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 _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request _request = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContributorsDto deleteMyself(String team) { + return deleteMyself(team, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public ContributorsDto deleteContributor(String team, String id) { + return deleteContributor(team, id, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ContributorsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getTeams() { + return getTeams(null); + } + + public List getTeams(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/teams") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public TeamDto postTeam(CreateTeamDto request) { + return postTeam(request, null); + } + + public TeamDto postTeam(CreateTeamDto request, RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/teams") + .build(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("name", request.getName()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TeamDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public TeamDto getTeam(String team) { + return getTeam(team, null); + } + + public TeamDto getTeam(String team, RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/teams") + .addPathSegment(team) + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TeamDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public TeamDto putTeam(String team, UpdateTeamDto request) { + return putTeam(team, request, 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("name", request.getName()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TeamDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..1fda985 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/teams/requests/CreateTeamDto.java @@ -0,0 +1,89 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "CreateTeamDto{" + "name: " + name + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..f9b16d4 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/teams/requests/UpdateTeamDto.java @@ -0,0 +1,89 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "UpdateTeamDto{" + "name: " + name + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..c38cb69 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/templates/TemplatesClient.java @@ -0,0 +1,72 @@ +package com.squidex.api.resources.templates; + +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 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() { + return getTemplates(null); + } + + public TemplatesDto getTemplates(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/templates") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TemplatesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public TemplateDetailsDto getTemplate(String name) { + return getTemplate(name, null); + } + + public TemplateDetailsDto getTemplate(String name, RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/templates") + .addPathSegment(name) + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TemplateDetailsDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/com/squidex/api/resources/translations/TranslationsClient.java b/src/main/java/com/squidex/api/resources/translations/TranslationsClient.java new file mode 100644 index 0000000..b2532e2 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/translations/TranslationsClient.java @@ -0,0 +1,65 @@ +package com.squidex.api.resources.translations; + +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.TranslateDto; +import com.squidex.api.types.TranslationDto; +import java.util.HashMap; +import java.util.Map; +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) { + return postTranslation(request, null); + } + + 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("text", request.getText()); + _requestBodyProperties.put("targetLanguage", request.getTargetLanguage()); + if (request.getSourceLanguage().isPresent()) { + _requestBodyProperties.put("sourceLanguage", request.getSourceLanguage()); + } + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), TranslationDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..1f0a40a --- /dev/null +++ b/src/main/java/com/squidex/api/resources/translations/requests/TranslateDto.java @@ -0,0 +1,158 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("text") + public String getText() { + return text; + } + + /** + * @return The target language. <span style="white-space: nowrap">non-empty</span> + */ + @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 "TranslateDto{" + "text: " + text + ", targetLanguage: " + targetLanguage + ", sourceLanguage: " + + sourceLanguage + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..06a95f0 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/usermanagement/UserManagementClient.java @@ -0,0 +1,252 @@ +package com.squidex.api.resources.usermanagement; + +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.util.HashMap; +import java.util.Map; +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(UserManagementGetUsersRequest request) { + return getUsers(request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UsersDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public UserDto postUser(CreateUserDto request) { + return postUser(request, null); + } + + public UserDto postUser(CreateUserDto request, RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/user-management") + .build(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("email", request.getEmail()); + _requestBodyProperties.put("displayName", request.getDisplayName()); + _requestBodyProperties.put("password", request.getPassword()); + _requestBodyProperties.put("permissions", request.getPermissions()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("POST", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public UserDto getUser(String id) { + return getUser(id, 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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public UserDto putUser(String id, UpdateUserDto request) { + return putUser(id, request, 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(); + Map _requestBodyProperties = new HashMap<>(); + _requestBodyProperties.put("email", request.getEmail()); + _requestBodyProperties.put("displayName", request.getDisplayName()); + if (request.getPassword().isPresent()) { + _requestBodyProperties.put("password", request.getPassword()); + } + _requestBodyProperties.put("permissions", request.getPermissions()); + RequestBody _requestBody; + try { + _requestBody = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(_requestBodyProperties), + MediaType.parse("application/json")); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl) + .method("PUT", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void deleteUser(String id) { + deleteUser(id, 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 _request = new Request.Builder() + .url(_httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return; + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public UserDto lockUser(String id) { + return lockUser(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public UserDto unlockUser(String id) { + return unlockUser(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..e17f464 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/usermanagement/requests/CreateUserDto.java @@ -0,0 +1,202 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("email") + public String getEmail() { + return email; + } + + /** + * @return The display name (usually first name and last name) of the user. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("displayName") + public String getDisplayName() { + return displayName; + } + + /** + * @return The password of the user. <span style="white-space: nowrap">non-empty</span> + */ + @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 "CreateUserDto{" + "email: " + email + ", displayName: " + displayName + ", password: " + password + + ", permissions: " + permissions + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..873ca45 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/usermanagement/requests/UpdateUserDto.java @@ -0,0 +1,209 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("email") + public String getEmail() { + return email; + } + + /** + * @return The display name (usually first name and last name) of the user. <span style="white-space: nowrap">non-empty</span> + */ + @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 "UpdateUserDto{" + "email: " + email + ", displayName: " + displayName + ", password: " + password + + ", permissions: " + permissions + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..0cb8193 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/usermanagement/requests/UserManagementGetUsersRequest.java @@ -0,0 +1,129 @@ +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 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 "UserManagementGetUsersRequest{" + "query: " + query + ", skip: " + skip + ", take: " + take + "}"; + } + + 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 new file mode 100644 index 0000000..5b35fa5 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/users/UsersClient.java @@ -0,0 +1,136 @@ +package com.squidex.api.resources.users; + +import com.fasterxml.jackson.core.type.TypeReference; +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.UsersGetUsersRequest; +import com.squidex.api.types.ResourcesDto; +import com.squidex.api.types.UserDto; +import java.io.InputStream; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +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() { + return getUserResources(null); + } + + public ResourcesDto getUserResources(RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api") + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), ResourcesDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public List getUsers(UsersGetUsersRequest request) { + return getUsers(request, null); + } + + 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()); + } + RequestBody _requestBody = null; + Request.Builder _requestBuilder = new Request.Builder() + .url(_httpUrl.build()) + .method("GET", _requestBody) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json"); + Request _request = _requestBuilder.build(); + try { + Response _response = clientOptions.httpClient().newCall(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue( + _response.body().string(), new TypeReference>() {}); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public UserDto getUser(String id) { + return getUser(id, null); + } + + public UserDto getUser(String id, RequestOptions requestOptions) { + HttpUrl _httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("api/users") + .addPathSegment(id) + .build(); + Request _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return ObjectMappers.JSON_MAPPER.readValue(_response.body().string(), UserDto.class); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public InputStream getUserPicture(String id) { + return getUserPicture(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 _request = 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(_request).execute(); + if (_response.isSuccessful()) { + return _response.body().byteStream(); + } + throw new RuntimeException(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} 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 new file mode 100644 index 0000000..464af42 --- /dev/null +++ b/src/main/java/com/squidex/api/resources/users/requests/UsersGetUsersRequest.java @@ -0,0 +1,79 @@ +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 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 "UsersGetUsersRequest{" + "query: " + query + "}"; + } + + 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/ActionTypeEnum.java b/src/main/java/com/squidex/api/types/ActionTypeEnum.java new file mode 100644 index 0000000..881cfb0 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ActionTypeEnum.java @@ -0,0 +1,23 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ActionTypeEnum { + BROADCAST("Broadcast"), + + USER("User"), + + GROUP("Group"); + + private final String value; + + ActionTypeEnum(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/AddFieldDto.java b/src/main/java/com/squidex/api/types/AddFieldDto.java new file mode 100644 index 0000000..f324e3c --- /dev/null +++ b/src/main/java/com/squidex/api/types/AddFieldDto.java @@ -0,0 +1,151 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = AddFieldDto.Builder.class) +public final class AddFieldDto { + private final String name; + + private final Optional partitioning; + + private final FieldPropertiesDto properties; + + private AddFieldDto(String name, Optional partitioning, FieldPropertiesDto properties) { + this.name = name; + this.partitioning = partitioning; + this.properties = properties; + } + + /** + * @return The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return Determines the optional partitioning of the field. + */ + @JsonProperty("partitioning") + public Optional getPartitioning() { + return partitioning; + } + + @JsonProperty("properties") + public FieldPropertiesDto getProperties() { + return properties; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AddFieldDto && equalTo((AddFieldDto) other); + } + + private boolean equalTo(AddFieldDto other) { + return name.equals(other.name) + && partitioning.equals(other.partitioning) + && properties.equals(other.properties); + } + + @Override + public int hashCode() { + return Objects.hash(this.name, this.partitioning, this.properties); + } + + @Override + public String toString() { + return "AddFieldDto{" + "name: " + name + ", partitioning: " + partitioning + ", properties: " + properties + + "}"; + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + PropertiesStage name(String name); + + Builder from(AddFieldDto other); + } + + public interface PropertiesStage { + _FinalStage properties(FieldPropertiesDto properties); + } + + public interface _FinalStage { + AddFieldDto build(); + + _FinalStage partitioning(Optional partitioning); + + _FinalStage partitioning(String partitioning); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, PropertiesStage, _FinalStage { + private String name; + + private FieldPropertiesDto properties; + + private Optional partitioning = Optional.empty(); + + private Builder() {} + + @Override + public Builder from(AddFieldDto other) { + name(other.getName()); + partitioning(other.getPartitioning()); + properties(other.getProperties()); + return this; + } + + /** + *

The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + @JsonSetter("properties") + public _FinalStage properties(FieldPropertiesDto properties) { + this.properties = properties; + 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; + } + + @Override + public AddFieldDto build() { + return new AddFieldDto(name, partitioning, properties); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java b/src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java new file mode 100644 index 0000000..2bae9ba --- /dev/null +++ b/src/main/java/com/squidex/api/types/AlgoliaRuleActionDto.java @@ -0,0 +1,225 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("appId") + public String getAppId() { + return appId; + } + + /** + * @return The API key to grant access to Squidex. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return The name of the index. <span style="white-space: nowrap">non-empty</span> + */ + @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 "AlgoliaRuleActionDto{" + "appId: " + appId + ", apiKey: " + apiKey + ", indexName: " + indexName + + ", document: " + document + ", delete: " + delete + "}"; + } + + public static AppIdStage builder() { + return new Builder(); + } + + public interface AppIdStage { + ApiKeyStage appId(String appId); + + Builder from(AlgoliaRuleActionDto other); + } + + public interface ApiKeyStage { + IndexNameStage apiKey(String apiKey); + } + + public interface IndexNameStage { + _FinalStage indexName(String indexName); + } + + public interface _FinalStage { + AlgoliaRuleActionDto build(); + + _FinalStage document(Optional document); + + _FinalStage document(String document); + + _FinalStage delete(Optional delete); + + _FinalStage delete(String delete); + } + + @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The name of the index. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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; + } + + @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); + } + } +} 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..ad22c74 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AllContentsByPostDto.java @@ -0,0 +1,244 @@ +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 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> 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> ids, + Optional scheduledFrom, + Optional scheduledTo, + Optional referencing, + Optional references, + Optional oData, + Optional q) { + 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 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 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.ids, this.scheduledFrom, this.scheduledTo, this.referencing, this.references, this.oData, this.q); + } + + @Override + public String toString() { + return "AllContentsByPostDto{" + "ids: " + ids + ", scheduledFrom: " + scheduledFrom + ", scheduledTo: " + + scheduledTo + ", referencing: " + referencing + ", references: " + references + ", oData: " + oData + + ", q: " + q + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + 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) { + 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 = "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(ids, scheduledFrom, scheduledTo, referencing, references, oData, q); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AppDto.java b/src/main/java/com/squidex/api/types/AppDto.java new file mode 100644 index 0000000..b473f22 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AppDto.java @@ -0,0 +1,622 @@ +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 java.time.OffsetDateTime; +import java.util.ArrayList; +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 = 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 "AppDto{" + "links: " + links + ", id: " + id + ", name: " + name + ", label: " + label + + ", description: " + description + ", version: " + version + ", created: " + created + + ", lastModified: " + lastModified + ", teamId: " + teamId + ", permissions: " + permissions + + ", canAccessApi: " + canAccessApi + ", canAccessContent: " + canAccessContent + ", roleName: " + + roleName + ", roleProperties: " + roleProperties + "}"; + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(String id); + + Builder from(AppDto other); + } + + public interface NameStage { + VersionStage name(String name); + } + + public interface VersionStage { + CreatedStage version(int version); + } + + public interface CreatedStage { + LastModifiedStage created(OffsetDateTime created); + } + + public interface LastModifiedStage { + CanAccessApiStage lastModified(OffsetDateTime lastModified); + } + + public interface CanAccessApiStage { + CanAccessContentStage canAccessApi(boolean canAccessApi); + } + + public interface CanAccessContentStage { + _FinalStage canAccessContent(boolean canAccessContent); + } + + 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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AppLanguageDto.java b/src/main/java/com/squidex/api/types/AppLanguageDto.java new file mode 100644 index 0000000..51f7814 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AppLanguageDto.java @@ -0,0 +1,291 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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 "AppLanguageDto{" + "links: " + links + ", iso2Code: " + iso2Code + ", englishName: " + englishName + + ", fallback: " + fallback + ", isMaster: " + isMaster + ", isOptional: " + isOptional + "}"; + } + + public static Iso2CodeStage builder() { + return new Builder(); + } + + public interface Iso2CodeStage { + EnglishNameStage iso2Code(String iso2Code); + + Builder from(AppLanguageDto other); + } + + public interface EnglishNameStage { + IsMasterStage englishName(String englishName); + } + + public interface IsMasterStage { + IsOptionalStage isMaster(boolean isMaster); + } + + public interface IsOptionalStage { + _FinalStage isOptional(boolean isOptional); + } + + 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); + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AppLanguagesDto.java b/src/main/java/com/squidex/api/types/AppLanguagesDto.java new file mode 100644 index 0000000..d61ed5a --- /dev/null +++ b/src/main/java/com/squidex/api/types/AppLanguagesDto.java @@ -0,0 +1,120 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + + private final List items; + + private AppLanguagesDto(Map links, List items) { + this.links = links; + this.items = items; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + /** + * @return The languages. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppLanguagesDto && equalTo((AppLanguagesDto) other); + } + + private boolean equalTo(AppLanguagesDto other) { + return links.equals(other.links) && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.items); + } + + @Override + public String toString() { + return "AppLanguagesDto{" + "links: " + links + ", items: " + items + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map links = new LinkedHashMap<>(); + + private List items = new ArrayList<>(); + + private Builder() {} + + public Builder from(AppLanguagesDto other) { + links(other.getLinks()); + items(other.getItems()); + return this; + } + + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public Builder links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + @JsonSetter(value = "items", nulls = Nulls.SKIP) + public Builder items(List items) { + this.items.clear(); + this.items.addAll(items); + return this; + } + + public Builder addItems(AppLanguageDto items) { + this.items.add(items); + return this; + } + + public Builder addAllItems(List items) { + this.items.addAll(items); + return this; + } + + public AppLanguagesDto build() { + return new AppLanguagesDto(links, items); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AppSettingsDto.java b/src/main/java/com/squidex/api/types/AppSettingsDto.java new file mode 100644 index 0000000..ed4f86a --- /dev/null +++ b/src/main/java/com/squidex/api/types/AppSettingsDto.java @@ -0,0 +1,312 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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); + } + + 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; + } + + @Override + public int hashCode() { + return Objects.hash( + this.links, this.patterns, this.editors, this.hideScheduler, this.hideDateTimeModeButton, this.version); + } + + @Override + public String toString() { + return "AppSettingsDto{" + "links: " + links + ", patterns: " + patterns + ", editors: " + editors + + ", hideScheduler: " + hideScheduler + ", hideDateTimeModeButton: " + hideDateTimeModeButton + + ", version: " + version + "}"; + } + + public static HideSchedulerStage builder() { + return new Builder(); + } + + public interface HideSchedulerStage { + HideDateTimeModeButtonStage hideScheduler(boolean hideScheduler); + + Builder from(AppSettingsDto other); + } + + public interface HideDateTimeModeButtonStage { + VersionStage hideDateTimeModeButton(boolean hideDateTimeModeButton); + } + + public interface VersionStage { + _FinalStage version(int version); + } + + 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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java new file mode 100644 index 0000000..e255c52 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ArrayFieldPropertiesDto.java @@ -0,0 +1,134 @@ +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 java.util.List; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = ArrayFieldPropertiesDto.Builder.class) +public final class ArrayFieldPropertiesDto { + private final Optional minItems; + + private final Optional maxItems; + + private final Optional> uniqueFields; + + private ArrayFieldPropertiesDto( + Optional minItems, Optional maxItems, Optional> uniqueFields) { + this.minItems = minItems; + this.maxItems = maxItems; + this.uniqueFields = uniqueFields; + } + + /** + * @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 fields that must be unique. + */ + @JsonProperty("uniqueFields") + public Optional> getUniqueFields() { + return uniqueFields; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ArrayFieldPropertiesDto && equalTo((ArrayFieldPropertiesDto) other); + } + + private boolean equalTo(ArrayFieldPropertiesDto other) { + return minItems.equals(other.minItems) + && maxItems.equals(other.maxItems) + && uniqueFields.equals(other.uniqueFields); + } + + @Override + public int hashCode() { + return Objects.hash(this.minItems, this.maxItems, this.uniqueFields); + } + + @Override + public String toString() { + return "ArrayFieldPropertiesDto{" + "minItems: " + minItems + ", maxItems: " + maxItems + ", uniqueFields: " + + uniqueFields + "}"; + } + + 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> uniqueFields = Optional.empty(); + + private Builder() {} + + public Builder from(ArrayFieldPropertiesDto other) { + minItems(other.getMinItems()); + maxItems(other.getMaxItems()); + uniqueFields(other.getUniqueFields()); + 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 = "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 ArrayFieldPropertiesDto build() { + return new ArrayFieldPropertiesDto(minItems, maxItems, uniqueFields); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java b/src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java new file mode 100644 index 0000000..abcbfb6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetChangedRuleTriggerDto.java @@ -0,0 +1,79 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = AssetChangedRuleTriggerDto.Builder.class) +public final class AssetChangedRuleTriggerDto { + private final Optional condition; + + private AssetChangedRuleTriggerDto(Optional condition) { + this.condition = condition; + } + + /** + * @return Javascript condition when to trigger. + */ + @JsonProperty("condition") + public Optional getCondition() { + return condition; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssetChangedRuleTriggerDto && equalTo((AssetChangedRuleTriggerDto) other); + } + + private boolean equalTo(AssetChangedRuleTriggerDto other) { + return condition.equals(other.condition); + } + + @Override + public int hashCode() { + return Objects.hash(this.condition); + } + + @Override + public String toString() { + return "AssetChangedRuleTriggerDto{" + "condition: " + condition + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional condition = Optional.empty(); + + private Builder() {} + + public Builder from(AssetChangedRuleTriggerDto other) { + condition(other.getCondition()); + return this; + } + + @JsonSetter(value = "condition", nulls = Nulls.SKIP) + public Builder condition(Optional condition) { + this.condition = condition; + return this; + } + + public Builder condition(String condition) { + this.condition = Optional.of(condition); + return this; + } + + public AssetChangedRuleTriggerDto build() { + return new AssetChangedRuleTriggerDto(condition); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AssetDto.java b/src/main/java/com/squidex/api/types/AssetDto.java new file mode 100644 index 0000000..697dba3 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetDto.java @@ -0,0 +1,976 @@ +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 java.time.OffsetDateTime; +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 = 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; + } + + @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; + } + + @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); + } + + @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); + } + + @Override + public String toString() { + return "AssetDto{" + "links: " + links + ", id: " + id + ", parentId: " + parentId + ", fileName: " + fileName + + ", fileHash: " + fileHash + ", isProtected: " + isProtected + ", slug: " + slug + ", mimeType: " + + mimeType + ", fileType: " + fileType + ", metadataText: " + metadataText + ", editToken: " + editToken + + ", metadata: " + metadata + ", tags: " + tags + ", fileSize: " + fileSize + ", fileVersion: " + + fileVersion + ", type: " + type + ", createdBy: " + createdBy + ", lastModifiedBy: " + lastModifiedBy + + ", created: " + created + ", lastModified: " + lastModified + ", version: " + version + ", meta: " + + meta + ", isImage: " + isImage + ", pixelWidth: " + pixelWidth + ", pixelHeight: " + pixelHeight + + "}"; + } + + 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; + } + + @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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AssetFolderDto.java b/src/main/java/com/squidex/api/types/AssetFolderDto.java new file mode 100644 index 0000000..d7cf8bc --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetFolderDto.java @@ -0,0 +1,234 @@ +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 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 "AssetFolderDto{" + "links: " + links + ", id: " + id + ", parentId: " + parentId + ", folderName: " + + folderName + ", version: " + version + "}"; + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + ParentIdStage id(String id); + + Builder from(AssetFolderDto other); + } + + public interface ParentIdStage { + FolderNameStage parentId(String parentId); + } + + public interface FolderNameStage { + VersionStage folderName(String folderName); + } + + public interface VersionStage { + _FinalStage version(int version); + } + + public interface _FinalStage { + AssetFolderDto build(); + + _FinalStage links(Map links); + + _FinalStage putAllLinks(Map links); + + _FinalStage links(String key, ResourceLink value); + } + + @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; + } + + @Override + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public _FinalStage links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + @Override + public AssetFolderDto build() { + return new AssetFolderDto(links, id, parentId, folderName, version); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AssetFolderScope.java b/src/main/java/com/squidex/api/types/AssetFolderScope.java new file mode 100644 index 0000000..f8eb04f --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetFolderScope.java @@ -0,0 +1,23 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssetFolderScope { + PATH_AND_ITEMS("PathAndItems"), + + PATH("Path"), + + ITEMS("Items"); + + private final String value; + + AssetFolderScope(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/AssetFoldersDto.java b/src/main/java/com/squidex/api/types/AssetFoldersDto.java new file mode 100644 index 0000000..44d6ce6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetFoldersDto.java @@ -0,0 +1,244 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + } + + /** + * @return The path to the current folder. + */ + @JsonProperty("path") + public List getPath() { + return path; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssetFoldersDto && equalTo((AssetFoldersDto) other); + } + + private boolean equalTo(AssetFoldersDto other) { + return links.equals(other.links) + && total == other.total + && items.equals(other.items) + && path.equals(other.path); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.total, this.items, this.path); + } + + @Override + public String toString() { + return "AssetFoldersDto{" + "links: " + links + ", total: " + total + ", items: " + items + ", path: " + path + + "}"; + } + + public static TotalStage builder() { + return new Builder(); + } + + public interface TotalStage { + _FinalStage total(int total); + + Builder from(AssetFoldersDto other); + } + + 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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AssetMeta.java b/src/main/java/com/squidex/api/types/AssetMeta.java new file mode 100644 index 0000000..e88d475 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetMeta.java @@ -0,0 +1,89 @@ +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 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); + } + + @Override + public String toString() { + return "AssetMeta{" + "isDuplicate: " + isDuplicate + "}"; + } + + public static IsDuplicateStage builder() { + return new Builder(); + } + + public interface IsDuplicateStage { + _FinalStage isDuplicate(String isDuplicate); + + Builder from(AssetMeta other); + } + + public interface _FinalStage { + AssetMeta build(); + } + + @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; + } + + /** + *

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; + } + + @Override + public AssetMeta build() { + return new AssetMeta(isDuplicate); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AssetPreviewMode.java b/src/main/java/com/squidex/api/types/AssetPreviewMode.java new file mode 100644 index 0000000..1c793c3 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetPreviewMode.java @@ -0,0 +1,23 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssetPreviewMode { + IMAGE_AND_FILE_NAME("ImageAndFileName"), + + IMAGE("Image"), + + FILE_NAME("FileName"); + + private final String value; + + AssetPreviewMode(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/AssetScriptsDto.java b/src/main/java/com/squidex/api/types/AssetScriptsDto.java new file mode 100644 index 0000000..4f2a532 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetScriptsDto.java @@ -0,0 +1,415 @@ +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 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; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssetScriptsDto && equalTo((AssetScriptsDto) other); + } + + 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; + } + + @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); + } + + @Override + public String toString() { + return "AssetScriptsDto{" + "links: " + links + ", query: " + query + ", queryPre: " + queryPre + ", create: " + + create + ", update: " + update + ", annotate: " + annotate + ", move: " + move + ", delete: " + delete + + ", version: " + version + "}"; + } + + public static VersionStage builder() { + return new Builder(); + } + + public interface VersionStage { + _FinalStage version(int version); + + Builder from(AssetScriptsDto other); + } + + 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); + } + + @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; + } + + @Override + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public _FinalStage query(Optional query) { + this.query = query; + 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 AssetScriptsDto build() { + return new AssetScriptsDto(links, query, queryPre, create, update, annotate, move, delete, version); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AssetType.java b/src/main/java/com/squidex/api/types/AssetType.java new file mode 100644 index 0000000..e2d14c0 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetType.java @@ -0,0 +1,25 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AssetType { + UNKNOWN("Unknown"), + + IMAGE("Image"), + + AUDIO("Audio"), + + VIDEO("Video"); + + private final String value; + + AssetType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/AssetsDto.java b/src/main/java/com/squidex/api/types/AssetsDto.java new file mode 100644 index 0000000..195fd18 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetsDto.java @@ -0,0 +1,191 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + } + + /** + * @return The assets. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssetsDto && equalTo((AssetsDto) other); + } + + private boolean equalTo(AssetsDto other) { + return links.equals(other.links) && total == other.total && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.total, this.items); + } + + @Override + public String toString() { + return "AssetsDto{" + "links: " + links + ", total: " + total + ", items: " + items + "}"; + } + + public static TotalStage builder() { + return new Builder(); + } + + 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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java new file mode 100644 index 0000000..fac1027 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssetsFieldPropertiesDto.java @@ -0,0 +1,662 @@ +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 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; + } + + @JsonProperty("previewMode") + public Optional getPreviewMode() { + return previewMode; + } + + @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; + } + + @JsonProperty("expectedType") + public Optional getExpectedType() { + return expectedType; + } + + /** + * @return True to resolve first asset in the content list. + */ + @JsonProperty("resolveFirst") + public Optional getResolveFirst() { + return resolveFirst; + } + + /** + * @return True to resolve first image in the content list. + */ + @JsonProperty("mustBeImage") + public Optional getMustBeImage() { + return mustBeImage; + } + + /** + * @return True to resolve first image in the content list. + */ + @JsonProperty("resolveImage") + public Optional getResolveImage() { + return resolveImage; + } + + /** + * @return The allowed file extensions. + */ + @JsonProperty("allowedExtensions") + public Optional> getAllowedExtensions() { + return allowedExtensions; + } + + /** + * @return True, if duplicate values are allowed. + */ + @JsonProperty("allowDuplicates") + public Optional getAllowDuplicates() { + return allowDuplicates; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssetsFieldPropertiesDto && equalTo((AssetsFieldPropertiesDto) other); + } + + 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); + } + + @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 "AssetsFieldPropertiesDto{" + "previewMode: " + previewMode + ", defaultValues: " + defaultValues + + ", defaultValue: " + defaultValue + ", folderId: " + folderId + ", previewFormat: " + previewFormat + + ", minItems: " + minItems + ", maxItems: " + maxItems + ", minSize: " + minSize + ", maxSize: " + + maxSize + ", minWidth: " + minWidth + ", maxWidth: " + maxWidth + ", minHeight: " + minHeight + + ", maxHeight: " + maxHeight + ", aspectWidth: " + aspectWidth + ", aspectHeight: " + aspectHeight + + ", expectedType: " + expectedType + ", resolveFirst: " + resolveFirst + ", mustBeImage: " + + mustBeImage + ", resolveImage: " + resolveImage + ", allowedExtensions: " + allowedExtensions + + ", allowDuplicates: " + allowDuplicates + "}"; + } + + 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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AssignContributorDto.java b/src/main/java/com/squidex/api/types/AssignContributorDto.java new file mode 100644 index 0000000..0b90358 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AssignContributorDto.java @@ -0,0 +1,162 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = AssignContributorDto.Builder.class) +public final class AssignContributorDto { + private final String contributorId; + + private final Optional role; + + private final Optional invite; + + private AssignContributorDto(String contributorId, Optional role, Optional invite) { + this.contributorId = contributorId; + this.role = role; + this.invite = invite; + } + + /** + * @return The id or email of the user to add to the app. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("contributorId") + public String getContributorId() { + return contributorId; + } + + /** + * @return The role of the contributor. + */ + @JsonProperty("role") + public Optional getRole() { + return role; + } + + /** + * @return Set to true to invite the user if he does not exist. + */ + @JsonProperty("invite") + public Optional getInvite() { + return invite; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AssignContributorDto && equalTo((AssignContributorDto) other); + } + + private boolean equalTo(AssignContributorDto other) { + return contributorId.equals(other.contributorId) && role.equals(other.role) && invite.equals(other.invite); + } + + @Override + public int hashCode() { + return Objects.hash(this.contributorId, this.role, this.invite); + } + + @Override + public String toString() { + return "AssignContributorDto{" + "contributorId: " + contributorId + ", role: " + role + ", invite: " + invite + + "}"; + } + + public static ContributorIdStage builder() { + return new Builder(); + } + + public interface ContributorIdStage { + _FinalStage contributorId(String contributorId); + + Builder from(AssignContributorDto other); + } + + public interface _FinalStage { + AssignContributorDto build(); + + _FinalStage role(Optional role); + + _FinalStage role(String role); + + _FinalStage invite(Optional invite); + + _FinalStage invite(Boolean invite); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ContributorIdStage, _FinalStage { + private String contributorId; + + private Optional invite = Optional.empty(); + + private Optional role = Optional.empty(); + + private Builder() {} + + @Override + public Builder from(AssignContributorDto other) { + contributorId(other.getContributorId()); + role(other.getRole()); + invite(other.getInvite()); + return this; + } + + /** + *

The id or email of the user to add to the app. <span style="white-space: nowrap">non-empty</span>

+ * @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 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; + } + + @Override + @JsonSetter(value = "invite", nulls = Nulls.SKIP) + public _FinalStage invite(Optional invite) { + this.invite = invite; + 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; + } + + @Override + public AssignContributorDto build() { + return new AssignContributorDto(contributorId, role, invite); + } + } +} diff --git a/src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java b/src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java new file mode 100644 index 0000000..df3a9d6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/AzureQueueRuleActionDto.java @@ -0,0 +1,158 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = AzureQueueRuleActionDto.Builder.class) +public final class AzureQueueRuleActionDto { + private final String connectionString; + + private final String queue; + + private final Optional payload; + + private AzureQueueRuleActionDto(String connectionString, String queue, Optional payload) { + this.connectionString = connectionString; + this.queue = queue; + this.payload = payload; + } + + /** + * @return The connection string to the storage account. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("connectionString") + public String getConnectionString() { + return connectionString; + } + + /** + * @return The name of the queue. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("queue") + public String getQueue() { + return queue; + } + + /** + * @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 AzureQueueRuleActionDto && equalTo((AzureQueueRuleActionDto) other); + } + + private boolean equalTo(AzureQueueRuleActionDto other) { + return connectionString.equals(other.connectionString) + && queue.equals(other.queue) + && payload.equals(other.payload); + } + + @Override + public int hashCode() { + return Objects.hash(this.connectionString, this.queue, this.payload); + } + + @Override + public String toString() { + return "AzureQueueRuleActionDto{" + "connectionString: " + connectionString + ", queue: " + queue + + ", payload: " + payload + "}"; + } + + public static ConnectionStringStage builder() { + return new Builder(); + } + + public interface ConnectionStringStage { + QueueStage connectionString(String connectionString); + + Builder from(AzureQueueRuleActionDto other); + } + + public interface QueueStage { + _FinalStage queue(String queue); + } + + public interface _FinalStage { + AzureQueueRuleActionDto build(); + + _FinalStage payload(Optional payload); + + _FinalStage payload(String payload); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ConnectionStringStage, QueueStage, _FinalStage { + private String connectionString; + + private String queue; + + private Optional payload = Optional.empty(); + + private Builder() {} + + @Override + public Builder from(AzureQueueRuleActionDto other) { + connectionString(other.getConnectionString()); + queue(other.getQueue()); + payload(other.getPayload()); + return this; + } + + /** + *

The connection string to the storage account. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The name of the queue. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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 AzureQueueRuleActionDto build() { + return new AzureQueueRuleActionDto(connectionString, queue, payload); + } + } +} diff --git a/src/main/java/com/squidex/api/types/BackupJobDto.java b/src/main/java/com/squidex/api/types/BackupJobDto.java new file mode 100644 index 0000000..3b11cff --- /dev/null +++ b/src/main/java/com/squidex/api/types/BackupJobDto.java @@ -0,0 +1,304 @@ +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 java.time.OffsetDateTime; +import java.util.LinkedHashMap; +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; + } + + @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 "BackupJobDto{" + "links: " + links + ", id: " + id + ", started: " + started + ", stopped: " + stopped + + ", handledEvents: " + handledEvents + ", handledAssets: " + handledAssets + ", status: " + status + + "}"; + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + StartedStage id(String id); + + Builder from(BackupJobDto other); + } + + public interface StartedStage { + HandledEventsStage started(OffsetDateTime started); + } + + public interface HandledEventsStage { + HandledAssetsStage handledEvents(int handledEvents); + } + + public interface HandledAssetsStage { + StatusStage handledAssets(int handledAssets); + } + + public interface StatusStage { + _FinalStage status(JobStatus status); + } + + 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; + } + + /** + *

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; + } + + /** + *

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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/BackupJobsDto.java b/src/main/java/com/squidex/api/types/BackupJobsDto.java new file mode 100644 index 0000000..9e51be8 --- /dev/null +++ b/src/main/java/com/squidex/api/types/BackupJobsDto.java @@ -0,0 +1,120 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + + private final List items; + + private BackupJobsDto(Map links, List items) { + this.links = links; + this.items = items; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + /** + * @return The backups. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BackupJobsDto && equalTo((BackupJobsDto) other); + } + + private boolean equalTo(BackupJobsDto other) { + return links.equals(other.links) && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.items); + } + + @Override + public String toString() { + return "BackupJobsDto{" + "links: " + links + ", items: " + items + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map links = new LinkedHashMap<>(); + + private List items = new ArrayList<>(); + + private Builder() {} + + public Builder from(BackupJobsDto other) { + links(other.getLinks()); + items(other.getItems()); + return this; + } + + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public Builder links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + @JsonSetter(value = "items", nulls = Nulls.SKIP) + public Builder items(List items) { + this.items.clear(); + this.items.addAll(items); + return this; + } + + public Builder addItems(BackupJobDto items) { + this.items.add(items); + return this; + } + + public Builder addAllItems(List items) { + this.items.addAll(items); + return this; + } + + public BackupJobsDto build() { + return new BackupJobsDto(links, items); + } + } +} diff --git a/src/main/java/com/squidex/api/types/BooleanFieldEditor.java b/src/main/java/com/squidex/api/types/BooleanFieldEditor.java new file mode 100644 index 0000000..c49a17d --- /dev/null +++ b/src/main/java/com/squidex/api/types/BooleanFieldEditor.java @@ -0,0 +1,21 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum BooleanFieldEditor { + CHECKBOX("Checkbox"), + + TOGGLE("Toggle"); + + private final String value; + + BooleanFieldEditor(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java new file mode 100644 index 0000000..e6da4d6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/BooleanFieldPropertiesDto.java @@ -0,0 +1,157 @@ +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 java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = BooleanFieldPropertiesDto.Builder.class) +public final class BooleanFieldPropertiesDto { + private final Optional>> defaultValues; + + private final Optional defaultValue; + + private final Optional inlineEditable; + + private final Optional editor; + + private BooleanFieldPropertiesDto( + Optional>> defaultValues, + Optional defaultValue, + Optional inlineEditable, + Optional editor) { + this.defaultValues = defaultValues; + this.defaultValue = defaultValue; + this.inlineEditable = inlineEditable; + this.editor = editor; + } + + @JsonProperty("defaultValues") + public Optional>> getDefaultValues() { + return defaultValues; + } + + /** + * @return The default value for the field value. + */ + @JsonProperty("defaultValue") + public Optional getDefaultValue() { + return defaultValue; + } + + /** + * @return Indicates that the inline editor is enabled for this field. + */ + @JsonProperty("inlineEditable") + public Optional getInlineEditable() { + return inlineEditable; + } + + @JsonProperty("editor") + public Optional getEditor() { + return editor; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BooleanFieldPropertiesDto && equalTo((BooleanFieldPropertiesDto) other); + } + + private boolean equalTo(BooleanFieldPropertiesDto other) { + return defaultValues.equals(other.defaultValues) + && defaultValue.equals(other.defaultValue) + && inlineEditable.equals(other.inlineEditable) + && editor.equals(other.editor); + } + + @Override + public int hashCode() { + return Objects.hash(this.defaultValues, this.defaultValue, this.inlineEditable, this.editor); + } + + @Override + public String toString() { + return "BooleanFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue + + ", inlineEditable: " + inlineEditable + ", editor: " + editor + "}"; + } + + 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 inlineEditable = Optional.empty(); + + private Optional editor = Optional.empty(); + + private Builder() {} + + 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 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(Boolean defaultValue) { + this.defaultValue = Optional.of(defaultValue); + 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(BooleanFieldEditor editor) { + this.editor = Optional.of(editor); + return this; + } + + public BooleanFieldPropertiesDto build() { + return new BooleanFieldPropertiesDto(defaultValues, defaultValue, inlineEditable, editor); + } + } +} diff --git a/src/main/java/com/squidex/api/types/BulkResultDto.java b/src/main/java/com/squidex/api/types/BulkResultDto.java new file mode 100644 index 0000000..22fc0f4 --- /dev/null +++ b/src/main/java/com/squidex/api/types/BulkResultDto.java @@ -0,0 +1,193 @@ +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 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; + } + + @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; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BulkResultDto && equalTo((BulkResultDto) other); + } + + private boolean equalTo(BulkResultDto other) { + return error.equals(other.error) + && jobIndex == other.jobIndex + && id.equals(other.id) + && contentId.equals(other.contentId); + } + + @Override + public int hashCode() { + return Objects.hash(this.error, this.jobIndex, this.id, this.contentId); + } + + @Override + public String toString() { + return "BulkResultDto{" + "error: " + error + ", jobIndex: " + jobIndex + ", id: " + id + ", contentId: " + + contentId + "}"; + } + + public static JobIndexStage builder() { + return new Builder(); + } + + 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; + } + + /** + *

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; + } + + @Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/BulkUpdateAssetType.java b/src/main/java/com/squidex/api/types/BulkUpdateAssetType.java new file mode 100644 index 0000000..5a7152f --- /dev/null +++ b/src/main/java/com/squidex/api/types/BulkUpdateAssetType.java @@ -0,0 +1,23 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum BulkUpdateAssetType { + ANNOTATE("Annotate"), + + MOVE("Move"), + + DELETE("Delete"); + + private final String value; + + BulkUpdateAssetType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java b/src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java new file mode 100644 index 0000000..b42c177 --- /dev/null +++ b/src/main/java/com/squidex/api/types/BulkUpdateAssetsJobDto.java @@ -0,0 +1,335 @@ +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 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; + } + + @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; + } + + /** + * @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; + } + + /** + * @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; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BulkUpdateAssetsJobDto && equalTo((BulkUpdateAssetsJobDto) other); + } + + 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); + } + + @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 "BulkUpdateAssetsJobDto{" + "id: " + id + ", type: " + type + ", parentId: " + parentId + ", fileName: " + + fileName + ", slug: " + slug + ", isProtected: " + isProtected + ", tags: " + tags + ", metadata: " + + metadata + ", permanent: " + permanent + ", expectedVersion: " + expectedVersion + "}"; + } + + 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; + } + + 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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/BulkUpdateContentType.java b/src/main/java/com/squidex/api/types/BulkUpdateContentType.java new file mode 100644 index 0000000..4aa076e --- /dev/null +++ b/src/main/java/com/squidex/api/types/BulkUpdateContentType.java @@ -0,0 +1,31 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum BulkUpdateContentType { + UPSERT("Upsert"), + + CHANGE_STATUS("ChangeStatus"), + + CREATE("Create"), + + DELETE("Delete"), + + PATCH("Patch"), + + UPDATE("Update"), + + VALIDATE("Validate"); + + private final String value; + + BulkUpdateContentType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java b/src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java new file mode 100644 index 0000000..9c85444 --- /dev/null +++ b/src/main/java/com/squidex/api/types/BulkUpdateContentsJobDto.java @@ -0,0 +1,358 @@ +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 java.time.OffsetDateTime; +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; + } + + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + /** + * @return An optional ID of the content to update. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + @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; + } + + @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; + } + + /** + * @return The expected version. + */ + @JsonProperty("expectedVersion") + public Optional getExpectedVersion() { + return expectedVersion; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BulkUpdateContentsJobDto && equalTo((BulkUpdateContentsJobDto) other); + } + + 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); + } + + @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); + } + + @Override + public String toString() { + return "BulkUpdateContentsJobDto{" + "query: " + query + ", id: " + id + ", data: " + data + ", status: " + + status + ", dueTime: " + dueTime + ", type: " + type + ", schema: " + schema + ", patch: " + patch + + ", permanent: " + permanent + ", expectedCount: " + expectedCount + ", expectedVersion: " + + expectedVersion + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @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; + } + + 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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/CallsUsageDtoDto.java b/src/main/java/com/squidex/api/types/CallsUsageDtoDto.java new file mode 100644 index 0000000..1ced41e --- /dev/null +++ b/src/main/java/com/squidex/api/types/CallsUsageDtoDto.java @@ -0,0 +1,391 @@ +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 java.util.LinkedHashMap; +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 "CallsUsageDtoDto{" + "totalCalls: " + totalCalls + ", totalBytes: " + totalBytes + ", monthCalls: " + + monthCalls + ", monthBytes: " + monthBytes + ", blockingApiCalls: " + blockingApiCalls + + ", allowedBytes: " + allowedBytes + ", allowedCalls: " + allowedCalls + ", averageElapsedMs: " + + averageElapsedMs + ", details: " + details + "}"; + } + + 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); + } + + public interface BlockingApiCallsStage { + AllowedBytesStage blockingApiCalls(int blockingApiCalls); + } + + public interface AllowedBytesStage { + AllowedCallsStage allowedBytes(int allowedBytes); + } + + public interface AllowedCallsStage { + AverageElapsedMsStage allowedCalls(int allowedCalls); + } + + public interface AverageElapsedMsStage { + _FinalStage averageElapsedMs(double averageElapsedMs); + } + + public interface _FinalStage { + CallsUsageDtoDto build(); + + _FinalStage details(Map> details); + + _FinalStage putAllDetails(Map> details); + + _FinalStage details(String key, List value); + } + + @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; + } + + /** + *

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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java b/src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java new file mode 100644 index 0000000..1f6d6ed --- /dev/null +++ b/src/main/java/com/squidex/api/types/CallsUsagePerDateDto.java @@ -0,0 +1,181 @@ +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 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 "CallsUsagePerDateDto{" + "date: " + date + ", totalCalls: " + totalCalls + ", totalBytes: " + totalBytes + + ", averageElapsedMs: " + averageElapsedMs + "}"; + } + + public static DateStage builder() { + return new Builder(); + } + + public interface DateStage { + TotalCallsStage date(String date); + + Builder from(CallsUsagePerDateDto other); + } + + public interface TotalCallsStage { + TotalBytesStage totalCalls(int totalCalls); + } + + public interface TotalBytesStage { + AverageElapsedMsStage totalBytes(int totalBytes); + } + + public interface AverageElapsedMsStage { + _FinalStage averageElapsedMs(double averageElapsedMs); + } + + public interface _FinalStage { + CallsUsagePerDateDto build(); + } + + @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; + } + + /** + *

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; + } + + /** + *

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 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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ChangePlanDto.java b/src/main/java/com/squidex/api/types/ChangePlanDto.java new file mode 100644 index 0000000..b4995f0 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ChangePlanDto.java @@ -0,0 +1,89 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + @Override + public String toString() { + return "ChangePlanDto{" + "planId: " + planId + "}"; + } + + public static PlanIdStage builder() { + return new Builder(); + } + + public interface PlanIdStage { + _FinalStage planId(String planId); + + Builder from(ChangePlanDto other); + } + + public interface _FinalStage { + ChangePlanDto build(); + } + + @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; + } + + /** + *

The new plan id. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + public ChangePlanDto build() { + return new ChangePlanDto(planId); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ClientDto.java b/src/main/java/com/squidex/api/types/ClientDto.java new file mode 100644 index 0000000..ca4fdd6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ClientDto.java @@ -0,0 +1,354 @@ +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 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 "ClientDto{" + "links: " + links + ", id: " + id + ", secret: " + secret + ", name: " + name + ", role: " + + role + ", apiCallsLimit: " + apiCallsLimit + ", apiTrafficLimit: " + apiTrafficLimit + + ", allowAnonymous: " + allowAnonymous + "}"; + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + SecretStage id(String id); + + Builder from(ClientDto other); + } + + public interface SecretStage { + NameStage secret(String secret); + } + + public interface NameStage { + ApiCallsLimitStage name(String name); + } + + public interface ApiCallsLimitStage { + ApiTrafficLimitStage apiCallsLimit(int apiCallsLimit); + } + + public interface ApiTrafficLimitStage { + AllowAnonymousStage apiTrafficLimit(int apiTrafficLimit); + } + + public interface AllowAnonymousStage { + _FinalStage allowAnonymous(boolean allowAnonymous); + } + + 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); + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ClientsDto.java b/src/main/java/com/squidex/api/types/ClientsDto.java new file mode 100644 index 0000000..1d94d79 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ClientsDto.java @@ -0,0 +1,120 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + + private final List items; + + private ClientsDto(Map links, List items) { + this.links = links; + this.items = items; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + /** + * @return The clients. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientsDto && equalTo((ClientsDto) other); + } + + private boolean equalTo(ClientsDto other) { + return links.equals(other.links) && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.items); + } + + @Override + public String toString() { + return "ClientsDto{" + "links: " + links + ", items: " + items + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map links = new LinkedHashMap<>(); + + private List items = new ArrayList<>(); + + private Builder() {} + + public Builder from(ClientsDto other) { + links(other.getLinks()); + items(other.getItems()); + return this; + } + + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public Builder links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + @JsonSetter(value = "items", nulls = Nulls.SKIP) + public Builder items(List items) { + this.items.clear(); + this.items.addAll(items); + return this; + } + + public Builder addItems(ClientDto items) { + this.items.add(items); + return this; + } + + public Builder addAllItems(List items) { + this.items.addAll(items); + return this; + } + + public ClientsDto build() { + return new ClientsDto(links, items); + } + } +} diff --git a/src/main/java/com/squidex/api/types/CommentDto.java b/src/main/java/com/squidex/api/types/CommentDto.java new file mode 100644 index 0000000..00a0baf --- /dev/null +++ b/src/main/java/com/squidex/api/types/CommentDto.java @@ -0,0 +1,219 @@ +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 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 "CommentDto{" + "id: " + id + ", time: " + time + ", user: " + user + ", text: " + text + ", url: " + url + + "}"; + } + + 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 new file mode 100644 index 0000000..cb2ae0f --- /dev/null +++ b/src/main/java/com/squidex/api/types/CommentRuleActionDto.java @@ -0,0 +1,126 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + @Override + public int hashCode() { + return Objects.hash(this.text, this.client); + } + + @Override + public String toString() { + return "CommentRuleActionDto{" + "text: " + text + ", client: " + client + "}"; + } + + public static TextStage builder() { + return new Builder(); + } + + public interface TextStage { + _FinalStage text(String text); + + Builder from(CommentRuleActionDto other); + } + + public interface _FinalStage { + CommentRuleActionDto build(); + + _FinalStage client(Optional client); + + _FinalStage client(String client); + } + + @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; + } + + /** + *

The comment text. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java b/src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java new file mode 100644 index 0000000..7cc86e1 --- /dev/null +++ b/src/main/java/com/squidex/api/types/CommentRuleTriggerDto.java @@ -0,0 +1,79 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = CommentRuleTriggerDto.Builder.class) +public final class CommentRuleTriggerDto { + private final Optional condition; + + private CommentRuleTriggerDto(Optional condition) { + this.condition = condition; + } + + /** + * @return Javascript condition when to trigger. + */ + @JsonProperty("condition") + public Optional getCondition() { + return condition; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CommentRuleTriggerDto && equalTo((CommentRuleTriggerDto) other); + } + + private boolean equalTo(CommentRuleTriggerDto other) { + return condition.equals(other.condition); + } + + @Override + public int hashCode() { + return Objects.hash(this.condition); + } + + @Override + public String toString() { + return "CommentRuleTriggerDto{" + "condition: " + condition + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional condition = Optional.empty(); + + private Builder() {} + + public Builder from(CommentRuleTriggerDto other) { + condition(other.getCondition()); + return this; + } + + @JsonSetter(value = "condition", nulls = Nulls.SKIP) + public Builder condition(Optional condition) { + this.condition = condition; + return this; + } + + public Builder condition(String condition) { + this.condition = Optional.of(condition); + return this; + } + + public CommentRuleTriggerDto build() { + return new CommentRuleTriggerDto(condition); + } + } +} diff --git a/src/main/java/com/squidex/api/types/CommentsDto.java b/src/main/java/com/squidex/api/types/CommentsDto.java new file mode 100644 index 0000000..cfb554b --- /dev/null +++ b/src/main/java/com/squidex/api/types/CommentsDto.java @@ -0,0 +1,205 @@ +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 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 "CommentsDto{" + "createdComments: " + createdComments + ", updatedComments: " + updatedComments + + ", deletedComments: " + deletedComments + ", version: " + version + "}"; + } + + 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 new file mode 100644 index 0000000..bd5f1ef --- /dev/null +++ b/src/main/java/com/squidex/api/types/ComponentFieldPropertiesDto.java @@ -0,0 +1,80 @@ +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 java.util.List; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = ComponentFieldPropertiesDto.Builder.class) +public final class ComponentFieldPropertiesDto { + private final Optional> schemaIds; + + private ComponentFieldPropertiesDto(Optional> schemaIds) { + this.schemaIds = schemaIds; + } + + /** + * @return The ID of the embedded schemas. + */ + @JsonProperty("schemaIds") + public Optional> getSchemaIds() { + return schemaIds; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentFieldPropertiesDto && equalTo((ComponentFieldPropertiesDto) other); + } + + private boolean equalTo(ComponentFieldPropertiesDto other) { + return schemaIds.equals(other.schemaIds); + } + + @Override + public int hashCode() { + return Objects.hash(this.schemaIds); + } + + @Override + public String toString() { + return "ComponentFieldPropertiesDto{" + "schemaIds: " + schemaIds + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> schemaIds = Optional.empty(); + + private Builder() {} + + public Builder from(ComponentFieldPropertiesDto other) { + schemaIds(other.getSchemaIds()); + 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 ComponentFieldPropertiesDto build() { + return new ComponentFieldPropertiesDto(schemaIds); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java new file mode 100644 index 0000000..ae846fe --- /dev/null +++ b/src/main/java/com/squidex/api/types/ComponentsFieldPropertiesDto.java @@ -0,0 +1,163 @@ +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 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> schemaIds; + + private final Optional> uniqueFields; + + private ComponentsFieldPropertiesDto( + Optional minItems, + Optional maxItems, + Optional> schemaIds, + Optional> uniqueFields) { + this.minItems = minItems; + this.maxItems = maxItems; + this.schemaIds = schemaIds; + this.uniqueFields = uniqueFields; + } + + /** + * @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 ID of the embedded schemas. + */ + @JsonProperty("schemaIds") + public Optional> getSchemaIds() { + return schemaIds; + } + + /** + * @return The fields that must be unique. + */ + @JsonProperty("uniqueFields") + public Optional> getUniqueFields() { + return uniqueFields; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsFieldPropertiesDto && equalTo((ComponentsFieldPropertiesDto) other); + } + + private boolean equalTo(ComponentsFieldPropertiesDto other) { + return minItems.equals(other.minItems) + && maxItems.equals(other.maxItems) + && schemaIds.equals(other.schemaIds) + && uniqueFields.equals(other.uniqueFields); + } + + @Override + public int hashCode() { + return Objects.hash(this.minItems, this.maxItems, this.schemaIds, this.uniqueFields); + } + + @Override + public String toString() { + return "ComponentsFieldPropertiesDto{" + "minItems: " + minItems + ", maxItems: " + maxItems + ", schemaIds: " + + schemaIds + ", uniqueFields: " + uniqueFields + "}"; + } + + 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> schemaIds = Optional.empty(); + + private Optional> uniqueFields = Optional.empty(); + + private Builder() {} + + public Builder from(ComponentsFieldPropertiesDto other) { + minItems(other.getMinItems()); + maxItems(other.getMaxItems()); + schemaIds(other.getSchemaIds()); + uniqueFields(other.getUniqueFields()); + 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 = "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, schemaIds, uniqueFields); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java b/src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java new file mode 100644 index 0000000..593b83e --- /dev/null +++ b/src/main/java/com/squidex/api/types/ContentChangedRuleTriggerDto.java @@ -0,0 +1,168 @@ +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 java.util.List; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = ContentChangedRuleTriggerDto.Builder.class) +public final class ContentChangedRuleTriggerDto { + private final Optional> schemas; + + private final Optional> referencedSchemas; + + private final boolean handleAll; + + private ContentChangedRuleTriggerDto( + Optional> schemas, + Optional> referencedSchemas, + boolean handleAll) { + this.schemas = schemas; + this.referencedSchemas = referencedSchemas; + this.handleAll = handleAll; + } + + /** + * @return The schema settings. + */ + @JsonProperty("schemas") + public Optional> getSchemas() { + return schemas; + } + + /** + * @return The schema references. + */ + @JsonProperty("referencedSchemas") + public Optional> getReferencedSchemas() { + return referencedSchemas; + } + + /** + * @return Determines whether the trigger should handle all content changes events. + */ + @JsonProperty("handleAll") + public boolean getHandleAll() { + return handleAll; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ContentChangedRuleTriggerDto && equalTo((ContentChangedRuleTriggerDto) other); + } + + private boolean equalTo(ContentChangedRuleTriggerDto other) { + return schemas.equals(other.schemas) + && referencedSchemas.equals(other.referencedSchemas) + && handleAll == other.handleAll; + } + + @Override + public int hashCode() { + return Objects.hash(this.schemas, this.referencedSchemas, this.handleAll); + } + + @Override + public String toString() { + return "ContentChangedRuleTriggerDto{" + "schemas: " + schemas + ", referencedSchemas: " + referencedSchemas + + ", handleAll: " + handleAll + "}"; + } + + public static HandleAllStage builder() { + return new Builder(); + } + + public interface HandleAllStage { + _FinalStage handleAll(boolean handleAll); + + Builder from(ContentChangedRuleTriggerDto other); + } + + public interface _FinalStage { + ContentChangedRuleTriggerDto build(); + + _FinalStage schemas(Optional> schemas); + + _FinalStage schemas(List schemas); + + _FinalStage referencedSchemas(Optional> referencedSchemas); + + _FinalStage referencedSchemas(List referencedSchemas); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HandleAllStage, _FinalStage { + private boolean handleAll; + + private Optional> referencedSchemas = Optional.empty(); + + private Optional> schemas = Optional.empty(); + + private Builder() {} + + @Override + public Builder from(ContentChangedRuleTriggerDto other) { + schemas(other.getSchemas()); + referencedSchemas(other.getReferencedSchemas()); + handleAll(other.getHandleAll()); + return this; + } + + /** + *

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; + } + + /** + *

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; + } + + @Override + @JsonSetter(value = "referencedSchemas", nulls = Nulls.SKIP) + public _FinalStage referencedSchemas(Optional> referencedSchemas) { + this.referencedSchemas = referencedSchemas; + return this; + } + + /** + *

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; + } + + @Override + @JsonSetter(value = "schemas", nulls = Nulls.SKIP) + public _FinalStage schemas(Optional> schemas) { + this.schemas = schemas; + return this; + } + + @Override + public ContentChangedRuleTriggerDto build() { + return new ContentChangedRuleTriggerDto(schemas, referencedSchemas, handleAll); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ContentDto.java b/src/main/java/com/squidex/api/types/ContentDto.java new file mode 100644 index 0000000..086c5ee --- /dev/null +++ b/src/main/java/com/squidex/api/types/ContentDto.java @@ -0,0 +1,790 @@ +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 java.time.OffsetDateTime; +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 = 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; + } + + @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; + } + + @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; + } + + @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); + } + + @Override + public String toString() { + return "ContentDto{" + "links: " + links + ", id: " + id + ", createdBy: " + createdBy + ", lastModifiedBy: " + + lastModifiedBy + ", data: " + data + ", referenceData: " + referenceData + ", created: " + created + + ", lastModified: " + lastModified + ", status: " + status + ", newStatus: " + newStatus + + ", statusColor: " + statusColor + ", newStatusColor: " + newStatusColor + ", editToken: " + editToken + + ", scheduleJob: " + scheduleJob + ", schemaId: " + schemaId + ", schemaName: " + schemaName + + ", schemaDisplayName: " + schemaDisplayName + ", referenceFields: " + referenceFields + + ", isDeleted: " + isDeleted + ", version: " + version + "}"; + } + + 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; + } + + @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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ContentsDto.java b/src/main/java/com/squidex/api/types/ContentsDto.java new file mode 100644 index 0000000..86316b7 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ContentsDto.java @@ -0,0 +1,244 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + } + + /** + * @return The possible statuses. + */ + @JsonProperty("statuses") + public List getStatuses() { + return statuses; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ContentsDto && equalTo((ContentsDto) other); + } + + private boolean equalTo(ContentsDto other) { + return links.equals(other.links) + && total == other.total + && items.equals(other.items) + && statuses.equals(other.statuses); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.total, this.items, this.statuses); + } + + @Override + public String toString() { + return "ContentsDto{" + "links: " + links + ", total: " + total + ", items: " + items + ", statuses: " + + statuses + "}"; + } + + public static TotalStage builder() { + return new Builder(); + } + + public interface TotalStage { + _FinalStage total(int total); + + Builder from(ContentsDto other); + } + + 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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ContributorDto.java b/src/main/java/com/squidex/api/types/ContributorDto.java new file mode 100644 index 0000000..433bc37 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ContributorDto.java @@ -0,0 +1,246 @@ +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 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); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.contributorId, this.contributorName, this.contributorEmail, this.role); + } + + @Override + public String toString() { + return "ContributorDto{" + "links: " + links + ", contributorId: " + contributorId + ", contributorName: " + + contributorName + ", contributorEmail: " + contributorEmail + ", role: " + role + "}"; + } + + public static ContributorIdStage builder() { + return new Builder(); + } + + public interface ContributorIdStage { + ContributorNameStage contributorId(String contributorId); + + Builder from(ContributorDto other); + } + + public interface ContributorNameStage { + ContributorEmailStage contributorName(String contributorName); + } + + public interface ContributorEmailStage { + _FinalStage contributorEmail(String contributorEmail); + } + + 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); + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ContributorsDto.java b/src/main/java/com/squidex/api/types/ContributorsDto.java new file mode 100644 index 0000000..5396335 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ContributorsDto.java @@ -0,0 +1,228 @@ +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 java.util.ArrayList; +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 = 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; + } + + @JsonProperty("_meta") + public Optional getMeta() { + return meta; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ContributorsDto && equalTo((ContributorsDto) other); + } + + private boolean equalTo(ContributorsDto other) { + return links.equals(other.links) + && items.equals(other.items) + && maxContributors == other.maxContributors + && meta.equals(other.meta); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.items, this.maxContributors, this.meta); + } + + @Override + public String toString() { + return "ContributorsDto{" + "links: " + links + ", items: " + items + ", maxContributors: " + maxContributors + + ", meta: " + meta + "}"; + } + + public static MaxContributorsStage builder() { + return new Builder(); + } + + public interface MaxContributorsStage { + _FinalStage maxContributors(int maxContributors); + + Builder from(ContributorsDto other); + } + + 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; + } + + @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; + } + + @Override + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public _FinalStage links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + @Override + public ContributorsDto build() { + return new ContributorsDto(links, items, maxContributors, meta); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ContributorsMetadata.java b/src/main/java/com/squidex/api/types/ContributorsMetadata.java new file mode 100644 index 0000000..b5809aa --- /dev/null +++ b/src/main/java/com/squidex/api/types/ContributorsMetadata.java @@ -0,0 +1,89 @@ +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 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); + } + + @Override + public String toString() { + return "ContributorsMetadata{" + "isInvited: " + isInvited + "}"; + } + + public static IsInvitedStage builder() { + return new Builder(); + } + + public interface IsInvitedStage { + _FinalStage isInvited(String isInvited); + + Builder from(ContributorsMetadata other); + } + + public interface _FinalStage { + ContributorsMetadata build(); + } + + @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; + } + + /** + *

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; + } + + @Override + public ContributorsMetadata build() { + return new ContributorsMetadata(isInvited); + } + } +} diff --git a/src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java b/src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java new file mode 100644 index 0000000..8b91ded --- /dev/null +++ b/src/main/java/com/squidex/api/types/CreateContentRuleActionDto.java @@ -0,0 +1,180 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("data") + public String getData() { + return data; + } + + /** + * @return The name of the schema. <span style="white-space: nowrap">non-empty</span> + */ + @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 "CreateContentRuleActionDto{" + "data: " + data + ", schema: " + schema + ", client: " + client + + ", publish: " + publish + "}"; + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + SchemaStage data(String data); + + Builder from(CreateContentRuleActionDto other); + } + + public interface SchemaStage { + ClientStage schema(String schema); + } + + public interface ClientStage { + PublishStage client(String client); + } + + public interface PublishStage { + _FinalStage publish(boolean publish); + } + + public interface _FinalStage { + CreateContentRuleActionDto build(); + } + + @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; + } + + /** + *

The content data. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The name of the schema. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/CreateRuleDto.java b/src/main/java/com/squidex/api/types/CreateRuleDto.java new file mode 100644 index 0000000..04a01c3 --- /dev/null +++ b/src/main/java/com/squidex/api/types/CreateRuleDto.java @@ -0,0 +1,104 @@ +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 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; + } + + @JsonProperty("trigger") + public RuleTriggerDto getTrigger() { + return trigger; + } + + @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 "CreateRuleDto{" + "trigger: " + trigger + ", action: " + action + "}"; + } + + public static TriggerStage builder() { + return new Builder(); + } + + public interface TriggerStage { + ActionStage trigger(RuleTriggerDto trigger); + + Builder from(CreateRuleDto other); + } + + public interface ActionStage { + _FinalStage action(RuleActionDto action); + } + + public interface _FinalStage { + CreateRuleDto build(); + } + + @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; + } + + @Override + @JsonSetter("trigger") + public ActionStage trigger(RuleTriggerDto trigger) { + this.trigger = trigger; + return this; + } + + @Override + @JsonSetter("action") + public _FinalStage action(RuleActionDto action) { + this.action = action; + return this; + } + + @Override + public CreateRuleDto build() { + return new CreateRuleDto(trigger, action); + } + } +} diff --git a/src/main/java/com/squidex/api/types/CurrentStorageDto.java b/src/main/java/com/squidex/api/types/CurrentStorageDto.java new file mode 100644 index 0000000..0df3b3b --- /dev/null +++ b/src/main/java/com/squidex/api/types/CurrentStorageDto.java @@ -0,0 +1,118 @@ +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 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); + } + + @Override + public String toString() { + return "CurrentStorageDto{" + "size: " + size + ", maxAllowed: " + maxAllowed + "}"; + } + + public static SizeStage builder() { + return new Builder(); + } + + public interface SizeStage { + MaxAllowedStage size(int size); + + Builder from(CurrentStorageDto other); + } + + public interface MaxAllowedStage { + _FinalStage maxAllowed(int maxAllowed); + } + + 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; + } + + /** + *

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; + } + + /** + *

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; + } + + @Override + public CurrentStorageDto build() { + return new CurrentStorageDto(size, maxAllowed); + } + } +} diff --git a/src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java b/src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java new file mode 100644 index 0000000..c184d17 --- /dev/null +++ b/src/main/java/com/squidex/api/types/DateTimeCalculatedDefaultValue.java @@ -0,0 +1,21 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DateTimeCalculatedDefaultValue { + NOW("Now"), + + TODAY("Today"); + + private final String value; + + DateTimeCalculatedDefaultValue(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/DateTimeFieldEditor.java b/src/main/java/com/squidex/api/types/DateTimeFieldEditor.java new file mode 100644 index 0000000..6117e56 --- /dev/null +++ b/src/main/java/com/squidex/api/types/DateTimeFieldEditor.java @@ -0,0 +1,21 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum DateTimeFieldEditor { + DATE("Date"), + + DATE_TIME("DateTime"); + + private final String value; + + DateTimeFieldEditor(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java new file mode 100644 index 0000000..314110e --- /dev/null +++ b/src/main/java/com/squidex/api/types/DateTimeFieldPropertiesDto.java @@ -0,0 +1,245 @@ +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 java.time.OffsetDateTime; +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; + } + + @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; + } + + @JsonProperty("editor") + public Optional getEditor() { + return editor; + } + + @JsonProperty("calculatedDefaultValue") + public Optional getCalculatedDefaultValue() { + return calculatedDefaultValue; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DateTimeFieldPropertiesDto && equalTo((DateTimeFieldPropertiesDto) other); + } + + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + this.defaultValues, + this.defaultValue, + this.maxValue, + this.minValue, + this.format, + this.editor, + this.calculatedDefaultValue); + } + + @Override + public String toString() { + return "DateTimeFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue + + ", maxValue: " + maxValue + ", minValue: " + minValue + ", format: " + format + ", editor: " + editor + + ", calculatedDefaultValue: " + calculatedDefaultValue + "}"; + } + + 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 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; + } + + @JsonSetter(value = "maxValue", nulls = Nulls.SKIP) + public Builder maxValue(Optional maxValue) { + this.maxValue = maxValue; + return this; + } + + public Builder maxValue(OffsetDateTime maxValue) { + this.maxValue = Optional.of(maxValue); + return this; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java b/src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java new file mode 100644 index 0000000..ef55f31 --- /dev/null +++ b/src/main/java/com/squidex/api/types/DiscourseRuleActionDto.java @@ -0,0 +1,297 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + /** + * @return The api key to authenticate to your discourse server. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return The api username to authenticate to your discourse server. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("apiUsername") + public String getApiUsername() { + return apiUsername; + } + + /** + * @return The text as markdown. <span style="white-space: nowrap">non-empty</span> + */ + @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 "DiscourseRuleActionDto{" + "url: " + url + ", apiKey: " + apiKey + ", apiUsername: " + apiUsername + + ", text: " + text + ", title: " + title + ", topic: " + topic + ", category: " + category + "}"; + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + ApiKeyStage url(String url); + + Builder from(DiscourseRuleActionDto other); + } + + public interface ApiKeyStage { + ApiUsernameStage apiKey(String apiKey); + } + + public interface ApiUsernameStage { + TextStage apiUsername(String apiUsername); + } + + public interface TextStage { + _FinalStage text(String text); + } + + 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); + } + + @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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 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; + } + + @Override + @JsonSetter(value = "category", nulls = Nulls.SKIP) + public _FinalStage category(Optional category) { + this.category = category; + return this; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/EditorDto.java b/src/main/java/com/squidex/api/types/EditorDto.java new file mode 100644 index 0000000..bfb2fff --- /dev/null +++ b/src/main/java/com/squidex/api/types/EditorDto.java @@ -0,0 +1,118 @@ +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 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 "EditorDto{" + "name: " + name + ", url: " + url + "}"; + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + UrlStage name(String name); + + Builder from(EditorDto other); + } + + public interface UrlStage { + _FinalStage url(String url); + } + + public interface _FinalStage { + EditorDto build(); + } + + @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; + } + + /** + *

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; + } + + @Override + public EditorDto build() { + return new EditorDto(name, url); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java b/src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java new file mode 100644 index 0000000..a3d9a98 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ElasticSearchRuleActionDto.java @@ -0,0 +1,272 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("host") + public String getHost() { + return host; + } + + /** + * @return The name of the index. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + @Override + public String toString() { + return "ElasticSearchRuleActionDto{" + "host: " + host + ", indexName: " + indexName + ", username: " + username + + ", password: " + password + ", document: " + document + ", delete: " + delete + "}"; + } + + public static HostStage builder() { + return new Builder(); + } + + public interface HostStage { + IndexNameStage host(String host); + + Builder from(ElasticSearchRuleActionDto other); + } + + public interface IndexNameStage { + _FinalStage indexName(String indexName); + } + + 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); + } + + @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; + } + + /** + *

The url to the instance or cluster. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/EmailRuleActionDto.java b/src/main/java/com/squidex/api/types/EmailRuleActionDto.java new file mode 100644 index 0000000..016e726 --- /dev/null +++ b/src/main/java/com/squidex/api/types/EmailRuleActionDto.java @@ -0,0 +1,335 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("serverUsername") + public String getServerUsername() { + return serverUsername; + } + + /** + * @return The password for the SMTP server. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("serverPassword") + public String getServerPassword() { + return serverPassword; + } + + /** + * @return The email sending address. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("messageFrom") + public String getMessageFrom() { + return messageFrom; + } + + /** + * @return The email message will be sent to. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("messageTo") + public String getMessageTo() { + return messageTo; + } + + /** + * @return The subject line for this email message. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("messageSubject") + public String getMessageSubject() { + return messageSubject; + } + + /** + * @return The message body. <span style="white-space: nowrap">non-empty</span> + */ + @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 "EmailRuleActionDto{" + "serverHost: " + serverHost + ", serverPort: " + serverPort + + ", serverUsername: " + serverUsername + ", serverPassword: " + serverPassword + ", messageFrom: " + + messageFrom + ", messageTo: " + messageTo + ", messageSubject: " + messageSubject + ", messageBody: " + + messageBody + "}"; + } + + 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); + } + + public interface MessageToStage { + MessageSubjectStage messageTo(String messageTo); + } + + public interface MessageSubjectStage { + MessageBodyStage messageSubject(String messageSubject); + } + + public interface MessageBodyStage { + _FinalStage messageBody(String messageBody); + } + + public interface _FinalStage { + EmailRuleActionDto build(); + } + + @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The username for the SMTP server. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The password for the SMTP server. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The email sending address. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ErrorDto.java b/src/main/java/com/squidex/api/types/ErrorDto.java new file mode 100644 index 0000000..d1db2cb --- /dev/null +++ b/src/main/java/com/squidex/api/types/ErrorDto.java @@ -0,0 +1,273 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + 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; + } + + @Override + public int hashCode() { + return Objects.hash(this.message, this.errorCode, this.traceId, this.type, this.details, this.statusCode); + } + + @Override + public String toString() { + return "ErrorDto{" + "message: " + message + ", errorCode: " + errorCode + ", traceId: " + traceId + ", type: " + + type + ", details: " + details + ", statusCode: " + statusCode + "}"; + } + + public static MessageStage builder() { + return new Builder(); + } + + public interface MessageStage { + StatusCodeStage message(String message); + + Builder from(ErrorDto other); + } + + public interface StatusCodeStage { + _FinalStage statusCode(int statusCode); + } + + 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); + } + + @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; + } + + /** + *

Error message. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/EventConsumerDto.java b/src/main/java/com/squidex/api/types/EventConsumerDto.java new file mode 100644 index 0000000..f4efc6a --- /dev/null +++ b/src/main/java/com/squidex/api/types/EventConsumerDto.java @@ -0,0 +1,314 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "EventConsumerDto{" + "links: " + links + ", isStopped: " + isStopped + ", isResetting: " + isResetting + + ", count: " + count + ", name: " + name + ", error: " + error + ", position: " + position + "}"; + } + + public static IsStoppedStage builder() { + return new Builder(); + } + + public interface IsStoppedStage { + IsResettingStage isStopped(boolean isStopped); + + Builder from(EventConsumerDto other); + } + + public interface IsResettingStage { + CountStage isResetting(boolean isResetting); + } + + public interface CountStage { + NameStage count(int count); + } + + public interface NameStage { + _FinalStage name(String name); + } + + 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); + } + + @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; + } + + /** + *

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; + } + + /** + *

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. <span style="white-space: nowrap">non-empty</span>

+ * @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/EventConsumersDto.java b/src/main/java/com/squidex/api/types/EventConsumersDto.java new file mode 100644 index 0000000..bf4fcc6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/EventConsumersDto.java @@ -0,0 +1,120 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + + private final List items; + + private EventConsumersDto(Map links, List items) { + this.links = links; + this.items = items; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + /** + * @return The event consumers. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EventConsumersDto && equalTo((EventConsumersDto) other); + } + + private boolean equalTo(EventConsumersDto other) { + return links.equals(other.links) && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.items); + } + + @Override + public String toString() { + return "EventConsumersDto{" + "links: " + links + ", items: " + items + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map links = new LinkedHashMap<>(); + + private List items = new ArrayList<>(); + + private Builder() {} + + public Builder from(EventConsumersDto other) { + links(other.getLinks()); + items(other.getItems()); + return this; + } + + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public Builder links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + @JsonSetter(value = "items", nulls = Nulls.SKIP) + public Builder items(List items) { + this.items.clear(); + this.items.addAll(items); + return this; + } + + public Builder addItems(EventConsumerDto items) { + this.items.add(items); + return this; + } + + public Builder addAllItems(List items) { + this.items.addAll(items); + return this; + } + + public EventConsumersDto build() { + return new EventConsumersDto(links, items); + } + } +} diff --git a/src/main/java/com/squidex/api/types/FastlyRuleActionDto.java b/src/main/java/com/squidex/api/types/FastlyRuleActionDto.java new file mode 100644 index 0000000..90bfbc0 --- /dev/null +++ b/src/main/java/com/squidex/api/types/FastlyRuleActionDto.java @@ -0,0 +1,118 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("apiKey") + public String getApiKey() { + return apiKey; + } + + /** + * @return The ID of the fastly service. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + @Override + public String toString() { + return "FastlyRuleActionDto{" + "apiKey: " + apiKey + ", serviceId: " + serviceId + "}"; + } + + public static ApiKeyStage builder() { + return new Builder(); + } + + public interface ApiKeyStage { + ServiceIdStage apiKey(String apiKey); + + Builder from(FastlyRuleActionDto other); + } + + public interface ServiceIdStage { + _FinalStage serviceId(String serviceId); + } + + 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; + } + + /** + *

The API key to grant access to Squidex. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The ID of the fastly service. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + public FastlyRuleActionDto build() { + return new FastlyRuleActionDto(apiKey, serviceId); + } + } +} diff --git a/src/main/java/com/squidex/api/types/FeatureDto.java b/src/main/java/com/squidex/api/types/FeatureDto.java new file mode 100644 index 0000000..f688811 --- /dev/null +++ b/src/main/java/com/squidex/api/types/FeatureDto.java @@ -0,0 +1,118 @@ +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 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 "FeatureDto{" + "name: " + name + ", text: " + text + "}"; + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + TextStage name(String name); + + Builder from(FeatureDto other); + } + + public interface TextStage { + _FinalStage text(String text); + } + + public interface _FinalStage { + FeatureDto build(); + } + + @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; + } + + /** + *

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; + } + + @Override + public FeatureDto build() { + return new FeatureDto(name, text); + } + } +} diff --git a/src/main/java/com/squidex/api/types/FeaturesDto.java b/src/main/java/com/squidex/api/types/FeaturesDto.java new file mode 100644 index 0000000..d553138 --- /dev/null +++ b/src/main/java/com/squidex/api/types/FeaturesDto.java @@ -0,0 +1,140 @@ +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 java.util.ArrayList; +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; + } + + @Override + public int hashCode() { + return Objects.hash(this.features, this.version); + } + + @Override + public String toString() { + return "FeaturesDto{" + "features: " + features + ", version: " + version + "}"; + } + + public static VersionStage builder() { + return new Builder(); + } + + public interface VersionStage { + _FinalStage version(int version); + + Builder from(FeaturesDto other); + } + + public interface _FinalStage { + FeaturesDto build(); + + _FinalStage features(List features); + + _FinalStage addFeatures(FeatureDto features); + + _FinalStage addAllFeatures(List features); + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/FieldDto.java b/src/main/java/com/squidex/api/types/FieldDto.java new file mode 100644 index 0000000..9f8e6dd --- /dev/null +++ b/src/main/java/com/squidex/api/types/FieldDto.java @@ -0,0 +1,381 @@ +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 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 = 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. <span style="white-space: nowrap">non-empty</span> + */ + @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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("partitioning") + public String getPartitioning() { + return partitioning; + } + + @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 "FieldDto{" + "links: " + links + ", fieldId: " + fieldId + ", name: " + name + ", isHidden: " + isHidden + + ", isLocked: " + isLocked + ", isDisabled: " + isDisabled + ", partitioning: " + partitioning + + ", properties: " + properties + ", nested: " + nested + "}"; + } + + public static FieldIdStage builder() { + return new Builder(); + } + + public interface FieldIdStage { + NameStage fieldId(int fieldId); + + Builder from(FieldDto other); + } + + public interface NameStage { + IsHiddenStage name(String name); + } + + public interface IsHiddenStage { + IsLockedStage isHidden(boolean isHidden); + } + + public interface IsLockedStage { + IsDisabledStage isLocked(boolean isLocked); + } + + public interface IsDisabledStage { + PartitioningStage isDisabled(boolean isDisabled); + } + + public interface PartitioningStage { + PropertiesStage partitioning(String partitioning); + } + + public interface PropertiesStage { + _FinalStage properties(FieldPropertiesDto properties); + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @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; + } + + /** + *

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 FieldDto build() { + return new FieldDto(links, fieldId, name, isHidden, isLocked, isDisabled, partitioning, properties, nested); + } + } +} diff --git a/src/main/java/com/squidex/api/types/FieldPropertiesDto.java b/src/main/java/com/squidex/api/types/FieldPropertiesDto.java new file mode 100644 index 0000000..a881485 --- /dev/null +++ b/src/main/java/com/squidex/api/types/FieldPropertiesDto.java @@ -0,0 +1,815 @@ +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); + } + + @Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @Override + public String toString() { + return "FieldPropertiesDto{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/squidex/api/types/FieldRuleAction.java b/src/main/java/com/squidex/api/types/FieldRuleAction.java new file mode 100644 index 0000000..8bf22f7 --- /dev/null +++ b/src/main/java/com/squidex/api/types/FieldRuleAction.java @@ -0,0 +1,23 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum FieldRuleAction { + DISABLE("Disable"), + + HIDE("Hide"), + + REQUIRE("Require"); + + private final String value; + + FieldRuleAction(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/FieldRuleDto.java b/src/main/java/com/squidex/api/types/FieldRuleDto.java new file mode 100644 index 0000000..0303826 --- /dev/null +++ b/src/main/java/com/squidex/api/types/FieldRuleDto.java @@ -0,0 +1,148 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = FieldRuleDto.Builder.class) +public final class FieldRuleDto { + private final FieldRuleAction action; + + private final String field; + + private final Optional condition; + + private FieldRuleDto(FieldRuleAction action, String field, Optional condition) { + this.action = action; + this.field = field; + this.condition = condition; + } + + @JsonProperty("action") + public FieldRuleAction getAction() { + return action; + } + + /** + * @return The field to update. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("field") + public String getField() { + return field; + } + + /** + * @return The condition. + */ + @JsonProperty("condition") + public Optional getCondition() { + return condition; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof FieldRuleDto && equalTo((FieldRuleDto) other); + } + + private boolean equalTo(FieldRuleDto other) { + return action.equals(other.action) && field.equals(other.field) && condition.equals(other.condition); + } + + @Override + public int hashCode() { + return Objects.hash(this.action, this.field, this.condition); + } + + @Override + public String toString() { + return "FieldRuleDto{" + "action: " + action + ", field: " + field + ", condition: " + condition + "}"; + } + + public static ActionStage builder() { + return new Builder(); + } + + public interface ActionStage { + FieldStage action(FieldRuleAction action); + + Builder from(FieldRuleDto other); + } + + public interface FieldStage { + _FinalStage field(String field); + } + + public interface _FinalStage { + FieldRuleDto build(); + + _FinalStage condition(Optional condition); + + _FinalStage condition(String condition); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ActionStage, FieldStage, _FinalStage { + private FieldRuleAction action; + + private String field; + + private Optional condition = Optional.empty(); + + private Builder() {} + + @Override + public Builder from(FieldRuleDto other) { + action(other.getAction()); + field(other.getField()); + condition(other.getCondition()); + return this; + } + + @Override + @JsonSetter("action") + public FieldStage action(FieldRuleAction action) { + this.action = action; + return this; + } + + /** + *

The field to update. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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; + } + + @Override + @JsonSetter(value = "condition", nulls = Nulls.SKIP) + public _FinalStage condition(Optional condition) { + this.condition = condition; + return this; + } + + @Override + public FieldRuleDto build() { + return new FieldRuleDto(action, field, condition); + } + } +} diff --git a/src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java new file mode 100644 index 0000000..6b1a675 --- /dev/null +++ b/src/main/java/com/squidex/api/types/GeolocationFieldPropertiesDto.java @@ -0,0 +1,76 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = GeolocationFieldPropertiesDto.Builder.class) +public final class GeolocationFieldPropertiesDto { + private final Optional editor; + + private GeolocationFieldPropertiesDto(Optional editor) { + this.editor = editor; + } + + @JsonProperty("editor") + public Optional getEditor() { + return editor; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GeolocationFieldPropertiesDto && equalTo((GeolocationFieldPropertiesDto) other); + } + + private boolean equalTo(GeolocationFieldPropertiesDto other) { + return editor.equals(other.editor); + } + + @Override + public int hashCode() { + return Objects.hash(this.editor); + } + + @Override + public String toString() { + return "GeolocationFieldPropertiesDto{" + "editor: " + editor + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional editor = Optional.empty(); + + private Builder() {} + + public Builder from(GeolocationFieldPropertiesDto other) { + editor(other.getEditor()); + return this; + } + + @JsonSetter(value = "editor", nulls = Nulls.SKIP) + public Builder editor(Optional editor) { + this.editor = editor; + return this; + } + + public Builder editor(String editor) { + this.editor = Optional.of(editor); + return this; + } + + public GeolocationFieldPropertiesDto build() { + return new GeolocationFieldPropertiesDto(editor); + } + } +} diff --git a/src/main/java/com/squidex/api/types/HistoryEventDto.java b/src/main/java/com/squidex/api/types/HistoryEventDto.java new file mode 100644 index 0000000..637438e --- /dev/null +++ b/src/main/java/com/squidex/api/types/HistoryEventDto.java @@ -0,0 +1,243 @@ +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 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 "HistoryEventDto{" + "message: " + message + ", eventType: " + eventType + ", actor: " + actor + + ", eventId: " + eventId + ", created: " + created + ", version: " + version + "}"; + } + + 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); + } + + public interface EventIdStage { + CreatedStage eventId(String eventId); + } + + public interface CreatedStage { + VersionStage created(OffsetDateTime created); + } + + public interface VersionStage { + _FinalStage version(int version); + } + + public interface _FinalStage { + HistoryEventDto build(); + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/IResource.java b/src/main/java/com/squidex/api/types/IResource.java new file mode 100644 index 0000000..66b4b61 --- /dev/null +++ b/src/main/java/com/squidex/api/types/IResource.java @@ -0,0 +1,7 @@ +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 new file mode 100644 index 0000000..3663c3e --- /dev/null +++ b/src/main/java/com/squidex/api/types/IUpsertSchemaDto.java @@ -0,0 +1,25 @@ +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 new file mode 100644 index 0000000..31765aa --- /dev/null +++ b/src/main/java/com/squidex/api/types/ImageFormat.java @@ -0,0 +1,33 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ImageFormat { + AVIF("AVIF"), + + BMP("BMP"), + + GIF("GIF"), + + JPEG("JPEG"), + + PNG("PNG"), + + TGA("TGA"), + + TIFF("TIFF"), + + WEBP("WEBP"); + + private final String value; + + ImageFormat(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/JobStatus.java b/src/main/java/com/squidex/api/types/JobStatus.java new file mode 100644 index 0000000..d2475a9 --- /dev/null +++ b/src/main/java/com/squidex/api/types/JobStatus.java @@ -0,0 +1,25 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum JobStatus { + CREATED("Created"), + + STARTED("Started"), + + COMPLETED("Completed"), + + FAILED("Failed"); + + private final String value; + + JobStatus(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java new file mode 100644 index 0000000..d039fd4 --- /dev/null +++ b/src/main/java/com/squidex/api/types/JsonFieldPropertiesDto.java @@ -0,0 +1,79 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = JsonFieldPropertiesDto.Builder.class) +public final class JsonFieldPropertiesDto { + private final Optional graphQlSchema; + + private JsonFieldPropertiesDto(Optional graphQlSchema) { + this.graphQlSchema = graphQlSchema; + } + + /** + * @return The GraphQL schema. + */ + @JsonProperty("graphQLSchema") + public Optional getGraphQlSchema() { + return graphQlSchema; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof JsonFieldPropertiesDto && equalTo((JsonFieldPropertiesDto) other); + } + + private boolean equalTo(JsonFieldPropertiesDto other) { + return graphQlSchema.equals(other.graphQlSchema); + } + + @Override + public int hashCode() { + return Objects.hash(this.graphQlSchema); + } + + @Override + public String toString() { + return "JsonFieldPropertiesDto{" + "graphQlSchema: " + graphQlSchema + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional graphQlSchema = Optional.empty(); + + private Builder() {} + + public Builder from(JsonFieldPropertiesDto other) { + graphQlSchema(other.getGraphQlSchema()); + return this; + } + + @JsonSetter(value = "graphQLSchema", nulls = Nulls.SKIP) + public Builder graphQlSchema(Optional graphQlSchema) { + this.graphQlSchema = graphQlSchema; + return this; + } + + public Builder graphQlSchema(String graphQlSchema) { + this.graphQlSchema = Optional.of(graphQlSchema); + return this; + } + + public JsonFieldPropertiesDto build() { + return new JsonFieldPropertiesDto(graphQlSchema); + } + } +} diff --git a/src/main/java/com/squidex/api/types/LanguageDto.java b/src/main/java/com/squidex/api/types/LanguageDto.java new file mode 100644 index 0000000..5e5056f --- /dev/null +++ b/src/main/java/com/squidex/api/types/LanguageDto.java @@ -0,0 +1,150 @@ +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 java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = LanguageDto.Builder.class) +public final class LanguageDto { + private final String iso2Code; + + private final String englishName; + + private final String nativeName; + + private LanguageDto(String iso2Code, String englishName, String nativeName) { + this.iso2Code = iso2Code; + this.englishName = englishName; + this.nativeName = nativeName; + } + + /** + * @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 native name of the language. + */ + @JsonProperty("nativeName") + public String getNativeName() { + return nativeName; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LanguageDto && equalTo((LanguageDto) other); + } + + private boolean equalTo(LanguageDto other) { + return iso2Code.equals(other.iso2Code) + && englishName.equals(other.englishName) + && nativeName.equals(other.nativeName); + } + + @Override + public int hashCode() { + return Objects.hash(this.iso2Code, this.englishName, this.nativeName); + } + + @Override + public String toString() { + return "LanguageDto{" + "iso2Code: " + iso2Code + ", englishName: " + englishName + ", nativeName: " + + nativeName + "}"; + } + + public static Iso2CodeStage builder() { + return new Builder(); + } + + public interface Iso2CodeStage { + EnglishNameStage iso2Code(String iso2Code); + + Builder from(LanguageDto other); + } + + public interface EnglishNameStage { + NativeNameStage englishName(String englishName); + } + + public interface NativeNameStage { + _FinalStage nativeName(String nativeName); + } + + public interface _FinalStage { + LanguageDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements Iso2CodeStage, EnglishNameStage, NativeNameStage, _FinalStage { + private String iso2Code; + + private String englishName; + + private String nativeName; + + private Builder() {} + + @Override + public Builder from(LanguageDto other) { + iso2Code(other.getIso2Code()); + englishName(other.getEnglishName()); + nativeName(other.getNativeName()); + return this; + } + + /** + *

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; + } + + /** + *

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; + } + + /** + *

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; + } + + @Override + public LanguageDto build() { + return new LanguageDto(iso2Code, englishName, nativeName); + } + } +} diff --git a/src/main/java/com/squidex/api/types/LogDownloadDto.java b/src/main/java/com/squidex/api/types/LogDownloadDto.java new file mode 100644 index 0000000..f947552 --- /dev/null +++ b/src/main/java/com/squidex/api/types/LogDownloadDto.java @@ -0,0 +1,79 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = LogDownloadDto.Builder.class) +public final class LogDownloadDto { + private final Optional downloadUrl; + + private LogDownloadDto(Optional downloadUrl) { + this.downloadUrl = downloadUrl; + } + + /** + * @return The url to download the log. + */ + @JsonProperty("downloadUrl") + public Optional getDownloadUrl() { + return downloadUrl; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof LogDownloadDto && equalTo((LogDownloadDto) other); + } + + private boolean equalTo(LogDownloadDto other) { + return downloadUrl.equals(other.downloadUrl); + } + + @Override + public int hashCode() { + return Objects.hash(this.downloadUrl); + } + + @Override + public String toString() { + return "LogDownloadDto{" + "downloadUrl: " + downloadUrl + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional downloadUrl = Optional.empty(); + + private Builder() {} + + public Builder from(LogDownloadDto other) { + downloadUrl(other.getDownloadUrl()); + return this; + } + + @JsonSetter(value = "downloadUrl", nulls = Nulls.SKIP) + public Builder downloadUrl(Optional downloadUrl) { + this.downloadUrl = downloadUrl; + return this; + } + + public Builder downloadUrl(String downloadUrl) { + this.downloadUrl = Optional.of(downloadUrl); + return this; + } + + public LogDownloadDto build() { + return new LogDownloadDto(downloadUrl); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java b/src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java new file mode 100644 index 0000000..7f66c50 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ManualRuleTriggerDto.java @@ -0,0 +1,16 @@ +package com.squidex.api.types; + +public final class ManualRuleTriggerDto { + private ManualRuleTriggerDto() {} + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ManualRuleTriggerDto; + } + + @Override + public String toString() { + return "ManualRuleTriggerDto{" + "}"; + } +} diff --git a/src/main/java/com/squidex/api/types/MediumRuleActionDto.java b/src/main/java/com/squidex/api/types/MediumRuleActionDto.java new file mode 100644 index 0000000..04c4802 --- /dev/null +++ b/src/main/java/com/squidex/api/types/MediumRuleActionDto.java @@ -0,0 +1,305 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("accessToken") + public String getAccessToken() { + return accessToken; + } + + /** + * @return The title, used for the url. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("title") + public String getTitle() { + return title; + } + + /** + * @return The content, either html or markdown. <span style="white-space: nowrap">non-empty</span> + */ + @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 "MediumRuleActionDto{" + "accessToken: " + accessToken + ", title: " + title + ", content: " + content + + ", canonicalUrl: " + canonicalUrl + ", tags: " + tags + ", publicationId: " + publicationId + + ", isHtml: " + isHtml + "}"; + } + + public static AccessTokenStage builder() { + return new Builder(); + } + + public interface AccessTokenStage { + TitleStage accessToken(String accessToken); + + Builder from(MediumRuleActionDto other); + } + + public interface TitleStage { + ContentStage title(String title); + } + + public interface ContentStage { + IsHtmlStage content(String content); + } + + public interface IsHtmlStage { + _FinalStage isHtml(boolean isHtml); + } + + 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); + } + + @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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; + } + + @Override + @JsonSetter(value = "publicationId", nulls = Nulls.SKIP) + public _FinalStage publicationId(Optional publicationId) { + this.publicationId = publicationId; + return this; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/NestedFieldDto.java b/src/main/java/com/squidex/api/types/NestedFieldDto.java new file mode 100644 index 0000000..544a727 --- /dev/null +++ b/src/main/java/com/squidex/api/types/NestedFieldDto.java @@ -0,0 +1,302 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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; + } + + @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 "NestedFieldDto{" + "links: " + links + ", fieldId: " + fieldId + ", name: " + name + ", isHidden: " + + isHidden + ", isLocked: " + isLocked + ", isDisabled: " + isDisabled + ", properties: " + properties + + "}"; + } + + public static FieldIdStage builder() { + return new Builder(); + } + + public interface FieldIdStage { + NameStage fieldId(int fieldId); + + Builder from(NestedFieldDto other); + } + + public interface NameStage { + IsHiddenStage name(String name); + } + + public interface IsHiddenStage { + IsLockedStage isHidden(boolean isHidden); + } + + public interface IsLockedStage { + IsDisabledStage isLocked(boolean isLocked); + } + + public interface IsDisabledStage { + PropertiesStage isDisabled(boolean isDisabled); + } + + public interface PropertiesStage { + _FinalStage properties(FieldPropertiesDto properties); + } + + public interface _FinalStage { + NestedFieldDto build(); + + _FinalStage links(Map links); + + _FinalStage putAllLinks(Map links); + + _FinalStage links(String key, ResourceLink value); + } + + @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + @JsonSetter("properties") + public _FinalStage properties(FieldPropertiesDto properties) { + this.properties = properties; + 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 NestedFieldDto build() { + return new NestedFieldDto(links, fieldId, name, isHidden, isLocked, isDisabled, properties); + } + } +} diff --git a/src/main/java/com/squidex/api/types/NotificationRuleActionDto.java b/src/main/java/com/squidex/api/types/NotificationRuleActionDto.java new file mode 100644 index 0000000..0967804 --- /dev/null +++ b/src/main/java/com/squidex/api/types/NotificationRuleActionDto.java @@ -0,0 +1,194 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("user") + public String getUser() { + return user; + } + + /** + * @return The text to send. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + @Override + public String toString() { + return "NotificationRuleActionDto{" + "user: " + user + ", text: " + text + ", url: " + url + ", client: " + + client + "}"; + } + + public static UserStage builder() { + return new Builder(); + } + + public interface UserStage { + TextStage user(String user); + + Builder from(NotificationRuleActionDto other); + } + + public interface TextStage { + _FinalStage text(String text); + } + + public interface _FinalStage { + NotificationRuleActionDto build(); + + _FinalStage url(Optional url); + + _FinalStage url(String url); + + _FinalStage client(Optional client); + + _FinalStage client(String client); + } + + @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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; + } + + @Override + @JsonSetter(value = "client", nulls = Nulls.SKIP) + public _FinalStage client(Optional client) { + this.client = client; + return this; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/NumberFieldEditor.java b/src/main/java/com/squidex/api/types/NumberFieldEditor.java new file mode 100644 index 0000000..2547c17 --- /dev/null +++ b/src/main/java/com/squidex/api/types/NumberFieldEditor.java @@ -0,0 +1,25 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum NumberFieldEditor { + INPUT("Input"), + + RADIO("Radio"), + + DROPDOWN("Dropdown"), + + STARS("Stars"); + + private final String value; + + NumberFieldEditor(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java new file mode 100644 index 0000000..90d11d5 --- /dev/null +++ b/src/main/java/com/squidex/api/types/NumberFieldPropertiesDto.java @@ -0,0 +1,276 @@ +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 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; + } + + @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; + } + + /** + * @return Indicates that the inline editor is enabled for this field. + */ + @JsonProperty("inlineEditable") + public Optional getInlineEditable() { + return inlineEditable; + } + + @JsonProperty("editor") + public Optional getEditor() { + return editor; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof NumberFieldPropertiesDto && equalTo((NumberFieldPropertiesDto) other); + } + + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + this.defaultValues, + this.defaultValue, + this.maxValue, + this.minValue, + this.allowedValues, + this.isUnique, + this.inlineEditable, + this.editor); + } + + @Override + public String toString() { + return "NumberFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue + + ", maxValue: " + maxValue + ", minValue: " + minValue + ", allowedValues: " + allowedValues + + ", isUnique: " + isUnique + ", inlineEditable: " + inlineEditable + ", editor: " + editor + "}"; + } + + 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 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; + } + + public Builder maxValue(Double maxValue) { + this.maxValue = Optional.of(maxValue); + return this; + } + + @JsonSetter(value = "minValue", nulls = Nulls.SKIP) + public Builder minValue(Optional minValue) { + this.minValue = minValue; + return this; + } + + 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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java b/src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java new file mode 100644 index 0000000..0b94cd6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/OpenSearchRuleActionDto.java @@ -0,0 +1,272 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("host") + public String getHost() { + return host; + } + + /** + * @return The name of the index. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + @Override + public String toString() { + return "OpenSearchRuleActionDto{" + "host: " + host + ", indexName: " + indexName + ", username: " + username + + ", password: " + password + ", document: " + document + ", delete: " + delete + "}"; + } + + public static HostStage builder() { + return new Builder(); + } + + public interface HostStage { + IndexNameStage host(String host); + + Builder from(OpenSearchRuleActionDto other); + } + + public interface IndexNameStage { + _FinalStage indexName(String indexName); + } + + 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); + } + + @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; + } + + /** + *

The url to the instance or cluster. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/PatternDto.java b/src/main/java/com/squidex/api/types/PatternDto.java new file mode 100644 index 0000000..e16d272 --- /dev/null +++ b/src/main/java/com/squidex/api/types/PatternDto.java @@ -0,0 +1,155 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = PatternDto.Builder.class) +public final class PatternDto { + private final String name; + + private final String regex; + + private final Optional message; + + private PatternDto(String name, String regex, Optional message) { + this.name = name; + this.regex = regex; + this.message = message; + } + + /** + * @return The name of the suggestion. + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The regex pattern. + */ + @JsonProperty("regex") + public String getRegex() { + return regex; + } + + /** + * @return The regex message. + */ + @JsonProperty("message") + public Optional getMessage() { + return message; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PatternDto && equalTo((PatternDto) other); + } + + private boolean equalTo(PatternDto other) { + return name.equals(other.name) && regex.equals(other.regex) && message.equals(other.message); + } + + @Override + public int hashCode() { + return Objects.hash(this.name, this.regex, this.message); + } + + @Override + public String toString() { + return "PatternDto{" + "name: " + name + ", regex: " + regex + ", message: " + message + "}"; + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + RegexStage name(String name); + + Builder from(PatternDto other); + } + + public interface RegexStage { + _FinalStage regex(String regex); + } + + public interface _FinalStage { + PatternDto build(); + + _FinalStage message(Optional message); + + _FinalStage message(String message); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameStage, RegexStage, _FinalStage { + private String name; + + private String regex; + + private Optional message = Optional.empty(); + + private Builder() {} + + @Override + public Builder from(PatternDto other) { + name(other.getName()); + regex(other.getRegex()); + message(other.getMessage()); + return this; + } + + /** + *

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; + } + + /** + *

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; + } + + /** + *

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; + } + + @Override + @JsonSetter(value = "message", nulls = Nulls.SKIP) + public _FinalStage message(Optional message) { + this.message = message; + return this; + } + + @Override + public PatternDto build() { + return new PatternDto(name, regex, message); + } + } +} diff --git a/src/main/java/com/squidex/api/types/PlanChangedDto.java b/src/main/java/com/squidex/api/types/PlanChangedDto.java new file mode 100644 index 0000000..41ee5e6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/PlanChangedDto.java @@ -0,0 +1,79 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = PlanChangedDto.Builder.class) +public final class PlanChangedDto { + private final Optional redirectUri; + + private PlanChangedDto(Optional redirectUri) { + this.redirectUri = redirectUri; + } + + /** + * @return Optional redirect uri. + */ + @JsonProperty("redirectUri") + public Optional getRedirectUri() { + return redirectUri; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlanChangedDto && equalTo((PlanChangedDto) other); + } + + private boolean equalTo(PlanChangedDto other) { + return redirectUri.equals(other.redirectUri); + } + + @Override + public int hashCode() { + return Objects.hash(this.redirectUri); + } + + @Override + public String toString() { + return "PlanChangedDto{" + "redirectUri: " + redirectUri + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional redirectUri = Optional.empty(); + + private Builder() {} + + public Builder from(PlanChangedDto other) { + redirectUri(other.getRedirectUri()); + return this; + } + + @JsonSetter(value = "redirectUri", nulls = Nulls.SKIP) + public Builder redirectUri(Optional redirectUri) { + this.redirectUri = redirectUri; + return this; + } + + public Builder redirectUri(String redirectUri) { + this.redirectUri = Optional.of(redirectUri); + return this; + } + + public PlanChangedDto build() { + return new PlanChangedDto(redirectUri); + } + } +} diff --git a/src/main/java/com/squidex/api/types/PlanDto.java b/src/main/java/com/squidex/api/types/PlanDto.java new file mode 100644 index 0000000..cd233b2 --- /dev/null +++ b/src/main/java/com/squidex/api/types/PlanDto.java @@ -0,0 +1,459 @@ +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 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 "PlanDto{" + "id: " + id + ", name: " + name + ", costs: " + costs + ", confirmText: " + confirmText + + ", yearlyConfirmText: " + yearlyConfirmText + ", yearlyCosts: " + yearlyCosts + ", yearlyId: " + + yearlyId + ", maxApiBytes: " + maxApiBytes + ", maxApiCalls: " + maxApiCalls + ", maxAssetSize: " + + maxAssetSize + ", maxContributors: " + maxContributors + "}"; + } + + 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); + } + + public interface MaxApiBytesStage { + MaxApiCallsStage maxApiBytes(int maxApiBytes); + } + + public interface MaxApiCallsStage { + MaxAssetSizeStage maxApiCalls(int maxApiCalls); + } + + public interface MaxAssetSizeStage { + MaxContributorsStage maxAssetSize(int maxAssetSize); + } + + public interface MaxContributorsStage { + _FinalStage maxContributors(int maxContributors); + } + + 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); + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/PlansDto.java b/src/main/java/com/squidex/api/types/PlansDto.java new file mode 100644 index 0000000..68d84c9 --- /dev/null +++ b/src/main/java/com/squidex/api/types/PlansDto.java @@ -0,0 +1,280 @@ +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 java.util.ArrayList; +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; + } + + @JsonProperty("referral") + public Optional getReferral() { + return referral; + } + + @JsonProperty("locked") + public PlansLockedReason getLocked() { + return locked; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PlansDto && equalTo((PlansDto) other); + } + + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + this.plans, this.currentPlanId, this.planOwner, this.portalLink, this.referral, this.locked); + } + + @Override + public String toString() { + return "PlansDto{" + "plans: " + plans + ", currentPlanId: " + currentPlanId + ", planOwner: " + planOwner + + ", portalLink: " + portalLink + ", referral: " + referral + ", locked: " + locked + "}"; + } + + public static LockedStage builder() { + return new Builder(); + } + + public interface LockedStage { + _FinalStage locked(PlansLockedReason locked); + + Builder from(PlansDto other); + } + + 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; + } + + @Override + @JsonSetter("locked") + public _FinalStage locked(PlansLockedReason locked) { + this.locked = locked; + return this; + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/PlansLockedReason.java b/src/main/java/com/squidex/api/types/PlansLockedReason.java new file mode 100644 index 0000000..2156ecf --- /dev/null +++ b/src/main/java/com/squidex/api/types/PlansLockedReason.java @@ -0,0 +1,25 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum PlansLockedReason { + NONE("None"), + + NOT_OWNER("NotOwner"), + + NO_PERMISSION("NoPermission"), + + MANAGED_BY_TEAM("ManagedByTeam"); + + private final String value; + + PlansLockedReason(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java b/src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java new file mode 100644 index 0000000..cb18e3b --- /dev/null +++ b/src/main/java/com/squidex/api/types/PrerenderRuleActionDto.java @@ -0,0 +1,118 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + /** + * @return The url to recache. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + @Override + public String toString() { + return "PrerenderRuleActionDto{" + "token: " + token + ", url: " + url + "}"; + } + + public static TokenStage builder() { + return new Builder(); + } + + public interface TokenStage { + UrlStage token(String token); + + Builder from(PrerenderRuleActionDto other); + } + + public interface UrlStage { + _FinalStage url(String url); + } + + 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; + } + + /** + *

The prerender token from your account. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The url to recache. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + public PrerenderRuleActionDto build() { + return new PrerenderRuleActionDto(token, url); + } + } +} diff --git a/src/main/java/com/squidex/api/types/QueryDto.java b/src/main/java/com/squidex/api/types/QueryDto.java new file mode 100644 index 0000000..9b4a66d --- /dev/null +++ b/src/main/java/com/squidex/api/types/QueryDto.java @@ -0,0 +1,156 @@ +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 java.util.List; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = QueryDto.Builder.class) +public final class QueryDto { + private final Optional> ids; + + private final Optional oData; + + private final Optional q; + + private final Optional parentId; + + private QueryDto( + Optional> ids, Optional oData, Optional q, Optional parentId) { + this.ids = ids; + this.oData = oData; + this.q = q; + this.parentId = parentId; + } + + /** + * @return The optional list of ids to query. + */ + @JsonProperty("ids") + public Optional> getIds() { + return ids; + } + + /** + * @return The optional odata query. + */ + @JsonProperty("oData") + public Optional getOData() { + return oData; + } + + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The parent id (for assets). + */ + @JsonProperty("parentId") + public Optional getParentId() { + return parentId; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof QueryDto && equalTo((QueryDto) other); + } + + private boolean equalTo(QueryDto other) { + return ids.equals(other.ids) + && oData.equals(other.oData) + && q.equals(other.q) + && parentId.equals(other.parentId); + } + + @Override + public int hashCode() { + return Objects.hash(this.ids, this.oData, this.q, this.parentId); + } + + @Override + public String toString() { + return "QueryDto{" + "ids: " + ids + ", oData: " + oData + ", q: " + q + ", parentId: " + parentId + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> ids = Optional.empty(); + + private Optional oData = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional parentId = Optional.empty(); + + private Builder() {} + + 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 Builder ids(List ids) { + this.ids = Optional.of(ids); + 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; + } + + @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 QueryDto build() { + return new QueryDto(ids, oData, q, parentId); + } + } +} diff --git a/src/main/java/com/squidex/api/types/QueryJsonDto.java b/src/main/java/com/squidex/api/types/QueryJsonDto.java new file mode 100644 index 0000000..6b69d06 --- /dev/null +++ b/src/main/java/com/squidex/api/types/QueryJsonDto.java @@ -0,0 +1,249 @@ +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 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 "QueryJsonDto{" + "filter: " + filter + ", fullText: " + fullText + ", skip: " + skip + ", take: " + take + + ", random: " + random + ", top: " + top + ", sort: " + sort + "}"; + } + + public static SkipStage builder() { + return new Builder(); + } + + public interface SkipStage { + TakeStage skip(int skip); + + Builder from(QueryJsonDto other); + } + + public interface TakeStage { + RandomStage take(int take); + } + + public interface RandomStage { + TopStage random(int random); + } + + public interface TopStage { + _FinalStage top(int top); + } + + 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); + } + + @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; + } + + @Override + public _FinalStage fullText(String fullText) { + this.fullText = Optional.of(fullText); + return this; + } + + @Override + @JsonSetter(value = "fullText", nulls = Nulls.SKIP) + public _FinalStage fullText(Optional fullText) { + this.fullText = fullText; + return this; + } + + @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; + } + + @Override + public QueryJsonDto build() { + return new QueryJsonDto(filter, fullText, skip, take, random, top, sort); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ReferencesFieldEditor.java b/src/main/java/com/squidex/api/types/ReferencesFieldEditor.java new file mode 100644 index 0000000..72c56f9 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ReferencesFieldEditor.java @@ -0,0 +1,27 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ReferencesFieldEditor { + LIST("List"), + + DROPDOWN("Dropdown"), + + TAGS("Tags"), + + CHECKBOXES("Checkboxes"), + + INPUT("Input"); + + private final String value; + + ReferencesFieldEditor(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java new file mode 100644 index 0000000..40d8f7b --- /dev/null +++ b/src/main/java/com/squidex/api/types/ReferencesFieldPropertiesDto.java @@ -0,0 +1,313 @@ +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 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 editor; + + private final Optional> schemaIds; + + private ReferencesFieldPropertiesDto( + Optional>> defaultValues, + Optional> defaultValue, + Optional minItems, + Optional maxItems, + Optional allowDuplicates, + Optional resolveReference, + Optional mustBePublished, + 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.editor = editor; + this.schemaIds = schemaIds; + } + + @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; + } + + @JsonProperty("editor") + public Optional getEditor() { + return editor; + } + + /** + * @return The ID of the referenced schemas. + */ + @JsonProperty("schemaIds") + public Optional> getSchemaIds() { + return schemaIds; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReferencesFieldPropertiesDto && equalTo((ReferencesFieldPropertiesDto) other); + } + + 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) + && editor.equals(other.editor) + && schemaIds.equals(other.schemaIds); + } + + @Override + public int hashCode() { + return Objects.hash( + this.defaultValues, + this.defaultValue, + this.minItems, + this.maxItems, + this.allowDuplicates, + this.resolveReference, + this.mustBePublished, + this.editor, + this.schemaIds); + } + + @Override + public String toString() { + return "ReferencesFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue + + ", minItems: " + minItems + ", maxItems: " + maxItems + ", allowDuplicates: " + allowDuplicates + + ", resolveReference: " + resolveReference + ", mustBePublished: " + mustBePublished + ", editor: " + + editor + ", schemaIds: " + schemaIds + "}"; + } + + 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 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 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()); + 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; + } + + @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 = "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 = "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, + editor, + schemaIds); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ReferralInfo.java b/src/main/java/com/squidex/api/types/ReferralInfo.java new file mode 100644 index 0000000..80cccbc --- /dev/null +++ b/src/main/java/com/squidex/api/types/ReferralInfo.java @@ -0,0 +1,126 @@ +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 java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = ReferralInfo.Builder.class) +public final class ReferralInfo { + private final String code; + + private final String earned; + + private final String condition; + + private ReferralInfo(String code, String earned, String condition) { + this.code = code; + this.earned = earned; + this.condition = condition; + } + + @JsonProperty("code") + public String getCode() { + return code; + } + + @JsonProperty("earned") + public String getEarned() { + return earned; + } + + @JsonProperty("condition") + public String getCondition() { + return condition; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReferralInfo && equalTo((ReferralInfo) other); + } + + private boolean equalTo(ReferralInfo other) { + return code.equals(other.code) && earned.equals(other.earned) && condition.equals(other.condition); + } + + @Override + public int hashCode() { + return Objects.hash(this.code, this.earned, this.condition); + } + + @Override + public String toString() { + return "ReferralInfo{" + "code: " + code + ", earned: " + earned + ", condition: " + condition + "}"; + } + + public static CodeStage builder() { + return new Builder(); + } + + public interface CodeStage { + EarnedStage code(String code); + + Builder from(ReferralInfo other); + } + + public interface EarnedStage { + ConditionStage earned(String earned); + } + + public interface ConditionStage { + _FinalStage condition(String condition); + } + + public interface _FinalStage { + ReferralInfo build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CodeStage, EarnedStage, ConditionStage, _FinalStage { + private String code; + + private String earned; + + private String condition; + + private Builder() {} + + @Override + public Builder from(ReferralInfo other) { + code(other.getCode()); + earned(other.getEarned()); + condition(other.getCondition()); + return this; + } + + @Override + @JsonSetter("code") + public EarnedStage code(String code) { + this.code = code; + return this; + } + + @Override + @JsonSetter("earned") + public ConditionStage earned(String earned) { + this.earned = earned; + return this; + } + + @Override + @JsonSetter("condition") + public _FinalStage condition(String condition) { + this.condition = condition; + return this; + } + + @Override + public ReferralInfo build() { + return new ReferralInfo(code, earned, condition); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ReorderFieldsDto.java b/src/main/java/com/squidex/api/types/ReorderFieldsDto.java new file mode 100644 index 0000000..176fbbb --- /dev/null +++ b/src/main/java/com/squidex/api/types/ReorderFieldsDto.java @@ -0,0 +1,86 @@ +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 java.util.ArrayList; +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; + + private ReorderFieldsDto(List fieldIds) { + this.fieldIds = fieldIds; + } + + /** + * @return The field ids in the target order. + */ + @JsonProperty("fieldIds") + public List getFieldIds() { + return fieldIds; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReorderFieldsDto && equalTo((ReorderFieldsDto) other); + } + + private boolean equalTo(ReorderFieldsDto other) { + return fieldIds.equals(other.fieldIds); + } + + @Override + public int hashCode() { + return Objects.hash(this.fieldIds); + } + + @Override + public String toString() { + return "ReorderFieldsDto{" + "fieldIds: " + fieldIds + "}"; + } + + 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; + } + + public Builder addFieldIds(Integer fieldIds) { + this.fieldIds.add(fieldIds); + return this; + } + + public Builder addAllFieldIds(List fieldIds) { + this.fieldIds.addAll(fieldIds); + return this; + } + + public ReorderFieldsDto build() { + return new ReorderFieldsDto(fieldIds); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ResizeMode.java b/src/main/java/com/squidex/api/types/ResizeMode.java new file mode 100644 index 0000000..b3b4ab6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ResizeMode.java @@ -0,0 +1,31 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ResizeMode { + CROP("Crop"), + + CROP_UPSIZE("CropUpsize"), + + PAD("Pad"), + + BOX_PAD("BoxPad"), + + MAX("Max"), + + MIN("Min"), + + STRETCH("Stretch"); + + private final String value; + + ResizeMode(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/Resource.java b/src/main/java/com/squidex/api/types/Resource.java new file mode 100644 index 0000000..cb5b0f8 --- /dev/null +++ b/src/main/java/com/squidex/api/types/Resource.java @@ -0,0 +1,87 @@ +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 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; + + private Resource(Map links) { + this.links = links; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Resource && equalTo((Resource) other); + } + + private boolean equalTo(Resource other) { + return links.equals(other.links); + } + + @Override + public int hashCode() { + return Objects.hash(this.links); + } + + @Override + public String toString() { + return "Resource{" + "links: " + links + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @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; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + public Resource build() { + return new Resource(links); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ResourceLink.java b/src/main/java/com/squidex/api/types/ResourceLink.java new file mode 100644 index 0000000..8a67d31 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ResourceLink.java @@ -0,0 +1,155 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = ResourceLink.Builder.class) +public final class ResourceLink { + private final String href; + + private final String method; + + private final Optional metadata; + + private ResourceLink(String href, String method, Optional metadata) { + this.href = href; + this.method = method; + this.metadata = metadata; + } + + /** + * @return The link url. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("href") + public String getHref() { + return href; + } + + /** + * @return The link method. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("method") + public String getMethod() { + return method; + } + + /** + * @return Additional data about the link. + */ + @JsonProperty("metadata") + public Optional getMetadata() { + return metadata; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResourceLink && equalTo((ResourceLink) other); + } + + private boolean equalTo(ResourceLink other) { + return href.equals(other.href) && method.equals(other.method) && metadata.equals(other.metadata); + } + + @Override + public int hashCode() { + return Objects.hash(this.href, this.method, this.metadata); + } + + @Override + public String toString() { + return "ResourceLink{" + "href: " + href + ", method: " + method + ", metadata: " + metadata + "}"; + } + + public static HrefStage builder() { + return new Builder(); + } + + public interface HrefStage { + MethodStage href(String href); + + Builder from(ResourceLink other); + } + + public interface MethodStage { + _FinalStage method(String method); + } + + public interface _FinalStage { + ResourceLink build(); + + _FinalStage metadata(Optional metadata); + + _FinalStage metadata(String metadata); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements HrefStage, MethodStage, _FinalStage { + private String href; + + private String method; + + private Optional metadata = Optional.empty(); + + private Builder() {} + + @Override + public Builder from(ResourceLink other) { + href(other.getHref()); + method(other.getMethod()); + metadata(other.getMetadata()); + return this; + } + + /** + *

The link url. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The link method. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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; + } + + @Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional metadata) { + this.metadata = metadata; + return this; + } + + @Override + public ResourceLink build() { + return new ResourceLink(href, method, metadata); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ResourcesDto.java b/src/main/java/com/squidex/api/types/ResourcesDto.java new file mode 100644 index 0000000..8310e39 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ResourcesDto.java @@ -0,0 +1,87 @@ +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 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; + + private ResourcesDto(Map links) { + this.links = links; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ResourcesDto && equalTo((ResourcesDto) other); + } + + private boolean equalTo(ResourcesDto other) { + return links.equals(other.links); + } + + @Override + public int hashCode() { + return Objects.hash(this.links); + } + + @Override + public String toString() { + return "ResourcesDto{" + "links: " + links + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @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; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + public ResourcesDto build() { + return new ResourcesDto(links); + } + } +} diff --git a/src/main/java/com/squidex/api/types/RestoreJobDto.java b/src/main/java/com/squidex/api/types/RestoreJobDto.java new file mode 100644 index 0000000..d6bc38c --- /dev/null +++ b/src/main/java/com/squidex/api/types/RestoreJobDto.java @@ -0,0 +1,234 @@ +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 java.time.OffsetDateTime; +import java.util.ArrayList; +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; + } + + @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); + } + + @Override + public String toString() { + return "RestoreJobDto{" + "url: " + url + ", log: " + log + ", started: " + started + ", stopped: " + stopped + + ", status: " + status + "}"; + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + StartedStage url(String url); + + Builder from(RestoreJobDto other); + } + + public interface StartedStage { + StatusStage started(OffsetDateTime started); + } + + public interface StatusStage { + _FinalStage status(JobStatus status); + } + + 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); + } + + @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; + } + + @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; + } + + @Override + @JsonSetter(value = "log", nulls = Nulls.SKIP) + public _FinalStage log(List log) { + this.log.clear(); + this.log.addAll(log); + return this; + } + + @Override + public RestoreJobDto build() { + return new RestoreJobDto(url, log, started, stopped, status); + } + } +} diff --git a/src/main/java/com/squidex/api/types/RoleDto.java b/src/main/java/com/squidex/api/types/RoleDto.java new file mode 100644 index 0000000..6fdd968 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RoleDto.java @@ -0,0 +1,349 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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); + } + + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + this.links, + this.name, + this.numClients, + this.numContributors, + this.isDefaultRole, + this.permissions, + this.properties); + } + + @Override + public String toString() { + return "RoleDto{" + "links: " + links + ", name: " + name + ", numClients: " + numClients + + ", numContributors: " + numContributors + ", isDefaultRole: " + isDefaultRole + ", permissions: " + + permissions + ", properties: " + properties + "}"; + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + NumClientsStage name(String name); + + Builder from(RoleDto other); + } + + public interface NumClientsStage { + NumContributorsStage numClients(int numClients); + } + + public interface NumContributorsStage { + IsDefaultRoleStage numContributors(int numContributors); + } + + public interface IsDefaultRoleStage { + _FinalStage isDefaultRole(boolean isDefaultRole); + } + + 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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/RolesDto.java b/src/main/java/com/squidex/api/types/RolesDto.java new file mode 100644 index 0000000..458e527 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RolesDto.java @@ -0,0 +1,120 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + + private final List items; + + private RolesDto(Map links, List items) { + this.links = links; + this.items = items; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + /** + * @return The roles. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RolesDto && equalTo((RolesDto) other); + } + + private boolean equalTo(RolesDto other) { + return links.equals(other.links) && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.items); + } + + @Override + public String toString() { + return "RolesDto{" + "links: " + links + ", items: " + items + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map links = new LinkedHashMap<>(); + + private List items = new ArrayList<>(); + + private Builder() {} + + public Builder from(RolesDto other) { + links(other.getLinks()); + items(other.getItems()); + return this; + } + + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public Builder links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + @JsonSetter(value = "items", nulls = Nulls.SKIP) + public Builder items(List items) { + this.items.clear(); + this.items.addAll(items); + return this; + } + + public Builder addItems(RoleDto items) { + this.items.add(items); + return this; + } + + public Builder addAllItems(List items) { + this.items.addAll(items); + return this; + } + + public RolesDto build() { + return new RolesDto(links, items); + } + } +} diff --git a/src/main/java/com/squidex/api/types/RuleActionDto.java b/src/main/java/com/squidex/api/types/RuleActionDto.java new file mode 100644 index 0000000..c37467a --- /dev/null +++ b/src/main/java/com/squidex/api/types/RuleActionDto.java @@ -0,0 +1,1100 @@ +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 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 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 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 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(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("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); + } + + @Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @Override + public String toString() { + return "RuleActionDto{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/squidex/api/types/RuleDto.java b/src/main/java/com/squidex/api/types/RuleDto.java new file mode 100644 index 0000000..38590ae --- /dev/null +++ b/src/main/java/com/squidex/api/types/RuleDto.java @@ -0,0 +1,560 @@ +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 java.time.OffsetDateTime; +import java.util.LinkedHashMap; +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; + } + + @JsonProperty("trigger") + public RuleTriggerDto getTrigger() { + return trigger; + } + + @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 "RuleDto{" + "links: " + links + ", id: " + id + ", createdBy: " + createdBy + ", lastModifiedBy: " + + lastModifiedBy + ", created: " + created + ", lastModified: " + lastModified + ", version: " + version + + ", isEnabled: " + isEnabled + ", name: " + name + ", trigger: " + trigger + ", action: " + action + + ", numSucceeded: " + numSucceeded + ", numFailed: " + numFailed + ", lastExecuted: " + lastExecuted + + "}"; + } + + 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; + } + + @Override + @JsonSetter("trigger") + public ActionStage trigger(RuleTriggerDto trigger) { + this.trigger = trigger; + return this; + } + + @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; + } + + /** + *

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 RuleDto build() { + return new RuleDto( + links, + id, + createdBy, + lastModifiedBy, + created, + lastModified, + version, + isEnabled, + name, + trigger, + action, + numSucceeded, + numFailed, + lastExecuted); + } + } +} diff --git a/src/main/java/com/squidex/api/types/RuleElementDto.java b/src/main/java/com/squidex/api/types/RuleElementDto.java new file mode 100644 index 0000000..b6cbe12 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RuleElementDto.java @@ -0,0 +1,332 @@ +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 java.util.ArrayList; +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); + } + + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + this.description, + this.display, + this.title, + this.iconColor, + this.iconImage, + this.readMore, + this.properties); + } + + @Override + public String toString() { + return "RuleElementDto{" + "description: " + description + ", display: " + display + ", title: " + title + + ", iconColor: " + iconColor + ", iconImage: " + iconImage + ", readMore: " + readMore + + ", properties: " + properties + "}"; + } + + public static DescriptionStage builder() { + return new Builder(); + } + + public interface DescriptionStage { + DisplayStage description(String description); + + Builder from(RuleElementDto other); + } + + public interface DisplayStage { + _FinalStage display(String display); + } + + 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; + } + + /** + *

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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/RuleElementPropertyDto.java b/src/main/java/com/squidex/api/types/RuleElementPropertyDto.java new file mode 100644 index 0000000..f73907a --- /dev/null +++ b/src/main/java/com/squidex/api/types/RuleElementPropertyDto.java @@ -0,0 +1,294 @@ +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 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; + } + + @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 "RuleElementPropertyDto{" + "editor: " + editor + ", name: " + name + ", display: " + display + + ", options: " + options + ", description: " + description + ", isFormattable: " + isFormattable + + ", isRequired: " + isRequired + "}"; + } + + public static EditorStage builder() { + return new Builder(); + } + + public interface EditorStage { + NameStage editor(RuleFieldEditor editor); + + Builder from(RuleElementPropertyDto other); + } + + public interface NameStage { + DisplayStage name(String name); + } + + public interface DisplayStage { + IsFormattableStage display(String display); + } + + public interface IsFormattableStage { + IsRequiredStage isFormattable(boolean isFormattable); + } + + public interface IsRequiredStage { + _FinalStage isRequired(boolean isRequired); + } + + public interface _FinalStage { + RuleElementPropertyDto build(); + + _FinalStage options(Optional> options); + + _FinalStage options(List options); + + _FinalStage description(Optional description); + + _FinalStage description(String description); + } + + @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; + } + + @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; + } + + @Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/RuleEventDto.java b/src/main/java/com/squidex/api/types/RuleEventDto.java new file mode 100644 index 0000000..28a760a --- /dev/null +++ b/src/main/java/com/squidex/api/types/RuleEventDto.java @@ -0,0 +1,413 @@ +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 java.time.OffsetDateTime; +import java.util.LinkedHashMap; +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; + } + + @JsonProperty("result") + public RuleResult getResult() { + return result; + } + + @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 "RuleEventDto{" + "links: " + links + ", id: " + id + ", created: " + created + ", description: " + + description + ", eventName: " + eventName + ", lastDump: " + lastDump + ", numCalls: " + numCalls + + ", nextAttempt: " + nextAttempt + ", result: " + result + ", jobResult: " + jobResult + "}"; + } + + 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); + } + + public interface DescriptionStage { + EventNameStage description(String description); + } + + public interface EventNameStage { + NumCallsStage eventName(String eventName); + } + + public interface NumCallsStage { + ResultStage numCalls(int numCalls); + } + + public interface ResultStage { + JobResultStage result(RuleResult result); + } + + public interface JobResultStage { + _FinalStage jobResult(RuleJobResult jobResult); + } + + 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); + } + + @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; + } + + /** + *

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; + } + + /** + *

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; + } + + @Override + @JsonSetter("result") + public JobResultStage result(RuleResult result) { + this.result = result; + return this; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/RuleEventsDto.java b/src/main/java/com/squidex/api/types/RuleEventsDto.java new file mode 100644 index 0000000..07b4e8e --- /dev/null +++ b/src/main/java/com/squidex/api/types/RuleEventsDto.java @@ -0,0 +1,191 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + } + + /** + * @return The rule events. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RuleEventsDto && equalTo((RuleEventsDto) other); + } + + private boolean equalTo(RuleEventsDto other) { + return links.equals(other.links) && total == other.total && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.total, this.items); + } + + @Override + public String toString() { + return "RuleEventsDto{" + "links: " + links + ", total: " + total + ", items: " + items + "}"; + } + + public static TotalStage builder() { + return new Builder(); + } + + 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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/RuleFieldEditor.java b/src/main/java/com/squidex/api/types/RuleFieldEditor.java new file mode 100644 index 0000000..3d8a279 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RuleFieldEditor.java @@ -0,0 +1,35 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum RuleFieldEditor { + CHECKBOX("Checkbox"), + + DROPDOWN("Dropdown"), + + EMAIL("Email"), + + JAVASCRIPT("Javascript"), + + NUMBER("Number"), + + PASSWORD("Password"), + + TEXT("Text"), + + TEXT_AREA("TextArea"), + + URL("Url"); + + private final String value; + + RuleFieldEditor(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/RuleJobResult.java b/src/main/java/com/squidex/api/types/RuleJobResult.java new file mode 100644 index 0000000..8220412 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RuleJobResult.java @@ -0,0 +1,27 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum RuleJobResult { + PENDING("Pending"), + + SUCCESS("Success"), + + RETRY("Retry"), + + FAILED("Failed"), + + CANCELLED("Cancelled"); + + private final String value; + + RuleJobResult(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/RuleResult.java b/src/main/java/com/squidex/api/types/RuleResult.java new file mode 100644 index 0000000..65b98a4 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RuleResult.java @@ -0,0 +1,25 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum RuleResult { + PENDING("Pending"), + + SUCCESS("Success"), + + FAILED("Failed"), + + TIMEOUT("Timeout"); + + private final String value; + + RuleResult(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/RuleTriggerDto.java b/src/main/java/com/squidex/api/types/RuleTriggerDto.java new file mode 100644 index 0000000..18e4320 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RuleTriggerDto.java @@ -0,0 +1,428 @@ +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); + } + + @Override + public int hashCode() { + return Objects.hash(this.type, this.value); + } + + @Override + public String toString() { + return "RuleTriggerDto{" + "type: " + type + ", value: " + value + "}"; + } + } +} diff --git a/src/main/java/com/squidex/api/types/RulesDto.java b/src/main/java/com/squidex/api/types/RulesDto.java new file mode 100644 index 0000000..9f8d302 --- /dev/null +++ b/src/main/java/com/squidex/api/types/RulesDto.java @@ -0,0 +1,146 @@ +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 java.util.ArrayList; +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 = RulesDto.Builder.class) +public final class RulesDto implements IResource { + private final Map links; + + private final List items; + + private final Optional runningRuleId; + + private RulesDto(Map links, List items, Optional runningRuleId) { + this.links = links; + this.items = items; + this.runningRuleId = runningRuleId; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + /** + * @return The rules. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + /** + * @return The ID of the rule that is currently rerunning. + */ + @JsonProperty("runningRuleId") + public Optional getRunningRuleId() { + return runningRuleId; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RulesDto && equalTo((RulesDto) other); + } + + private boolean equalTo(RulesDto other) { + return links.equals(other.links) && items.equals(other.items) && runningRuleId.equals(other.runningRuleId); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.items, this.runningRuleId); + } + + @Override + public String toString() { + return "RulesDto{" + "links: " + links + ", items: " + items + ", runningRuleId: " + runningRuleId + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map links = new LinkedHashMap<>(); + + private List items = new ArrayList<>(); + + private Optional runningRuleId = Optional.empty(); + + private Builder() {} + + public Builder from(RulesDto other) { + links(other.getLinks()); + items(other.getItems()); + runningRuleId(other.getRunningRuleId()); + return this; + } + + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public Builder links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + @JsonSetter(value = "items", nulls = Nulls.SKIP) + public Builder items(List items) { + this.items.clear(); + this.items.addAll(items); + return this; + } + + public Builder addItems(RuleDto items) { + this.items.add(items); + return this; + } + + public Builder addAllItems(List items) { + this.items.addAll(items); + return this; + } + + @JsonSetter(value = "runningRuleId", nulls = Nulls.SKIP) + public Builder runningRuleId(Optional runningRuleId) { + this.runningRuleId = runningRuleId; + return this; + } + + public Builder runningRuleId(String runningRuleId) { + this.runningRuleId = Optional.of(runningRuleId); + return this; + } + + public RulesDto build() { + return new RulesDto(links, items, runningRuleId); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ScheduleJobDto.java b/src/main/java/com/squidex/api/types/ScheduleJobDto.java new file mode 100644 index 0000000..b7b3a5a --- /dev/null +++ b/src/main/java/com/squidex/api/types/ScheduleJobDto.java @@ -0,0 +1,212 @@ +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 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 "ScheduleJobDto{" + "id: " + id + ", status: " + status + ", dueTime: " + dueTime + ", color: " + color + + ", scheduledBy: " + scheduledBy + "}"; + } + + 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); + } + + public interface DueTimeStage { + ColorStage dueTime(OffsetDateTime dueTime); + } + + public interface ColorStage { + ScheduledByStage color(String color); + } + + public interface ScheduledByStage { + _FinalStage scheduledBy(String scheduledBy); + } + + public interface _FinalStage { + ScheduleJobDto build(); + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java b/src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java new file mode 100644 index 0000000..7637212 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SchemaChangedRuleTriggerDto.java @@ -0,0 +1,79 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = SchemaChangedRuleTriggerDto.Builder.class) +public final class SchemaChangedRuleTriggerDto { + private final Optional condition; + + private SchemaChangedRuleTriggerDto(Optional condition) { + this.condition = condition; + } + + /** + * @return Javascript condition when to trigger. + */ + @JsonProperty("condition") + public Optional getCondition() { + return condition; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SchemaChangedRuleTriggerDto && equalTo((SchemaChangedRuleTriggerDto) other); + } + + private boolean equalTo(SchemaChangedRuleTriggerDto other) { + return condition.equals(other.condition); + } + + @Override + public int hashCode() { + return Objects.hash(this.condition); + } + + @Override + public String toString() { + return "SchemaChangedRuleTriggerDto{" + "condition: " + condition + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional condition = Optional.empty(); + + private Builder() {} + + public Builder from(SchemaChangedRuleTriggerDto other) { + condition(other.getCondition()); + return this; + } + + @JsonSetter(value = "condition", nulls = Nulls.SKIP) + public Builder condition(Optional condition) { + this.condition = condition; + return this; + } + + public Builder condition(String condition) { + this.condition = Optional.of(condition); + return this; + } + + public SchemaChangedRuleTriggerDto build() { + return new SchemaChangedRuleTriggerDto(condition); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SchemaCondition.java b/src/main/java/com/squidex/api/types/SchemaCondition.java new file mode 100644 index 0000000..ed54bde --- /dev/null +++ b/src/main/java/com/squidex/api/types/SchemaCondition.java @@ -0,0 +1,112 @@ +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 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); + } + + @Override + public int hashCode() { + return Objects.hash(this.schemaId, this.condition); + } + + @Override + public String toString() { + return "SchemaCondition{" + "schemaId: " + schemaId + ", condition: " + condition + "}"; + } + + public static SchemaIdStage builder() { + return new Builder(); + } + + public interface SchemaIdStage { + _FinalStage schemaId(String schemaId); + + Builder from(SchemaCondition other); + } + + public interface _FinalStage { + SchemaCondition build(); + + _FinalStage condition(Optional condition); + + _FinalStage condition(String condition); + } + + @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; + } + + @Override + @JsonSetter("schemaId") + public _FinalStage schemaId(String schemaId) { + this.schemaId = schemaId; + return this; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SchemaDto.java b/src/main/java/com/squidex/api/types/SchemaDto.java new file mode 100644 index 0000000..0233630 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SchemaDto.java @@ -0,0 +1,811 @@ +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 java.time.OffsetDateTime; +import java.util.ArrayList; +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 = 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("createdBy") + public String getCreatedBy() { + return createdBy; + } + + /** + * @return The user that has updated the schema. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("lastModifiedBy") + public String getLastModifiedBy() { + return lastModifiedBy; + } + + /** + * @return The name of the schema. Unique within the app. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("name") + public String getName() { + return name; + } + + @JsonProperty("type") + public SchemaType getType() { + return type; + } + + /** + * @return The name of the category. + */ + @JsonProperty("category") + public Optional getCategory() { + return category; + } + + @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; + } + + @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); + } + + 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); + } + + @Override + public String toString() { + return "SchemaDto{" + "links: " + links + ", id: " + id + ", createdBy: " + createdBy + ", lastModifiedBy: " + + lastModifiedBy + ", name: " + name + ", type: " + type + ", category: " + category + ", properties: " + + properties + ", isSingleton: " + isSingleton + ", isPublished: " + isPublished + ", created: " + + created + ", lastModified: " + lastModified + ", version: " + version + ", scripts: " + scripts + + ", previewUrls: " + previewUrls + ", fieldsInLists: " + fieldsInLists + ", fieldsInReferences: " + + fieldsInReferences + ", fieldRules: " + fieldRules + ", fields: " + fields + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + @JsonSetter("type") + public PropertiesStage type(SchemaType type) { + this.type = type; + return this; + } + + @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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SchemaPropertiesDto.java b/src/main/java/com/squidex/api/types/SchemaPropertiesDto.java new file mode 100644 index 0000000..27e2964 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SchemaPropertiesDto.java @@ -0,0 +1,325 @@ +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 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; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SchemaPropertiesDto && equalTo((SchemaPropertiesDto) other); + } + + 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); + } + + @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 "SchemaPropertiesDto{" + "label: " + label + ", hints: " + hints + ", contentsSidebarUrl: " + + contentsSidebarUrl + ", contentSidebarUrl: " + contentSidebarUrl + ", contentEditorUrl: " + + contentEditorUrl + ", validateOnPublish: " + validateOnPublish + ", tags: " + tags + "}"; + } + + public static ValidateOnPublishStage builder() { + return new Builder(); + } + + public interface ValidateOnPublishStage { + _FinalStage validateOnPublish(boolean validateOnPublish); + + Builder from(SchemaPropertiesDto other); + } + + 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); + } + + @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; + } + + /** + *

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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SchemaScriptsDto.java b/src/main/java/com/squidex/api/types/SchemaScriptsDto.java new file mode 100644 index 0000000..7a65989 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SchemaScriptsDto.java @@ -0,0 +1,216 @@ +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 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; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SchemaScriptsDto && equalTo((SchemaScriptsDto) other); + } + + 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); + } + + @Override + public int hashCode() { + return Objects.hash(this.query, this.queryPre, this.create, this.update, this.delete, this.change); + } + + @Override + public String toString() { + return "SchemaScriptsDto{" + "query: " + query + ", queryPre: " + queryPre + ", create: " + create + + ", update: " + update + ", delete: " + delete + ", change: " + change + "}"; + } + + 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 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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SchemaType.java b/src/main/java/com/squidex/api/types/SchemaType.java new file mode 100644 index 0000000..b7da05a --- /dev/null +++ b/src/main/java/com/squidex/api/types/SchemaType.java @@ -0,0 +1,23 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum SchemaType { + DEFAULT("Default"), + + SINGLETON("Singleton"), + + COMPONENT("Component"); + + private final String value; + + SchemaType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/SchemasDto.java b/src/main/java/com/squidex/api/types/SchemasDto.java new file mode 100644 index 0000000..64bb1a6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SchemasDto.java @@ -0,0 +1,120 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + + private final List items; + + private SchemasDto(Map links, List items) { + this.links = links; + this.items = items; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + /** + * @return The schemas. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SchemasDto && equalTo((SchemasDto) other); + } + + private boolean equalTo(SchemasDto other) { + return links.equals(other.links) && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.items); + } + + @Override + public String toString() { + return "SchemasDto{" + "links: " + links + ", items: " + items + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map links = new LinkedHashMap<>(); + + private List items = new ArrayList<>(); + + private Builder() {} + + public Builder from(SchemasDto other) { + links(other.getLinks()); + items(other.getItems()); + return this; + } + + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public Builder links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + @JsonSetter(value = "items", nulls = Nulls.SKIP) + public Builder items(List items) { + this.items.clear(); + this.items.addAll(items); + return this; + } + + public Builder addItems(SchemaDto items) { + this.items.add(items); + return this; + } + + public Builder addAllItems(List items) { + this.items.addAll(items); + return this; + } + + public SchemasDto build() { + return new SchemasDto(links, items); + } + } +} diff --git a/src/main/java/com/squidex/api/types/ScriptRuleActionDto.java b/src/main/java/com/squidex/api/types/ScriptRuleActionDto.java new file mode 100644 index 0000000..9b43d87 --- /dev/null +++ b/src/main/java/com/squidex/api/types/ScriptRuleActionDto.java @@ -0,0 +1,89 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + @Override + public String toString() { + return "ScriptRuleActionDto{" + "script: " + script + "}"; + } + + public static ScriptStage builder() { + return new Builder(); + } + + public interface ScriptStage { + _FinalStage script(String script); + + Builder from(ScriptRuleActionDto other); + } + + public interface _FinalStage { + ScriptRuleActionDto build(); + } + + @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; + } + + /** + *

The script to render. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + public ScriptRuleActionDto build() { + return new ScriptRuleActionDto(script); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SearchResultDto.java b/src/main/java/com/squidex/api/types/SearchResultDto.java new file mode 100644 index 0000000..4fbe4c2 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SearchResultDto.java @@ -0,0 +1,204 @@ +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 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; + } + + @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); + } + + private boolean equalTo(SearchResultDto other) { + return links.equals(other.links) + && name.equals(other.name) + && type.equals(other.type) + && label.equals(other.label); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.name, this.type, this.label); + } + + @Override + public String toString() { + return "SearchResultDto{" + "links: " + links + ", name: " + name + ", type: " + type + ", label: " + label + + "}"; + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + TypeStage name(String name); + + Builder from(SearchResultDto other); + } + + public interface TypeStage { + _FinalStage type(SearchResultType type); + } + + 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); + } + + @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; + } + + @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; + } + + @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 SearchResultDto build() { + return new SearchResultDto(links, name, type, label); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SearchResultType.java b/src/main/java/com/squidex/api/types/SearchResultType.java new file mode 100644 index 0000000..6aedba1 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SearchResultType.java @@ -0,0 +1,29 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum SearchResultType { + ASSET("Asset"), + + CONTENT("Content"), + + DASHBOARD("Dashboard"), + + SETTING("Setting"), + + RULE("Rule"), + + SCHEMA("Schema"); + + private final String value; + + SearchResultType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/SignalRRuleActionDto.java b/src/main/java/com/squidex/api/types/SignalRRuleActionDto.java new file mode 100644 index 0000000..72c9c67 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SignalRRuleActionDto.java @@ -0,0 +1,261 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("connectionString") + public String getConnectionString() { + return connectionString; + } + + /** + * @return The name of the hub. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("hubName") + public String getHubName() { + return hubName; + } + + @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 "SignalRRuleActionDto{" + "connectionString: " + connectionString + ", hubName: " + hubName + + ", action: " + action + ", methodName: " + methodName + ", target: " + target + ", payload: " + + payload + "}"; + } + + public static ConnectionStringStage builder() { + return new Builder(); + } + + public interface ConnectionStringStage { + HubNameStage connectionString(String connectionString); + + Builder from(SignalRRuleActionDto other); + } + + public interface HubNameStage { + ActionStage hubName(String hubName); + } + + public interface ActionStage { + _FinalStage action(ActionTypeEnum action); + } + + 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); + } + + @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @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; + } + + @Override + @JsonSetter(value = "target", nulls = Nulls.SKIP) + public _FinalStage target(Optional target) { + this.target = target; + return this; + } + + /** + *

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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java b/src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java new file mode 100644 index 0000000..f9a3cf1 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SimulatedRuleEventDto.java @@ -0,0 +1,383 @@ +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 java.util.ArrayList; +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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("eventId") + public String getEventId() { + return eventId; + } + + /** + * @return The the unique id of the simulated event. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("uniqueId") + public String getUniqueId() { + return uniqueId; + } + + /** + * @return The name of the event. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + @Override + public String toString() { + return "SimulatedRuleEventDto{" + "eventId: " + eventId + ", uniqueId: " + uniqueId + ", eventName: " + + eventName + ", event: " + event + ", enrichedEvent: " + enrichedEvent + ", actionName: " + actionName + + ", actionData: " + actionData + ", error: " + error + ", skipReasons: " + skipReasons + "}"; + } + + public static EventIdStage builder() { + return new Builder(); + } + + public interface EventIdStage { + UniqueIdStage eventId(String eventId); + + Builder from(SimulatedRuleEventDto other); + } + + public interface UniqueIdStage { + EventNameStage uniqueId(String uniqueId); + } + + public interface EventNameStage { + EventStage eventName(String eventName); + } + + public interface EventStage { + _FinalStage event(Object event); + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java b/src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java new file mode 100644 index 0000000..f1f3048 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SimulatedRuleEventsDto.java @@ -0,0 +1,191 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + } + + /** + * @return The simulated rule events. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof SimulatedRuleEventsDto && equalTo((SimulatedRuleEventsDto) other); + } + + private boolean equalTo(SimulatedRuleEventsDto other) { + return links.equals(other.links) && total == other.total && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.total, this.items); + } + + @Override + public String toString() { + return "SimulatedRuleEventsDto{" + "links: " + links + ", total: " + total + ", items: " + items + "}"; + } + + public static TotalStage builder() { + return new Builder(); + } + + 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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SkipReason.java b/src/main/java/com/squidex/api/types/SkipReason.java new file mode 100644 index 0000000..cdbf55b --- /dev/null +++ b/src/main/java/com/squidex/api/types/SkipReason.java @@ -0,0 +1,39 @@ +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"), + + FAILED("Failed"), + + FROM_RULE("FromRule"), + + NO_ACTION("NoAction"), + + NO_TRIGGER("NoTrigger"), + + TOO_OLD("TooOld"), + + WRONG_EVENT("WrongEvent"), + + WRONG_EVENT_FOR_TRIGGER("WrongEventForTrigger"); + + private final String value; + + SkipReason(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/SlackRuleActionDto.java b/src/main/java/com/squidex/api/types/SlackRuleActionDto.java new file mode 100644 index 0000000..23aaf86 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SlackRuleActionDto.java @@ -0,0 +1,118 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("webhookUrl") + public String getWebhookUrl() { + return webhookUrl; + } + + /** + * @return The text that is sent as message to slack. <span style="white-space: nowrap">non-empty</span> + */ + @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); + } + + @Override + public String toString() { + return "SlackRuleActionDto{" + "webhookUrl: " + webhookUrl + ", text: " + text + "}"; + } + + public static WebhookUrlStage builder() { + return new Builder(); + } + + public interface WebhookUrlStage { + TextStage webhookUrl(String webhookUrl); + + Builder from(SlackRuleActionDto other); + } + + public interface TextStage { + _FinalStage text(String text); + } + + 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; + } + + /** + *

The slack webhook url. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The text that is sent as message to slack. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + public SlackRuleActionDto build() { + return new SlackRuleActionDto(webhookUrl, text); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SortNode.java b/src/main/java/com/squidex/api/types/SortNode.java new file mode 100644 index 0000000..b4f22c4 --- /dev/null +++ b/src/main/java/com/squidex/api/types/SortNode.java @@ -0,0 +1,122 @@ +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 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); + } + + @Override + public int hashCode() { + return Objects.hash(this.path, this.order); + } + + @Override + public String toString() { + return "SortNode{" + "path: " + path + ", order: " + order + "}"; + } + + public static OrderStage builder() { + return new Builder(); + } + + public interface OrderStage { + _FinalStage order(SortOrder order); + + Builder from(SortNode other); + } + + public interface _FinalStage { + SortNode build(); + + _FinalStage path(List path); + + _FinalStage addPath(String path); + + _FinalStage addAllPath(List path); + } + + @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; + } + + @Override + public _FinalStage addAllPath(List path) { + this.path.addAll(path); + return this; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/SortOrder.java b/src/main/java/com/squidex/api/types/SortOrder.java new file mode 100644 index 0000000..c1f1c4d --- /dev/null +++ b/src/main/java/com/squidex/api/types/SortOrder.java @@ -0,0 +1,21 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum SortOrder { + ASCENDING("Ascending"), + + DESCENDING("Descending"); + + private final String value; + + SortOrder(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/StatusInfoDto.java b/src/main/java/com/squidex/api/types/StatusInfoDto.java new file mode 100644 index 0000000..9231196 --- /dev/null +++ b/src/main/java/com/squidex/api/types/StatusInfoDto.java @@ -0,0 +1,118 @@ +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 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 "StatusInfoDto{" + "status: " + status + ", color: " + color + "}"; + } + + public static StatusStage builder() { + return new Builder(); + } + + public interface StatusStage { + ColorStage status(String status); + + Builder from(StatusInfoDto other); + } + + public interface ColorStage { + _FinalStage color(String color); + } + + public interface _FinalStage { + StatusInfoDto build(); + } + + @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; + } + + /** + *

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; + } + + @Override + public StatusInfoDto build() { + return new StatusInfoDto(status, color); + } + } +} diff --git a/src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java b/src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java new file mode 100644 index 0000000..a92de77 --- /dev/null +++ b/src/main/java/com/squidex/api/types/StorageUsagePerDateDto.java @@ -0,0 +1,148 @@ +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 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 "StorageUsagePerDateDto{" + "date: " + date + ", totalCount: " + totalCount + ", totalSize: " + totalSize + + "}"; + } + + public static DateStage builder() { + return new Builder(); + } + + public interface DateStage { + TotalCountStage date(String date); + + Builder from(StorageUsagePerDateDto other); + } + + public interface TotalCountStage { + TotalSizeStage totalCount(int totalCount); + } + + public interface TotalSizeStage { + _FinalStage totalSize(int totalSize); + } + + 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; + } + + /** + *

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; + } + + /** + *

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; + } + + @Override + public StorageUsagePerDateDto build() { + return new StorageUsagePerDateDto(date, totalCount, totalSize); + } + } +} diff --git a/src/main/java/com/squidex/api/types/StringContentType.java b/src/main/java/com/squidex/api/types/StringContentType.java new file mode 100644 index 0000000..135cefa --- /dev/null +++ b/src/main/java/com/squidex/api/types/StringContentType.java @@ -0,0 +1,23 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum StringContentType { + UNSPECIFIED("Unspecified"), + + HTML("Html"), + + MARKDOWN("Markdown"); + + private final String value; + + StringContentType(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/StringFieldEditor.java b/src/main/java/com/squidex/api/types/StringFieldEditor.java new file mode 100644 index 0000000..ef7a09c --- /dev/null +++ b/src/main/java/com/squidex/api/types/StringFieldEditor.java @@ -0,0 +1,37 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +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"); + + private final String value; + + StringFieldEditor(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java new file mode 100644 index 0000000..27b558a --- /dev/null +++ b/src/main/java/com/squidex/api/types/StringFieldPropertiesDto.java @@ -0,0 +1,603 @@ +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 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; + } + + @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; + } + + /** + * @return The allowed schema ids that can be embedded. + */ + @JsonProperty("schemaIds") + public Optional> getSchemaIds() { + return schemaIds; + } + + /** + * @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; + } + + /** + * @return Indicates that the inline editor is enabled for this field. + */ + @JsonProperty("inlineEditable") + public Optional getInlineEditable() { + return inlineEditable; + } + + /** + * @return Indicates whether GraphQL Enum should be created. + */ + @JsonProperty("createEnum") + public Optional getCreateEnum() { + return createEnum; + } + + @JsonProperty("contentType") + public Optional getContentType() { + return contentType; + } + + @JsonProperty("editor") + public Optional getEditor() { + return editor; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StringFieldPropertiesDto && equalTo((StringFieldPropertiesDto) other); + } + + 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); + } + + @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); + } + + @Override + public String toString() { + return "StringFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue + + ", pattern: " + pattern + ", patternMessage: " + patternMessage + ", folderId: " + folderId + + ", minLength: " + minLength + ", maxLength: " + maxLength + ", minCharacters: " + minCharacters + + ", maxCharacters: " + maxCharacters + ", minWords: " + minWords + ", maxWords: " + maxWords + + ", allowedValues: " + allowedValues + ", schemaIds: " + schemaIds + ", isUnique: " + isUnique + + ", isEmbeddable: " + isEmbeddable + ", inlineEditable: " + inlineEditable + ", createEnum: " + + createEnum + ", contentType: " + contentType + ", editor: " + editor + "}"; + } + + 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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/TagsFieldEditor.java b/src/main/java/com/squidex/api/types/TagsFieldEditor.java new file mode 100644 index 0000000..ea08fab --- /dev/null +++ b/src/main/java/com/squidex/api/types/TagsFieldEditor.java @@ -0,0 +1,23 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum TagsFieldEditor { + TAGS("Tags"), + + CHECKBOXES("Checkboxes"), + + DROPDOWN("Dropdown"); + + private final String value; + + TagsFieldEditor(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java new file mode 100644 index 0000000..61f9a81 --- /dev/null +++ b/src/main/java/com/squidex/api/types/TagsFieldPropertiesDto.java @@ -0,0 +1,248 @@ +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 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; + } + + @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; + } + + /** + * @return The allowed values for the field value. + */ + @JsonProperty("allowedValues") + public Optional> getAllowedValues() { + return allowedValues; + } + + /** + * @return Indicates whether GraphQL Enum should be created. + */ + @JsonProperty("createEnum") + public Optional getCreateEnum() { + return createEnum; + } + + @JsonProperty("editor") + public Optional getEditor() { + return editor; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TagsFieldPropertiesDto && equalTo((TagsFieldPropertiesDto) other); + } + + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + this.defaultValues, + this.defaultValue, + this.minItems, + this.maxItems, + this.allowedValues, + this.createEnum, + this.editor); + } + + @Override + public String toString() { + return "TagsFieldPropertiesDto{" + "defaultValues: " + defaultValues + ", defaultValue: " + defaultValue + + ", minItems: " + minItems + ", maxItems: " + maxItems + ", allowedValues: " + allowedValues + + ", createEnum: " + createEnum + ", editor: " + editor + "}"; + } + + 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 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; + } + + @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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/TeamDto.java b/src/main/java/com/squidex/api/types/TeamDto.java new file mode 100644 index 0000000..489fade --- /dev/null +++ b/src/main/java/com/squidex/api/types/TeamDto.java @@ -0,0 +1,310 @@ +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 java.time.OffsetDateTime; +import java.util.LinkedHashMap; +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 "TeamDto{" + "links: " + links + ", id: " + id + ", name: " + name + ", version: " + version + + ", created: " + created + ", lastModified: " + lastModified + ", roleName: " + roleName + "}"; + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + NameStage id(String id); + + Builder from(TeamDto other); + } + + public interface NameStage { + VersionStage name(String name); + } + + public interface VersionStage { + CreatedStage version(int version); + } + + public interface CreatedStage { + LastModifiedStage created(OffsetDateTime created); + } + + public interface LastModifiedStage { + _FinalStage lastModified(OffsetDateTime lastModified); + } + + 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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/TemplateDetailsDto.java b/src/main/java/com/squidex/api/types/TemplateDetailsDto.java new file mode 100644 index 0000000..b4dfb3e --- /dev/null +++ b/src/main/java/com/squidex/api/types/TemplateDetailsDto.java @@ -0,0 +1,141 @@ +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 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; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TemplateDetailsDto && equalTo((TemplateDetailsDto) other); + } + + private boolean equalTo(TemplateDetailsDto other) { + return links.equals(other.links) && details.equals(other.details); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.details); + } + + @Override + public String toString() { + return "TemplateDetailsDto{" + "links: " + links + ", details: " + details + "}"; + } + + public static DetailsStage builder() { + return new Builder(); + } + + public interface DetailsStage { + _FinalStage details(String details); + + Builder from(TemplateDetailsDto other); + } + + public interface _FinalStage { + TemplateDetailsDto build(); + + _FinalStage links(Map links); + + _FinalStage putAllLinks(Map links); + + _FinalStage links(String key, ResourceLink value); + } + + @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; + } + + /** + *

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 TemplateDetailsDto build() { + return new TemplateDetailsDto(links, details); + } + } +} diff --git a/src/main/java/com/squidex/api/types/TemplateDto.java b/src/main/java/com/squidex/api/types/TemplateDto.java new file mode 100644 index 0000000..d745297 --- /dev/null +++ b/src/main/java/com/squidex/api/types/TemplateDto.java @@ -0,0 +1,234 @@ +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 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 "TemplateDto{" + "links: " + links + ", name: " + name + ", title: " + title + ", description: " + + description + ", isStarter: " + isStarter + "}"; + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + TitleStage name(String name); + + Builder from(TemplateDto other); + } + + public interface TitleStage { + DescriptionStage title(String title); + } + + public interface DescriptionStage { + IsStarterStage description(String description); + } + + public interface IsStarterStage { + _FinalStage isStarter(boolean isStarter); + } + + public interface _FinalStage { + TemplateDto build(); + + _FinalStage links(Map links); + + _FinalStage putAllLinks(Map links); + + _FinalStage links(String key, ResourceLink value); + } + + @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; + } + + @Override + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public _FinalStage links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + @Override + public TemplateDto build() { + return new TemplateDto(links, name, title, description, isStarter); + } + } +} diff --git a/src/main/java/com/squidex/api/types/TemplatesDto.java b/src/main/java/com/squidex/api/types/TemplatesDto.java new file mode 100644 index 0000000..f8ec459 --- /dev/null +++ b/src/main/java/com/squidex/api/types/TemplatesDto.java @@ -0,0 +1,120 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + + private final List items; + + private TemplatesDto(Map links, List items) { + this.links = links; + this.items = items; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + /** + * @return The event consumers. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TemplatesDto && equalTo((TemplatesDto) other); + } + + private boolean equalTo(TemplatesDto other) { + return links.equals(other.links) && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.items); + } + + @Override + public String toString() { + return "TemplatesDto{" + "links: " + links + ", items: " + items + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map links = new LinkedHashMap<>(); + + private List items = new ArrayList<>(); + + private Builder() {} + + public Builder from(TemplatesDto other) { + links(other.getLinks()); + items(other.getItems()); + return this; + } + + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public Builder links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + @JsonSetter(value = "items", nulls = Nulls.SKIP) + public Builder items(List items) { + this.items.clear(); + this.items.addAll(items); + return this; + } + + public Builder addItems(TemplateDto items) { + this.items.add(items); + return this; + } + + public Builder addAllItems(List items) { + this.items.addAll(items); + return this; + } + + public TemplatesDto build() { + return new TemplatesDto(links, items); + } + } +} diff --git a/src/main/java/com/squidex/api/types/TranslationDto.java b/src/main/java/com/squidex/api/types/TranslationDto.java new file mode 100644 index 0000000..d2751a7 --- /dev/null +++ b/src/main/java/com/squidex/api/types/TranslationDto.java @@ -0,0 +1,119 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = TranslationDto.Builder.class) +public final class TranslationDto { + private final TranslationResultCode result; + + private final Optional text; + + private TranslationDto(TranslationResultCode result, Optional text) { + this.result = result; + this.text = text; + } + + @JsonProperty("result") + public TranslationResultCode getResult() { + return result; + } + + /** + * @return The translated text. + */ + @JsonProperty("text") + public Optional getText() { + return text; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TranslationDto && equalTo((TranslationDto) other); + } + + private boolean equalTo(TranslationDto other) { + return result.equals(other.result) && text.equals(other.text); + } + + @Override + public int hashCode() { + return Objects.hash(this.result, this.text); + } + + @Override + public String toString() { + return "TranslationDto{" + "result: " + result + ", text: " + text + "}"; + } + + public static ResultStage builder() { + return new Builder(); + } + + public interface ResultStage { + _FinalStage result(TranslationResultCode result); + + Builder from(TranslationDto other); + } + + public interface _FinalStage { + TranslationDto build(); + + _FinalStage text(Optional text); + + _FinalStage text(String text); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ResultStage, _FinalStage { + private TranslationResultCode result; + + private Optional text = Optional.empty(); + + private Builder() {} + + @Override + public Builder from(TranslationDto other) { + result(other.getResult()); + text(other.getText()); + return this; + } + + @Override + @JsonSetter("result") + public _FinalStage result(TranslationResultCode result) { + this.result = result; + return this; + } + + /** + *

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; + } + + @Override + @JsonSetter(value = "text", nulls = Nulls.SKIP) + public _FinalStage text(Optional text) { + this.text = text; + return this; + } + + @Override + public TranslationDto build() { + return new TranslationDto(result, text); + } + } +} diff --git a/src/main/java/com/squidex/api/types/TranslationResultCode.java b/src/main/java/com/squidex/api/types/TranslationResultCode.java new file mode 100644 index 0000000..f52c479 --- /dev/null +++ b/src/main/java/com/squidex/api/types/TranslationResultCode.java @@ -0,0 +1,29 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum TranslationResultCode { + TRANSLATED("Translated"), + + LANGUAGE_NOT_SUPPORTED("LanguageNotSupported"), + + NOT_TRANSLATED("NotTranslated"), + + NOT_CONFIGURED("NotConfigured"), + + UNAUTHORIZED("Unauthorized"), + + FAILED("Failed"); + + private final String value; + + TranslationResultCode(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/TweetRuleActionDto.java b/src/main/java/com/squidex/api/types/TweetRuleActionDto.java new file mode 100644 index 0000000..77ad8be --- /dev/null +++ b/src/main/java/com/squidex/api/types/TweetRuleActionDto.java @@ -0,0 +1,150 @@ +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 java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = TweetRuleActionDto.Builder.class) +public final class TweetRuleActionDto { + private final String accessToken; + + private final String accessSecret; + + private final String text; + + private TweetRuleActionDto(String accessToken, String accessSecret, String text) { + this.accessToken = accessToken; + this.accessSecret = accessSecret; + this.text = text; + } + + /** + * @return The generated access token. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("accessToken") + public String getAccessToken() { + return accessToken; + } + + /** + * @return The generated access secret. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("accessSecret") + public String getAccessSecret() { + return accessSecret; + } + + /** + * @return The text that is sent as tweet to twitter. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("text") + public String getText() { + return text; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TweetRuleActionDto && equalTo((TweetRuleActionDto) other); + } + + private boolean equalTo(TweetRuleActionDto other) { + return accessToken.equals(other.accessToken) + && accessSecret.equals(other.accessSecret) + && text.equals(other.text); + } + + @Override + public int hashCode() { + return Objects.hash(this.accessToken, this.accessSecret, this.text); + } + + @Override + public String toString() { + return "TweetRuleActionDto{" + "accessToken: " + accessToken + ", accessSecret: " + accessSecret + ", text: " + + text + "}"; + } + + public static AccessTokenStage builder() { + return new Builder(); + } + + public interface AccessTokenStage { + AccessSecretStage accessToken(String accessToken); + + Builder from(TweetRuleActionDto other); + } + + public interface AccessSecretStage { + TextStage accessSecret(String accessSecret); + } + + public interface TextStage { + _FinalStage text(String text); + } + + public interface _FinalStage { + TweetRuleActionDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccessTokenStage, AccessSecretStage, TextStage, _FinalStage { + private String accessToken; + + private String accessSecret; + + private String text; + + private Builder() {} + + @Override + public Builder from(TweetRuleActionDto other) { + accessToken(other.getAccessToken()); + accessSecret(other.getAccessSecret()); + text(other.getText()); + return this; + } + + /** + *

The generated access token. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The generated access secret. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The text that is sent as tweet to twitter. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + public TweetRuleActionDto build() { + return new TweetRuleActionDto(accessToken, accessSecret, text); + } + } +} diff --git a/src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java b/src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java new file mode 100644 index 0000000..2f741e6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/TypesenseRuleActionDto.java @@ -0,0 +1,225 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("host") + public String getHost() { + return host; + } + + /** + * @return The name of the index. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("indexName") + public String getIndexName() { + return indexName; + } + + /** + * @return The api key. <span style="white-space: nowrap">non-empty</span> + */ + @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 "TypesenseRuleActionDto{" + "host: " + host + ", indexName: " + indexName + ", apiKey: " + apiKey + + ", document: " + document + ", delete: " + delete + "}"; + } + + public static HostStage builder() { + return new Builder(); + } + + public interface HostStage { + IndexNameStage host(String host); + + Builder from(TypesenseRuleActionDto other); + } + + public interface IndexNameStage { + ApiKeyStage indexName(String indexName); + } + + public interface ApiKeyStage { + _FinalStage apiKey(String apiKey); + } + + public interface _FinalStage { + TypesenseRuleActionDto build(); + + _FinalStage document(Optional document); + + _FinalStage document(String document); + + _FinalStage delete(Optional delete); + + _FinalStage delete(String delete); + } + + @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. <span style="white-space: nowrap">non-empty</span>

+ * @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

The api key. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + /** + *

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; + } + + @Override + public TypesenseRuleActionDto build() { + return new TypesenseRuleActionDto(host, indexName, apiKey, document, delete); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java b/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java new file mode 100644 index 0000000..d1e6db8 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UiFieldPropertiesDto.java @@ -0,0 +1,76 @@ +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 java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = UiFieldPropertiesDto.Builder.class) +public final class UiFieldPropertiesDto { + private final Optional editor; + + private UiFieldPropertiesDto(Optional editor) { + this.editor = editor; + } + + @JsonProperty("editor") + public Optional getEditor() { + return editor; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UiFieldPropertiesDto && equalTo((UiFieldPropertiesDto) other); + } + + private boolean equalTo(UiFieldPropertiesDto other) { + return editor.equals(other.editor); + } + + @Override + public int hashCode() { + return Objects.hash(this.editor); + } + + @Override + public String toString() { + return "UiFieldPropertiesDto{" + "editor: " + editor + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional editor = Optional.empty(); + + private Builder() {} + + public Builder from(UiFieldPropertiesDto other) { + editor(other.getEditor()); + return this; + } + + @JsonSetter(value = "editor", nulls = Nulls.SKIP) + public Builder editor(Optional editor) { + this.editor = editor; + return this; + } + + public Builder editor(String editor) { + this.editor = Optional.of(editor); + return this; + } + + public UiFieldPropertiesDto build() { + return new UiFieldPropertiesDto(editor); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UiSettingsDto.java b/src/main/java/com/squidex/api/types/UiSettingsDto.java new file mode 100644 index 0000000..a6a9478 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UiSettingsDto.java @@ -0,0 +1,118 @@ +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 java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_EMPTY) +@JsonDeserialize(builder = UiSettingsDto.Builder.class) +public final class UiSettingsDto { + private final boolean canCreateApps; + + private final boolean canCreateTeams; + + private UiSettingsDto(boolean canCreateApps, boolean canCreateTeams) { + this.canCreateApps = canCreateApps; + this.canCreateTeams = canCreateTeams; + } + + /** + * @return True when the user can create apps. + */ + @JsonProperty("canCreateApps") + public boolean getCanCreateApps() { + return canCreateApps; + } + + /** + * @return True when the user can create teams. + */ + @JsonProperty("canCreateTeams") + public boolean getCanCreateTeams() { + return canCreateTeams; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UiSettingsDto && equalTo((UiSettingsDto) other); + } + + private boolean equalTo(UiSettingsDto other) { + return canCreateApps == other.canCreateApps && canCreateTeams == other.canCreateTeams; + } + + @Override + public int hashCode() { + return Objects.hash(this.canCreateApps, this.canCreateTeams); + } + + @Override + public String toString() { + return "UiSettingsDto{" + "canCreateApps: " + canCreateApps + ", canCreateTeams: " + canCreateTeams + "}"; + } + + public static CanCreateAppsStage builder() { + return new Builder(); + } + + public interface CanCreateAppsStage { + CanCreateTeamsStage canCreateApps(boolean canCreateApps); + + Builder from(UiSettingsDto other); + } + + public interface CanCreateTeamsStage { + _FinalStage canCreateTeams(boolean canCreateTeams); + } + + public interface _FinalStage { + UiSettingsDto build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements CanCreateAppsStage, CanCreateTeamsStage, _FinalStage { + private boolean canCreateApps; + + private boolean canCreateTeams; + + private Builder() {} + + @Override + public Builder from(UiSettingsDto other) { + canCreateApps(other.getCanCreateApps()); + canCreateTeams(other.getCanCreateTeams()); + return this; + } + + /** + *

True when the user can create apps.

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

True when the user can create teams.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @Override + @JsonSetter("canCreateTeams") + public _FinalStage canCreateTeams(boolean canCreateTeams) { + this.canCreateTeams = canCreateTeams; + return this; + } + + @Override + public UiSettingsDto build() { + return new UiSettingsDto(canCreateApps, canCreateTeams); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateFieldDto.java b/src/main/java/com/squidex/api/types/UpdateFieldDto.java new file mode 100644 index 0000000..d081fb0 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateFieldDto.java @@ -0,0 +1,82 @@ +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 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; + } + + @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); + } + + @Override + public String toString() { + return "UpdateFieldDto{" + "properties: " + properties + "}"; + } + + public static PropertiesStage builder() { + return new Builder(); + } + + public interface PropertiesStage { + _FinalStage properties(FieldPropertiesDto properties); + + Builder from(UpdateFieldDto other); + } + + public interface _FinalStage { + UpdateFieldDto build(); + } + + @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; + } + + @Override + @JsonSetter("properties") + public _FinalStage properties(FieldPropertiesDto properties) { + this.properties = properties; + return this; + } + + @Override + public UpdateFieldDto build() { + return new UpdateFieldDto(properties); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UpdateSettingDto.java b/src/main/java/com/squidex/api/types/UpdateSettingDto.java new file mode 100644 index 0000000..88f0c2d --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpdateSettingDto.java @@ -0,0 +1,82 @@ +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 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); + } + + @Override + public String toString() { + return "UpdateSettingDto{" + "value: " + value + "}"; + } + + public static ValueStage builder() { + return new Builder(); + } + + public interface ValueStage { + _FinalStage value(Object value); + + Builder from(UpdateSettingDto other); + } + + public interface _FinalStage { + UpdateSettingDto build(); + } + + @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; + } + + @Override + @JsonSetter("value") + public _FinalStage value(Object value) { + this.value = value; + return this; + } + + @Override + public UpdateSettingDto build() { + return new UpdateSettingDto(value); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UpsertCommentDto.java b/src/main/java/com/squidex/api/types/UpsertCommentDto.java new file mode 100644 index 0000000..08841b0 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpsertCommentDto.java @@ -0,0 +1,126 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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 "UpsertCommentDto{" + "text: " + text + ", url: " + url + "}"; + } + + 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. <span style="white-space: nowrap">non-empty</span>

+ * @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 new file mode 100644 index 0000000..6d5a5f6 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpsertSchemaDto.java @@ -0,0 +1,322 @@ +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 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; + } + + @JsonProperty("properties") + @Override + public Optional getProperties() { + return properties; + } + + @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; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpsertSchemaDto && equalTo((UpsertSchemaDto) other); + } + + 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); + } + + @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); + } + + @Override + public String toString() { + return "UpsertSchemaDto{" + "properties: " + properties + ", scripts: " + scripts + ", fieldsInReferences: " + + fieldsInReferences + ", fieldsInLists: " + fieldsInLists + ", fields: " + fields + ", previewUrls: " + + previewUrls + ", fieldRules: " + fieldRules + ", category: " + category + ", isPublished: " + + isPublished + "}"; + } + + 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; + } + + @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; + } + + public UpsertSchemaDto build() { + return new UpsertSchemaDto( + properties, + scripts, + fieldsInReferences, + fieldsInLists, + fields, + previewUrls, + fieldRules, + category, + isPublished); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java b/src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java new file mode 100644 index 0000000..287f91b --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpsertSchemaFieldDto.java @@ -0,0 +1,311 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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; + } + + @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); + } + + 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); + } + + @Override + public int hashCode() { + return Objects.hash( + this.name, + this.isHidden, + this.isLocked, + this.isDisabled, + this.partitioning, + this.properties, + this.nested); + } + + @Override + public String toString() { + return "UpsertSchemaFieldDto{" + "name: " + name + ", isHidden: " + isHidden + ", isLocked: " + isLocked + + ", isDisabled: " + isDisabled + ", partitioning: " + partitioning + ", properties: " + properties + + ", nested: " + nested + "}"; + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + PropertiesStage name(String name); + + Builder from(UpsertSchemaFieldDto other); + } + + public interface PropertiesStage { + _FinalStage properties(FieldPropertiesDto properties); + } + + 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); + } + + @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; + } + + /** + *

The name of the field. Must be unique within the schema. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java b/src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java new file mode 100644 index 0000000..f1e50f5 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UpsertSchemaNestedFieldDto.java @@ -0,0 +1,228 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @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; + } + + @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 "UpsertSchemaNestedFieldDto{" + "name: " + name + ", isHidden: " + isHidden + ", isLocked: " + isLocked + + ", isDisabled: " + isDisabled + ", properties: " + properties + "}"; + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + PropertiesStage name(String name); + + Builder from(UpsertSchemaNestedFieldDto other); + } + + public interface PropertiesStage { + _FinalStage properties(FieldPropertiesDto properties); + } + + 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); + } + + @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. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @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; + } + + @Override + @JsonSetter(value = "isHidden", nulls = Nulls.SKIP) + public _FinalStage isHidden(Optional isHidden) { + this.isHidden = isHidden; + return this; + } + + @Override + public UpsertSchemaNestedFieldDto build() { + return new UpsertSchemaNestedFieldDto(name, isHidden, isLocked, isDisabled, properties); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java b/src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java new file mode 100644 index 0000000..f6a5e26 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UsageRuleTriggerDto.java @@ -0,0 +1,126 @@ +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 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); + } + + @Override + public int hashCode() { + return Objects.hash(this.limit, this.numDays); + } + + @Override + public String toString() { + return "UsageRuleTriggerDto{" + "limit: " + limit + ", numDays: " + numDays + "}"; + } + + public static LimitStage builder() { + return new Builder(); + } + + public interface LimitStage { + _FinalStage limit(int limit); + + Builder from(UsageRuleTriggerDto other); + } + + public interface _FinalStage { + UsageRuleTriggerDto build(); + + _FinalStage numDays(Optional numDays); + + _FinalStage numDays(Integer numDays); + } + + @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; + } + + /** + *

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; + } + + /** + *

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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UserDto.java b/src/main/java/com/squidex/api/types/UserDto.java new file mode 100644 index 0000000..6fa8995 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UserDto.java @@ -0,0 +1,290 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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 "UserDto{" + "links: " + links + ", id: " + id + ", email: " + email + ", displayName: " + displayName + + ", isLocked: " + isLocked + ", permissions: " + permissions + "}"; + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + EmailStage id(String id); + + Builder from(UserDto other); + } + + public interface EmailStage { + DisplayNameStage email(String email); + } + + public interface DisplayNameStage { + IsLockedStage displayName(String displayName); + } + + public interface IsLockedStage { + _FinalStage isLocked(boolean isLocked); + } + + 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); + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UserProperty.java b/src/main/java/com/squidex/api/types/UserProperty.java new file mode 100644 index 0000000..b04b629 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UserProperty.java @@ -0,0 +1,118 @@ +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 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; + } + + /** + * @return <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return <span style="white-space: nowrap">non-empty</span> + */ + @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 "UserProperty{" + "name: " + name + ", value: " + value + "}"; + } + + public static NameStage builder() { + return new Builder(); + } + + public interface NameStage { + ValueStage name(String name); + + Builder from(UserProperty other); + } + + public interface ValueStage { + _FinalStage value(String value); + } + + public interface _FinalStage { + UserProperty build(); + } + + @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; + } + + /** + *

<span style="white-space: nowrap">non-empty</span>

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

<span style="white-space: nowrap">non-empty</span>

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @Override + @JsonSetter("value") + public _FinalStage value(String value) { + this.value = value; + return this; + } + + @Override + public UserProperty build() { + return new UserProperty(name, value); + } + } +} diff --git a/src/main/java/com/squidex/api/types/UsersDto.java b/src/main/java/com/squidex/api/types/UsersDto.java new file mode 100644 index 0000000..4401ed7 --- /dev/null +++ b/src/main/java/com/squidex/api/types/UsersDto.java @@ -0,0 +1,191 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + } + + /** + * @return The users. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UsersDto && equalTo((UsersDto) other); + } + + private boolean equalTo(UsersDto other) { + return links.equals(other.links) && total == other.total && items.equals(other.items); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.total, this.items); + } + + @Override + public String toString() { + return "UsersDto{" + "links: " + links + ", total: " + total + ", items: " + items + "}"; + } + + public static TotalStage builder() { + return new Builder(); + } + + 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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/WebhookMethod.java b/src/main/java/com/squidex/api/types/WebhookMethod.java new file mode 100644 index 0000000..6fe9654 --- /dev/null +++ b/src/main/java/com/squidex/api/types/WebhookMethod.java @@ -0,0 +1,27 @@ +package com.squidex.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum WebhookMethod { + POST("POST"), + + PUT("PUT"), + + GET("GET"), + + DELETE("DELETE"), + + PATCH("PATCH"); + + private final String value; + + WebhookMethod(String value) { + this.value = value; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/squidex/api/types/WebhookRuleActionDto.java b/src/main/java/com/squidex/api/types/WebhookRuleActionDto.java new file mode 100644 index 0000000..5c3e45c --- /dev/null +++ b/src/main/java/com/squidex/api/types/WebhookRuleActionDto.java @@ -0,0 +1,265 @@ +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 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. <span style="white-space: nowrap">non-empty</span> + */ + @JsonProperty("url") + public String getUrl() { + return url; + } + + @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); + } + + @Override + public String toString() { + return "WebhookRuleActionDto{" + "url: " + url + ", method: " + method + ", payload: " + payload + + ", payloadType: " + payloadType + ", headers: " + headers + ", sharedSecret: " + sharedSecret + "}"; + } + + public static UrlStage builder() { + return new Builder(); + } + + public interface UrlStage { + MethodStage url(String url); + + Builder from(WebhookRuleActionDto other); + } + + public interface MethodStage { + _FinalStage method(WebhookMethod method); + } + + 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); + } + + @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; + } + + /** + *

The url to the webhook. <span style="white-space: nowrap">non-empty</span>

+ * @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; + } + + @Override + @JsonSetter("method") + public _FinalStage method(WebhookMethod method) { + this.method = method; + return this; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/WorkflowDto.java b/src/main/java/com/squidex/api/types/WorkflowDto.java new file mode 100644 index 0000000..7e7ce28 --- /dev/null +++ b/src/main/java/com/squidex/api/types/WorkflowDto.java @@ -0,0 +1,302 @@ +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 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 = 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; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowDto && equalTo((WorkflowDto) other); + } + + 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); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.id, this.name, this.steps, this.schemaIds, this.initial); + } + + @Override + public String toString() { + return "WorkflowDto{" + "links: " + links + ", id: " + id + ", name: " + name + ", steps: " + steps + + ", schemaIds: " + schemaIds + ", initial: " + initial + "}"; + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + InitialStage id(String id); + + Builder from(WorkflowDto other); + } + + public interface InitialStage { + _FinalStage initial(String initial); + } + + 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); + } + + @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; + } + + /** + *

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; + } + + /** + *

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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/WorkflowStepDto.java b/src/main/java/com/squidex/api/types/WorkflowStepDto.java new file mode 100644 index 0000000..5e2938d --- /dev/null +++ b/src/main/java/com/squidex/api/types/WorkflowStepDto.java @@ -0,0 +1,225 @@ +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 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; + } + + /** + * @return True if the content should be validated when moving to this step. + */ + @JsonProperty("validate") + public Optional getValidate() { + return validate; + } + + /** + * @return Indicates if updates should not be allowed. + */ + @JsonProperty("noUpdate") + public Optional getNoUpdate() { + return noUpdate; + } + + /** + * @return Optional expression that must evaluate to true when you want to prevent updates. + */ + @JsonProperty("noUpdateExpression") + public Optional getNoUpdateExpression() { + return noUpdateExpression; + } + + /** + * @return Optional list of roles to restrict the updates for users with these roles. + */ + @JsonProperty("noUpdateRoles") + public Optional> getNoUpdateRoles() { + return noUpdateRoles; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowStepDto && equalTo((WorkflowStepDto) other); + } + + 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); + } + + @Override + public String toString() { + return "WorkflowStepDto{" + "transitions: " + transitions + ", color: " + color + ", validate: " + validate + + ", noUpdate: " + noUpdate + ", noUpdateExpression: " + noUpdateExpression + ", noUpdateRoles: " + + noUpdateRoles + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/WorkflowTransitionDto.java b/src/main/java/com/squidex/api/types/WorkflowTransitionDto.java new file mode 100644 index 0000000..c0ea314 --- /dev/null +++ b/src/main/java/com/squidex/api/types/WorkflowTransitionDto.java @@ -0,0 +1,105 @@ +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 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; + + private final Optional> roles; + + private WorkflowTransitionDto(Optional expression, Optional> roles) { + this.expression = expression; + this.roles = roles; + } + + /** + * @return The optional expression. + */ + @JsonProperty("expression") + public Optional getExpression() { + return expression; + } + + /** + * @return The optional restricted role. + */ + @JsonProperty("roles") + public Optional> getRoles() { + return roles; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowTransitionDto && equalTo((WorkflowTransitionDto) other); + } + + private boolean equalTo(WorkflowTransitionDto other) { + return expression.equals(other.expression) && roles.equals(other.roles); + } + + @Override + public int hashCode() { + return Objects.hash(this.expression, this.roles); + } + + @Override + public String toString() { + return "WorkflowTransitionDto{" + "expression: " + expression + ", roles: " + roles + "}"; + } + + 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; + } + + @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); + } + } +} diff --git a/src/main/java/com/squidex/api/types/WorkflowsDto.java b/src/main/java/com/squidex/api/types/WorkflowsDto.java new file mode 100644 index 0000000..ea4a055 --- /dev/null +++ b/src/main/java/com/squidex/api/types/WorkflowsDto.java @@ -0,0 +1,151 @@ +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 java.util.ArrayList; +import java.util.LinkedHashMap; +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; + + private final List items; + + private final List errors; + + private WorkflowsDto(Map links, List items, List errors) { + this.links = links; + this.items = items; + this.errors = errors; + } + + /** + * @return The links. + */ + @JsonProperty("_links") + @Override + public Map getLinks() { + return links; + } + + /** + * @return The workflow. + */ + @JsonProperty("items") + public List getItems() { + return items; + } + + /** + * @return The errros that should be fixed. + */ + @JsonProperty("errors") + public List getErrors() { + return errors; + } + + @Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof WorkflowsDto && equalTo((WorkflowsDto) other); + } + + private boolean equalTo(WorkflowsDto other) { + return links.equals(other.links) && items.equals(other.items) && errors.equals(other.errors); + } + + @Override + public int hashCode() { + return Objects.hash(this.links, this.items, this.errors); + } + + @Override + public String toString() { + return "WorkflowsDto{" + "links: " + links + ", items: " + items + ", errors: " + errors + "}"; + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Map links = new LinkedHashMap<>(); + + private List items = new ArrayList<>(); + + private List errors = new ArrayList<>(); + + private Builder() {} + + public Builder from(WorkflowsDto other) { + links(other.getLinks()); + items(other.getItems()); + errors(other.getErrors()); + return this; + } + + @JsonSetter(value = "_links", nulls = Nulls.SKIP) + public Builder links(Map links) { + this.links.clear(); + this.links.putAll(links); + return this; + } + + public Builder putAllLinks(Map links) { + this.links.putAll(links); + return this; + } + + public Builder links(String key, ResourceLink value) { + this.links.put(key, value); + return this; + } + + @JsonSetter(value = "items", nulls = Nulls.SKIP) + public Builder items(List items) { + this.items.clear(); + this.items.addAll(items); + return this; + } + + public Builder addItems(WorkflowDto items) { + this.items.add(items); + return this; + } + + public Builder addAllItems(List items) { + this.items.addAll(items); + return this; + } + + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(List errors) { + this.errors.clear(); + this.errors.addAll(errors); + return this; + } + + public Builder addErrors(String errors) { + this.errors.add(errors); + return this; + } + + public Builder addAllErrors(List errors) { + this.errors.addAll(errors); + return this; + } + + public WorkflowsDto build() { + return new WorkflowsDto(links, items, errors); + } + } +}