Skip to content

Commit 8ed3837

Browse files
Rename BaseURL parameter.
1 parent 15cd987 commit 8ed3837

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
lines changed

src/main/java/com/squidex/api/AuthInterceptor.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import org.jetbrains.annotations.NotNull;
66

77
import java.io.IOException;
8-
import java.time.Instant;
98
import java.util.Objects;
109

1110
import okhttp3.FormBody;
@@ -18,15 +17,15 @@
1817

1918
public final class AuthInterceptor implements Interceptor {
2019
private final Gson gson = new Gson();
21-
private final String baseUrl;
20+
private final String url;
2221
private final String clientId;
2322
private final String clientSecret;
2423
private final TokenStore tokenStore;
2524
private final OkHttpClient httpClient;
2625

27-
public AuthInterceptor(OkHttpClient httpClient, String baseUrl, String clientId, String clientSecret, TokenStore tokenStore) {
26+
public AuthInterceptor(OkHttpClient httpClient, String url, String clientId, String clientSecret, TokenStore tokenStore) {
2827
this.httpClient = httpClient;
29-
this.baseUrl = baseUrl;
28+
this.url = url;
3029
this.clientId = clientId;
3130
this.clientSecret = clientSecret;
3231
this.tokenStore = tokenStore;
@@ -72,7 +71,7 @@ private AccessToken acquireToken() throws IOException {
7271
.add("scope", "squidex-api")
7372
.build();
7473

75-
HttpUrl tokenUrl = Objects.requireNonNull(HttpUrl.parse(baseUrl))
74+
HttpUrl tokenUrl = Objects.requireNonNull(HttpUrl.parse(url))
7675
.newBuilder()
7776
.addPathSegments("identity-server/connect/token")
7877
.build();

src/main/java/com/squidex/api/SquidexClient.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ public class SquidexClient {
5050
private final String appName;
5151
private final String clientId;
5252
private final String clientSecret;
53-
private final String baseUrl;
53+
private final String url;
5454

5555
public SquidexClient(ApiClient apiClient, String appName, String clientId, String clientSecret, String baseUrl) {
5656
this.appName = appName;
5757
this.clientId = clientId;
5858
this.clientSecret = clientSecret;
59-
this.baseUrl = baseUrl;
59+
this.url = baseUrl;
6060
this.appsApi = memoize(() -> new AppsApi(apiClient));
6161
this.assetsApi = memoize(() -> new AssetsApi(apiClient));
6262
this.backupsApi = memoize(() -> new BackupsApi(apiClient));
@@ -106,8 +106,8 @@ public String getClientSecret() {
106106
return clientSecret;
107107
}
108108

109-
public String getBaseUrl() {
110-
return baseUrl;
109+
public String getUrl() {
110+
return url;
111111
}
112112

113113
public UserManagementApi userManagement() {

src/main/java/com/squidex/api/SquidexClientBuilder.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,23 @@
1818
import okhttp3.Response;
1919

2020
public final class SquidexClientBuilder {
21-
private String baseUrl = "https://cloud.squidex.io";
21+
private String url = "https://cloud.squidex.io";
2222
private String clientId;
2323
private String clientSecret;
2424
private String appName;
2525
private TokenStore tokenStore;
2626
private OkHttpClient httpClient;
2727
private boolean trustAllCerts;
2828

29-
public SquidexClientBuilder baseUrl(String baseUrl) {
30-
this.baseUrl = baseUrl;
29+
public SquidexClientBuilder url(String url) {
30+
this.url = url;
3131
return this;
3232
}
3333

34+
public String url() {
35+
return this.url;
36+
}
37+
3438
public SquidexClientBuilder clientId(String clientId) {
3539
this.clientId = clientId;
3640
return this;
@@ -124,7 +128,7 @@ public java.security.cert.X509Certificate[] getAcceptedIssuers() {
124128

125129
AuthInterceptor interceptor = new AuthInterceptor(
126130
this.httpClient,
127-
this.baseUrl,
131+
this.url,
128132
this.clientId,
129133
this.clientSecret,
130134
this.tokenStore);
@@ -148,9 +152,9 @@ public Response intercept(@NotNull Chain chain) throws IOException {
148152
.build();
149153

150154
ApiClient apiClient = new ApiClient(this.httpClient);
151-
apiClient.setBasePath(this.baseUrl);
155+
apiClient.setBasePath(this.url);
152156
apiClient.setVerifyingSsl(!this.trustAllCerts);
153157

154-
return new SquidexClient(apiClient, this.appName, this.clientId, this.clientSecret, this.baseUrl);
158+
return new SquidexClient(apiClient, this.appName, this.clientId, this.clientSecret, this.url);
155159
}
156160
}

src/test/java/com/squidex/api/TestSetup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public void beforeAll(ExtensionContext context) throws Exception {
1818
System.out.printf("Using <appName>=<%s>%n", client.getAppName());
1919
System.out.printf("Using <clientId>=<%s>%n", client.getClientId());
2020
System.out.printf("Using <clientSecret>=<%s>%n", client.getClientSecret());
21-
System.out.printf("Using <baseUrl>=<%s>%n", client.getBaseUrl());
21+
System.out.printf("Using <baseUrl>=<%s>%n", client.getUrl());
2222

2323
this.waitForServer();
2424

src/test/java/com/squidex/api/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public static ClientProvider getClient() {
3737
.appName(appName)
3838
.clientId(clientId)
3939
.clientSecret(clientSecret)
40-
.baseUrl(environment);
40+
.url(environment);
4141

4242
singleClient = new ClientProvider(builder, builder.build());
4343

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy