├── .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}'/