Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,45 @@ public AppStoreServerAPIClient(BearerTokenAuthenticatorInterface bearerTokenAuth
this.urlBase = HttpUrl.parse(this.url);
}

/**
* Create an App Store Server API client with a custom HTTP proxy
* @param bearerTokenAuthenticator An implementation of {@link BearerTokenAuthenticatorInterface} that provides tokens
* @param environment The environment to target
* @param proxy Optional HTTP proxy (can be null for direct connection)
*/
public AppStoreServerAPIClient(BearerTokenAuthenticatorInterface bearerTokenAuthenticator,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have the existing constructor delegate to these new constructors with a null proxy please? That should reduce code duplication

Environment environment,
java.net.Proxy proxy) {
super(bearerTokenAuthenticator, environment);
OkHttpClient.Builder builder = new OkHttpClient.Builder();
if (proxy != null) {
builder.proxy(proxy);
}
// Use system authenticator for proxy credentials if needed
builder.proxyAuthenticator(Authenticator.JAVA_NET_AUTHENTICATOR);
this.httpClient = builder.build();
this.urlBase = HttpUrl.parse(this.url);
}

/**
* Create an App Store Server API client with proxy and signing credentials
* @param signingKey Your private key downloaded from App Store Connect
* @param keyId Your private key ID from App Store Connect
* @param issuerId Your issuer ID from the Keys page in App Store Connect
* @param bundleId Your app’s bundle ID
* @param environment The environment to target
* @param proxy Optional HTTP proxy (can be null for direct connection)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we reword this slightly to HTTP Proxy, use null for direct connections

*/
public AppStoreServerAPIClient(String signingKey,
String keyId,
String issuerId,
String bundleId,
Environment environment,
java.net.Proxy proxy) {
this(new BearerTokenAuthenticator(signingKey, keyId, issuerId, bundleId), environment, proxy);
}


@Override
protected HttpResponseInterface makeRequest(String path,
String method,
Expand Down