├── .buildscript ├── codecov.sh ├── deploy_snapshot.sh └── settings.xml ├── .codecov.yml ├── .github └── CODEOWNERS ├── .gitignore ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .travis.yml ├── CHANGELOG.md ├── LICENSE.txt ├── README.md ├── assets └── feature_graphic.png ├── catalog-info.yaml ├── checkstyle.xml ├── jitpack.yml ├── mvnw ├── mvnw.cmd ├── pom.xml └── src ├── main ├── java │ └── com │ │ └── contentful │ │ └── java │ │ └── cma │ │ ├── AbsModule.java │ │ ├── CMACallback.java │ │ ├── CMAClient.java │ │ ├── Constants.java │ │ ├── DefaultQueryParameter.java │ │ ├── Logger.java │ │ ├── ModuleApiKeys.java │ │ ├── ModuleAssets.java │ │ ├── ModuleBulkActions.java │ │ ├── ModuleContentTypes.java │ │ ├── ModuleEditorInterfaces.java │ │ ├── ModuleEntries.java │ │ ├── ModuleEnvironments.java │ │ ├── ModuleLocales.java │ │ ├── ModuleOrganizationUsage.java │ │ ├── ModuleOrganizations.java │ │ ├── ModulePersonalAccessTokens.java │ │ ├── ModulePreviewApiKeys.java │ │ ├── ModuleRoles.java │ │ ├── ModuleScheduledActions.java │ │ ├── ModuleSpaceMemberships.java │ │ ├── ModuleSpaceUsage.java │ │ ├── ModuleSpaces.java │ │ ├── ModuleTags.java │ │ ├── ModuleTaxonomy.java │ │ ├── ModuleUiExtensions.java │ │ ├── ModuleUploads.java │ │ ├── ModuleUsers.java │ │ ├── ModuleWebhooks.java │ │ ├── Platform.java │ │ ├── RxExtensions.java │ │ ├── ServiceApiKeys.java │ │ ├── ServiceAssets.java │ │ ├── ServiceBulkActions.java │ │ ├── ServiceContentTags.java │ │ ├── ServiceContentTypes.java │ │ ├── ServiceEditorInterfaces.java │ │ ├── ServiceEntries.java │ │ ├── ServiceEnvironments.java │ │ ├── ServiceLocales.java │ │ ├── ServiceOrganizationUsage.java │ │ ├── ServiceOrganizations.java │ │ ├── ServicePersonalAccessTokens.java │ │ ├── ServicePreviewApiKeys.java │ │ ├── ServiceRoles.java │ │ ├── ServiceScheduledActions.java │ │ ├── ServiceSpaceMemberships.java │ │ ├── ServiceSpaceUsage.java │ │ ├── ServiceSpaces.java │ │ ├── ServiceTaxonomy.java │ │ ├── ServiceUiExtensions.java │ │ ├── ServiceUploads.java │ │ ├── ServiceUsers.java │ │ ├── ServiceWebhooks.java │ │ ├── SynchronousExecutor.java │ │ ├── gson │ │ ├── CMASystemDeserializer.java │ │ ├── EntrySerializer.java │ │ ├── FieldTypeAdapter.java │ │ ├── LocaleSerializer.java │ │ ├── MetadataSerializer.java │ │ ├── SnapshotDeserializer.java │ │ └── WebHookBodyDeserializer.java │ │ ├── interceptor │ │ ├── AuthorizationHeaderInterceptor.java │ │ ├── ContentTypeInterceptor.java │ │ ├── ContentfulUserAgentHeaderInterceptor.java │ │ ├── ErrorInterceptor.java │ │ ├── HeaderInterceptor.java │ │ ├── LogInterceptor.java │ │ ├── RateLimitInterceptor.java │ │ ├── RateLimitsListener.java │ │ └── UserAgentHeaderInterceptor.java │ │ └── model │ │ ├── CMAApiKey.java │ │ ├── CMAArray.java │ │ ├── CMAAsset.java │ │ ├── CMAAssetFile.java │ │ ├── CMABulkAction.java │ │ ├── CMABulkStatus.java │ │ ├── CMAConcept.java │ │ ├── CMAConceptScheme.java │ │ ├── CMAConstraint.java │ │ ├── CMAContentType.java │ │ ├── CMAEditorInterface.java │ │ ├── CMAEntities.java │ │ ├── CMAEntry.java │ │ ├── CMAEnvironment.java │ │ ├── CMAEnvironmentStatus.java │ │ ├── CMAError.java │ │ ├── CMAField.java │ │ ├── CMAHttpException.java │ │ ├── CMALink.java │ │ ├── CMALocale.java │ │ ├── CMAMetadata.java │ │ ├── CMANotWithEnvironmentsException.java │ │ ├── CMAOrganization.java │ │ ├── CMAPages.java │ │ ├── CMAPayload.java │ │ ├── CMAPermissions.java │ │ ├── CMAPersonalAccessToken.java │ │ ├── CMAPolicy.java │ │ ├── CMAPreviewApiKey.java │ │ ├── CMAResource.java │ │ ├── CMARole.java │ │ ├── CMAScheduledAction.java │ │ ├── CMAScheduledActionStatus.java │ │ ├── CMAScheduledFor.java │ │ ├── CMASnapshot.java │ │ ├── CMASpace.java │ │ ├── CMASpaceMembership.java │ │ ├── CMASystem.java │ │ ├── CMATag.java │ │ ├── CMATotalConcepts.java │ │ ├── CMAType.java │ │ ├── CMAUiExtension.java │ │ ├── CMAUiExtensionParameter.java │ │ ├── CMAUiExtensionParameterType.java │ │ ├── CMAUiExtensionParameters.java │ │ ├── CMAUpload.java │ │ ├── CMAUsage.java │ │ ├── CMAUser.java │ │ ├── CMAVisibility.java │ │ ├── CMAWebhook.java │ │ ├── CMAWebhookCall.java │ │ ├── CMAWebhookCallDetail.java │ │ ├── CMAWebhookHeader.java │ │ ├── CMAWebhookHealth.java │ │ ├── CMAWebhookRequest.java │ │ ├── CMAWebhookResponse.java │ │ ├── CMAWebhookTopic.java │ │ ├── CMAWebhookTransformation.java │ │ ├── RateLimits.java │ │ └── rich │ │ ├── CMARichBlock.java │ │ ├── CMARichDocument.java │ │ ├── CMARichEmbeddedLink.java │ │ ├── CMARichHeading.java │ │ ├── CMARichHorizontalRule.java │ │ ├── CMARichHyperLink.java │ │ ├── CMARichListItem.java │ │ ├── CMARichMark.java │ │ ├── CMARichNode.java │ │ ├── CMARichOrderedList.java │ │ ├── CMARichParagraph.java │ │ ├── CMARichQuote.java │ │ ├── CMARichTable.java │ │ ├── CMARichTableCell.java │ │ ├── CMARichTableHeaderCell.java │ │ ├── CMARichTableRow.java │ │ ├── CMARichText.java │ │ ├── CMARichUnorderedList.java │ │ └── RichTextFactory.java └── resources │ └── com │ └── contentful │ └── java │ └── cma │ └── build │ └── GeneratedBuildParameters.java └── test ├── bash ├── __rerun_all.sh ├── apikeys_create.sh ├── apikeys_get_all.sh ├── apikeys_get_one.sh ├── apikeys_update.sh ├── asset_create_in_environment.sh ├── asset_create_with_upload.sh ├── asset_delete_from_environment.sh ├── asset_fetch_all_from_environment.sh ├── asset_fetch_all_from_environment_with_query.sh ├── asset_fetch_one_from_environment.sh ├── asset_process_and_poll.sh ├── content_type_create_in_environment.sh ├── content_type_create_localized.sh ├── content_type_delete_from_environment.sh ├── content_type_error_field_type_invalid.sh ├── content_type_fetch_all_from_environment.sh ├── content_type_fetch_one_from_environment.sh ├── content_type_snapshots_get_all.sh ├── content_type_snapshots_get_one.sh ├── editor_interfaces_get.sh ├── editor_interfaces_get_from_environment.sh ├── editor_interfaces_update.sh ├── editor_interfaces_update_in_environment.sh ├── entry_create_error_array_type_value.sh ├── entry_create_in_environment.sh ├── entry_delete_from_environment.sh ├── entry_fetch_all_from_environment.sh ├── entry_fetch_all_from_environment_with_query.sh ├── entry_fetch_one_from_environment.sh ├── entry_snapshots_get_all.sh ├── entry_snapshots_get_one.sh ├── environments_create.sh ├── environments_create_from_id.sh ├── environments_create_with_id.sh ├── environments_delete.sh ├── environments_get_all.sh ├── environments_get_all_entries.sh ├── environments_get_one.sh ├── environments_update.sh ├── locales_create.sh ├── locales_create_in_environment.sh ├── locales_delete.sh ├── locales_get_all.sh ├── locales_get_all_form_environment.sh ├── locales_get_all_form_environment_with_query.sh ├── locales_get_one.sh ├── locales_get_one_form_environment.sh ├── locales_update.sh ├── organizations_get_all.sh ├── personal_access_token_create.sh ├── personal_access_token_create_error.sh ├── personal_access_token_get_all.sh ├── personal_access_token_get_one.sh ├── personal_access_token_revoke.sh ├── preview_apikeys_get_all.sh ├── preview_apikeys_get_one.sh ├── rich_text_create_one.sh ├── rich_text_get_all.sh ├── rich_text_get_one.sh ├── rich_text_update_one.sh ├── roles_create.sh ├── roles_delete.sh ├── roles_get_all.sh ├── roles_get_one.sh ├── roles_update.sh ├── space_membership_create_membership.sh ├── space_membership_delete_one_membership.sh ├── space_membership_get_all_memberships.sh ├── space_membership_get_one_membership.sh ├── space_membership_update_membership.sh ├── ui_extensions_create_parameters.sh ├── ui_extensions_create_with_html_data.sh ├── ui_extensions_create_with_url.sh ├── ui_extensions_delete.sh ├── ui_extensions_get_all.sh ├── ui_extensions_get_one.sh ├── ui_extensions_update.sh ├── upload_delete.sh ├── upload_fetch.sh ├── upload_upload.sh ├── users_get_me.sh ├── webhook_create.sh ├── webhook_delete.sh ├── webhook_get_all.sh ├── webhook_get_one.sh └── webhook_update.sh ├── kotlin └── com │ └── contentful │ └── java │ └── cma │ ├── ApiKeysTests.kt │ ├── AssetTests.kt │ ├── BaseTest.kt │ ├── BulkActionsTests.kt │ ├── CMAHttpExceptionTest.kt │ ├── ClientTests.kt │ ├── ContentTagsTests.kt │ ├── ContentTypeTests.kt │ ├── DefaultQueryParameterTests.kt │ ├── EditorInterfacesTests.kt │ ├── EntryTests.kt │ ├── EnvironmentsTests.kt │ ├── GeneralTests.kt │ ├── LinkTests.kt │ ├── LocalesTests.kt │ ├── ModelTests.kt │ ├── ModuleTests.kt │ ├── OrganizationTests.kt │ ├── PersonalAccessTokenTests.kt │ ├── PreviewApiKeysTests.kt │ ├── RichFieldTests.kt │ ├── RolesTests.kt │ ├── ScheduledActionsTests.kt │ ├── SpaceMembershipTests.kt │ ├── SpaceTests.kt │ ├── TaxonomyTests.kt │ ├── UiExtensionsTests.kt │ ├── UploadTests.kt │ ├── UsageTest.kt │ ├── UsersTests.kt │ ├── WebhookTests.kt │ ├── e2e │ ├── AccessTokensE2E.kt │ ├── ApiKeysE2E.kt │ ├── AssetsE2E.kt │ ├── Base.kt │ ├── ContentTypesE2E.kt │ ├── EntryE2E.kt │ ├── EnvironmentsE2E.kt │ ├── LocalesE2E.kt │ ├── PreviewApiKeysE2E.kt │ ├── RichTextE2E.kt │ ├── RolesE2E.kt │ ├── SpaceMembershipsE2E.kt │ ├── SpacesE2E.kt │ └── WebhookE2E.kt │ ├── interceptor │ └── RateLimitsTests.kt │ ├── lib │ ├── TestCallback.kt │ └── TestUtils.kt │ └── model │ ├── AssetModelTest.kt │ └── Extensions.kt └── resources ├── apikeys_create.json ├── apikeys_get_all.json ├── apikeys_get_one.json ├── apikeys_update.json ├── asset_archive_response.json ├── asset_create_in_environment.json ├── asset_create_request.json ├── asset_create_response.json ├── asset_create_with_upload_id_response.json ├── asset_delete_from_environment.json ├── asset_fetch_all_from_environment.json ├── asset_fetch_all_from_environment_with_query.json ├── asset_fetch_all_response.json ├── asset_fetch_one_from_environment.json ├── asset_publish_response.json ├── asset_update_request.json ├── bulk_actions_response.json ├── content_tags_delete.json ├── content_tags_one_response.json ├── content_tags_response.json ├── content_type_create_in_environment.json ├── content_type_create_localized.json ├── content_type_create_localized_payload.json ├── content_type_create_request.json ├── content_type_create_response.json ├── content_type_create_with_link.json ├── content_type_delete_from_environment.json ├── content_type_error_field_type_invalid.json ├── content_type_fetch_all_from_environment.json ├── content_type_fetch_all_response.json ├── content_type_fetch_one_from_environment.json ├── content_type_fetch_one_response.json ├── content_type_publish_response.json ├── content_type_snapshots_get_all.json ├── content_type_snapshots_get_one.json ├── content_type_unpublish_response.json ├── content_type_update_object.json ├── content_type_update_request.json ├── content_type_update_response.json ├── editor_interfaces_get.json ├── editor_interfaces_get_from_environment.json ├── editor_interfaces_update.json ├── editor_interfaces_update_in_environment.json ├── editor_interfaces_update_payload.json ├── entry_archive_response.json ├── entry_create_error_array_type_value.json ├── entry_create_in_environment.json ├── entry_create_links_request.json ├── entry_create_metadata_request.json ├── entry_create_metadata_response.json ├── entry_create_request.json ├── entry_create_response.json ├── entry_delete_from_environment.json ├── entry_fetch_all_from_environment.json ├── entry_fetch_all_from_environment_with_query.json ├── entry_fetch_all_response.json ├── entry_fetch_one_from_environment.json ├── entry_fetch_one_response.json ├── entry_snapshots_get_all.json ├── entry_snapshots_get_all_with_query.json ├── entry_snapshots_get_one.json ├── entry_update_request.json ├── entry_update_response.json ├── entry_with_list_object.json ├── environments_create.json ├── environments_create_from_id.json ├── environments_create_with_id.json ├── environments_delete.json ├── environments_get_all.json ├── environments_get_all_entries.json ├── environments_get_one.json ├── environments_update.json ├── error_invalid_json.json ├── error_post_wrong_data.json ├── error_unknown_path.json ├── error_wrong_field.json ├── error_wrong_type.json ├── error_wrong_type_for_date.json ├── error_wrong_type_for_limit.json ├── field_object.json ├── locales_create.json ├── locales_create_in_environment.json ├── locales_create_payload.json ├── locales_delete.json ├── locales_get_all.json ├── locales_get_all_form_environment.json ├── locales_get_all_form_environment_with_query.json ├── locales_get_one.json ├── locales_get_one_form_environment.json ├── locales_update.json ├── locales_update_payload.json ├── organization_space_get_all.json ├── organizations_get_all.json ├── organizations_usage_get_all.json ├── personal_access_token_create.json ├── personal_access_token_create_error.json ├── personal_access_token_get_all.json ├── personal_access_token_get_one.json ├── personal_access_token_revoke.json ├── preview_apikeys_get_all.json ├── preview_apikeys_get_one.json ├── rich_text_create_one.json ├── rich_text_create_one_payload.json ├── rich_text_get_all.json ├── rich_text_get_one.json ├── rich_text_update_one.json ├── rich_text_update_one_payload.json ├── roles_create.json ├── roles_create_payload.json ├── roles_delete.json ├── roles_get_all.json ├── roles_get_one.json ├── roles_update.json ├── roles_update_payload.json ├── scheduled_action_cancel_response.json ├── scheduled_action_create_response.json ├── scheduled_action_fetch_response.json ├── scheduled_action_update_response.json ├── space_create_request.json ├── space_create_response.json ├── space_create_with_locale_request.json ├── space_create_with_locale_response.json ├── space_fetch_all_response.json ├── space_fetch_locales_response.json ├── space_fetch_one_response.json ├── space_memberships_create.json ├── space_memberships_delete_one.json ├── space_memberships_fetch_all.json ├── space_memberships_fetch_one.json ├── space_memberships_no_admin_needs_roles.json ├── space_memberships_update.json ├── space_update_object.json ├── space_update_request.json ├── space_update_response.json ├── taxonomy_concept_scheme_get_all_response.json ├── taxonomy_concept_scheme_get_one_response.json ├── taxonomy_concepts_create_one_response.json ├── taxonomy_concepts_get_all_response.json ├── taxonomy_concepts_get_one_response.json ├── ui_extensions_create_with_html_data.json ├── ui_extensions_create_with_html_data_payload.json ├── ui_extensions_create_with_parameters.json ├── ui_extensions_create_with_url.json ├── ui_extensions_create_with_url_payload.json ├── ui_extensions_delete.json ├── ui_extensions_get_all.json ├── ui_extensions_get_one.json ├── ui_extensions_update.json ├── ui_extensions_update_payload.json ├── upload_get_upload_with_id.json ├── upload_post_payload.jpg ├── upload_post_payload_bigger.jpg ├── upload_post_response.json ├── upload_welcome_response.json ├── users_get_me.json ├── webhook_calls_detail_response.json ├── webhook_calls_overview_response.json ├── webhook_create.json ├── webhook_create_request.json ├── webhook_create_with_id_request.json ├── webhook_create_with_id_response.json ├── webhook_delete.json ├── webhook_get_all.json ├── webhook_get_one.json ├── webhook_health_response.json ├── webhook_update.json └── webhook_update_request.json /.buildscript/deploy_snapshot.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Deploy a jar, source jar, and javadoc jar to Sonatype's snapshot repo. 4 | # 5 | # Adapted from https://coderwall.com/p/9b_lfq and 6 | # http://benlimmer.com/2013/12/26/automatically-publish-javadoc-to-gh-pages-with-travis-ci/ 7 | 8 | SLUG="contentful/contentful-management.java" 9 | JDK="oraclejdk8" 10 | BRANCH="master" 11 | 12 | set -e 13 | 14 | if [ "$TRAVIS_REPO_SLUG" != "$SLUG" ]; then 15 | echo "Skipping snapshot deployment: wrong repository. Expected '$SLUG' but was '$TRAVIS_REPO_SLUG'." 16 | elif [ "$TRAVIS_JDK_VERSION" != "$JDK" ]; then 17 | echo "Skipping snapshot deployment: wrong JDK. Expected '$JDK' but was '$TRAVIS_JDK_VERSION'." 18 | elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then 19 | echo "Skipping snapshot deployment: was pull request." 20 | elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then 21 | echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'." 22 | else 23 | echo "Deploying snapshot to maven ..." 24 | mvn clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -Dmaven.test.skip=true 25 | echo "Snapshot deployed to maven!" 26 | fi 27 | 28 | echo "Deploying snapshot to jitpack ..." 29 | curl --verbose --location "https://jitpack.io/com/github/contentful/contentful-management.java/${TRAVIS_BRANCH}-SNAPSHOT/" 30 | echo "Snapshot deployed to jitpack!" 31 | -------------------------------------------------------------------------------- /.buildscript/settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | sonatype-nexus-snapshots 5 | ${env.CI_DEPLOY_USERNAME} 6 | ${env.CI_DEPLOY_PASSWORD} 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "src/main/resources/com/contentful/java/cma/build/GeneratedBuildParameters.java" # ignore build resource folders 3 | - "*Test*" # ignore all end to tests 4 | - "*E2E*" # ignore all end to end tests 5 | 6 | coverage: 7 | precision: 1 8 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @contentful/team-tundra @contentful/team-developer-experience 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | *.iml 3 | target/ 4 | .classpath 5 | .project 6 | .settings/ 7 | .DS_Store 8 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.0/apache-maven-3.5.0-bin.zip -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | dist: trusty 3 | group: edge 4 | 5 | language: java 6 | 7 | jdk: 8 | - oraclejdk8 9 | - openjdk8 10 | 11 | script: 12 | - mvn jacoco:prepare-agent test jacoco:report 13 | 14 | after_success: 15 | - .buildscript/codecov.sh 16 | - .buildscript/deploy_snapshot.sh 17 | 18 | env: 19 | global: 20 | - secure: DYRkN0jWwDLFk6b5Vb86SPFngrR5OXC5WfR09TY7t2bgMUXnNo+8jAL/k3vNjYhc150iuV+4KVy70I5bFetaHp5PaW+lE6fKL7ipScbkQX/kR8ECKqdPjMZNg4b2B4dBRv527S8QvVy3zqnHpext75IZK3rp1eVUBO/DSWLq1JA= 21 | - secure: OSVseZDWe2u0llDwkIUX2wXWgq48Sfd0uxB6m0LLo/gz79EW8D43czzDhlFA8CRYt/WBYXFUKqaPP6yO09Vz5oLjBPeNq91wlV+I9Gj9RTJ5KfhTRb3K1rJkjoPmQMm2R1NzanxvSHMhogJIwwLpVK+RJ6gtWiB7Xf1vZnjdpIc= 22 | 23 | branches: 24 | except: 25 | - gh-pages 26 | 27 | notifications: 28 | slack: 29 | - secure: JlFWDMtaUhwF8i+jgWdgdmhw4VE7OvIcq1ugkqF2ti4iLkOMhQm2/I0GjwkJdNsLPiA81Z/hJsKVQ478tR22isEKX5WhQLvrP3Fjb5cCWqBmk/sCaUrAlCQDd03QYS3A9EoRwIcGU0WjFQLANY3lRnDzcpGeoaj8+zJtuOzMc00= 30 | -------------------------------------------------------------------------------- /assets/feature_graphic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/assets/feature_graphic.png -------------------------------------------------------------------------------- /catalog-info.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: backstage.io/v1alpha1 2 | kind: Component 3 | metadata: 4 | name: contentful-management.java 5 | description: Java SDK for Content Management API. It helps in editing and creating content stored in Contentful with Java applications. 6 | annotations: 7 | github.com/project-slug: contentful/contentful-management.java 8 | contentful.com/service-tier: "4" 9 | tags: 10 | - tier-4 11 | spec: 12 | type: library 13 | lifecycle: production 14 | owner: group:team-developer-experience 15 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - oraclejdk8 3 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/DefaultQueryParameter.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * Internal class for storing default http query parameter. 8 | */ 9 | class DefaultQueryParameter { 10 | 11 | /** 12 | * Use these parameter for every fetch, unless overwritten by user. 13 | *

