Skip to content

Commit d2b9ded

Browse files
committed
Refactor: update ApiClient to handle MC_RESOURCES URL retrieval and bump version to 0.1.3.6-SNAPSHOT
1 parent 7e63f27 commit d2b9ded

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group = "fr.sandro642.github"
9-
version = "0.1.3.5-SNAPSHOT" // Version de votre projet
9+
version = "0.1.3.6-SNAPSHOT" // Version de votre projet
1010

1111
// Ajoutez cette tâche à votre build.gradle.kts
1212
tasks.register("printVersion") {

src/main/java/fr/sandro642/github/api/ApiClient.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,15 @@ public class ApiClient {
3232
* @param resourceType Type de ressource (peut être utilisé pour des configurations spécifiques).
3333
*/
3434
public ApiClient(ResourceType resourceType) {
35-
String baseUrl = (String) ConnectorAPI.StoreAndRetrieve().store.get(ConnectorAPI.StoreAndRetrieve().URL_KEY);
35+
String baseUrl;
36+
if (resourceType == ResourceType.MC_RESOURCES) {
37+
baseUrl = ConnectorAPI.YamlUtils().getURL();
38+
} else {
39+
baseUrl = ConnectorAPI.StoreAndRetrieve().store.get(ConnectorAPI.StoreAndRetrieve().URL_KEY).toString();
40+
}
41+
3642
if (baseUrl == null) {
37-
throw new RuntimeException("URL de base non trouvée. Assurez-vous d'avoir initialisé ConnectorAPI.");
43+
throw new RuntimeException("URL de base non trouvée. Assurez-vous d'avoir initialisé ConnectorAPI. ");
3844
}
3945

4046
this.webClient = WebClient.builder()

src/test/java/fr/sandro642/github/test/Main.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,21 @@ public void getUrl() {
2222
ConnectorAPI.initialize(ResourceType.TEST_RESOURCES);
2323

2424
System.out.println(ConnectorAPI.YamlUtils().getURL());
25+
26+
27+
28+
}
29+
30+
@Test
31+
public void outGetURL() {
32+
System.out.println(ConnectorAPI.StoreAndRetrieve().store.get(ConnectorAPI.StoreAndRetrieve().URL_KEY));
2533
}
2634

2735
@Test
2836
public void getRoute() {
2937
ConnectorAPI.initialize(ResourceType.TEST_RESOURCES);
3038

31-
System.out.println(ConnectorAPI.JobGetInfos().getRoutes(VersionType.V1_BRANCH, MethodType.GET, "info"));
39+
3240
}
3341

3442
public static void main(String[] args) {

0 commit comments

Comments
 (0)