Skip to content

Commit

Permalink
Delete contentful references
Browse files Browse the repository at this point in the history
See gh-21
  • Loading branch information
mbhave committed Nov 4, 2024
1 parent d202951 commit 9b2164f
Show file tree
Hide file tree
Showing 25 changed files with 1 addition and 1,974 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-hateoas'
implementation 'org.springframework.boot:spring-boot-starter-graphql'
implementation 'com.azure.spring:spring-cloud-azure-starter-keyvault-secrets'
implementation 'com.contentful.java:cma-sdk:3.4.12'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310'
implementation 'com.vladsch.flexmark:flexmark-all:0.64.8'
implementation 'org.apache.maven:maven-artifact:3.6.3'
Expand Down
19 changes: 0 additions & 19 deletions src/main/java/io/spring/projectapi/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,19 @@
package io.spring.projectapi;

import com.fasterxml.jackson.databind.ObjectMapper;
import io.spring.projectapi.ApplicationProperties.Contentful;
import io.spring.projectapi.ApplicationProperties.Github;
import io.spring.projectapi.contentful.ContentfulService;
import io.spring.projectapi.github.GithubOperations;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.web.reactive.function.client.WebClient;

@SpringBootApplication
@EnableConfigurationProperties(ApplicationProperties.class)
public class Application {

private static final String BASE_URL = "https://graphql.contentful.com/content/v1/spaces/%s/environments/%s";

@Bean
public ContentfulService contentfulService(ObjectMapper objectMapper, WebClient.Builder webClientBuilder,
ApplicationProperties properties) {
Contentful contentful = properties.getContentful();
String accessToken = contentful.getAccessToken();
String contentManagementToken = contentful.getContentManagementToken();
String spaceId = contentful.getSpaceId();
String environmentId = contentful.getEnvironmentId();
String baseUrl = BASE_URL.formatted(spaceId, environmentId);
WebClient webClient = webClientBuilder.baseUrl(baseUrl).build();
return new ContentfulService(objectMapper, webClient, accessToken, contentManagementToken, spaceId,
environmentId);
}

@Bean
public GithubOperations githubOperations(RestTemplateBuilder builder, ObjectMapper objectMapper,
ApplicationProperties properties) {
Expand Down
68 changes: 1 addition & 67 deletions src/main/java/io/spring/projectapi/ApplicationProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,83 +28,17 @@
@ConfigurationProperties(prefix = "projects")
public class ApplicationProperties {

private final Contentful contentful;

private final Github github;

@ConstructorBinding
ApplicationProperties(@DefaultValue Contentful contentful, @DefaultValue Github github) {
this.contentful = contentful;
ApplicationProperties(@DefaultValue Github github) {
this.github = github;
}

public Contentful getContentful() {
return this.contentful;
}

public Github getGithub() {
return this.github;
}

/**
* Properties to access Contentful's API.
*/
public static class Contentful {

/**
* Access token for Contentful's Content Delivery API.
*
* @see <a href=
* "https://www.contentful.com/developers/docs/references/content-delivery-api/">Content
* Delivery API</a>
*/
private String accessToken;

/**
* Access token for Contentful's Content Management API.
*
* @see <a href=
* "https://www.contentful.com/developers/docs/references/content-management-api/">Content
* Management API</a>
*/
private String contentManagementToken;

/**
* Contentful space id.
*/
private String spaceId;

/**
* Contentful environment id.
*/
private String environmentId;

@ConstructorBinding
Contentful(String accessToken, String contentManagementToken, String spaceId, String environmentId) {
this.accessToken = accessToken;
this.contentManagementToken = contentManagementToken;
this.spaceId = spaceId;
this.environmentId = environmentId;
}

public String getAccessToken() {
return this.accessToken;
}

public String getSpaceId() {
return this.spaceId;
}

public String getEnvironmentId() {
return this.environmentId;
}

public String getContentManagementToken() {
return this.contentManagementToken;
}

}

/**
* Properties to decide Github team membership.
*/
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9b2164f

Please sign in to comment.