14 | * Right now set the limit to 100. 15 | */ 16 | static final HashMap FETCH = new HashMap(); 17 | 18 | static { 19 | FETCH.put("limit", "100"); 20 | } 21 | 22 | /** 23 | * Do not initiate this class. Its only used in static contexts. 24 | * 25 | * @throws UnsupportedOperationException since it should not be used. 26 | */ 27 | private DefaultQueryParameter() { 28 | throw new UnsupportedOperationException("Do not create instance from this class!"); 29 | } 30 | 31 | /** 32 | * Update a given map with some default values if not already present in map. 33 | * 34 | * @param target the map to be filled with values, if a key for them is not set already. 35 | * @param defaults the list of defaults, to be set. 36 | * @return the same map if no change had to be made, a new map otherwise. 37 | */ 38 | static Map putIfNotSet(Map target, Map defaults) { 39 | boolean needsChange = defaults.keySet().stream().anyMatch(key -> !target.containsKey(key)); 40 | if (needsChange) { 41 | Map copy = new HashMap<>(target); 42 | for (final String key : defaults.keySet()) { 43 | if (!copy.containsKey(key)) { 44 | copy.put(key, defaults.get(key)); 45 | } 46 | } 47 | return copy; 48 | } 49 | return target; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/Logger.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma; 2 | 3 | /** 4 | * Custom logger interface, used for logging network traffic. 5 | */ 6 | public interface Logger { 7 | /** 8 | * Abstract method to be implemented by client. 9 | *

10 | * This method gets called, once there is something to log 11 | * 12 | * @param message to be delivered to the logger. 13 | */ 14 | void log(String message); 15 | 16 | /** 17 | * Determine the level of logging 18 | */ 19 | enum Level { 20 | /** 21 | * Do not log anything. 22 | */ 23 | NONE, 24 | 25 | /** 26 | * Do basic logging, not all requests will be logged. 27 | */ 28 | BASIC, 29 | 30 | /** 31 | * Log all requests. 32 | */ 33 | FULL 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/ServiceOrganizationUsage.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma; 2 | 3 | import com.contentful.java.cma.model.CMAArray; 4 | import com.contentful.java.cma.model.CMAUsage; 5 | import io.reactivex.Flowable; 6 | import retrofit2.http.GET; 7 | import retrofit2.http.Path; 8 | import retrofit2.http.QueryMap; 9 | 10 | import java.util.Map; 11 | 12 | public interface ServiceOrganizationUsage { 13 | 14 | @GET("organizations/{organization_id}/organization_periodic_usages") 15 | Flowable> fetchAll( 16 | @Path("organization_id") String organizationId 17 | ); 18 | 19 | @GET("organizations/{organization_id}/organization_periodic_usages") 20 | Flowable> fetchAll( 21 | @Path("organization_id") String organizationId, 22 | @QueryMap Map query 23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/ServiceOrganizations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Contentful GmbH 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.contentful.java.cma; 18 | 19 | import com.contentful.java.cma.model.CMAArray; 20 | import com.contentful.java.cma.model.CMAOrganization; 21 | 22 | import java.util.Map; 23 | 24 | import io.reactivex.Flowable; 25 | import retrofit2.http.GET; 26 | import retrofit2.http.QueryMap; 27 | 28 | /** 29 | * Organizations Service. 30 | */ 31 | interface ServiceOrganizations { 32 | @GET("organizations") 33 | Flowable> fetchAll(); 34 | 35 | @GET("organizations") 36 | Flowable> fetchAll(@QueryMap Map query); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/ServicePreviewApiKeys.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Contentful GmbH 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.contentful.java.cma; 18 | 19 | import com.contentful.java.cma.model.CMAArray; 20 | import com.contentful.java.cma.model.CMAPreviewApiKey; 21 | 22 | import io.reactivex.Flowable; 23 | import retrofit2.http.GET; 24 | import retrofit2.http.Path; 25 | 26 | /** 27 | * Preview Api Token Service. 28 | */ 29 | interface ServicePreviewApiKeys { 30 | @GET("spaces/{spaceId}/preview_api_keys") 31 | Flowable> fetchAll(@Path("spaceId") String spaceId); 32 | 33 | @GET("spaces/{spaceId}/preview_api_keys/{keyId}") 34 | Flowable fetchOne( 35 | @Path("spaceId") String spaceId, 36 | @Path("keyId") String keyId); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/ServiceRoles.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma; 2 | 3 | import com.contentful.java.cma.model.CMAArray; 4 | import com.contentful.java.cma.model.CMARole; 5 | 6 | import java.util.Map; 7 | 8 | import io.reactivex.Flowable; 9 | import retrofit2.Response; 10 | import retrofit2.http.Body; 11 | import retrofit2.http.DELETE; 12 | import retrofit2.http.GET; 13 | import retrofit2.http.Header; 14 | import retrofit2.http.POST; 15 | import retrofit2.http.PUT; 16 | import retrofit2.http.Path; 17 | import retrofit2.http.QueryMap; 18 | 19 | /** 20 | * Service class to define the REST interface to Contentful. 21 | */ 22 | public interface ServiceRoles { 23 | @GET("spaces/{spaceId}/roles") 24 | Flowable> fetchAll(@Path("spaceId") String spaceId); 25 | 26 | @GET("spaces/{spaceId}/roles") 27 | Flowable> fetchAll( 28 | @Path("spaceId") String spaceId, 29 | @QueryMap Map query 30 | ); 31 | 32 | @GET("spaces/{spaceId}/roles/{roleId}") 33 | Flowable fetchOne( 34 | @Path("spaceId") String spaceId, 35 | @Path("roleId") String roleId 36 | ); 37 | 38 | @POST("spaces/{spaceId}/roles/") 39 | Flowable create( 40 | @Path("spaceId") String spaceId, 41 | @Body CMARole role 42 | ); 43 | 44 | @PUT("spaces/{spaceId}/roles/{roleId}") 45 | Flowable update( 46 | @Path("spaceId") String spaceId, 47 | @Path("roleId") String roleId, 48 | @Body CMARole role, 49 | @Header("X-Contentful-Version") Integer version 50 | ); 51 | 52 | @DELETE("spaces/{spaceId}/roles/{roleId}") 53 | Flowable> delete( 54 | @Path("spaceId") String spaceId, 55 | @Path("roleId") String roleId 56 | ); 57 | } 58 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/ServiceSpaceUsage.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma; 2 | 3 | import com.contentful.java.cma.model.CMAArray; 4 | import com.contentful.java.cma.model.CMAUsage; 5 | import io.reactivex.Flowable; 6 | import retrofit2.http.GET; 7 | import retrofit2.http.Path; 8 | import retrofit2.http.QueryMap; 9 | 10 | import java.util.Map; 11 | 12 | public interface ServiceSpaceUsage { 13 | @GET("organizations/{organization_id}/space_periodic_usages") 14 | Flowable> fetchAll( 15 | @Path("organization_id") String organizationId 16 | ); 17 | 18 | @GET("organizations/{organization_id}/space_periodic_usages") 19 | Flowable> fetchAll( 20 | @Path("organization_id") String organizationId, 21 | @QueryMap Map query 22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/ServiceUsers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Contentful GmbH 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.contentful.java.cma; 18 | 19 | import com.contentful.java.cma.model.CMAUser; 20 | 21 | import io.reactivex.Flowable; 22 | import retrofit2.http.GET; 23 | 24 | /** 25 | * Users Service. 26 | */ 27 | interface ServiceUsers { 28 | @GET("users/me") 29 | Flowable fetchMe(); 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/SynchronousExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Contentful GmbH 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.contentful.java.cma; 18 | 19 | import java.util.concurrent.Executor; 20 | 21 | /** 22 | * SynchronousExecutor. 23 | */ 24 | class SynchronousExecutor implements Executor { 25 | @Override public void execute(Runnable runnable) { 26 | runnable.run(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/gson/LocaleSerializer.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.gson; 2 | 3 | import com.contentful.java.cma.model.CMALocale; 4 | import com.google.gson.JsonElement; 5 | import com.google.gson.JsonObject; 6 | import com.google.gson.JsonSerializationContext; 7 | import com.google.gson.JsonSerializer; 8 | 9 | import java.lang.reflect.Type; 10 | 11 | public class LocaleSerializer implements JsonSerializer { 12 | @Override 13 | public JsonElement serialize(CMALocale src, Type typeOfSrc, JsonSerializationContext context) { 14 | final JsonObject result = new JsonObject(); 15 | result.add("code", context.serialize(src.getCode())); 16 | result.add("name", context.serialize(src.getName())); 17 | result.add("fallbackCode", context.serialize(src.getFallbackCode())); 18 | result.add("contentManagementApi", context.serialize(src.isContentManagementApi())); 19 | result.add("contentDeliveryApi", context.serialize(src.isContentDeliveryApi())); 20 | return result; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/interceptor/AuthorizationHeaderInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.interceptor; 2 | 3 | /** 4 | * Interceptor to add authorization header to requests 5 | */ 6 | public class AuthorizationHeaderInterceptor extends HeaderInterceptor { 7 | public static final String HEADER_NAME = "Authorization"; 8 | 9 | /** 10 | * Create Header interceptor, saving parameters. 11 | * 12 | * @param token the access token to be used with *every* request. 13 | */ 14 | public AuthorizationHeaderInterceptor(String token) { 15 | super(HEADER_NAME, "Bearer " + token); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/interceptor/ErrorInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.interceptor; 2 | 3 | 4 | import com.contentful.java.cma.model.CMAHttpException; 5 | 6 | import java.io.IOException; 7 | 8 | import okhttp3.Interceptor; 9 | import okhttp3.Request; 10 | import okhttp3.Response; 11 | 12 | /** 13 | * This interceptor will only be used for throwing an exception, once the server returns an error. 14 | */ 15 | public class ErrorInterceptor implements Interceptor { 16 | private final boolean logSensitiveData; 17 | 18 | public ErrorInterceptor(boolean logSensitiveData) { 19 | this.logSensitiveData = logSensitiveData; 20 | } 21 | 22 | /** 23 | * Intercepts chain to check for unsuccessful requests. 24 | * 25 | * @param chain provided by the framework to check 26 | * @return the response if no error occurred 27 | * @throws IOException will get thrown if response code is unsuccessful 28 | */ 29 | @Override public Response intercept(Chain chain) throws IOException { 30 | final Request request = chain.request(); 31 | final Response response = chain.proceed(request); 32 | 33 | if (!response.isSuccessful()) { 34 | throw new CMAHttpException(request, response, logSensitiveData); 35 | } 36 | 37 | return response; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/interceptor/HeaderInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.interceptor; 2 | 3 | import java.io.IOException; 4 | 5 | import okhttp3.Interceptor; 6 | import okhttp3.Request; 7 | import okhttp3.Response; 8 | 9 | /** 10 | * This class adds custom headers to all requests it intercepts. 11 | */ 12 | public class HeaderInterceptor implements Interceptor { 13 | private final String name; 14 | private final String value; 15 | 16 | /** 17 | * Create an arbitrary header adding interceptor. 18 | * 19 | * @param name of the header to be used. 20 | * @param value value of the new header. 21 | */ 22 | public HeaderInterceptor(String name, String value) { 23 | this.name = name; 24 | this.value = value; 25 | } 26 | 27 | /** 28 | * Method called by framework, to enrich current request chain with requested header information. 29 | * 30 | * @param chain the execution chain for the request. 31 | * @return the response received. 32 | * @throws IOException in case of failure down the line. 33 | */ 34 | @Override public Response intercept(Chain chain) throws IOException { 35 | final Request request = chain.request(); 36 | 37 | return chain.proceed(request.newBuilder() 38 | .addHeader(name, value) 39 | .build()); 40 | } 41 | 42 | /** 43 | * @return the name of this header. 44 | */ 45 | public String getName() { 46 | return name; 47 | } 48 | 49 | /** 50 | * @return the value of this header. 51 | */ 52 | public String getValue() { 53 | return value; 54 | } 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/interceptor/RateLimitInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.interceptor; 2 | 3 | import com.contentful.java.cma.model.RateLimits; 4 | 5 | import java.io.IOException; 6 | import java.util.List; 7 | import java.util.Map; 8 | 9 | import okhttp3.Headers; 10 | import okhttp3.Interceptor; 11 | import okhttp3.Response; 12 | 13 | /** 14 | * Get informed when ever a rate limit header is encountered. 15 | */ 16 | public class RateLimitInterceptor implements Interceptor { 17 | 18 | final RateLimitsListener listener; 19 | 20 | /** 21 | * Create a new ratelimit interceptor. 22 | * 23 | * @param listener an object to be informed once a rate limit header is encountered. 24 | * @throws IllegalArgumentException if listener is null. 25 | */ 26 | public RateLimitInterceptor(RateLimitsListener listener) { 27 | if (listener == null) { 28 | throw new IllegalArgumentException("listener cannot be null!"); 29 | } 30 | this.listener = listener; 31 | } 32 | 33 | /** 34 | * Intercept a http call. 35 | * 36 | * @param chain the current chain of calls. 37 | * @return a response from this call. 38 | * @throws IOException if something goes wrong. 39 | */ 40 | @Override public Response intercept(Chain chain) throws IOException { 41 | final Response response = chain.proceed(chain.request()); 42 | 43 | final Headers headers = response.headers(); 44 | final Map> mappedHeaders = headers.toMultimap(); 45 | final RateLimits limits = new RateLimits.DefaultParser().parse(mappedHeaders); 46 | 47 | listener.onRateLimitHeaderReceived(limits); 48 | 49 | return response; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/interceptor/RateLimitsListener.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.interceptor; 2 | 3 | import com.contentful.java.cma.model.RateLimits; 4 | 5 | /** 6 | * Interface to get informed about rate limits. 7 | */ 8 | public interface RateLimitsListener { 9 | void onRateLimitHeaderReceived(RateLimits rateLimits); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/interceptor/UserAgentHeaderInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.interceptor; 2 | 3 | /** 4 | * Interceptor to add user agent header to requests 5 | */ 6 | public class UserAgentHeaderInterceptor extends HeaderInterceptor { 7 | public static final String HEADER_NAME = "User-Agent"; 8 | 9 | /** 10 | * Create Header interceptor, saving parameters. 11 | * 12 | * @param userAgent user agent header to be send with _every_ request. 13 | */ 14 | public UserAgentHeaderInterceptor(String userAgent) { 15 | super(HEADER_NAME, userAgent); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMABulkStatus.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | public enum CMABulkStatus { 4 | CREATED("created"), 5 | IN_PROGRESS("inProgress"), 6 | SUCCEEDED("succeeded"), 7 | FAILED("failed"); 8 | 9 | private final String status; 10 | 11 | CMABulkStatus(String status) { 12 | this.status = status; 13 | } 14 | 15 | public String getStatus() { 16 | return status; 17 | } 18 | 19 | public static CMABulkStatus from(String status) { 20 | for (CMABulkStatus bulkStatus : values()) { 21 | if (bulkStatus.status.equals(status)) { 22 | return bulkStatus; 23 | } 24 | } 25 | return null; // or throw an IllegalArgumentException 26 | } 27 | } -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAEntities.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | import java.util.List; 4 | 5 | public class CMAEntities { 6 | 7 | List items; 8 | 9 | public List getItems() { 10 | return items; 11 | } 12 | 13 | public CMAEntities setItems(List items) { 14 | this.items = items; 15 | return this; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAEnvironmentStatus.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public enum CMAEnvironmentStatus { 6 | @SerializedName("ready") 7 | Ready, 8 | @SerializedName("queued") 9 | Queued, 10 | @SerializedName("creating") 11 | Creating, 12 | @SerializedName("failed") 13 | Failed 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAError.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | public class CMAError extends CMAResource { 4 | public CMAError() { 5 | super(CMAType.Error); 6 | } 7 | } -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAMetadata.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | import java.util.List; 4 | 5 | public class CMAMetadata { 6 | List tags; 7 | 8 | List taxonomy; 9 | 10 | public List getConcepts() { 11 | return concepts; 12 | } 13 | 14 | public void setConcepts(List concepts) { 15 | this.concepts = concepts; 16 | } 17 | 18 | List concepts; 19 | 20 | public List getTaxonomy() { 21 | return taxonomy; 22 | } 23 | 24 | public void setTaxonomy(List taxonomy) { 25 | this.taxonomy = taxonomy; 26 | } 27 | 28 | /** 29 | * Gets the list of tags associated with this resource. 30 | * 31 | * @return The list of {@link CMATag} instances representing the tags. 32 | */ 33 | public List getTags() { 34 | return tags; 35 | } 36 | 37 | /** 38 | * Sets the list of tags for this resource. 39 | * 40 | * @param tags The list of {@link CMATag} instances to be associated with the resource. 41 | */ 42 | public void setTags(List tags) { 43 | this.tags = tags; 44 | } 45 | 46 | /** 47 | * @return a human-readable string, representing the object. 48 | */ 49 | @Override public String toString() { 50 | return "CMAMetadata { " 51 | + "tags = " + getTags() + "}"; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMANotWithEnvironmentsException.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | /** 4 | * Exception defining the behavioural limits of using configured spaces and environments. 5 | */ 6 | public class CMANotWithEnvironmentsException extends RuntimeException { 7 | private static final long serialVersionUID = 8730567118486688363L; 8 | 9 | /** 10 | * Please do not use configured environments with specific endpoints. 11 | *

12 | * For more information on the differences, please compare 13 | * {@link com.contentful.java.cma.ModuleApiKeys#fetchAll()} and 14 | * {@link com.contentful.java.cma.ModuleApiKeys#fetchAll(String)} for example. 15 | */ 16 | public CMANotWithEnvironmentsException() { 17 | super("An endpoint that does not support environments was reached.\n\n" 18 | + "\tIn order to avoid unintentional behaviour, this endpoint got disabled for use with\n" 19 | + "\tconfigured environments.\n\n" 20 | + "\tSince you have specified an environment id through Client.Builder.setEnvironmentId,\n" 21 | + "\tplease create a new CMAClient not using an environment id to use this endpoint, or\n" 22 | + "\tuse the method variant overwriting the space id and environment id."); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAOrganization.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | /** 4 | * Model class representing one organization. 5 | */ 6 | public class CMAOrganization extends CMAResource { 7 | private String name; 8 | 9 | /** 10 | * Creates a new organization. 11 | */ 12 | public CMAOrganization() { 13 | super(CMAType.Organization); 14 | } 15 | 16 | /** 17 | * @return the name of this organization. 18 | */ 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | /** 24 | * Update the name of the organization. 25 | * 26 | * @param name new name to be set 27 | * @return this instance for chaining. 28 | */ 29 | public CMAOrganization setName(String name) { 30 | this.name = name; 31 | return this; 32 | } 33 | 34 | /** 35 | * @return a human readable string, representing the object. 36 | */ 37 | @Override public String toString() { 38 | return "CMAOrganizations { " + super.toString() + " " 39 | + "name = " + getName() + " " 40 | + "}"; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAPages.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | public class CMAPages { 4 | String prev; 5 | String next; 6 | 7 | public String getPrev() { 8 | return prev; 9 | } 10 | 11 | public void setPrev(String prev) { 12 | this.prev = prev; 13 | } 14 | 15 | public String getNext() { 16 | return next; 17 | } 18 | 19 | public void setNext(String next) { 20 | this.next = next; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAPayload.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | /** 4 | * This model can be used to control the appearance and usability of ui elements on Contentful. 5 | */ 6 | public class CMAPayload { 7 | CMAEntities entities; 8 | 9 | public CMAEntities getEntities() { 10 | return entities; 11 | } 12 | 13 | public CMAPayload setEntities(CMAEntities entities) { 14 | this.entities = entities; 15 | return this; 16 | } 17 | } -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAPreviewApiKey.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | /** 4 | * Class representing api keys created. 5 | */ 6 | public class CMAPreviewApiKey extends CMAResource { 7 | private String accessToken; 8 | 9 | /** 10 | * Create a new api key. 11 | */ 12 | public CMAPreviewApiKey() { 13 | super(CMAType.PreviewApiKey); 14 | } 15 | 16 | /** 17 | * @return readonly api access token for this key. 18 | */ 19 | public String getAccessToken() { 20 | return accessToken; 21 | } 22 | 23 | /** 24 | * @return a human readable string, representing the object. 25 | */ 26 | @Override public String toString() { 27 | return "CMAApiKey { " + super.toString() + " " 28 | + "accessToken = " + getAccessToken() + ", " 29 | + "}"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAScheduledActionStatus.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | public enum CMAScheduledActionStatus { 4 | CANCELED("canceled"), 5 | FAILED("failed"), 6 | SCHEDULED("scheduled"), 7 | SUCCEEDED("succeeded"); 8 | 9 | private final String status; 10 | 11 | CMAScheduledActionStatus(String status) { 12 | this.status = status; 13 | } 14 | 15 | public String getStatus() { 16 | return status; 17 | } 18 | 19 | public static CMAScheduledActionStatus from(String status) { 20 | for (CMAScheduledActionStatus scheduledActionStatus : values()) { 21 | if (scheduledActionStatus.status.equals(status)) { 22 | return scheduledActionStatus; 23 | } 24 | } 25 | return null; // or throw an IllegalArgumentException 26 | } 27 | } -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAScheduledFor.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | public class CMAScheduledFor { 4 | 5 | String datetime; 6 | String timezone; 7 | 8 | public String getDatetime() { 9 | return datetime; 10 | } 11 | 12 | public void setDatetime(String datetime) { 13 | this.datetime = datetime; 14 | } 15 | 16 | public String getTimezone() { 17 | return timezone; 18 | } 19 | 20 | public void setTimezone(String timezone) { 21 | this.timezone = timezone; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMASnapshot.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | /** 4 | * This model represents a snapshot of a specific resource. 5 | */ 6 | public class CMASnapshot extends CMAResource { 7 | 8 | private CMAResource snapshot; 9 | 10 | /** 11 | * Create a new snapshot. 12 | *

13 | * Used for internal testing and json parsing only. 14 | */ 15 | public CMASnapshot() { 16 | super(CMAType.Snapshot); 17 | } 18 | 19 | /** 20 | * @return the actual data of the snapshot 21 | */ 22 | public CMAResource getSnapshot() { 23 | return snapshot; 24 | } 25 | 26 | /** 27 | * Update the current snapshot. 28 | * 29 | * @param snapshot the value to be used. 30 | * @return the actual CMASnapshot 31 | */ 32 | public CMASnapshot setSnapshot(CMAResource snapshot) { 33 | this.snapshot = snapshot; 34 | return this; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMATotalConcepts.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | public class CMATotalConcepts { 4 | public int getTotal() { 5 | return total; 6 | } 7 | 8 | public void setTotal(int total) { 9 | this.total = total; 10 | } 11 | 12 | private int total; 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAType.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * A Contentful resource will be of one of those types. If a new type gets added, this enum will be 7 | * set to null. 8 | */ 9 | public enum CMAType { 10 | ApiKey, 11 | Array, 12 | Asset, 13 | BulkAction, 14 | ContentType, 15 | EditorInterface, 16 | Entry, 17 | Error, 18 | Environment, 19 | Link, 20 | Locale, 21 | Organization, 22 | OrganizationPeriodicUsage, 23 | SpacePeriodicUsage, 24 | PersonalAccessToken, 25 | PreviewApiKey, 26 | Role, 27 | ScheduledAction, 28 | Snapshot, 29 | Space, 30 | SpaceMembership, 31 | Tag, 32 | TaxonomyConcept, 33 | TaxonomyConceptScheme, 34 | Upload, 35 | User, 36 | @SerializedName("Extension") UiExtension, 37 | Webhook, 38 | WebhookCallOverview, 39 | WebhookDefinition; 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAUiExtensionParameterType.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | /** 4 | * Enum holding the build in values of the UI extension parameter type. 5 | *

6 | * Allowed types: String, one of Symbol, Enum, Number, Boolean. 7 | */ 8 | public enum CMAUiExtensionParameterType { 9 | Boolean, 10 | Enum, 11 | Number, 12 | Symbol 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/CMAVisibility.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | public enum CMAVisibility { 6 | @SerializedName("private") privateVisibility, 7 | @SerializedName("public") publicVisibility, 8 | } 9 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichDocument.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * The base of a rich text field, containing all the other nodes. 5 | */ 6 | public class CMARichDocument extends CMARichBlock { 7 | /** 8 | * Create a new document. 9 | */ 10 | public CMARichDocument() { 11 | super("document"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichEmbeddedLink.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | import com.contentful.java.cma.model.CMALink; 4 | import com.contentful.java.cma.model.CMAType; 5 | 6 | /** 7 | * This node is an inline link to a CMAEntry 8 | * 9 | * @see com.contentful.java.cma.model.CMAEntry 10 | */ 11 | public class CMARichEmbeddedLink extends CMARichHyperLink { 12 | private final transient boolean inline; 13 | 14 | /** 15 | * Create a link pointing to a CMAEntry. 16 | * 17 | * @param target an entry to be pointed to. 18 | * @param inline should be inline or block 19 | */ 20 | public CMARichEmbeddedLink(Object target, boolean inline) { 21 | super(target); 22 | this.inline = inline; 23 | } 24 | 25 | /** 26 | * Create a link pointing to a CMAEntry. 27 | * 28 | * @param target an entry to be pointed to. 29 | */ 30 | public CMARichEmbeddedLink(Object target) { 31 | this(target, false); 32 | } 33 | 34 | /** 35 | * @return the internal representation of this node type. 36 | */ 37 | @Override public String getNodeType() { 38 | if (data instanceof CMALink) { 39 | final CMAType linkType = ((CMALink) data).getSystem().getLinkType(); 40 | final String block = inline ? "inline" : "block"; 41 | 42 | if (linkType == CMAType.Asset) { 43 | return "embedded-asset-" + block; 44 | } else if (linkType == CMAType.Entry) { 45 | return "embedded-entry-" + block; 46 | } 47 | } 48 | return super.getNodeType(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichHeading.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * Defines a headline of the text. 5 | *

6 | * Can have an arbitrary level assigned, but useful probably between 1 and 6. 7 | */ 8 | public class CMARichHeading extends CMARichBlock { 9 | private final transient int level; 10 | 11 | /** 12 | * Create a heading block, describing a level elements deep nested heading. 13 | * 14 | * @param level a number indicating the level of this heading. 15 | */ 16 | public CMARichHeading(int level) { 17 | super("heading-" + level); 18 | this.level = level; 19 | } 20 | 21 | /** 22 | * @return the current nesting level of this heading. 23 | */ 24 | public int getLevel() { 25 | return level; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichHorizontalRule.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * A node representing a division, called a horizontal rule. 8 | */ 9 | public class CMARichHorizontalRule extends CMARichNode { 10 | private List content = new ArrayList<>(); 11 | 12 | /** 13 | * Construct a horizontal rule node. 14 | */ 15 | public CMARichHorizontalRule() { 16 | super("hr"); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichListItem.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * A block representing an item inside a list. 5 | */ 6 | public class CMARichListItem extends CMARichBlock { 7 | /** 8 | * Create an item inside a list. 9 | */ 10 | public CMARichListItem() { 11 | super("list-item"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichMark.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * How to draw a given text. 5 | *

6 | * Subclasses are used for further differentiation. 7 | */ 8 | public class CMARichMark { 9 | private final String type; 10 | 11 | protected CMARichMark(String type) { 12 | this.type = type; 13 | } 14 | 15 | /** 16 | * A bold mark of a rich text. 17 | */ 18 | public static class CMARichMarkBold extends CMARichMark { 19 | public CMARichMarkBold() { 20 | super("bold"); 21 | } 22 | } 23 | 24 | /** 25 | * Declares the text as being displayed in italics. 26 | */ 27 | public static class CMARichMarkItalic extends CMARichMark { 28 | public CMARichMarkItalic() { 29 | super("italic"); 30 | } 31 | } 32 | 33 | /** 34 | * Marker for making the rich text displayed as underline. 35 | */ 36 | public static class CMARichMarkUnderline extends CMARichMark { 37 | public CMARichMarkUnderline() { 38 | super("underline"); 39 | } 40 | } 41 | 42 | /** 43 | * The text marked by this marker should be represented by Code. 44 | */ 45 | public static class CMARichMarkCode extends CMARichMark { 46 | public CMARichMarkCode() { 47 | super("code"); 48 | } 49 | } 50 | 51 | /** 52 | * Any custom marker for a given rich text. 53 | */ 54 | public static class CMARichMarkCustom extends CMARichMark { 55 | /** 56 | * Create a custom marker using the given type. 57 | * 58 | * @param type which type should this marker have? 59 | */ 60 | public CMARichMarkCustom(String type) { 61 | super(type); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichNode.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | import java.util.HashMap; 4 | 5 | import io.reactivex.annotations.NonNull; 6 | import io.reactivex.annotations.Nullable; 7 | 8 | /** 9 | * A leaf node of the rich text hierarchy. 10 | */ 11 | public class CMARichNode { 12 | @NonNull private final String nodeType; 13 | 14 | @Nullable protected Object data = new HashMap<>(); 15 | 16 | /** 17 | * Create an instance, settings its node type. 18 | * 19 | * @param nodeType the type of node to be used for creating json. 20 | */ 21 | protected CMARichNode(String nodeType) { 22 | this.nodeType = nodeType; 23 | } 24 | 25 | /** 26 | * @return the internal node type. 27 | */ 28 | public String getNodeType() { 29 | return nodeType; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichOrderedList.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * A list of elements, ordered by number. 5 | */ 6 | public class CMARichOrderedList extends CMARichBlock { 7 | /** 8 | * Create an ordered list. 9 | */ 10 | public CMARichOrderedList() { 11 | super("ordered-list"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichParagraph.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * A paragraph of nodes, usually rendered together. 5 | */ 6 | public class CMARichParagraph extends CMARichBlock { 7 | /** 8 | * Create a paragraph. 9 | */ 10 | public CMARichParagraph() { 11 | super("paragraph"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichQuote.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * A block of nodes rendered as a direct quote. 5 | */ 6 | public class CMARichQuote extends CMARichBlock { 7 | /** 8 | * Create a quote node. 9 | */ 10 | public CMARichQuote() { 11 | super("blockquote"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichTable.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * Rich Text table. 5 | */ 6 | public class CMARichTable extends CMARichBlock { 7 | /** 8 | * Create a table. 9 | */ 10 | public CMARichTable() { 11 | super("table"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichTableCell.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * Rich Text table cell. 5 | */ 6 | public class CMARichTableCell extends CMARichBlock { 7 | /** 8 | * Create a table. 9 | */ 10 | public CMARichTableCell() { 11 | super("table-cell"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichTableHeaderCell.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * Rich Text table header cell. 5 | */ 6 | public class CMARichTableHeaderCell extends CMARichBlock { 7 | /** 8 | * Create a table header cell. 9 | */ 10 | public CMARichTableHeaderCell() { 11 | super("table-header-cell"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichTableRow.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * Rich Text table row. 5 | */ 6 | public class CMARichTableRow extends CMARichBlock { 7 | /** 8 | * Create a table row. 9 | */ 10 | public CMARichTableRow() { 11 | super("table-row"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/contentful/java/cma/model/rich/CMARichUnorderedList.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model.rich; 2 | 3 | /** 4 | * Representation of a block of unordered items. 5 | */ 6 | public class CMARichUnorderedList extends CMARichBlock { 7 | /** 8 | * Creates an unordered list. 9 | */ 10 | public CMARichUnorderedList() { 11 | super("unordered-list"); 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/resources/com/contentful/java/cma/build/GeneratedBuildParameters.java: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.build; 2 | 3 | /** 4 | * Generated class containing the project version. 5 | * 6 | * This is generated on build time, so we don't have to fetch the properties on application 7 | * load. 8 | */ 9 | public final class GeneratedBuildParameters { 10 | /** 11 | * Hide constructor. 12 | */ 13 | private GeneratedBuildParameters() { 14 | } 15 | 16 | /** 17 | * Which version of '${project.name}' is getting used? 18 | */ 19 | public static final String PROJECT_VERSION = "${project.version}"; 20 | } 21 | -------------------------------------------------------------------------------- /src/test/bash/__rerun_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | THIS_SCRIPT="$(basename $0 .sh)" 4 | 5 | for f in $(ls); do 6 | CURRENT="$(basename ${f} .sh)" 7 | if [ "${CURRENT}" != "$THIS_SCRIPT" ]; then 8 | echo ${CURRENT} 9 | ./${CURRENT}.sh 10 | fi 11 | done -------------------------------------------------------------------------------- /src/test/bash/apikeys_create.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d '{"name":"Test","description":"some Description"}' \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/api_keys' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/apikeys_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/api_keys' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/apikeys_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/api_keys/5syMy6BsUtcVXlD6PpE6LA' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${CDA_TOKEN}'//g' \ 11 | | sed 's/'${USER_ID}'//g' \ 12 | | tee ${output} 13 | -------------------------------------------------------------------------------- /src/test/bash/apikeys_update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'X-Contentful-Version: 5' \ 8 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/api_keys/5syMy6BsUtcVXlD6PpE6LA' \ 11 | -d '{ 12 | "name":"First API Key Name", 13 | "description":"Updated API Key Description", 14 | "environments":[ 15 | {"sys":{"id":"master","linkType":"Environment","type":"Link"}}, 16 | {"sys":{"id":"java_e2e","linkType":"Environment","type":"Link"}} 17 | ] 18 | }' \ 19 | | sed 's/'${SPACE_ID}'//g' \ 20 | | sed 's/'${CMA_TOKEN}'//g' \ 21 | | sed 's/'${CDA_TOKEN}'//g' \ 22 | | sed 's/'${USER_ID}'//g' \ 23 | | tee ${output} 24 | 25 | 26 | -------------------------------------------------------------------------------- /src/test/bash/asset_create_in_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -d '{"fields":{ 8 | "description":{ 9 | "en-US":"description" 10 | }, 11 | "title":{ 12 | "en-US":"title" 13 | }}}' \ 14 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 15 | -H 'Authorization: Bearer '$CMA_TOKEN \ 16 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/assets" \ 17 | | sed 's/'${SPACE_ID}'//g' \ 18 | | sed 's/'${CMA_TOKEN}'//g' \ 19 | | sed 's/'${USER_ID}'//g' \ 20 | | tee ${output} 21 | -------------------------------------------------------------------------------- /src/test/bash/asset_create_with_upload.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ ! -e /tmp/contentful-upload-response ]; then 3 | echo 'please run `upload_upload.sh` first.' 4 | exit 5 | else 6 | echo 'Upload found again' 7 | fi 8 | 9 | ID="$(grep -sirn '^ "id"' /tmp/contentful-upload-response | cut -d':' -f3 | cut -d'"' -f2)" 10 | echo "ID: "$ID 11 | 12 | curl \ 13 | --request POST \ 14 | --data ' 15 | { 16 | "fields":{ 17 | "file":{ 18 | "en-US":{ 19 | "contentType":"image/jpeg", 20 | "uploadFrom":{ 21 | "sys":{ 22 | "id":"589W3nEu5ZTmmDY2gBoVcp", 23 | "linkType":"Upload", 24 | "type":"Link" 25 | } 26 | }, 27 | "fileName":"upload" 28 | } 29 | }, 30 | "description":{ 31 | "en-US":"description" 32 | }, 33 | "title":{ 34 | "en-US":"title" 35 | } 36 | } 37 | }' \ 38 | --header 'Authorization: Bearer '$CMA_TOKEN \ 39 | 'https://api.contentful.com/spaces/'$SPACE_ID'/assets/' \ 40 | | tee /tmp/contentful-create-asset-response 41 | 42 | -------------------------------------------------------------------------------- /src/test/bash/asset_delete_from_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X DELETE \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/assets/1fgii3GZo4euykA6u6mKmi" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/asset_fetch_all_from_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/assets" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/asset_fetch_all_from_environment_with_query.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/assets?limit=1" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/asset_fetch_one_from_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/assets/2ReMHJhXoAcy4AyamgsgwQ" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/asset_process_and_poll.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ ! -e /tmp/contentful-create-asset-response ]; then 3 | echo 'please run `asset_create_asset_with_upload.sh` first.' 4 | exit 5 | else 6 | echo 'Upload found again' 7 | fi 8 | 9 | ASSET_ID="$(grep -sirn '^ "id"' /tmp/contentful-create-asset-response | cut -d':' -f3 | cut -d'"' -f2)" 10 | echo "ASSET_ID: "$ASSET_ID 11 | 12 | curl \ 13 | --verbose \ 14 | --request PUT \ 15 | --header 'Authorization: Bearer '$CMA_TOKEN \ 16 | 'https://api.contentful.com/spaces/'$SPACE_ID'/assets/'$ASSET_ID'/files/en-US/process' 17 | echo polling 18 | 19 | url="" 20 | attempts=10 21 | while [ "$url" = "" -a $attempts -gt 0 ]; do 22 | curl \ 23 | --silent \ 24 | --request GET \ 25 | --header 'Authorization: Bearer '$CMA_TOKEN \ 26 | 'https://api.contentful.com/spaces/'$SPACE_ID'/assets/'$ASSET_ID \ 27 | > /tmp/contentful-create-asset-process-poll-response 28 | 29 | url="$(grep -i 'url' /tmp/contentful-create-asset-process-poll-response | cut -d'"' -f4)" 30 | echo "url: '$url', attempts left: '$((attempts--))'" 31 | 32 | if [ -z "$url" ]; then 33 | sleep 0.3 34 | fi 35 | done 36 | 37 | if [ -z "$url" ]; then 38 | echo 'No url found!' 39 | else 40 | echo URL found: $url 41 | fi 42 | 43 | -------------------------------------------------------------------------------- /src/test/bash/content_type_create_in_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d '{ 10 | "name": "Post", 11 | "fields": [ { 12 | "id": "title", 13 | "name": "Title", 14 | "required": true, 15 | "localized": true, 16 | "type": "Text" 17 | } ] }' \ 18 | 'https://api.contentful.com/spaces/'$SPACE_ID'/environments/staging/content_types' \ 19 | | sed 's/'${SPACE_ID}'//g' \ 20 | | sed 's/'${CMA_TOKEN}'//g' \ 21 | | sed 's/'${USER_ID}'//g' \ 22 | | tee ${output} 23 | -------------------------------------------------------------------------------- /src/test/bash/content_type_create_localized.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d @../resources/content_type_create_localized_payload.json \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/content_types' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/content_type_delete_from_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X DELETE \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/spaces/'$SPACE_ID'/environments/staging/content_types/6WIydLkj2ogUWusoQguOki' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/content_type_error_field_type_invalid.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh$#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H "X-Contentful-Content-Type: TESTID" \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d '{"sys":{"id":"InvalidContentType"},"fields":[{"name":"name","id":"testid","type":"null"}],"name":"Invalid Content Type"}' \ 11 | "https://api.contentful.com/spaces/$SPACE_ID/content_types/" \ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/content_type_fetch_all_from_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/spaces/'$SPACE_ID'/environments/staging/content_types' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/content_type_fetch_one_from_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/spaces/'$SPACE_ID'/environments/staging/content_types/1kUEViTN4EmGiEaaeC6ouY' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/content_type_snapshots_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh$#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/spaces/'$SPACE_ID'/content_types/'$CONTENT_TYPE_ID'/snapshots' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/content_type_snapshots_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh$#json#g' | sed 's#^#../resources/#g')" 4 | 5 | SNAPSHOT_ID=2fBAIYLYAgJcG0VRwg1MO7 6 | 7 | curl --verbose \ 8 | -X GET \ 9 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 10 | -H 'Authorization: Bearer '$CMA_TOKEN \ 11 | 'https://api.contentful.com/spaces/'$SPACE_ID'/content_types/'$CONTENT_TYPE_ID'/snapshots/'$SNAPSHOT_ID'' \ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/editor_interfaces_get.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/spaces/'$SPACE_ID'/content_types/'$CONTENT_TYPE_ID'/editor_interface' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/editor_interfaces_get_from_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/spaces/'$SPACE_ID'/environments/staging/content_types/'$CONTENT_TYPE_ID'/editor_interface' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/editor_interfaces_update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'X-Contentful-Version: 150' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d @../resources/editor_interfaces_update_payload.json \ 11 | 'https://api.contentful.com/spaces/'$SPACE_ID'/content_types/'$CONTENT_TYPE_ID'/editor_interface' \ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/editor_interfaces_update_in_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'X-Contentful-Version: 192' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d '{ "controls": [ { 11 | "fieldId": "name", 12 | "widgetId": "singleLine" 13 | } ] }' \ 14 | 'https://api.contentful.com/spaces/'$SPACE_ID'/environments/staging/content_types/'$CONTENT_TYPE_ID'/editor_interface' \ 15 | | sed 's/'${SPACE_ID}'//g' \ 16 | | sed 's/'${CMA_TOKEN}'//g' \ 17 | | sed 's/'${USER_ID}'//g' \ 18 | | tee ${output} 19 | -------------------------------------------------------------------------------- /src/test/bash/entry_create_error_array_type_value.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh$#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H "X-Contentful-Content-Type: TESTID" \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d '{"fields":{"testField2":{"en-US":[2]}}}' \ 11 | 'https://api.contentful.com/spaces/'$SPACE_ID'/entries/' \ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/entry_create_in_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'X-Contentful-Content-Type: deleteme' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/entries" \ 11 | -d '{ 12 | "fields": { 13 | "name": { 14 | "en-US": "Pete" 15 | } 16 | } 17 | }' \ 18 | | sed 's/'${SPACE_ID}'//g' \ 19 | | sed 's/'${CMA_TOKEN}'//g' \ 20 | | sed 's/'${USER_ID}'//g' \ 21 | | tee ${output} 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/test/bash/entry_delete_from_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X DELETE \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/entries/6AwRL4Sw2QMQCG6QG64GmM" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/entry_fetch_all_from_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/entries" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/entry_fetch_all_from_environment_with_query.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/entries?limit=1" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/entry_fetch_one_from_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/entries/6MUKUSDqPCEcQUeeewAgAW" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/entry_snapshots_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh$#json#g' | sed 's#^#../resources/#g')" 4 | 5 | ENTRY_ID=34MftYTFmoOoKCqM48wcc8 6 | 7 | curl --verbose \ 8 | -X GET \ 9 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 10 | -H 'Authorization: Bearer '$CMA_TOKEN \ 11 | 'https://api.contentful.com/spaces/'$SPACE_ID'/entries/'$ENTRY_ID'/snapshots' \ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/entry_snapshots_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh$#json#g' | sed 's#^#../resources/#g')" 4 | 5 | ENTRY_ID=34MftYTFmoOoKCqM48wcc8 6 | SNAPSHOT_ID=3v5AOdklBfe7preLva5OeZ 7 | 8 | curl --verbose \ 9 | -X GET \ 10 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 11 | -H 'Authorization: Bearer '$CMA_TOKEN \ 12 | 'https://api.contentful.com/spaces/'$SPACE_ID'/entries/'$ENTRY_ID'/snapshots/'$SNAPSHOT_ID'' \ 13 | | sed 's/'${SPACE_ID}'//g' \ 14 | | sed 's/'${CMA_TOKEN}'//g' \ 15 | | sed 's/'${USER_ID}'//g' \ 16 | | tee ${output} 17 | -------------------------------------------------------------------------------- /src/test/bash/environments_create.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d '{"name":"environment_name"}' \ 10 | "https://api.contentful.com/spaces/$SPACE_ID/environments" \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/environments_create_from_id.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -H 'X-Contentful-Source-Environment: io' \ 10 | -d '{"name":"environment cloned from io"}' \ 11 | "https://api.contentful.com/spaces/$SPACE_ID/environments/cloned_from_io" \ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/environments_create_with_id.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d '{"name":"environment_with_id"}' \ 10 | "https://api.contentful.com/spaces/$SPACE_ID/environments/new_id" \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/environments_delete.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X DELETE \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -H 'X-Contentful-Version: 6' \ 10 | "https://api.contentful.com/spaces/$SPACE_ID/environments/environment_id" \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/environments_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/environments_get_all_entries.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging/entries" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/environments_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | "https://api.contentful.com/spaces/$SPACE_ID/environments/staging" \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/environments_update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -H 'X-Contentful-Version: 12' \ 10 | -d '{"name":"environment_new_name"}' \ 11 | "https://api.contentful.com/spaces/$SPACE_ID/environments/environment_id" \ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/locales_create.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d @../resources/locales_create_payload.json \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/locales' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/locales_create_in_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d '{ 10 | "name": "Chinese", 11 | "code": "cn", 12 | "fallbackCode": "en-US", 13 | "optional": false 14 | }' \ 15 | 'https://api.contentful.com/spaces/'$SPACE_ID'/environments/staging/locales' \ 16 | | sed 's/'${SPACE_ID}'//g' \ 17 | | sed 's/'${CMA_TOKEN}'//g' \ 18 | | sed 's/'${USER_ID}'//g' \ 19 | | tee ${output} 20 | -------------------------------------------------------------------------------- /src/test/bash/locales_delete.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X DELETE \ 7 | -H 'X-Contentful-Version: 1' \ 8 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/locales/1LHPNLtOuBZ3ZTOxo7P7wo' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/locales_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/locales' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/locales_get_all_form_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/environments/staging/locales' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/locales_get_all_form_environment_with_query.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/environments/staging/locales' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/locales_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/locales/7lTcrh2SzR626t7fR8rIPD' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/locales_get_one_form_environment.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/environments/staging/locales/7lTcrh2SzR626t7fR8rIPD' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/locales_update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'X-Contentful-Version: 0' \ 8 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d @../resources/locales_update_payload.json \ 11 | 'https://api.contentful.com/spaces/'$SPACE_ID'/locales/7lTcrh2SzR626t7fR8rIPD' \ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/organizations_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/organizations' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/personal_access_token_create.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d '{"name":"Test Token","scopes":["content_management_read"]}' \ 10 | 'https://api.contentful.com/users/me/access_tokens' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/personal_access_token_create_error.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d '{"name":"Test Token","scopes":["content_management_write"]}' \ 10 | 'https://api.contentful.com/users/me/access_tokens' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/personal_access_token_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/users/me/access_tokens' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/personal_access_token_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/users/me/access_tokens/0LYG3uP7KihkEwsRsYijTo' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/personal_access_token_revoke.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/users/me/access_tokens/0LYG3uP7KihkEwsRsYijTo/revoked' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/preview_apikeys_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/preview_api_keys' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/preview_apikeys_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/preview_api_keys/5szEuycyXqACwhWgwNwX2m' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/rich_text_create_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'X-Contentful-Content-Type: rich' \ 8 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d @../resources/rich_text_create_one_payload.json \ 11 | 'https://api.contentful.com/spaces/'$RICH_TEXT_SPACE_ID'/entries/richtexttestentry' \ 12 | | sed 's/'${RICH_TEXT_SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} -------------------------------------------------------------------------------- /src/test/bash/rich_text_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$RICH_TEXT_SPACE_ID'/entries' \ 8 | | sed 's/'${RICH_TEXT_SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/rich_text_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$RICH_TEXT_SPACE_ID'/entries?sys.id=6VkkamQ5zO4qWIugKkWowK' \ 8 | | sed 's/'${RICH_TEXT_SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/rich_text_update_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'X-Contentful-Version: 9' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d @../resources/rich_text_update_one_payload.json \ 11 | 'https://api.contentful.com/spaces/'$RICH_TEXT_SPACE_ID'/entries/6VkkamQ5zO4qWIugKkWowK' \ 12 | | sed 's/'${RICH_TEXT_SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} -------------------------------------------------------------------------------- /src/test/bash/roles_create.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d @../resources/roles_create_payload.json \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/roles' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/roles_delete.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X DELETE \ 7 | -H 'Authorization: Bearer '$CMA_TOKEN \ 8 | 'https://api.contentful.com/spaces/'$SPACE_ID'/roles/3GJwcU7wiYT76olGjDdjCK' \ 9 | | sed 's/'${SPACE_ID}'//g' \ 10 | | sed 's/'${CMA_TOKEN}'//g' \ 11 | | sed 's/'${USER_ID}'//g' \ 12 | | tee ${output} 13 | -------------------------------------------------------------------------------- /src/test/bash/roles_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/roles' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/roles_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/roles/1sJzssG9PfxOKGVr2ePpXm' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/roles_update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'X-Contentful-Version: 1' \ 8 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d @../resources/roles_update_payload.json \ 11 | 'https://api.contentful.com/spaces/'$SPACE_ID'/roles/3h44ENEEpAA9XNx52dRDs0' \ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/space_membership_create_membership.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | curl --verbose \ 4 | -d '{"admin": true, "email": "mario+space_membership_test@contentful.com"}' \ 5 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 6 | 'https://api.contentful.com/spaces/'$SPACE_ID'/space_memberships?access_token='$CMA_TOKEN \ 7 | | tee /tmp/create_space_membership_response 8 | -------------------------------------------------------------------------------- /src/test/bash/space_membership_delete_one_membership.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | curl --verbose \ 4 | -X DELETE \ 5 | 'https://api.contentful.com/spaces/'$SPACE_ID'/space_memberships/3oDvvmtZnw1DoMS56y1n5I?access_token='$CMA_TOKEN \ 6 | | tee /tmp/delete_one_space_membership_response 7 | -------------------------------------------------------------------------------- /src/test/bash/space_membership_get_all_memberships.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | curl --verbose \ 4 | 'https://api.contentful.com/spaces/'$SPACE_ID'/space_memberships?access_token='$CMA_TOKEN \ 5 | | tee /tmp/get_all_space_membership_response 6 | -------------------------------------------------------------------------------- /src/test/bash/space_membership_get_one_membership.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | curl --verbose \ 4 | 'https://api.contentful.com/spaces/'$SPACE_ID'/space_memberships/7mgt3wsJ8oU6cbI2XQL12h?access_token='$CMA_TOKEN \ 5 | | tee /tmp/get_one_space_membership_response 6 | -------------------------------------------------------------------------------- /src/test/bash/space_membership_update_membership.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | curl --verbose \ 4 | -X PUT \ 5 | -d '{"admin": false}' \ 6 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 7 | -H 'Authorization: Bearer '$CMA_TOKEN \ 8 | -H 'X-Contentful-Version: 1' \ 9 | 'https://api.contentful.com/spaces/'$SPACE_ID'/space_memberships/7CgvT6bSNvpojgcdETZvL0' \ 10 | | tee /tmp/update_space_membership_response 11 | 12 | -------------------------------------------------------------------------------- /src/test/bash/ui_extensions_create_parameters.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d @../resources/ui_extensions_create_with_parameters.json \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/extensions' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/ui_extensions_create_with_html_data.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d @../resources/ui_extensions_create_with_html_data_payload.json \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/extensions' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/ui_extensions_create_with_url.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | -d @../resources/ui_extensions_create_with_url_payload.json \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/extensions' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/ui_extensions_delete.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X DELETE \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'X-Contentful-Version: 1' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/extensions/3MdkEVBQvmAo4qU8egwyM8' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/ui_extensions_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/spaces/'$SPACE_ID'/extensions' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/ui_extensions_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X GET \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'Authorization: Bearer '$CMA_TOKEN \ 9 | 'https://api.contentful.com/spaces/'$SPACE_ID'/extensions/4dBWHpKhao8AuYAMcosSyw' \ 10 | | sed 's/'${SPACE_ID}'//g' \ 11 | | sed 's/'${CMA_TOKEN}'//g' \ 12 | | sed 's/'${USER_ID}'//g' \ 13 | | tee ${output} 14 | -------------------------------------------------------------------------------- /src/test/bash/ui_extensions_update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'X-Contentful-Version: 2' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d @../resources/ui_extensions_update_payload.json \ 11 | 'https://api.contentful.com/spaces/'$SPACE_ID'/extensions' \ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/upload_delete.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ ! -e /tmp/contentful-upload-response ]; then 3 | echo 'please run `upload.sh` first.' 4 | exit 5 | else 6 | echo 'Not creating asset again' 7 | fi 8 | 9 | ID="$(grep -sirn '^ "id"' /tmp/contentful-upload-response | cut -d':' -f3 | cut -d'"' -f2)" 10 | echo "ID: "$ID 11 | 12 | set -ev 13 | curl \ 14 | --verbose \ 15 | --request DELETE \ 16 | --header 'Authorization: Bearer '$CMA_TOKEN \ 17 | 'https://upload.contentful.com/spaces/'$SPACE_ID'/uploads/'$ID \ 18 | | tee /tmp/contentful-upload-delete-response 19 | 20 | rm /tmp/contentful-upload-response 21 | -------------------------------------------------------------------------------- /src/test/bash/upload_fetch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ ! -e /tmp/contentful-upload-response ]; then 3 | echo 'please run `upload.sh` first.' 4 | exit 5 | else 6 | echo 'Not creating asset again' 7 | fi 8 | 9 | ID="$(grep -sirn '^ "id"' /tmp/contentful-upload-response | cut -d':' -f3 | cut -d'"' -f2)" 10 | echo "ID: "$ID 11 | 12 | set -ev 13 | curl \ 14 | --request GET \ 15 | --header 'Authorization: Bearer '$CMA_TOKEN \ 16 | 'https://upload.contentful.com/spaces/'$SPACE_ID'/uploads/'$ID \ 17 | | tee /tmp/contentful-upload-id-response 18 | 19 | -------------------------------------------------------------------------------- /src/test/bash/upload_upload.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | if [ ! -e /tmp/200.jpg ]; then 3 | echo 'Downloading cat' 4 | curl https://http.cat/200 > /tmp/200.jpg 5 | else 6 | echo 'Not downloading cat again.' 7 | fi 8 | 9 | set -ev 10 | curl \ 11 | --request POST \ 12 | --header 'Content-Type: application/octet-stream' \ 13 | --header 'Authorization: Bearer '$CMA_TOKEN \ 14 | --data-binary @/tmp/200.jpg \ 15 | 'https://upload.contentful.com/spaces/'$SPACE_ID'/uploads' \ 16 | | tee /tmp/contentful-upload-response 17 | 18 | -------------------------------------------------------------------------------- /src/test/bash/users_get_me.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/users/me' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/webhook_create.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X POST \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'X-Contentful-Version: 9' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d @../resources/webhook_create_request.json \ 11 | "https://api.contentful.com/spaces/$SPACE_ID/webhook_definitions"\ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/bash/webhook_delete.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X DELETE \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'X-Contentful-Version: 1' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | 'https://api.contentful.com/spaces/'$SPACE_ID'/webhook_definitions/14xlNJNiHlO8rCnmfXREFo' \ 11 | | sed 's/'${SPACE_ID}'//g' \ 12 | | sed 's/'${CMA_TOKEN}'//g' \ 13 | | sed 's/'${USER_ID}'//g' \ 14 | | tee ${output} 15 | -------------------------------------------------------------------------------- /src/test/bash/webhook_get_all.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/webhook_definitions' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/webhook_get_one.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -H 'Authorization: Bearer '$CMA_TOKEN \ 7 | 'https://api.contentful.com/spaces/'$SPACE_ID'/webhook_definitions/3mxXKShPg8N7ZMTnfFaDFL' \ 8 | | sed 's/'${SPACE_ID}'//g' \ 9 | | sed 's/'${CMA_TOKEN}'//g' \ 10 | | sed 's/'${USER_ID}'//g' \ 11 | | tee ${output} 12 | -------------------------------------------------------------------------------- /src/test/bash/webhook_update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | output="$(basename $(echo $0) | sed 's#sh#json#g' | sed 's#^#../resources/#g')" 4 | 5 | curl --verbose \ 6 | -X PUT \ 7 | -H 'Content-Type: application/vnd.contentful.management.v1+json' \ 8 | -H 'X-Contentful-Version: 2' \ 9 | -H 'Authorization: Bearer '$CMA_TOKEN \ 10 | -d @../resources/webhook_update_request.json \ 11 | "https://api.contentful.com/spaces/$SPACE_ID/webhook_definitions/5epBQND7dLGecdktBMpgPB"\ 12 | | sed 's/'${SPACE_ID}'//g' \ 13 | | sed 's/'${CMA_TOKEN}'//g' \ 14 | | sed 's/'${USER_ID}'//g' \ 15 | | tee ${output} 16 | -------------------------------------------------------------------------------- /src/test/kotlin/com/contentful/java/cma/BaseTest.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Contentful GmbH 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.contentful.java.cma 18 | 19 | import com.contentful.java.cma.lib.TestCallback 20 | import com.google.gson.JsonParser 21 | import kotlin.test.assertNotNull 22 | import kotlin.test.assertNull 23 | import kotlin.test.assertTrue 24 | import org.junit.After as after 25 | import org.junit.Before as before 26 | 27 | // Extensions 28 | fun assertTestCallback(cb: TestCallback): T? { 29 | cb.await() 30 | assertNull(cb.error) 31 | if (cb.allowEmpty) { 32 | return null 33 | } 34 | assertNotNull(cb.value) 35 | return cb.value 36 | } 37 | 38 | fun assertJsonEquals(json1: String, json2: String) { 39 | val parser = JsonParser() 40 | assertTrue(parser.parse(json1).equals(parser.parse(json2)), 41 | "Expected:\n$json1\nActual:\n$json2\n") 42 | } 43 | -------------------------------------------------------------------------------- /src/test/kotlin/com/contentful/java/cma/e2e/LocalesE2E.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Contentful GmbH 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.contentful.java.cma.e2e 18 | 19 | import com.contentful.java.cma.model.CMALocale 20 | import org.junit.Test 21 | import kotlin.test.assertEquals 22 | 23 | open class LocalesE2E : Base() { 24 | @Test 25 | fun testLocales() { 26 | var locale = CMALocale().apply { 27 | code = "de-DE" 28 | name = "German" 29 | fallbackCode = "en-US" 30 | } 31 | 32 | locale = client.locales().create(locale) 33 | assertEquals("de-DE", locale.code) 34 | assertEquals("German", locale.name) 35 | assertEquals("en-US", locale.fallbackCode) 36 | 37 | locale.name = "German in Germany" 38 | locale = client.locales().update(locale) 39 | assertEquals("German in Germany", locale.name) 40 | 41 | assertEquals(204, client.locales().delete(locale)) 42 | 43 | assertEquals(1, client.locales().fetchAll().total) 44 | } 45 | } -------------------------------------------------------------------------------- /src/test/kotlin/com/contentful/java/cma/e2e/RolesE2E.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Contentful GmbH 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.contentful.java.cma.e2e 18 | 19 | import com.contentful.java.cma.CMAClient 20 | import org.junit.BeforeClass 21 | import org.junit.Test 22 | import kotlin.test.assertEquals 23 | 24 | open class RolesE2E : Base() { 25 | companion object { 26 | @BeforeClass 27 | @JvmStatic 28 | fun setUpRolesSuite() { 29 | client = CMAClient.Builder().apply { 30 | if (!(PROXY.isNullOrEmpty())) { 31 | setCoreEndpoint(PROXY) 32 | setUploadEndpoint(PROXY) 33 | } 34 | setAccessToken(ACCESS_TOKEN) 35 | setSpaceId(SPACE_ID) 36 | setCoreCallFactory(createCallFactory()) 37 | setUploadCallFactory(createCallFactory()) 38 | }.build() 39 | } 40 | } 41 | 42 | @Test 43 | fun testRoles() { 44 | val roles = client.roles().fetchAll().items 45 | assertEquals(0, roles.size) 46 | } 47 | } -------------------------------------------------------------------------------- /src/test/kotlin/com/contentful/java/cma/lib/TestCallback.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 Contentful GmbH 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.contentful.java.cma.lib 18 | 19 | import com.contentful.java.cma.CMACallback 20 | import java.util.concurrent.CountDownLatch 21 | 22 | class TestCallback(val allowEmpty: Boolean = false) : CMACallback() { 23 | val cdl: CountDownLatch 24 | var value: T? = null 25 | var error: RuntimeException? = null 26 | 27 | init { 28 | cdl = CountDownLatch(1) 29 | } 30 | 31 | override fun onSuccess(result: T) { 32 | value = result 33 | cdl.countDown() 34 | } 35 | 36 | override fun onFailure(exception: RuntimeException?) { 37 | super.onFailure(exception) 38 | error = exception 39 | cdl.countDown() 40 | } 41 | 42 | @Throws(InterruptedException::class) 43 | fun await() { 44 | cdl.await() 45 | } 46 | } -------------------------------------------------------------------------------- /src/test/kotlin/com/contentful/java/cma/model/Extensions.kt: -------------------------------------------------------------------------------- 1 | package com.contentful.java.cma.model 2 | 3 | fun CMASystem.setCreatedBy(link: CMALink): CMASystem { 4 | this.createdBy = link 5 | return this 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/apikeys_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Test", 3 | "description": "some Description", 4 | "accessToken": "", 5 | "policies": [ 6 | { 7 | "effect": "allow", 8 | "actions": "all" 9 | } 10 | ], 11 | "sys": { 12 | "type": "ApiKey", 13 | "id": "2APoXwV3okKBrdkKNKOifo", 14 | "version": 0, 15 | "space": { 16 | "sys": { 17 | "type": "Link", 18 | "linkType": "Space", 19 | "id": "" 20 | } 21 | }, 22 | "createdBy": { 23 | "sys": { 24 | "type": "Link", 25 | "linkType": "User", 26 | "id": "" 27 | } 28 | }, 29 | "createdAt": "2018-05-16T13:38:25Z", 30 | "updatedBy": { 31 | "sys": { 32 | "type": "Link", 33 | "linkType": "User", 34 | "id": "" 35 | } 36 | }, 37 | "updatedAt": "2018-05-16T13:38:25Z" 38 | }, 39 | "environments": [ 40 | { 41 | "sys": { 42 | "id": "master", 43 | "type": "Link", 44 | "linkType": "Environment" 45 | } 46 | }, 47 | { 48 | "sys": { 49 | "id": "staging", 50 | "type": "Link", 51 | "linkType": "Environment" 52 | } 53 | } 54 | ], 55 | "preview_api_key": { 56 | "sys": { 57 | "type": "Link", 58 | "linkType": "PreviewApiKey", 59 | "id": "2AQ2dSH1WrSrI9G2MNA8cW" 60 | } 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/test/resources/apikeys_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"First API Key Name", 3 | "description":"Updated API Key Description", 4 | "accessToken":"", 5 | "policies":[ 6 | { 7 | "effect":"allow", 8 | "actions":"all" 9 | } 10 | ], 11 | "sys":{ 12 | "type":"ApiKey", 13 | "id":"5syMy6BsUtcVXlD6PpE6LA", 14 | "version":5, 15 | "space":{ 16 | "sys":{ 17 | "type":"Link", 18 | "linkType":"Space", 19 | "id":"" 20 | } 21 | }, 22 | "createdBy":{ 23 | "sys":{ 24 | "type":"Link", 25 | "linkType":"User", 26 | "id":"" 27 | } 28 | }, 29 | "createdAt":"2018-04-17T12:56:42Z", 30 | "updatedBy":{ 31 | "sys":{ 32 | "type":"Link", 33 | "linkType":"User", 34 | "id":"" 35 | } 36 | }, 37 | "updatedAt":"2018-08-09T10:53:00Z" 38 | }, 39 | "environments":[ 40 | { 41 | "sys":{ 42 | "id":"master", 43 | "type":"Link", 44 | "linkType":"Environment" 45 | } 46 | }, 47 | { 48 | "sys":{ 49 | "id":"java_e2e", 50 | "type":"Link", 51 | "linkType":"Environment" 52 | } 53 | } 54 | ], 55 | "preview_api_key":{ 56 | "sys":{ 57 | "type":"Link", 58 | "linkType":"PreviewApiKey", 59 | "id":"5szEuycyXqACwhWgwNwX2m" 60 | } 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/test/resources/asset_archive_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "title": { 4 | "en-US": "Bacon Pancakes" 5 | }, 6 | "file": { 7 | "en-US": { 8 | "contentType": "image/jpeg", 9 | "fileName": "example.jpg", 10 | "details": { 11 | "image": { 12 | "width": 250, 13 | "height": 250 14 | }, 15 | "size": 12273 16 | }, 17 | "url": "//images.contentful.com/274214qi376d/bacon-pancakes/4d43f2d7fc098f57a110b09d9dfc68c1/example.jpg" 18 | } 19 | } 20 | }, 21 | "sys": { 22 | "id": "bacon-pancakes", 23 | "type": "Asset", 24 | "createdAt": "2014-11-10T09:13:14.586Z", 25 | "createdBy": { 26 | "sys": { 27 | "type": "Link", 28 | "linkType": "User", 29 | "id": "47ucx8wPpr1JvqcUCzLeAK" 30 | } 31 | }, 32 | "space": { 33 | "sys": { 34 | "type": "Link", 35 | "linkType": "Space", 36 | "id": "274214qi376d" 37 | } 38 | }, 39 | "firstPublishedAt": "2014-11-10T13:03:50.321Z", 40 | "publishedCounter": 2, 41 | "version": 10, 42 | "updatedAt": "2014-11-10T14:17:03.726Z", 43 | "updatedBy": { 44 | "sys": { 45 | "type": "Link", 46 | "linkType": "User", 47 | "id": "47ucx8wPpr1JvqcUCzLeAK" 48 | } 49 | }, 50 | "archivedAt": "2014-11-10T14:17:03.726Z", 51 | "archivedBy": { 52 | "sys": { 53 | "type": "Link", 54 | "linkType": "User", 55 | "id": "47ucx8wPpr1JvqcUCzLeAK" 56 | } 57 | }, 58 | "archivedVersion": 9 59 | } 60 | } -------------------------------------------------------------------------------- /src/test/resources/asset_create_in_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "space": { 4 | "sys": { 5 | "type": "Link", 6 | "linkType": "Space", 7 | "id": "" 8 | } 9 | }, 10 | "id": "1fgii3GZo4euykA6u6mKmi", 11 | "type": "Asset", 12 | "createdAt": "2018-03-29T09:16:39.062Z", 13 | "updatedAt": "2018-03-29T09:16:39.062Z", 14 | "environment": { 15 | "sys": { 16 | "id": "staging", 17 | "type": "Link", 18 | "linkType": "Environment" 19 | } 20 | }, 21 | "createdBy": { 22 | "sys": { 23 | "type": "Link", 24 | "linkType": "User", 25 | "id": "" 26 | } 27 | }, 28 | "updatedBy": { 29 | "sys": { 30 | "type": "Link", 31 | "linkType": "User", 32 | "id": "" 33 | } 34 | }, 35 | "version": 1 36 | }, 37 | "fields": { 38 | "title": { 39 | "en-US": "title" 40 | }, 41 | "description": { 42 | "en-US": "description" 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/test/resources/asset_create_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "title": { 4 | "en-US": "title" 5 | }, 6 | "description": { 7 | "en-US": "description" 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/asset_create_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "tags": [ 4 | { 5 | "sys": { 6 | "type": "Link", 7 | "linkType": "Tag", 8 | "id": "anotherone" 9 | } 10 | }, 11 | { 12 | "sys": { 13 | "type": "Link", 14 | "linkType": "Tag", 15 | "id": "wat" 16 | } 17 | } 18 | ] 19 | }, 20 | "fields": { 21 | "title": { 22 | "en-US": "title" 23 | }, 24 | "description": { 25 | "en-US": "description" 26 | } 27 | }, 28 | "sys": { 29 | "id": "assetid", 30 | "type": "Asset", 31 | "version": 1, 32 | "createdAt": "2014-11-10T09:13:14.586Z", 33 | "createdBy": { 34 | "sys": { 35 | "type": "Link", 36 | "linkType": "User", 37 | "id": "uid" 38 | } 39 | }, 40 | "space": { 41 | "sys": { 42 | "type": "Link", 43 | "linkType": "Space", 44 | "id": "spaceid" 45 | } 46 | }, 47 | "updatedAt": "2014-11-10T09:13:14.586Z", 48 | "updatedBy": { 49 | "sys": { 50 | "type": "Link", 51 | "linkType": "User", 52 | "id": "uid" 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/test/resources/asset_create_with_upload_id_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "title": { 4 | "en-US": "title" 5 | }, 6 | "description": { 7 | "en-US": "description" 8 | } 9 | }, 10 | "sys": { 11 | "id": "assetid", 12 | "type": "Asset", 13 | "version": 1, 14 | "createdAt": "2014-11-10T09:13:14.586Z", 15 | "createdBy": { 16 | "sys": { 17 | "type": "Link", 18 | "linkType": "User", 19 | "id": "uid" 20 | } 21 | }, 22 | "space": { 23 | "sys": { 24 | "type": "Link", 25 | "linkType": "Space", 26 | "id": "spaceid" 27 | } 28 | }, 29 | "updatedAt": "2014-11-10T09:13:14.586Z", 30 | "updatedBy": { 31 | "sys": { 32 | "type": "Link", 33 | "linkType": "User", 34 | "id": "uid" 35 | } 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/resources/asset_delete_from_environment.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/asset_delete_from_environment.json -------------------------------------------------------------------------------- /src/test/resources/asset_publish_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "title": { 4 | "en-US": "Bacon Pancakes" 5 | }, 6 | "file": { 7 | "en-US": { 8 | "contentType": "image/jpeg", 9 | "fileName": "example.jpg", 10 | "details": { 11 | "image": { 12 | "width": 1680, 13 | "height": 1050 14 | }, 15 | "size": 327054 16 | }, 17 | "url": "//images.contentful.com/yecu8kbi7r6b/bacon-pancakes/f92060e13c91fb2f5cfb9971a50b1bf6/example.jpg" 18 | } 19 | } 20 | }, 21 | "sys": { 22 | "id": "bacon-pancakes", 23 | "type": "Asset", 24 | "createdAt": "2014-11-10T15:25:15.850Z", 25 | "createdBy": { 26 | "sys": { 27 | "type": "Link", 28 | "linkType": "User", 29 | "id": "uid" 30 | } 31 | }, 32 | "space": { 33 | "sys": { 34 | "type": "Link", 35 | "linkType": "Space", 36 | "id": "spaceid" 37 | } 38 | }, 39 | "version": 5, 40 | "updatedAt": "2014-11-10T15:28:51.090Z", 41 | "updatedBy": { 42 | "sys": { 43 | "type": "Link", 44 | "linkType": "User", 45 | "id": "uid" 46 | } 47 | }, 48 | "firstPublishedAt": "2014-11-10T15:28:51.089Z", 49 | "publishedCounter": 1, 50 | "publishedAt": "2014-11-10T15:28:51.090Z", 51 | "publishedBy": { 52 | "sys": { 53 | "type": "Link", 54 | "linkType": "User", 55 | "id": "uid" 56 | } 57 | }, 58 | "publishedVersion": 4 59 | } 60 | } -------------------------------------------------------------------------------- /src/test/resources/asset_update_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "file": { 4 | "en-US": { 5 | "contentType": "image/jpeg", 6 | "upload": "https://www.nowhere.com/image.jpg", 7 | "fileName": "example.jpg" 8 | } 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/bulk_actions_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "", 4 | "type": "BulkAction", 5 | "status": "inProgress", 6 | "createdBy": { 7 | "sys": { 8 | "type": "Link", 9 | "linkType": "User", 10 | "id": "7BslKh9TdKGOK41VmLDjFZ" 11 | } 12 | }, 13 | "createdAt `2020-01-01T13:00:00.000Z`": "", 14 | "updatedAt `2020-01-01T13:00:00.000Z`": "", 15 | "space": { 16 | "sys": { 17 | "type": "Link", 18 | "linkType": "Space", 19 | "id": "yadj1kx9rmg0" 20 | } 21 | }, 22 | "environment": { 23 | "sys": { 24 | "type": "Link", 25 | "linkType": "Environment", 26 | "id": "staging" 27 | } 28 | } 29 | }, 30 | "action": "bulk_action", 31 | "payload": { 32 | "entities": { 33 | "items": [ 34 | { 35 | "sys": { 36 | "id": "", 37 | "type": "Link", 38 | "linkType": "", 39 | "version": 0 40 | } 41 | } 42 | ] 43 | } 44 | }, 45 | "error": { 46 | "sys": { 47 | "id": "", 48 | "type": "Error" 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /src/test/resources/content_tags_delete.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/content_tags_delete.json -------------------------------------------------------------------------------- /src/test/resources/content_tags_one_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "NY Campaign", 3 | "sys": { 4 | "type": "Tag", 5 | "id": "nyCampaign", 6 | "version": 1, 7 | "visibility": "public", 8 | "space": { 9 | "sys": { 10 | "type": "Link", 11 | "linkType": "Space", 12 | "id": "yadj1kx9rmg0" 13 | } 14 | }, 15 | "environment": { 16 | "sys": { 17 | "type": "Link", 18 | "linkType": "Environment", 19 | "id": "staging" 20 | } 21 | }, 22 | "createdAt": "2015-05-18T11:29:46.809Z", 23 | "createdBy": { 24 | "sys": { 25 | "type": "Link", 26 | "linkType": "User", 27 | "id": "7BslKh9TdKGOK41VmLDjFZ" 28 | } 29 | }, 30 | "updatedAt": "2015-05-18T11:29:46.809Z", 31 | "updatedBy": { 32 | "sys": { 33 | "type": "Link", 34 | "linkType": "User", 35 | "id": "4FLrUHftHW3v2BLi9fzfjU" 36 | } 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/content_tags_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Array" 4 | }, 5 | "total": 1, 6 | "skip": 0, 7 | "limit": 100, 8 | "items": [ 9 | { 10 | "name": "NY Campaign", 11 | "sys": { 12 | "type": "Tag", 13 | "id": "nyCampaign", 14 | "version": 1, 15 | "space": { 16 | "sys": { 17 | "type": "Link", 18 | "linkType": "Space", 19 | "id": "yadj1kx9rmg0" 20 | } 21 | }, 22 | "environment": { 23 | "sys": { 24 | "type": "Link", 25 | "linkType": "Environment", 26 | "id": "staging" 27 | } 28 | }, 29 | "createdAt": "2015-05-18T11:29:46.809Z", 30 | "createdBy": { 31 | "sys": { 32 | "type": "Link", 33 | "linkType": "User", 34 | "id": "7BslKh9TdKGOK41VmLDjFZ" 35 | } 36 | }, 37 | "updatedAt": "2015-05-18T11:29:46.809Z", 38 | "updatedBy": { 39 | "sys": { 40 | "type": "Link", 41 | "linkType": "User", 42 | "id": "4FLrUHftHW3v2BLi9fzfjU" 43 | } 44 | } 45 | } 46 | } 47 | ] 48 | } -------------------------------------------------------------------------------- /src/test/resources/content_type_create_in_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "space": { 4 | "sys": { 5 | "type": "Link", 6 | "linkType": "Space", 7 | "id": "" 8 | } 9 | }, 10 | "id": "6WIydLkj2ogUWusoQguOki", 11 | "type": "ContentType", 12 | "createdAt": "2018-03-29T12:09:57.415Z", 13 | "updatedAt": "2018-03-29T12:09:57.415Z", 14 | "environment": { 15 | "sys": { 16 | "id": "staging", 17 | "type": "Link", 18 | "linkType": "Environment" 19 | } 20 | }, 21 | "createdBy": { 22 | "sys": { 23 | "type": "Link", 24 | "linkType": "User", 25 | "id": "" 26 | } 27 | }, 28 | "updatedBy": { 29 | "sys": { 30 | "type": "Link", 31 | "linkType": "User", 32 | "id": "" 33 | } 34 | }, 35 | "version": 1 36 | }, 37 | "displayField": null, 38 | "name": "Post", 39 | "description": null, 40 | "fields": [ 41 | { 42 | "id": "title", 43 | "name": "Title", 44 | "type": "Text", 45 | "localized": true, 46 | "required": true, 47 | "validations": [], 48 | "disabled": false, 49 | "omitted": false 50 | } 51 | ] 52 | } 53 | -------------------------------------------------------------------------------- /src/test/resources/content_type_create_localized.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "space": { 4 | "sys": { 5 | "type": "Link", 6 | "linkType": "Space", 7 | "id": "" 8 | } 9 | }, 10 | "id": "51Q7ngbcakOm6MUi2aKEIM", 11 | "type": "ContentType", 12 | "createdAt": "2017-08-21T14:33:10.285Z", 13 | "updatedAt": "2017-08-21T14:33:10.285Z", 14 | "createdBy": { 15 | "sys": { 16 | "type": "Link", 17 | "linkType": "User", 18 | "id": "" 19 | } 20 | }, 21 | "updatedBy": { 22 | "sys": { 23 | "type": "Link", 24 | "linkType": "User", 25 | "id": "" 26 | } 27 | }, 28 | "version": 1 29 | }, 30 | "displayField": null, 31 | "name": "Blog Post", 32 | "description": null, 33 | "fields": [ 34 | { 35 | "id": "title", 36 | "name": "Title", 37 | "type": "Text", 38 | "localized": true, 39 | "required": true, 40 | "validations": [], 41 | "disabled": false, 42 | "omitted": false 43 | } 44 | ] 45 | } 46 | -------------------------------------------------------------------------------- /src/test/resources/content_type_create_localized_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Blog Post", 3 | "fields": [ 4 | { 5 | "id": "title", 6 | "name": "Title", 7 | "required": true, 8 | "localized": true, 9 | "type": "Text" 10 | } 11 | ] 12 | } -------------------------------------------------------------------------------- /src/test/resources/content_type_create_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "whatever1", 3 | "description": "desc1", 4 | "displayField": "df", 5 | "fields": [ 6 | { 7 | "id": "f1", 8 | "name": "field1", 9 | "type": "Text", 10 | "required": true 11 | }, 12 | { 13 | "id": "f2", 14 | "name": "field2", 15 | "type": "Number" 16 | } 17 | ] 18 | } -------------------------------------------------------------------------------- /src/test/resources/content_type_create_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "whatever1", 3 | "description": "desc1", 4 | "displayField": "df", 5 | "fields": [ 6 | { 7 | "id": "f1", 8 | "name": "field1", 9 | "type": "Text", 10 | "required": true 11 | }, 12 | { 13 | "id": "f2", 14 | "name": "field2", 15 | "type": "Number" 16 | } 17 | ], 18 | "sys": { 19 | "id": "whatever1", 20 | "type": "ContentType", 21 | "version": 1, 22 | "createdAt": "2014-11-04T14:01:20.483Z", 23 | "createdBy": { 24 | "sys": { 25 | "type": "Link", 26 | "linkType": "User", 27 | "id": "47ucx8wPpr1JvqcUCzLeAK" 28 | } 29 | }, 30 | "space": { 31 | "sys": { 32 | "type": "Link", 33 | "linkType": "Space", 34 | "id": "ajlz3tpv4hl9" 35 | } 36 | }, 37 | "updatedAt": "2014-11-04T14:01:20.483Z", 38 | "updatedBy": { 39 | "sys": { 40 | "type": "Link", 41 | "linkType": "User", 42 | "id": "47ucx8wPpr1JvqcUCzLeAK" 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/test/resources/content_type_create_with_link.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "whatever1", 3 | "fields": [ 4 | { 5 | "id": "f1", 6 | "name": "field1", 7 | "type": "Link", 8 | "linkType": "Entry" 9 | } 10 | ] 11 | } -------------------------------------------------------------------------------- /src/test/resources/content_type_delete_from_environment.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/content_type_delete_from_environment.json -------------------------------------------------------------------------------- /src/test/resources/content_type_error_field_type_invalid.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Error", 4 | "id": "ValidationFailed" 5 | }, 6 | "message": "Validation error", 7 | "details": { 8 | "errors": [ 9 | { 10 | "name": "in", 11 | "path": [ 12 | "fields", 13 | 0, 14 | "type" 15 | ], 16 | "value": "null", 17 | "expected": [ 18 | "Array", 19 | "Boolean", 20 | "Date", 21 | "Integer", 22 | "Number", 23 | "Object", 24 | "Symbol", 25 | "Link", 26 | "Location", 27 | "Text" 28 | ] 29 | } 30 | ] 31 | }, 32 | "requestId": "ca5845b2efc9cebbc417e25dec1d3277" 33 | } 34 | -------------------------------------------------------------------------------- /src/test/resources/content_type_fetch_one_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Blog Post", 3 | "description": "desc1", 4 | "fields": [ 5 | { 6 | "id": "titleid", 7 | "name": "titlename", 8 | "type": "Text" 9 | }, 10 | { 11 | "id": "bodyid", 12 | "name": "bodyname", 13 | "type": "Text" 14 | } 15 | ], 16 | "sys": { 17 | "id": "contenttypeid", 18 | "type": "ContentType", 19 | "createdAt": "2014-11-05T09:19:49.489Z", 20 | "createdBy": { 21 | "sys": { 22 | "type": "Link", 23 | "linkType": "User", 24 | "id": "cuid" 25 | } 26 | }, 27 | "space": { 28 | "sys": { 29 | "type": "Link", 30 | "linkType": "Space", 31 | "id": "spaceid" 32 | } 33 | }, 34 | "firstPublishedAt": "2014-11-05T09:20:41.770Z", 35 | "publishedCounter": 1, 36 | "version": 3, 37 | "updatedAt": "2014-11-05T09:44:09.857Z", 38 | "updatedBy": { 39 | "sys": { 40 | "type": "Link", 41 | "linkType": "User", 42 | "id": "uuid" 43 | } 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /src/test/resources/content_type_publish_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Blog Post", 3 | "fields": [ 4 | { 5 | "id": "title", 6 | "name": "Title", 7 | "type": "Text" 8 | }, 9 | { 10 | "id": "body", 11 | "name": "Body", 12 | "type": "Text" 13 | } 14 | ], 15 | "sys": { 16 | "id": "blog-xost", 17 | "type": "ContentType", 18 | "createdAt": "2014-11-05T09:19:49.489Z", 19 | "createdBy": { 20 | "sys": { 21 | "type": "Link", 22 | "linkType": "User", 23 | "id": "47ucx8wPpr1JvqcUCzLeAK" 24 | } 25 | }, 26 | "space": { 27 | "sys": { 28 | "type": "Link", 29 | "linkType": "Space", 30 | "id": "ajlz3tpv4hl9" 31 | } 32 | }, 33 | "version": 2, 34 | "updatedAt": "2014-11-05T09:20:41.770Z", 35 | "updatedBy": { 36 | "sys": { 37 | "type": "Link", 38 | "linkType": "User", 39 | "id": "47ucx8wPpr1JvqcUCzLeAK" 40 | } 41 | }, 42 | "firstPublishedAt": "2014-11-05T09:20:41.770Z", 43 | "publishedCounter": 1, 44 | "publishedAt": "2014-11-05T09:20:41.770Z", 45 | "publishedBy": { 46 | "sys": { 47 | "type": "Link", 48 | "linkType": "User", 49 | "id": "47ucx8wPpr1JvqcUCzLeAK" 50 | } 51 | }, 52 | "publishedVersion": 1 53 | } 54 | } -------------------------------------------------------------------------------- /src/test/resources/content_type_unpublish_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Blog Post", 3 | "fields": [ 4 | { 5 | "id": "title", 6 | "name": "Title", 7 | "type": "Text" 8 | }, 9 | { 10 | "id": "body", 11 | "name": "Body", 12 | "type": "Text" 13 | } 14 | ], 15 | "sys": { 16 | "id": "blog-xost", 17 | "type": "ContentType", 18 | "createdAt": "2014-11-05T09:19:49.489Z", 19 | "createdBy": { 20 | "sys": { 21 | "type": "Link", 22 | "linkType": "User", 23 | "id": "47ucx8wPpr1JvqcUCzLeAK" 24 | } 25 | }, 26 | "space": { 27 | "sys": { 28 | "type": "Link", 29 | "linkType": "Space", 30 | "id": "ajlz3tpv4hl9" 31 | } 32 | }, 33 | "firstPublishedAt": "2014-11-05T09:20:41.770Z", 34 | "publishedCounter": 1, 35 | "version": 3, 36 | "updatedAt": "2014-11-05T09:44:09.853Z", 37 | "updatedBy": { 38 | "sys": { 39 | "type": "Link", 40 | "linkType": "User", 41 | "id": "47ucx8wPpr1JvqcUCzLeAK" 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/test/resources/content_type_update_object.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "whatever1", 3 | "fields": [ 4 | { 5 | "id": "f1", 6 | "name": "field1", 7 | "type": "Text" 8 | }, 9 | { 10 | "id": "f2", 11 | "name": "field2", 12 | "type": "Number" 13 | } 14 | ], 15 | "sys": { 16 | "id": "contenttypeid", 17 | "type": "ContentType", 18 | "version": 1, 19 | "createdAt": "2014-11-04T14:01:20.483Z", 20 | "createdBy": { 21 | "sys": { 22 | "type": "Link", 23 | "linkType": "User", 24 | "id": "uid" 25 | } 26 | }, 27 | "space": { 28 | "sys": { 29 | "type": "Link", 30 | "linkType": "Space", 31 | "id": "spaceid" 32 | } 33 | }, 34 | "updatedAt": "2014-11-04T14:01:20.483Z", 35 | "updatedBy": { 36 | "sys": { 37 | "type": "Link", 38 | "linkType": "User", 39 | "id": "uid" 40 | } 41 | } 42 | } 43 | } -------------------------------------------------------------------------------- /src/test/resources/content_type_update_request.json: -------------------------------------------------------------------------------- 1 | {"name":"whatever1","fields":[{"id":"f1","name":"field1","type":"Text"},{"id":"f2","name":"field2","type":"Number"},{"id":"f3","name":"field3","type":"Text","validations":[{"size":{"min":1,"max":5}}]}]} -------------------------------------------------------------------------------- /src/test/resources/content_type_update_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "whatever1", 3 | "fields": [ 4 | { 5 | "id": "f1", 6 | "name": "field1", 7 | "type": "Text", 8 | "validations": [ 9 | { 10 | "size": { 11 | "min": 1, 12 | "max": 5 13 | } 14 | } 15 | ] 16 | }, 17 | { 18 | "id": "f2", 19 | "name": "field2", 20 | "type": "Number" 21 | }, 22 | { 23 | "id": "f3", 24 | "name": "field3", 25 | "type": "Text" 26 | } 27 | ], 28 | "sys": { 29 | "id": "whatever1", 30 | "type": "ContentType", 31 | "createdAt": "2014-11-04T16:36:13.438Z", 32 | "createdBy": { 33 | "sys": { 34 | "type": "Link", 35 | "linkType": "User", 36 | "id": "47ucx8wPpr1JvqcUCzLeAK" 37 | } 38 | }, 39 | "space": { 40 | "sys": { 41 | "type": "Link", 42 | "linkType": "Space", 43 | "id": "ajlz3tpv4hl9" 44 | } 45 | }, 46 | "version": 2, 47 | "updatedAt": "2014-11-04T16:36:13.855Z", 48 | "updatedBy": { 49 | "sys": { 50 | "type": "Link", 51 | "linkType": "User", 52 | "id": "47ucx8wPpr1JvqcUCzLeAK" 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /src/test/resources/editor_interfaces_update_in_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "controls": [ 3 | { 4 | "fieldId": "name", 5 | "widgetId": "singleLine" 6 | } 7 | ], 8 | "sys": { 9 | "id": "default", 10 | "type": "EditorInterface", 11 | "space": { 12 | "sys": { 13 | "id": "", 14 | "type": "Link", 15 | "linkType": "Space" 16 | } 17 | }, 18 | "version": 193, 19 | "createdAt": "2016-08-30T12:52:59.554Z", 20 | "createdBy": { 21 | "sys": { 22 | "id": "", 23 | "type": "Link", 24 | "linkType": "User" 25 | } 26 | }, 27 | "updatedAt": "2018-03-29T13:16:26.494Z", 28 | "updatedBy": { 29 | "sys": { 30 | "type": "Link", 31 | "linkType": "User", 32 | "id": "" 33 | } 34 | }, 35 | "contentType": { 36 | "sys": { 37 | "id": "deleteme", 38 | "type": "Link", 39 | "linkType": "ContentType" 40 | } 41 | }, 42 | "environment": { 43 | "sys": { 44 | "id": "staging", 45 | "type": "Link", 46 | "linkType": "Environment" 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/test/resources/editor_interfaces_update_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "controls": [ 3 | { 4 | "fieldId": "name", 5 | "widgetId": "singleLine" 6 | }, 7 | { 8 | "fieldId": "media", 9 | "widgetId": "assetLinkEditor" 10 | }, 11 | { 12 | "fieldId": "link", 13 | "widgetId": "entryLinkEditor" 14 | }, 15 | { 16 | "fieldId": "fields", 17 | "widgetId": "listInput" 18 | }, 19 | { 20 | "fieldId": "sys", 21 | "widgetId": "listInput" 22 | }, 23 | { 24 | "fieldId": "date", 25 | "widgetId": "datePicker", 26 | "settings": { 27 | "format": "timeZ", 28 | "ampm": "24" 29 | } 30 | }, 31 | { 32 | "fieldId": "location", 33 | "widgetId": "locationEditor" 34 | }, 35 | { 36 | "fieldId": "not_existing", 37 | "widgetId": "locationEditor" 38 | }, 39 | { 40 | "fieldId": "slug", 41 | "widgetId": "singleLine" 42 | }, 43 | { 44 | "fieldId": "custom", 45 | "widgetId": "custom_ui_extension", 46 | "settings": { 47 | "helpText": "Help!" 48 | } 49 | } 50 | ] 51 | } 52 | -------------------------------------------------------------------------------- /src/test/resources/entry_archive_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "title": { 4 | "en-US": "Hello, World!" 5 | }, 6 | "body": { 7 | "en-US": "Bacon is healthy!" 8 | } 9 | }, 10 | "sys": { 11 | "id": "entryid", 12 | "type": "Entry", 13 | "createdAt": "2014-11-10T14:36:42.316Z", 14 | "createdBy": { 15 | "sys": { 16 | "type": "Link", 17 | "linkType": "User", 18 | "id": "uid" 19 | } 20 | }, 21 | "space": { 22 | "sys": { 23 | "type": "Link", 24 | "linkType": "Space", 25 | "id": "spaceid" 26 | } 27 | }, 28 | "contentType": { 29 | "sys": { 30 | "type": "Link", 31 | "linkType": "ContentType", 32 | "id": "ctid" 33 | } 34 | }, 35 | "version": 2, 36 | "updatedAt": "2014-11-10T14:37:25.133Z", 37 | "updatedBy": { 38 | "sys": { 39 | "type": "Link", 40 | "linkType": "User", 41 | "id": "uid" 42 | } 43 | }, 44 | "archivedAt": "2014-11-10T14:37:25.133Z", 45 | "archivedBy": { 46 | "sys": { 47 | "type": "Link", 48 | "linkType": "User", 49 | "id": "uid" 50 | } 51 | }, 52 | "archivedVersion": 1 53 | } 54 | } -------------------------------------------------------------------------------- /src/test/resources/entry_create_error_array_type_value.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Error", 4 | "id": "InvalidEntry" 5 | }, 6 | "message": "Validation error", 7 | "details": { 8 | "errors": [ 9 | { 10 | "name": "type", 11 | "value": [ 12 | 2 13 | ], 14 | "type": "Symbol", 15 | "details": "The type of \"value\" is incorrect, expected type: Symbol", 16 | "path": [ 17 | "fields", 18 | "testField2", 19 | "en-US" 20 | ] 21 | } 22 | ] 23 | }, 24 | "requestId": "fa607c736302207868b25e97c18ad3dd" 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/entry_create_in_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "space": { 4 | "sys": { 5 | "type": "Link", 6 | "linkType": "Space", 7 | "id": "" 8 | } 9 | }, 10 | "id": "6AwRL4Sw2QMQCG6QG64GmM", 11 | "type": "Entry", 12 | "createdAt": "2018-03-28T12:58:26.611Z", 13 | "updatedAt": "2018-03-28T12:58:26.611Z", 14 | "environment": { 15 | "sys": { 16 | "id": "staging", 17 | "type": "Link", 18 | "linkType": "Environment" 19 | } 20 | }, 21 | "createdBy": { 22 | "sys": { 23 | "type": "Link", 24 | "linkType": "User", 25 | "id": "" 26 | } 27 | }, 28 | "updatedBy": { 29 | "sys": { 30 | "type": "Link", 31 | "linkType": "User", 32 | "id": "" 33 | } 34 | }, 35 | "version": 1, 36 | "contentType": { 37 | "sys": { 38 | "type": "Link", 39 | "linkType": "ContentType", 40 | "id": "deleteme" 41 | } 42 | } 43 | }, 44 | "fields": { 45 | "name": { 46 | "en-US": "Pete" 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/test/resources/entry_create_links_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "name": { 4 | "en-US": "foo" 5 | }, 6 | "link": { 7 | "en-US": { 8 | "sys": { 9 | "type": "Link", 10 | "linkType": "Entry", 11 | "id": "bar" 12 | } 13 | }, 14 | "he-IL": { 15 | "sys": { 16 | "type": "Link", 17 | "linkType": "Entry", 18 | "id": "bar" 19 | } 20 | } 21 | }, 22 | "array": { 23 | "en-US": [ 24 | { 25 | "sys": { 26 | "type": "Link", 27 | "linkType": "Entry", 28 | "id": "bar" 29 | } 30 | } 31 | ] 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/test/resources/entry_create_metadata_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "tags": [ 4 | { 5 | "sys": { 6 | "type": "Link", 7 | "linkType": "Tag", 8 | "id": "tag1" 9 | } 10 | } 11 | ] 12 | }, 13 | "fields": { 14 | "fid1": { 15 | "en-US": "value1" 16 | }, 17 | "fid2": { 18 | "en-US": "value2" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/entry_create_metadata_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "metadata": { 3 | "tags": [ 4 | { 5 | "sys": { 6 | "type": "Link", 7 | "linkType": "Tag", 8 | "id": "tag1" 9 | } 10 | } 11 | ] 12 | }, 13 | "fields": { 14 | "fid1": { 15 | "en-US": "value1" 16 | }, 17 | "fid2": { 18 | "en-US": "value2" 19 | } 20 | }, 21 | "sys": { 22 | "id": "entryid", 23 | "type": "Entry", 24 | "version": 1, 25 | "createdAt": "2014-11-06T14:18:27.081Z", 26 | "createdBy": { 27 | "sys": { 28 | "type": "Link", 29 | "linkType": "User", 30 | "id": "userid" 31 | } 32 | }, 33 | "space": { 34 | "sys": { 35 | "type": "Link", 36 | "linkType": "Space", 37 | "id": "spaceid" 38 | } 39 | }, 40 | "contentType": { 41 | "sys": { 42 | "type": "Link", 43 | "linkType": "ContentType", 44 | "id": "ct" 45 | } 46 | }, 47 | "updatedAt": "2014-11-06T14:18:27.081Z", 48 | "updatedBy": { 49 | "sys": { 50 | "type": "Link", 51 | "linkType": "User", 52 | "id": "userid" 53 | } 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/test/resources/entry_create_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "fid1": { 4 | "en-US": "value1" 5 | }, 6 | "fid2": { 7 | "en-US": "value2" 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/entry_create_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "id1": { 4 | "en-US": "value1" 5 | }, 6 | "id2": { 7 | "en-US": "value2" 8 | } 9 | }, 10 | "sys": { 11 | "id": "entryid", 12 | "type": "Entry", 13 | "version": 1, 14 | "createdAt": "2014-11-06T14:18:27.081Z", 15 | "createdBy": { 16 | "sys": { 17 | "type": "Link", 18 | "linkType": "User", 19 | "id": "userid" 20 | } 21 | }, 22 | "space": { 23 | "sys": { 24 | "type": "Link", 25 | "linkType": "Space", 26 | "id": "spaceid" 27 | } 28 | }, 29 | "contentType": { 30 | "sys": { 31 | "type": "Link", 32 | "linkType": "ContentType", 33 | "id": "ct" 34 | } 35 | }, 36 | "updatedAt": "2014-11-06T14:18:27.081Z", 37 | "updatedBy": { 38 | "sys": { 39 | "type": "Link", 40 | "linkType": "User", 41 | "id": "userid" 42 | } 43 | } 44 | } 45 | } -------------------------------------------------------------------------------- /src/test/resources/entry_delete_from_environment.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/entry_delete_from_environment.json -------------------------------------------------------------------------------- /src/test/resources/entry_fetch_all_from_environment_with_query.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Array" 4 | }, 5 | "total": 23, 6 | "skip": 0, 7 | "limit": 1, 8 | "items": [ 9 | { 10 | "sys": { 11 | "space": { 12 | "sys": { 13 | "type": "Link", 14 | "linkType": "Space", 15 | "id": "" 16 | } 17 | }, 18 | "id": "4iO7CN7tSE8aia4wm2CkmS", 19 | "type": "Entry", 20 | "createdAt": "2017-09-28T09:02:53.305Z", 21 | "updatedAt": "2017-09-28T09:02:53.305Z", 22 | "environment": { 23 | "sys": { 24 | "id": "staging", 25 | "type": "Link", 26 | "linkType": "Environment" 27 | } 28 | }, 29 | "createdBy": { 30 | "sys": { 31 | "type": "Link", 32 | "linkType": "User", 33 | "id": "" 34 | } 35 | }, 36 | "updatedBy": { 37 | "sys": { 38 | "type": "Link", 39 | "linkType": "User", 40 | "id": "" 41 | } 42 | }, 43 | "version": 1, 44 | "contentType": { 45 | "sys": { 46 | "type": "Link", 47 | "linkType": "ContentType", 48 | "id": "deletemeLinks" 49 | } 50 | } 51 | }, 52 | "fields": {} 53 | } 54 | ] 55 | } 56 | -------------------------------------------------------------------------------- /src/test/resources/entry_fetch_one_from_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "space": { 4 | "sys": { 5 | "type": "Link", 6 | "linkType": "Space", 7 | "id": "" 8 | } 9 | }, 10 | "id": "6MUKUSDqPCEcQUeeewAgAW", 11 | "type": "Entry", 12 | "createdAt": "2018-01-15T11:47:43.421Z", 13 | "updatedAt": "2018-02-07T14:04:27.483Z", 14 | "environment": { 15 | "sys": { 16 | "id": "staging", 17 | "type": "Link", 18 | "linkType": "Environment" 19 | } 20 | }, 21 | "createdBy": { 22 | "sys": { 23 | "type": "Link", 24 | "linkType": "User", 25 | "id": "" 26 | } 27 | }, 28 | "updatedBy": { 29 | "sys": { 30 | "type": "Link", 31 | "linkType": "User", 32 | "id": "" 33 | } 34 | }, 35 | "publishedCounter": 7, 36 | "version": 33, 37 | "publishedBy": { 38 | "sys": { 39 | "type": "Link", 40 | "linkType": "User", 41 | "id": "" 42 | } 43 | }, 44 | "publishedVersion": 32, 45 | "firstPublishedAt": "2018-01-15T11:48:44.130Z", 46 | "publishedAt": "2018-02-07T14:04:27.483Z", 47 | "contentType": { 48 | "sys": { 49 | "type": "Link", 50 | "linkType": "ContentType", 51 | "id": "51Q7ngbcakOm6MUi2aKEIM" 52 | } 53 | } 54 | }, 55 | "fields": { 56 | "title": { 57 | "en-US": "🍌🍌🍌🍏", 58 | "en-UK": "🍌🍌🍌🍏🍏🍏" 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/test/resources/entry_fetch_one_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "entryid", 4 | "type": "Entry" 5 | }, 6 | "fields": { 7 | "url": { 8 | "en-US": "http://www.url.com" 9 | }, 10 | "key": { 11 | "en-US": "value" 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/entry_update_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "fid1": { 4 | "en-US": "newvalue1" 5 | }, 6 | "fid2": { 7 | "en-US": "newvalue2" 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/entry_update_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "fid1": { 4 | "en-US": "newvalue1" 5 | }, 6 | "fid2": { 7 | "en-US": "newvalue2" 8 | } 9 | }, 10 | "sys": { 11 | "id": "entryid", 12 | "type": "Entry" 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/entry_with_list_object.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "title": { 4 | "en-US": "whatever" 5 | }, 6 | "list": { 7 | "en-US": [ 8 | { 9 | "sys": { 10 | "type": "Link", 11 | "linkType": "Entry", 12 | "id": "..." 13 | } 14 | } 15 | ] 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/environments_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"environment_name", 3 | "sys":{ 4 | "type":"Environment", 5 | "id":"d35qsfsq3ctp", 6 | "version":1, 7 | "space":{ 8 | "sys":{ 9 | "type":"Link", 10 | "linkType":"Space", 11 | "id":"" 12 | } 13 | }, 14 | "status":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Status", 18 | "id":"queued" 19 | } 20 | }, 21 | "createdBy":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"User", 25 | "id":"" 26 | } 27 | }, 28 | "createdAt":"2018-03-26T15:46:47Z", 29 | "updatedBy":{ 30 | "sys":{ 31 | "type":"Link", 32 | "linkType":"User", 33 | "id":"" 34 | } 35 | }, 36 | "updatedAt":"2018-03-26T15:46:47Z" 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/environments_create_from_id.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"environment cloned from io", 3 | "sys":{ 4 | "type":"Environment", 5 | "id":"cloned_from_io", 6 | "version":1, 7 | "space":{ 8 | "sys":{ 9 | "type":"Link", 10 | "linkType":"Space", 11 | "id":"" 12 | } 13 | }, 14 | "status":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Status", 18 | "id":"queued" 19 | } 20 | }, 21 | "createdBy":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"User", 25 | "id":"" 26 | } 27 | }, 28 | "createdAt":"2019-02-18T14:45:22Z", 29 | "updatedBy":{ 30 | "sys":{ 31 | "type":"Link", 32 | "linkType":"User", 33 | "id":"" 34 | } 35 | }, 36 | "updatedAt":"2019-02-18T14:45:22Z" 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/environments_create_with_id.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"environment_with_id", 3 | "sys":{ 4 | "type":"Environment", 5 | "id":"new_id", 6 | "version":1, 7 | "space":{ 8 | "sys":{ 9 | "type":"Link", 10 | "linkType":"Space", 11 | "id":"" 12 | } 13 | }, 14 | "status":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Status", 18 | "id":"queued" 19 | } 20 | }, 21 | "createdBy":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"User", 25 | "id":"" 26 | } 27 | }, 28 | "createdAt":"2018-04-05T11:48:42Z", 29 | "updatedBy":{ 30 | "sys":{ 31 | "type":"Link", 32 | "linkType":"User", 33 | "id":"" 34 | } 35 | }, 36 | "updatedAt":"2018-04-05T11:48:42Z" 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/environments_delete.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/environments_delete.json -------------------------------------------------------------------------------- /src/test/resources/environments_get_one.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"staging", 3 | "sys":{ 4 | "type":"Environment", 5 | "id":"staging", 6 | "version":6, 7 | "space":{ 8 | "sys":{ 9 | "type":"Link", 10 | "linkType":"Space", 11 | "id":"" 12 | } 13 | }, 14 | "status":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Status", 18 | "id":"ready" 19 | } 20 | }, 21 | "createdBy":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"User", 25 | "id":"" 26 | } 27 | }, 28 | "createdAt":"2018-02-27T13:25:13Z", 29 | "updatedBy":{ 30 | "sys":{ 31 | "type":"Link", 32 | "linkType":"User", 33 | "id":"" 34 | } 35 | }, 36 | "updatedAt":"2018-02-27T13:25:37Z" 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/environments_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"environment_new_name", 3 | "sys":{ 4 | "type":"Environment", 5 | "id":"environment_id", 6 | "version":12, 7 | "space":{ 8 | "sys":{ 9 | "type":"Link", 10 | "linkType":"Space", 11 | "id":"" 12 | } 13 | }, 14 | "status":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Status", 18 | "id":"queued" 19 | } 20 | }, 21 | "createdBy":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"User", 25 | "id":"" 26 | } 27 | }, 28 | "createdAt":"2018-03-26T15:47:36Z", 29 | "updatedBy":{ 30 | "sys":{ 31 | "type":"Link", 32 | "linkType":"User", 33 | "id":"" 34 | } 35 | }, 36 | "updatedAt":"2018-03-26T15:47:36Z" 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/error_invalid_json.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Error", 4 | "id": "BadRequest" 5 | }, 6 | "message": "Invalid JSON in request body: {\n\t\"fields\": {\n\t\t\"test\": {\n\t\t\t\"en-US: \"bar\"\n\t\t}\n\t}\n}", 7 | "requestId": "8467e3d93f5650aefc596367370b6fa3" 8 | } -------------------------------------------------------------------------------- /src/test/resources/error_post_wrong_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Error", 4 | "id": "InvalidEntry" 5 | }, 6 | "message": "Validation error", 7 | "details": { 8 | "errors": [ 9 | { 10 | "name": "unknown", 11 | "path": [ 12 | "fields", 13 | "test" 14 | ], 15 | "value": "bar", 16 | "details": "The property \"test\" is not allowed here." 17 | } 18 | ] 19 | }, 20 | "requestId": "0cb77b0bf64d814ed182a668be4dc0eb" 21 | } -------------------------------------------------------------------------------- /src/test/resources/error_unknown_path.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Error", 4 | "id": "InvalidQuery" 5 | }, 6 | "message": "The query you sent was invalid. Probably a filter or ordering specification is not applicable to the type of a field.", 7 | "details": { 8 | "errors": [ 9 | { 10 | "name": "unknown", 11 | "path": [ 12 | "sys", 13 | "foo" 14 | ], 15 | "details": "The path \"sys.foo\" is not recognized" 16 | } 17 | ] 18 | }, 19 | "requestId": "f5841eb3c46dc4a2c4f67c2d5a027f1c" 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/error_wrong_field.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Error", 4 | "id": "InvalidEntry" 5 | }, 6 | "message":"The body you sent contains an unknown key.", 7 | "details":{ 8 | "keys":[ 9 | "a_field_that_does_not_exist" 10 | ] 11 | }, 12 | "requestId": "fieldsRequestId" 13 | } -------------------------------------------------------------------------------- /src/test/resources/error_wrong_type.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Error", 4 | "id": "InvalidEntry" 5 | }, 6 | "message": "Validation error", 7 | "details": { 8 | "errors": [ 9 | { 10 | "name": "type", 11 | "value": "bar", 12 | "type": "Object", 13 | "details": "The type of \"value\" is incorrect, expected type: Object", 14 | "path": [ 15 | "fields", 16 | "xqZFfK7YdzEfhhJg", 17 | "en-US" 18 | ] 19 | } 20 | ] 21 | }, 22 | "requestId": "8cd7ef1751dd283ee230e6a58efef8ec" 23 | } -------------------------------------------------------------------------------- /src/test/resources/error_wrong_type_for_date.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Error", 4 | "id": "InvalidQuery" 5 | }, 6 | "message": "The query you sent was invalid. Probably a filter or ordering specification is not applicable to the type of a field.", 7 | "details": { 8 | "errors": [ 9 | { 10 | "name": "value", 11 | "path": [ 12 | "sys", 13 | "archivedAt" 14 | ], 15 | "type": "Date", 16 | "filter": "equals", 17 | "details": "false used on sys.archivedAt is not a valid value for type Date." 18 | } 19 | ] 20 | }, 21 | "requestId": "4dfcab3bd85b753033280b1fa38d7717" 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/error_wrong_type_for_limit.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Error", 4 | "id": "InvalidQuery" 5 | }, 6 | "message": "The value provided for \"limit\" is invalid. Please provide a valid number value", 7 | "details": { 8 | "errors": [] 9 | }, 10 | "requestId": "20add8f6cab860a61752c2e0b00966f1" 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/field_object.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fieldname", 3 | "id": "fieldid", 4 | "type": "Text", 5 | "required": true, 6 | "disabled": true, 7 | "omitted": true, 8 | "validations": [ 9 | { 10 | "size": { 11 | "min": 1, 12 | "max": 5 13 | } 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/locales_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"English (British)", 3 | "internal_code":"nopenotol", 4 | "code":"en-UK", 5 | "fallbackCode":"en-US", 6 | "default":false, 7 | "contentManagementApi":true, 8 | "contentDeliveryApi":true, 9 | "optional":false, 10 | "sys":{ 11 | "type":"Locale", 12 | "id":"502kn7lUaVFRTzv3jx7maG", 13 | "version":0, 14 | "space":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Space", 18 | "id":"" 19 | } 20 | }, 21 | "createdBy":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"User", 25 | "id":"" 26 | } 27 | }, 28 | "createdAt":"2017-08-22T15:08:13Z", 29 | "updatedBy":{ 30 | "sys":{ 31 | "type":"Link", 32 | "linkType":"User", 33 | "id":"" 34 | } 35 | }, 36 | "updatedAt":"2017-08-22T15:08:13Z" 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/locales_create_in_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"Chinese", 3 | "internal_code":"cn", 4 | "code":"cn", 5 | "fallbackCode":"en-US", 6 | "default":false, 7 | "contentManagementApi":true, 8 | "contentDeliveryApi":true, 9 | "optional":false, 10 | "sys":{ 11 | "type":"Locale", 12 | "id":"5j47OUo10BOIqAw3iqsRRi", 13 | "version":0, 14 | "space":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Space", 18 | "id":"" 19 | } 20 | }, 21 | "environment":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"Environment", 25 | "id":"staging" 26 | } 27 | }, 28 | "createdBy":{ 29 | "sys":{ 30 | "type":"Link", 31 | "linkType":"User", 32 | "id":"" 33 | } 34 | }, 35 | "createdAt":"2018-03-29T11:24:34Z", 36 | "updatedBy":{ 37 | "sys":{ 38 | "type":"Link", 39 | "linkType":"User", 40 | "id":"" 41 | } 42 | }, 43 | "updatedAt":"2018-03-29T11:24:34Z" 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/test/resources/locales_create_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "English (British)", 3 | "code": "en-UK", 4 | "fallbackCode": "en-US", 5 | "optional": false 6 | } -------------------------------------------------------------------------------- /src/test/resources/locales_delete.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/locales_delete.json -------------------------------------------------------------------------------- /src/test/resources/locales_get_one.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"U.S. English", 3 | "internal_code":"en-US", 4 | "code":"en-US", 5 | "fallbackCode":null, 6 | "default":true, 7 | "contentManagementApi":true, 8 | "contentDeliveryApi":true, 9 | "optional":false, 10 | "sys":{ 11 | "type":"Locale", 12 | "id":"7lTcrh2SzR626t7fR8rIPD", 13 | "version":0, 14 | "space":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Space", 18 | "id":"" 19 | } 20 | }, 21 | "createdBy":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"User", 25 | "id":"" 26 | } 27 | }, 28 | "createdAt":"2016-07-26T09:40:42Z", 29 | "updatedBy":{ 30 | "sys":{ 31 | "type":"Link", 32 | "linkType":"User", 33 | "id":"" 34 | } 35 | }, 36 | "updatedAt":"2016-07-26T09:40:42Z" 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/locales_get_one_form_environment.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"U.S. English", 3 | "internal_code":"en-US", 4 | "code":"en-US", 5 | "fallbackCode":null, 6 | "default":true, 7 | "contentManagementApi":true, 8 | "contentDeliveryApi":true, 9 | "optional":false, 10 | "sys":{ 11 | "type":"Locale", 12 | "id":"7lTcrh2SzR626t7fR8rIPD", 13 | "version":1, 14 | "space":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Space", 18 | "id":"" 19 | } 20 | }, 21 | "environment":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"Environment", 25 | "id":"staging" 26 | } 27 | }, 28 | "createdBy":{ 29 | "sys":{ 30 | "type":"Link", 31 | "linkType":"User", 32 | "id":"" 33 | } 34 | }, 35 | "createdAt":"2018-02-27T13:25:13Z", 36 | "updatedBy":{ 37 | "sys":{ 38 | "type":"Link", 39 | "linkType":"User", 40 | "id":"" 41 | } 42 | }, 43 | "updatedAt":"2018-02-27T13:25:13Z" 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/test/resources/locales_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"U.S. English", 3 | "internal_code":"en-US", 4 | "code":"en-US", 5 | "fallbackCode":null, 6 | "default":true, 7 | "contentManagementApi":true, 8 | "contentDeliveryApi":true, 9 | "optional":false, 10 | "sys":{ 11 | "type":"Locale", 12 | "id":"7lTcrh2SzR626t7fR8rIPD", 13 | "version":0, 14 | "space":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Space", 18 | "id":"" 19 | } 20 | }, 21 | "createdBy":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"User", 25 | "id":"" 26 | } 27 | }, 28 | "createdAt":"2016-07-26T09:40:42Z", 29 | "updatedBy":{ 30 | "sys":{ 31 | "type":"Link", 32 | "linkType":"User", 33 | "id":"" 34 | } 35 | }, 36 | "updatedAt":"2016-07-26T09:40:42Z" 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/locales_update_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "U.S. English", 3 | "code": "en-US", 4 | "optional": false 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/organizations_get_all.json: -------------------------------------------------------------------------------- 1 | { 2 | "total":4, 3 | "limit":25, 4 | "skip":0, 5 | "sys":{ 6 | "type":"Array" 7 | }, 8 | "items":[ 9 | { 10 | "name":"Contentful", 11 | "sys":{ 12 | "type":"Organization", 13 | "id":"781CC83AZAPo72ADSs1BR1", 14 | "version":3, 15 | "createdAt":"2013-05-06T07:53:34Z", 16 | "updatedAt":"2016-06-28T08:58:32Z" 17 | } 18 | }, 19 | { 20 | "name":"Space Templates", 21 | "sys":{ 22 | "type":"Organization", 23 | "id":"781CC83AZAPo72ADSs1BR2", 24 | "version":22, 25 | "createdAt":"2015-01-07T16:26:56Z", 26 | "updatedAt":"2016-06-28T08:58:37Z" 27 | } 28 | }, 29 | { 30 | "name":"Marios Org", 31 | "sys":{ 32 | "type":"Organization", 33 | "id":"781CC83AZAPo72ADSs1BR3", 34 | "version":4, 35 | "createdAt":"2015-12-15T13:09:13Z", 36 | "updatedAt":"2016-01-27T17:17:30Z" 37 | } 38 | }, 39 | { 40 | "name":"Contentful-SDK-Tests", 41 | "sys":{ 42 | "type":"Organization", 43 | "id":"781CC83AZAPo72ADSs1BR4", 44 | "version":0, 45 | "createdAt":"2017-04-19T08:59:40Z", 46 | "updatedAt":"2017-04-19T08:59:40Z" 47 | } 48 | } 49 | ] 50 | } 51 | 52 | -------------------------------------------------------------------------------- /src/test/resources/personal_access_token_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"Test Token", 3 | "revokedAt":null, 4 | "sys":{ 5 | "type":"PersonalAccessToken", 6 | "id":"04HUtX5O7XsNFdKX7BrJvo", 7 | "createdAt":"2017-06-27T08:46:17Z", 8 | "updatedAt":"2017-06-27T08:46:17Z" 9 | }, 10 | "scopes":["content_management_read"], 11 | "token":"CFPAT-TOKEN" 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/personal_access_token_create_error.json: -------------------------------------------------------------------------------- 1 | { 2 | "requestId": "631c49efc019fb403306e5c49b99133b", 3 | "message": "Provided scopes for the personal access token are invalid", 4 | "sys": { 5 | "type": "Error", 6 | "id": "PersonalAccessTokenInvalidScopes" 7 | } 8 | } 9 | 10 | -------------------------------------------------------------------------------- /src/test/resources/personal_access_token_get_all.json: -------------------------------------------------------------------------------- 1 | { 2 | "total": 2, 3 | "limit": 25, 4 | "skip": 0, 5 | "sys": { 6 | "type": "Array" 7 | }, 8 | "items": [ 9 | { 10 | "name": "Test Token", 11 | "revokedAt": null, 12 | "sys": { 13 | "type": "PersonalAccessToken", 14 | "id": "7inecgCPc1wuNefg1o1lem", 15 | "createdAt": "2017-06-26T11:45:55Z", 16 | "updatedAt": "2017-06-26T11:45:55Z" 17 | }, 18 | "scopes": [ 19 | "content_management_manage" 20 | ] 21 | }, 22 | { 23 | "name": "Test Token", 24 | "revokedAt": null, 25 | "sys": { 26 | "type": "PersonalAccessToken", 27 | "id": "4AHhB3m4tzdOFylCh1SlcG", 28 | "createdAt": "2017-06-26T11:50:35Z", 29 | "updatedAt": "2017-06-26T11:50:35Z" 30 | }, 31 | "scopes": [ 32 | "content_management_manage", 33 | "content_management_read" 34 | ] 35 | } 36 | ] 37 | } 38 | 39 | -------------------------------------------------------------------------------- /src/test/resources/personal_access_token_get_one.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Test Token", 3 | "revokedAt": null, 4 | "sys": { 5 | "type": "PersonalAccessToken", 6 | "id": "0LYG3uP7KihkEwsRsYijTo", 7 | "createdAt": "2017-06-26T11:54:14Z", 8 | "updatedAt": "2017-06-26T11:54:14Z" 9 | }, 10 | "scopes": [ 11 | "content_management_read" 12 | ] 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/test/resources/personal_access_token_revoke.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Test Token", 3 | "revokedAt": "2017-06-26T12:01:04Z", 4 | "sys": { 5 | "type": "PersonalAccessToken", 6 | "id": "0LYG3uP7KihkEwsRsYijTo", 7 | "createdAt": "2017-06-26T11:54:14Z", 8 | "updatedAt": "2017-06-26T11:54:14Z" 9 | }, 10 | "scopes": [ 11 | "content_management_read" 12 | ] 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/test/resources/preview_apikeys_get_one.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Playground 5", 3 | "description": null, 4 | "accessToken": "", 5 | "sys": { 6 | "type": "PreviewApiKey", 7 | "id": "5szEuycyXqACwhWgwNwX2m", 8 | "version": 1, 9 | "space": { 10 | "sys": { 11 | "type": "Link", 12 | "linkType": "Space", 13 | "id": "" 14 | } 15 | }, 16 | "createdBy": { 17 | "sys": { 18 | "type": "Link", 19 | "linkType": "User", 20 | "id": "" 21 | } 22 | }, 23 | "createdAt": "2018-04-17T12:56:42Z", 24 | "updatedBy": { 25 | "sys": { 26 | "type": "Link", 27 | "linkType": "User", 28 | "id": "" 29 | } 30 | }, 31 | "updatedAt": "2018-04-17T12:57:18Z" 32 | }, 33 | "environments": [ 34 | { 35 | "sys": { 36 | "id": "master", 37 | "type": "Link", 38 | "linkType": "Environment" 39 | } 40 | }, 41 | { 42 | "sys": { 43 | "id": "staging", 44 | "type": "Link", 45 | "linkType": "Environment" 46 | } 47 | } 48 | ] 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/test/resources/rich_text_create_one_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "name": { 4 | "en-US": "testing_created_this_entry_and_will_delete_it_soon" 5 | }, 6 | "rich": { 7 | "en-US": { 8 | "data": {}, 9 | "content": [ 10 | { 11 | "data": {}, 12 | "content": [ 13 | { 14 | "data": {}, 15 | "marks": [ 16 | { 17 | "type": "bold" 18 | } 19 | ], 20 | "value": "delete me soon™", 21 | "nodeType": "text" 22 | } 23 | ], 24 | "nodeType": "paragraph" 25 | } 26 | ], 27 | "nodeType": "document" 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/resources/rich_text_update_one_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "fields": { 3 | "name": { 4 | "en-US": "simple_text_code" 5 | }, 6 | "rich": { 7 | "en-US": { 8 | "data": {}, 9 | "content": [ 10 | { 11 | "data": {}, 12 | "content": [ 13 | { 14 | "data": {}, 15 | "marks": [], 16 | "value": "delete me soon™", 17 | "nodeType": "text" 18 | } 19 | ], 20 | "nodeType": "paragraph" 21 | } 22 | ], 23 | "nodeType": "document" 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/test/resources/roles_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"Manage Settings Role is actually all", 3 | "description":"Test role", 4 | "policies":[], 5 | "permissions":{ 6 | "ContentModel":[], 7 | "Settings":"all", 8 | "ContentDelivery":[] 9 | }, 10 | "sys":{ 11 | "type":"Role", 12 | "id":"0g3FcTwbFicqZuoaY288Qe", 13 | "version":0, 14 | "space":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"Space", 18 | "id":"" 19 | } 20 | }, 21 | "createdBy":{ 22 | "sys":{ 23 | "type":"Link", 24 | "linkType":"User", 25 | "id":"" 26 | } 27 | }, 28 | "createdAt":"2017-06-01T12:23:25Z", 29 | "updatedBy":{ 30 | "sys":{ 31 | "type":"Link", 32 | "linkType":"User", 33 | "id":"" 34 | } 35 | }, 36 | "updatedAt":"2017-06-01T12:23:25Z" 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/roles_create_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Foo", 3 | "description": "Test role", 4 | "permissions": { 5 | "Settings": ["manage"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/roles_delete.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/roles_delete.json -------------------------------------------------------------------------------- /src/test/resources/roles_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"DELETE ME!!", 3 | "description":"Test role", 4 | "policies":[ 5 | { 6 | "effect":"allow", 7 | "actions":[ 8 | "read", 9 | "create", 10 | "update", 11 | "delete", 12 | "publish", 13 | "unpublish", 14 | "archive", 15 | "unarchive" 16 | ], 17 | "constraint":{ 18 | "and":[ 19 | { 20 | "equals":[ 21 | { 22 | "doc":"sys.type" 23 | }, 24 | "Entry" 25 | ] 26 | } 27 | ] 28 | } 29 | } 30 | ], 31 | "permissions":{ 32 | "ContentModel":[ 33 | "read" 34 | ], 35 | "Settings":[], 36 | "ContentDelivery":"all" 37 | }, 38 | "sys":{ 39 | "type":"Role", 40 | "id":"3h44ENEEpAA9XNx52dRDs0", 41 | "version":1, 42 | "space":{ 43 | "sys":{ 44 | "type":"Link", 45 | "linkType":"Space", 46 | "id":"" 47 | } 48 | }, 49 | "createdBy":{ 50 | "sys":{ 51 | "type":"Link", 52 | "linkType":"User", 53 | "id":"" 54 | } 55 | }, 56 | "createdAt":"2017-06-01T10:10:10Z", 57 | "updatedBy":{ 58 | "sys":{ 59 | "type":"Link", 60 | "linkType":"User", 61 | "id":"" 62 | } 63 | }, 64 | "updatedAt":"2017-06-01T11:22:12Z" 65 | } 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/test/resources/roles_update_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DELETE ME!!", 3 | "description": "Test role", 4 | "policies": [ 5 | { 6 | "effect": "allow", 7 | "actions": [ 8 | "read", 9 | "create", 10 | "update", 11 | "delete", 12 | "publish", 13 | "unpublish", 14 | "archive", 15 | "unarchive" 16 | ], 17 | "constraint": { 18 | "and": [ 19 | { 20 | "equals": [ 21 | { 22 | "doc": "sys.type" 23 | }, 24 | "Entry" 25 | ] 26 | } 27 | ] 28 | } 29 | } 30 | ], 31 | "permissions": { 32 | "ContentModel": [ 33 | "read" 34 | ], 35 | "ContentDelivery": "all" 36 | } 37 | } -------------------------------------------------------------------------------- /src/test/resources/scheduled_action_cancel_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "entity": { 3 | "sys": { 4 | "type": "Link", 5 | "linkType": "Entry", 6 | "id": "5KsDBWseXY6QegucYAoacS" 7 | } 8 | }, 9 | "environment": { 10 | "sys": { 11 | "type": "Link", 12 | "linkType": "Environment", 13 | "id": "staging" 14 | } 15 | }, 16 | "scheduledFor": { 17 | "datetime": "2022-01-01T12:00:00.000Z", 18 | "timezone": "Europe/Berlin" 19 | }, 20 | "action": "publish", 21 | "sys": { 22 | "id": "3A13SXSDwO8c46NrjigFYT", 23 | "type": "ScheduledAction", 24 | "status": "canceled", 25 | "createdAt": "2020-01-01T13:00:00.000Z", 26 | "createdBy": { 27 | "sys": { 28 | "type": "Link", 29 | "linkType": "User", 30 | "id": "7BslKh9TdKGOK41VmLDjFZ" 31 | } 32 | }, 33 | "canceledAt": "2020-01-01T13:00:00.000Z", 34 | "canceledBy": { 35 | "sys": { 36 | "type": "Link", 37 | "linkType": "User", 38 | "id": "4FLrUHftHW3v2BLi9fzfjU" 39 | } 40 | }, 41 | "space": { 42 | "sys": { 43 | "type": "Link", 44 | "id": "yadj1kx9rmg0" 45 | } 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /src/test/resources/scheduled_action_create_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "3A13SXSDwO8c46NrjigFYT", 4 | "type": "ScheduledAction", 5 | "status": "scheduled" 6 | }, 7 | "action": "publish", 8 | "entity": { 9 | "sys": { 10 | "id": "5KsDBWseXY6QegucYAoacS", 11 | "type": "Link", 12 | "linkType": "Entry" 13 | } 14 | }, 15 | "scheduledFor": { 16 | "datetime": "2022-01-01T12:00:00.000Z", 17 | "timezone": "Europe/Berlin" 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/scheduled_action_fetch_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "3A13SXSDwO8c46NrjigFYT", 4 | "type": "ScheduledAction", 5 | "status": "scheduled" 6 | }, 7 | "action": "publish", 8 | "entity": { 9 | "sys": { 10 | "id": "5KsDBWseXY6QegucYAoacS", 11 | "type": "Link", 12 | "linkType": "Entry" 13 | } 14 | }, 15 | "scheduledFor": { 16 | "datetime": "2022-01-01T12:00:00.000Z", 17 | "timezone": "Europe/Berlin" 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/scheduled_action_update_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "entity": { 3 | "sys": { 4 | "type": "Link", 5 | "linkType": "Entry", 6 | "id": "5KsDBWseXY6QegucYAoacS" 7 | } 8 | }, 9 | "environment": { 10 | "sys": { 11 | "type": "Link", 12 | "linkType": "Environment", 13 | "id": "staging" 14 | } 15 | }, 16 | "scheduledFor": { 17 | "datetime": "2022-01-01T12:00:00.000Z", 18 | "timezone": "Europe/Berlin" 19 | }, 20 | "action": "publish", 21 | "sys": { 22 | "createdAt": "2020-01-01T13:00:00.000Z", 23 | "createdBy": { 24 | "sys": { 25 | "type": "Link", 26 | "linkType": "User", 27 | "id": "7BslKh9TdKGOK41VmLDjFZ" 28 | } 29 | }, 30 | "id": "3A13SXSDwO8c46NrjigFYT", 31 | "space": { 32 | "sys": { 33 | "type": "Link", 34 | "id": "yadj1kx9rmg0" 35 | } 36 | }, 37 | "status": "scheduled", 38 | "type": "ScheduledAction", 39 | "updatedAt": "2020-03-11T16:00:00.000Z", 40 | "updatedBy": { 41 | "sys": { 42 | "type": "Link", 43 | "linkType": "User", 44 | "id": "7BslKh9TdKGOK41VmLDjFZ" 45 | } 46 | }, 47 | "version": 2 48 | } 49 | } -------------------------------------------------------------------------------- /src/test/resources/space_create_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "xxx" 3 | } -------------------------------------------------------------------------------- /src/test/resources/space_create_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "spaceid" 4 | }, 5 | "name": "xxx" 6 | } -------------------------------------------------------------------------------- /src/test/resources/space_create_with_locale_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "foo", 3 | "defaultLocale": "de-DE" 4 | } -------------------------------------------------------------------------------- /src/test/resources/space_create_with_locale_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "spaceid" 4 | }, 5 | "name": "foo" 6 | } -------------------------------------------------------------------------------- /src/test/resources/space_fetch_locales_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Array" 4 | }, 5 | "items": [ 6 | { 7 | "sys": { 8 | "type": "Locale", 9 | "id": "64vLBYZcoOKnDi9UGspKnr", 10 | "version": 0, 11 | "space": { 12 | "sys": { 13 | "type": "Link", 14 | "linkType": "Space", 15 | "id": "256tjdsmm689" 16 | } 17 | }, 18 | "createdBy": { 19 | "sys": { 20 | "type": "Link", 21 | "linkType": "User", 22 | "id": "4VwE8Z1aLx6gPr2BqY0bBQ" 23 | } 24 | }, 25 | "createdAt": "2014-08-26T12:23:59Z", 26 | "updatedBy": { 27 | "sys": { 28 | "type": "Link", 29 | "linkType": "User", 30 | "id": "4VwE8Z1aLx6gPr2BqY0bBQ" 31 | } 32 | }, 33 | "updatedAt": "2014-08-26T12:23:59Z" 34 | }, 35 | "name": "U.S. English", 36 | "code": "en-US", 37 | "fallbackCode":null, 38 | "default": true, 39 | "contentManagementApi": true, 40 | "contentDeliveryApi": true 41 | } 42 | ], 43 | "total": 1, 44 | "limit": 25, 45 | "skip": 0 46 | } -------------------------------------------------------------------------------- /src/test/resources/space_fetch_one_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Space", 4 | "id": "id1", 5 | "version": 1, 6 | "createdBy": { 7 | "sys": { 8 | "type": "Link", 9 | "linkType": "User", 10 | "id": "user1" 11 | } 12 | }, 13 | "createdAt": "2014-03-21T08:43:52Z", 14 | "updatedBy": { 15 | "sys": { 16 | "type": "Link", 17 | "linkType": "User", 18 | "id": "user1" 19 | } 20 | }, 21 | "updatedAt": "2014-04-27T18:16:10Z", 22 | "organization": { 23 | "sys": { 24 | "type": "Link", 25 | "linkType": "Organization", 26 | "id": "org1" 27 | } 28 | } 29 | }, 30 | "name": "space1" 31 | } -------------------------------------------------------------------------------- /src/test/resources/space_memberships_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "admin":true, 3 | "sys":{ 4 | "type":"SpaceMembership", 5 | "id":"7CgvT6bSNvpojgcdETZvL0", 6 | "version":0, 7 | "space":{ 8 | "sys":{ 9 | "type":"Link", 10 | "linkType":"Space", 11 | "id":"" 12 | } 13 | }, 14 | "createdBy":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"User", 18 | "id":"" 19 | } 20 | }, 21 | "createdAt":"2017-05-30T11:42:26Z", 22 | "updatedBy":{ 23 | "sys":{ 24 | "type":"Link", 25 | "linkType":"User", 26 | "id":"" 27 | } 28 | }, 29 | "updatedAt":"2017-05-30T11:42:26Z" 30 | }, 31 | "user":{ 32 | "sys":{ 33 | "type":"Link", 34 | "linkType":"User", 35 | "id":"7CgWzjaOaefGbPBv5EfTBI" 36 | } 37 | }, 38 | "roles":[] 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/space_memberships_delete_one.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/space_memberships_delete_one.json -------------------------------------------------------------------------------- /src/test/resources/space_memberships_fetch_one.json: -------------------------------------------------------------------------------- 1 | { 2 | "admin":true, 3 | "sys":{ 4 | "type":"SpaceMembership", 5 | "id":"MEMBERSHIP_ID", 6 | "version":0, 7 | "space":{ 8 | "sys":{ 9 | "type":"Link", 10 | "linkType":"Space", 11 | "id":"" 12 | } 13 | }, 14 | "createdBy":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"User", 18 | "id":"" 19 | } 20 | }, 21 | "createdAt":"2016-07-26T09:40:42Z", 22 | "updatedBy":{ 23 | "sys":{ 24 | "type":"Link", 25 | "linkType":"User", 26 | "id":"" 27 | } 28 | }, 29 | "updatedAt":"2016-07-26T09:40:42Z" 30 | }, 31 | "user":{ 32 | "sys":{ 33 | "type":"Link", 34 | "linkType":"User", 35 | "id":"" 36 | } 37 | }, 38 | "roles":[] 39 | } 40 | -------------------------------------------------------------------------------- /src/test/resources/space_memberships_no_admin_needs_roles.json: -------------------------------------------------------------------------------- 1 | { 2 | "admin":false, 3 | "sys":{ 4 | "type":"SpaceMembership", 5 | "id":"sampleid", 6 | "version":1, 7 | "space":{ 8 | "sys":{ 9 | "type":"Link", 10 | "linkType":"Space", 11 | "id":"" 12 | } 13 | }, 14 | "createdBy":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"User", 18 | "id":"" 19 | } 20 | }, 21 | "createdAt":"2017-04-26T07:08:43Z", 22 | "updatedBy":{ 23 | "sys":{ 24 | "type":"Link", 25 | "linkType":"User", 26 | "id":"" 27 | } 28 | }, 29 | "updatedAt":"2017-04-26T07:10:01Z" 30 | }, 31 | "user":{ 32 | "sys":{ 33 | "type":"Link", 34 | "linkType":"User", 35 | "id":"0PpV3cQM3fI5WKAZvFkTWu" 36 | } 37 | }, 38 | "roles":[ 39 | { 40 | "sys":{ 41 | "type":"Link", 42 | "linkType":"Role", 43 | "id":"7mdjKnRonMN0e2lLVooOjT" 44 | } 45 | } 46 | ] 47 | } 48 | 49 | -------------------------------------------------------------------------------- /src/test/resources/space_memberships_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "admin":false, 3 | "sys":{ 4 | "type":"SpaceMembership", 5 | "id":"sampleid", 6 | "version":1, 7 | "space":{ 8 | "sys":{ 9 | "type":"Link", 10 | "linkType":"Space", 11 | "id":"" 12 | } 13 | }, 14 | "createdBy":{ 15 | "sys":{ 16 | "type":"Link", 17 | "linkType":"User", 18 | "id":"" 19 | } 20 | }, 21 | "createdAt":"2017-04-26T07:08:43Z", 22 | "updatedBy":{ 23 | "sys":{ 24 | "type":"Link", 25 | "linkType":"User", 26 | "id":"" 27 | } 28 | }, 29 | "updatedAt":"2017-04-26T07:10:01Z" 30 | }, 31 | "user":{ 32 | "sys":{ 33 | "type":"Link", 34 | "linkType":"User", 35 | "id":"0PpV3cQM3fI5WKAZvFkTWu" 36 | } 37 | }, 38 | "roles":[] 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/test/resources/space_update_object.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Space", 4 | "id": "spaceid", 5 | "version": 1 6 | }, 7 | "name": "space" 8 | } -------------------------------------------------------------------------------- /src/test/resources/space_update_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "newname" 3 | } -------------------------------------------------------------------------------- /src/test/resources/space_update_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Space", 4 | "id": "spaceid", 5 | "version": 2, 6 | "updatedBy": { 7 | "sys": { 8 | "type": "Link", 9 | "linkType": "User", 10 | "id": "someone" 11 | } 12 | }, 13 | "updatedAt": "sometime" 14 | }, 15 | "name": "newname" 16 | } -------------------------------------------------------------------------------- /src/test/resources/taxonomy_concept_scheme_get_one_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "3ObFCyQRmzXGNrTNf7ejn7", 4 | "type": "TaxonomyConceptScheme", 5 | "createdAt": "2025-01-22T14:14:33.149Z", 6 | "updatedAt": "2025-01-22T14:19:19.508Z", 7 | "organization": { 8 | "sys": { 9 | "id": "0ar3TVMKEKfNfi1zRoENff", 10 | "type": "Link", 11 | "linkType": "Organization" 12 | } 13 | }, 14 | "createdBy": { 15 | "sys": { 16 | "id": "0aq1aR1pMpgsM7j6LLjRRP", 17 | "type": "Link", 18 | "linkType": "User" 19 | } 20 | }, 21 | "updatedBy": { 22 | "sys": { 23 | "id": "0aq1aR1pMpgsM7j6LLjRRP", 24 | "type": "Link", 25 | "linkType": "User" 26 | } 27 | }, 28 | "version": 4 29 | }, 30 | "uri": null, 31 | "prefLabel": { 32 | "en-US": "ExampleSchema2" 33 | }, 34 | "definition": { 35 | "en-US": "This is example schema 2" 36 | }, 37 | "topConcepts": [ 38 | { 39 | "sys": { 40 | "id": "6mGQ3L1vSc9Ejh93vdgjiv", 41 | "type": "Link", 42 | "linkType": "TaxonomyConcept" 43 | } 44 | } 45 | ], 46 | "concepts": [ 47 | { 48 | "sys": { 49 | "id": "6mGQ3L1vSc9Ejh93vdgjiv", 50 | "type": "Link", 51 | "linkType": "TaxonomyConcept" 52 | } 53 | }, 54 | { 55 | "sys": { 56 | "id": "5EzTDFmXoH774nO5uVDkRR", 57 | "type": "Link", 58 | "linkType": "TaxonomyConcept" 59 | } 60 | }, 61 | { 62 | "sys": { 63 | "id": "uTpwzHqhWHva3Cv8MtJtf", 64 | "type": "Link", 65 | "linkType": "TaxonomyConcept" 66 | } 67 | } 68 | ], 69 | "totalConcepts": 3 70 | } -------------------------------------------------------------------------------- /src/test/resources/taxonomy_concepts_get_one_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "6mGQ3L1vSc9Ejh93vdgjiv", 4 | "type": "TaxonomyConcept", 5 | "createdAt": "2025-01-22T14:15:58.326Z", 6 | "updatedAt": "2025-01-22T14:15:58.326Z", 7 | "organization": { 8 | "sys": { 9 | "id": "0ar3TVMKEKfNfi1zRoENff", 10 | "type": "Link", 11 | "linkType": "Organization" 12 | } 13 | }, 14 | "createdBy": { 15 | "sys": { 16 | "id": "0aq1aR1pMpgsM7j6LLjRRP", 17 | "type": "Link", 18 | "linkType": "User" 19 | } 20 | }, 21 | "updatedBy": { 22 | "sys": { 23 | "id": "0aq1aR1pMpgsM7j6LLjRRP", 24 | "type": "Link", 25 | "linkType": "User" 26 | } 27 | }, 28 | "version": 1 29 | }, 30 | "uri": null, 31 | "prefLabel": { 32 | "en-US": "example concept 2" 33 | }, 34 | "altLabels": { 35 | "en-US": [ 36 | "ddede" 37 | ] 38 | }, 39 | "hiddenLabels": { 40 | "en-US": [ 41 | "dede" 42 | ] 43 | }, 44 | "note": { 45 | "en-US": "eddede" 46 | }, 47 | "changeNote": null, 48 | "definition": { 49 | "en-US": "this is an example concept 2" 50 | }, 51 | "editorialNote": { 52 | "en-US": "deed" 53 | }, 54 | "example": { 55 | "en-US": "dedede" 56 | }, 57 | "historyNote": { 58 | "en-US": "edde" 59 | }, 60 | "scopeNote": { 61 | "en-US": "deedde" 62 | }, 63 | "notations": [], 64 | "broader": [ 65 | { 66 | "sys": { 67 | "id": "5yddoLMAMMPcsFqEQAqvd3", 68 | "type": "Link", 69 | "linkType": "TaxonomyConcept" 70 | } 71 | } 72 | ], 73 | "related": [] 74 | } -------------------------------------------------------------------------------- /src/test/resources/ui_extensions_create_with_html_data.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": { 3 | "srcdoc": " Sample Editor Extension<title> <link rel='stylesheet' href='https://contentful.github.io/ui-extensions-sdk/cf-extension.css'> <script src='https://contentful.github.io/ui-extensions-sdk/cf-extension-api.js'></script> </head> <body> <div id='content'></div> <script> window.contentfulExtension.init(function (extension) { window.alert(extension); var value = extension.field.getValue() extension.field.setValue('Hello world!')extension.field.onValueChanged(function(value) { if (value !== currentValue) { extension.field.setValue('Hello world!') } }) }) </script> </body> </html>", 4 | "name": "My awesome extension by srcDoc", 5 | "fieldTypes": [ 6 | { 7 | "type": "Symbol" 8 | }, 9 | { 10 | "type": "Text" 11 | } 12 | ], 13 | "sidebar": false 14 | }, 15 | "sys": { 16 | "id": "4dBWHpKhao8AuYAMcosSyw", 17 | "type": "Extension", 18 | "version": 1, 19 | "createdAt": "2017-06-29T10:07:47.689Z", 20 | "createdBy": { 21 | "sys": { 22 | "type": "Link", 23 | "linkType": "User", 24 | "id": "<user_id>" 25 | } 26 | }, 27 | "space": { 28 | "sys": { 29 | "type": "Link", 30 | "linkType": "Space", 31 | "id": "<space_id>" 32 | } 33 | }, 34 | "updatedAt": "2017-06-29T10:07:47.690Z", 35 | "updatedBy": { 36 | "sys": { 37 | "type": "Link", 38 | "linkType": "User", 39 | "id": "<user_id>" 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/ui_extensions_create_with_html_data_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": { 3 | "srcdoc": "<!doctype html> <html lang='en'> <head> <meta charset='UTF-8'/> <title>Sample Editor Extension<itle> <link rel='stylesheet' href='https://contentful.github.io/ui-extensions-sdk/cf-extension.css'> <script src='https://contentful.github.io/ui-extensions-sdk/cf-extension-api.js'></script> </head> <body> <div id='content'></div> <script> window.contentfulExtension.init(function (extension) { var value = extension.field.getValue() extension.field.setValue('Hello world!')extension.field.onValueChanged(function(value) { if (value !== currentValue) { extension.field.setValue('Hello world!') } }) }) </script> </body> </html>", 4 | "name": "My awesome extension by srcDoc", 5 | "fieldTypes": [ 6 | { 7 | "type": "Symbol" 8 | }, 9 | { 10 | "type": "Text" 11 | } 12 | ], 13 | "sidebar": false 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/ui_extensions_create_with_url.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": { 3 | "src": "https://example.com/my", 4 | "name": "My awesome extension", 5 | "fieldTypes": [ 6 | { 7 | "type": "Symbol" 8 | }, 9 | { 10 | "type": "Text" 11 | } 12 | ], 13 | "sidebar": false 14 | }, 15 | "sys": { 16 | "id": "newId", 17 | "type": "Extension", 18 | "version": 1, 19 | "createdAt": "2017-06-29T10:05:52.592Z", 20 | "createdBy": { 21 | "sys": { 22 | "type": "Link", 23 | "linkType": "User", 24 | "id": "<user_id>" 25 | } 26 | }, 27 | "space": { 28 | "sys": { 29 | "type": "Link", 30 | "linkType": "Space", 31 | "id": "<space_id>" 32 | } 33 | }, 34 | "updatedAt": "2017-06-29T10:05:52.592Z", 35 | "updatedBy": { 36 | "sys": { 37 | "type": "Link", 38 | "linkType": "User", 39 | "id": "<user_id>" 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/ui_extensions_create_with_url_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": { 3 | "src": "https://example.com/my", 4 | "name": "My awesome extension", 5 | "fieldTypes": [ 6 | { 7 | "type": "Symbol" 8 | }, 9 | { 10 | "type": "Text" 11 | } 12 | ], 13 | "sidebar": false 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/ui_extensions_delete.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/ui_extensions_delete.json -------------------------------------------------------------------------------- /src/test/resources/ui_extensions_get_one.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": { 3 | "srcdoc": "<!doctype html> <html lang='en'> <head> <meta charset='UTF-8'/> <title>Sample Editor Extension<itle> <link rel='stylesheet' href='https://contentful.github.io/ui-extensions-sdk/cf-extension.css'> <script src='https://contentful.github.io/ui-extensions-sdk/cf-extension-api.js'></script> </head> <body> <div id='content'></div> <script> window.contentfulExtension.init(function (extension) { var value = extension.field.getValue() extension.field.setValue('Hello world!')extension.field.onValueChanged(function(value) { if (value !== currentValue) { extension.field.setValue('Hello world!') } }) }) </script> </body> </html>", 4 | "name": "My awesome extension by srcDoc", 5 | "fieldTypes": [ 6 | { 7 | "type": "Symbol" 8 | }, 9 | { 10 | "type": "Text" 11 | } 12 | ], 13 | "sidebar": false 14 | }, 15 | "sys": { 16 | "id": "4dBWHpKhao8AuYAMcosSyw", 17 | "type": "Extension", 18 | "version": 1, 19 | "createdAt": "2017-06-29T10:07:47.689Z", 20 | "createdBy": { 21 | "sys": { 22 | "type": "Link", 23 | "linkType": "User", 24 | "id": "<user_id>" 25 | } 26 | }, 27 | "space": { 28 | "sys": { 29 | "type": "Link", 30 | "linkType": "Space", 31 | "id": "<space_id>" 32 | } 33 | }, 34 | "updatedAt": "2017-06-29T10:07:47.690Z", 35 | "updatedBy": { 36 | "sys": { 37 | "type": "Link", 38 | "linkType": "User", 39 | "id": "<user_id>" 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/ui_extensions_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": { 3 | "src": "http://example.com/my", 4 | "name": "My awesome extension by srcUrl", 5 | "fieldTypes": [ 6 | { 7 | "type": "Symbol" 8 | }, 9 | { 10 | "type": "Text" 11 | } 12 | ], 13 | "sidebar": false 14 | }, 15 | "sys": { 16 | "id": "2ZJduY1pKEma6G8Y2ImqYU", 17 | "type": "Extension", 18 | "version": 1, 19 | "createdAt": "2017-06-29T11:04:33.874Z", 20 | "createdBy": { 21 | "sys": { 22 | "type": "Link", 23 | "linkType": "User", 24 | "id": "<user_id>" 25 | } 26 | }, 27 | "space": { 28 | "sys": { 29 | "type": "Link", 30 | "linkType": "Space", 31 | "id": "<space_id>" 32 | } 33 | }, 34 | "updatedAt": "2017-06-29T11:04:33.874Z", 35 | "updatedBy": { 36 | "sys": { 37 | "type": "Link", 38 | "linkType": "User", 39 | "id": "<user_id>" 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/test/resources/ui_extensions_update_payload.json: -------------------------------------------------------------------------------- 1 | { 2 | "extension": { 3 | "srcdoc": "<!doctype html><html lang='en'><head><meta charset='UTF-8'/><title>Sample Editor Extension

", 4 | "name": "My awesome extension by src doc thingy", 5 | "fieldTypes": [ 6 | { 7 | "type": "Symbol" 8 | }, 9 | { 10 | "type": "Text" 11 | } 12 | ], 13 | "sidebar": false 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/upload_get_upload_with_id.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "upload_id", 4 | "type": "Upload", 5 | "createdAt": "2017-02-22T15:17:27.000Z", 6 | "expiresAt": "2017-02-24T00:00:00.000Z", 7 | "space": { 8 | "sys": { 9 | "type": "Link", 10 | "linkType": "Space", 11 | "id": "0ixrn4rxzjob" 12 | } 13 | }, 14 | "createdBy": { 15 | "sys": { 16 | "type": "Link", 17 | "linkType": "User", 18 | "id": "7uqvFPPLzgtVaezGvjA9U6" 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/upload_post_payload.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/upload_post_payload.jpg -------------------------------------------------------------------------------- /src/test/resources/upload_post_payload_bigger.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/upload_post_payload_bigger.jpg -------------------------------------------------------------------------------- /src/test/resources/upload_post_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "upload_id", 4 | "type": "Upload", 5 | "createdAt": "2017-02-22T15:17:27.000Z", 6 | "expiresAt": "2017-02-24T00:00:00.000Z", 7 | "space": { 8 | "sys": { 9 | "type": "Link", 10 | "linkType": "Space", 11 | "id": "0ixrn4rxzjob" 12 | } 13 | }, 14 | "createdBy": { 15 | "sys": { 16 | "type": "Link", 17 | "linkType": "User", 18 | "id": "7uqvFPPLzgtVaezGvjA9U6" 19 | } 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/upload_welcome_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "type": "Welcome" 4 | }, 5 | "message": "Read the docs: https://www.contentful.com/developers/docs/references/content-management-api" 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/users_get_me.json: -------------------------------------------------------------------------------- 1 | { 2 | "firstName":"Mario", 3 | "lastName":"Bodemann", 4 | "avatarUrl":"https://avatars.githubusercontent.com/u/1162562?v=3", 5 | "email":"mario@contentful.com", 6 | "activated":true, 7 | "signInCount":68, 8 | "confirmed":true, 9 | "sys":{ 10 | "type":"User", 11 | "id":"", 12 | "version":126, 13 | "createdAt":"", 14 | "updatedAt":"" 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/test/resources/webhook_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"cma-created", 3 | "url":"https://contentful.com", 4 | "httpBasicUsername":"user", 5 | "topics":[ 6 | "Entry.*" 7 | ], 8 | "filters":null, 9 | "transformation":{ 10 | "method":"PUT", 11 | "contentType":"application/json; charset=utf-8", 12 | "includeContentLength":true, 13 | "body":"{ /payload/sys/id }: { /payload/fields/title }" 14 | }, 15 | "sys":{ 16 | "type":"WebhookDefinition", 17 | "id":"5epBQND7dLGecdktBMpgPB", 18 | "version":0, 19 | "space":{ 20 | "sys":{ 21 | "type":"Link", 22 | "linkType":"Space", 23 | "id":"" 24 | } 25 | }, 26 | "createdBy":{ 27 | "sys":{ 28 | "type":"Link", 29 | "linkType":"User", 30 | "id":"" 31 | } 32 | }, 33 | "createdAt":"2019-06-17T04:45:36Z", 34 | "updatedBy":{ 35 | "sys":{ 36 | "type":"Link", 37 | "linkType":"User", 38 | "id":"" 39 | } 40 | }, 41 | "updatedAt":"2019-06-17T04:45:36Z" 42 | }, 43 | "headers":[ 44 | { 45 | "key":"key", 46 | "value":"value" 47 | } 48 | ] 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/test/resources/webhook_create_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cma-created", 3 | "url": "https://contentful.com", 4 | "topics":[ "Entry.*" ], 5 | "headers": [ 6 | { 7 | "key": "key", 8 | "value": "value" 9 | } 10 | ], 11 | "httpBasicUsername": "user", 12 | "httpBasicPassword": "password", 13 | "transformation":{ 14 | "method":"PUT", 15 | "contentType":"application/json; charset=utf-8", 16 | "includeContentLength":true, 17 | "body":"{ /payload/sys/id }: { /payload/fields/title }" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/webhook_create_with_id_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cma-created", 3 | "url": "http://lorempixel.com/200/200/cats", 4 | "topics": [ 5 | "Entry.save" 6 | ], 7 | "headers": [ 8 | { 9 | "key": "key", 10 | "value": "value" 11 | } 12 | ], 13 | "httpBasicUsername": "user", 14 | "httpBasicPassword": "password" 15 | } -------------------------------------------------------------------------------- /src/test/resources/webhook_create_with_id_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "url":"http://example.com", 3 | "httpBasicUsername":null, 4 | "name":"cma-created", 5 | "headers":[], 6 | "topics":[ 7 | "Entry.Save" 8 | ], 9 | "sys":{ 10 | "type":"WebhookDefinition", 11 | "id":"webhookid", 12 | "version":0, 13 | "space":{ 14 | "sys":{ 15 | "type":"Link", 16 | "linkType":"Space", 17 | "id":"" 18 | } 19 | }, 20 | "createdBy":{ 21 | "sys":{ 22 | "type":"Link", 23 | "linkType":"User", 24 | "id":"" 25 | } 26 | }, 27 | "createdAt":"2016-07-26T09:48:13Z", 28 | "updatedBy":{ 29 | "sys":{ 30 | "type":"Link", 31 | "linkType":"User", 32 | "id":"" 33 | } 34 | }, 35 | "updatedAt":"2016-07-26T09:48:13Z" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/test/resources/webhook_delete.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/contentful/contentful-management.java/4d19a138a821cf53762187811795822e5cc23fcc/src/test/resources/webhook_delete.json -------------------------------------------------------------------------------- /src/test/resources/webhook_get_one.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"cma-created", 3 | "url":"https://contentful.com", 4 | "httpBasicUsername":"user", 5 | "topics":[ 6 | "Entry.*" 7 | ], 8 | "filters":null, 9 | "transformation":{ 10 | "method":"PUT", 11 | "contentType":"application/json; charset=utf-8", 12 | "includeContentLength":true, 13 | "body":"{ /payload/sys/id }: { /payload/fields/title }" 14 | }, 15 | "sys":{ 16 | "type":"WebhookDefinition", 17 | "id":"3mxXKShPg8N7ZMTnfFaDFL", 18 | "version":0, 19 | "space":{ 20 | "sys":{ 21 | "type":"Link", 22 | "linkType":"Space", 23 | "id":"" 24 | } 25 | }, 26 | "createdBy":{ 27 | "sys":{ 28 | "type":"Link", 29 | "linkType":"User", 30 | "id":"" 31 | } 32 | }, 33 | "createdAt":"2019-06-17T04:43:53Z", 34 | "updatedBy":{ 35 | "sys":{ 36 | "type":"Link", 37 | "linkType":"User", 38 | "id":"" 39 | } 40 | }, 41 | "updatedAt":"2019-06-17T04:43:53Z" 42 | }, 43 | "headers":[ 44 | { 45 | "key":"key", 46 | "value":"value" 47 | } 48 | ] 49 | } 50 | 51 | -------------------------------------------------------------------------------- /src/test/resources/webhook_health_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "sys": { 3 | "id": "cma-created", 4 | "type": "Webhook", 5 | "space": { 6 | "sys": { 7 | "type": "Link", 8 | "linkType": "Space", 9 | "id": "" 10 | } 11 | }, 12 | "createdBy": { 13 | "sys": { 14 | "type": "Link", 15 | "linkType": "WebhookDefinition", 16 | "id": "cma-created" 17 | } 18 | } 19 | }, 20 | "calls": { 21 | "total": 5, 22 | "healthy": 0 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/test/resources/webhook_update.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"cma-created", 3 | "url":"https://contentful.com", 4 | "httpBasicUsername":"user", 5 | "topics":[ 6 | "Entry.*" 7 | ], 8 | "filters":null, 9 | "transformation":{ 10 | "body":"{ /payload/sys/id }: { /payload/fields/new }" 11 | }, 12 | "sys":{ 13 | "type":"WebhookDefinition", 14 | "id":"5epBQND7dLGecdktBMpgPB", 15 | "version":2, 16 | "space":{ 17 | "sys":{ 18 | "type":"Link", 19 | "linkType":"Space", 20 | "id":"" 21 | } 22 | }, 23 | "createdBy":{ 24 | "sys":{ 25 | "type":"Link", 26 | "linkType":"User", 27 | "id":"" 28 | } 29 | }, 30 | "createdAt":"2019-06-17T04:45:36Z", 31 | "updatedBy":{ 32 | "sys":{ 33 | "type":"Link", 34 | "linkType":"User", 35 | "id":"" 36 | } 37 | }, 38 | "updatedAt":"2019-06-17T04:59:53Z" 39 | }, 40 | "headers":[ 41 | { 42 | "key":"my_new_header_name", 43 | "value":"header_value" 44 | } 45 | ] 46 | } 47 | 48 | -------------------------------------------------------------------------------- /src/test/resources/webhook_update_request.json: -------------------------------------------------------------------------------- 1 | { 2 | "transformation":{ 3 | "body":"{ /payload/sys/id }: { /payload/fields/new }" 4 | }, 5 | "headers": [ 6 | { 7 | "key": "my_new_header_name", 8 | "value": "header_value" 9 | } 10 | ], 11 | "sys": { 12 | "id": "webhookid", 13 | "version": 3, 14 | "space": { 15 | "sys": { 16 | "id": "spaceid" 17 | } 18 | } 19 | } 20 | } 21 | --------------------------------------------------------------------------------