Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
13 changes: 6 additions & 7 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
{
"cliVersion": "5.90.1",
"cliVersion": "5.213.0",
"generatorName": "fernapi/fern-java-sdk",
"generatorVersion": "4.9.1",
"generatorVersion": "4.37.6",
"generatorConfig": {
"package-prefix": "com.whop.api",
"group": "com.whop.api",
"artifact": "whop-java"
},
"originGitCommit": "a26a97d2d8ee29f78819a299712fb3b4086d634e",
"originGitCommitIsDirty": false,
"originGitCommit": "6c2e2119355476e931ab5084119092783f82102e",
"originGitCommitIsDirty": true,
"invokedBy": "ci",
"requestedVersion": "1.0.11",
"ciProvider": "unknown",
"sdkVersion": "1.0.11"
"requestedVersion": "2.8.1",
"ciProvider": "unknown"
}
16 changes: 16 additions & 0 deletions .fern/replay.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

67 changes: 65 additions & 2 deletions .fernignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,63 @@
# Specify files that shouldn't be modified by Fern
# Files Fern must not modify or delete when regenerating this repo.
#
# Fern prunes anything it did not generate, and it reads this file from the pull request's
# base branch — so an entry only protects a file once it is on main.
#
# publish-main.yml is hand-written: it releases com.whop.api:whop-java when a merge to main
# lands a gradle.properties version that is not yet published, and it is meant to be the
# only publish path. It has two targets behind one set of guards — GitHub Packages
# (whopio-internal, authenticated with the run's own GITHUB_TOKEN, no namespace to
# register) and the Sonatype Central Portal (public, blocked on DNS verification and a
# signing key). RELEASE_TARGET sets the default, a workflow_dispatch input overrides it,
# and every pull request rehearses both so neither path rots while the other is the live
# one.
#
# stamp-version.py is that workflow's version stamp: gradle.properties, every source file
# carrying X-Fern-SDK-Version, and .fern/metadata.json. It is a file rather than a script
# inlined into one job because both publish paths build the same commit and have to stamp
# it identically.
#
# gradle.properties is the version of record and the release trigger. The Fern Java
# generator writes no version and no group into build.gradle at all — `gradle properties`
# on the delivered tree reports `version: unspecified`, an empty group and an artifact name
# taken from the checkout directory — so without this file the project has no Maven
# coordinate. Gradle reads `group` and `version` from gradle.properties natively, which
# keeps the coordinate out of the generated build.gradle and lets Fern keep owning the
# dependency list there.
#
# release.gradle is the Gradle init script that adds the MavenPublication: the POM (name,
# description, url, licenses, developers, scm) that Maven Central requires, the whop-java
# archive name, a repository that stages the bundle to build/bundle instead of uploading
# it, and the GitHub Packages repository the internal release publishes to. Applying it
# with -I rather than editing build.gradle means a regeneration cannot silently drop it
# and Fern keeps ownership of the build file — including the four `api` dependencies,
# which are the reason a real POM and not a bare jar is what has to reach consumers.
#
# ci.yml is hand-written for a security reason, not a stylistic one. The Fern Java
# generator's GithubWorkflowGenerator emits a tag-gated `publish` job — `if:
# github.event_name == 'push' && contains(github.ref, 'refs/tags/')`, running `./gradlew
# publish` or `./gradlew sonatypeCentralUpload` with MAVEN_USERNAME, MAVEN_PASSWORD,
# MAVEN_SIGNATURE_KID, MAVEN_SIGNATURE_SECRET_KEY and MAVEN_SIGNATURE_PASSWORD in the same
# environment as Gradle's dependency resolution — whenever the generator is configured
# with a Maven registry. The java-release group in the monorepo's sdks/fern/generators.yml
# has no maven output today, so the ci.yml Fern delivered in whopsdk-java#1 is compile+test
# only. Adding that output is the obvious next step for anyone wiring Maven publishing
# through Fern, and it would introduce a second unreviewed publish path that also fires on
# the tag publish-main.yml creates. Because Fern reads this file from the base branch, the
# entry has to exist before that regeneration, not after it. Ours is the generated file
# with the publish job that cannot appear, modernised off actions/setup-java@v1.
#
# LICENSE: Fern does not carry over a LICENSE, and the POM this repo publishes declares
# Apache-2.0 — the same license the python-release and ruby-release groups pass to Fern.
# Without this entry the first regeneration would delete the file the POM points at.
.github/workflows/ci.yml
.github/workflows/publish-main.yml
.github/release.gradle
.github/stamp-version.py
.github/package-smoke/
gradle.properties
LICENSE
MIGRATING.md

# src/main/java/com/whop/api/helpers/oidc is the hand-written OIDC helper. OidcToken and
# IdentityTokens trade a cloud provider's identity token for a short-lived Whop access token and
Expand All @@ -8,7 +67,8 @@
# WhopOidc subclasses both; apiVersionDate(String), overridden to note a pinned version; the
# protected setAuthentication hook, overridden; the protected setCustomHeaders hook,
# overridden to call super and add Api-Version-Date when none is pinned; and the async
# builder's protected buildClientOptions, overridden to call super and rebuild its options.
# builder's build, overridden to authenticate a derived client while retaining the original
# options' HTTP-client ownership and close behavior.
# - core.ClientOptions: httpClient(), Builder.from, Builder.addHeader(String, Supplier),
# Builder.addHeader(String, String), Builder.httpClient, Builder.timeout(Optional) and
# Builder.build.
Expand All @@ -21,3 +81,6 @@
# users().retrieve, core.ILogger, core.LogConfig, core.LogLevel and ApiKeyApiVersionDate.Value.
src/main/java/com/whop/api/helpers/
src/test/java/com/whop/api/helpers/
.fern/replay.lock
.fern/replay.yml
.gitattributes
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.fern/replay.lock linguist-generated=true
16 changes: 16 additions & 0 deletions .github/package-smoke/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
plugins {
id 'application'
}

repositories {
maven { url = uri(providers.gradleProperty('sdkRepository').get()) }
mavenCentral()
}

dependencies {
implementation "com.whop.api:whop-java:${providers.gradleProperty('sdkVersion').get()}"
}

application {
mainClass = 'PackageConsumer'
}
1 change: 1 addition & 0 deletions .github/package-smoke/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = 'whop-java-package-smoke'
129 changes: 129 additions & 0 deletions .github/package-smoke/src/main/java/PackageConsumer.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.whop.api.AsyncWhopApiClient;
import com.whop.api.WhopApiClient;
import com.whop.api.core.Environment;
import com.whop.api.helpers.oidc.OidcToken;
import com.whop.api.helpers.oidc.WhopOidc;
import com.whop.api.resources.stats.requests.RetrieveStatsRequest;
import com.whop.api.types.ApiKeyApiVersionDate;
import com.whop.api.types.FunnelStep;
import com.whop.api.types.RetrieveStatsRequestSteps;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Protocol;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;

public final class PackageConsumer {
public static void main(String[] args) throws Exception {
String version = args[0];
require(
version.equals(WhopApiClient.class.getPackage().getImplementationVersion()),
"installed jar manifest has an incorrect version");
String apiVersion = java.util.Arrays.stream(ApiKeyApiVersionDate.class.getFields())
.filter(field ->
Modifier.isStatic(field.getModifiers()) && field.getType() == ApiKeyApiVersionDate.class)
.map(field -> {
try {
return field.get(null).toString();
} catch (IllegalAccessException exception) {
throw new IllegalStateException(exception);
}
})
.max(String::compareTo)
.orElseThrow(IllegalStateException::new);
List<Request> requests = new ArrayList<>();
OkHttpClient transport = new OkHttpClient.Builder()
.addInterceptor(chain -> {
requests.add(chain.request());
Object body = chain.request().url().encodedPath().contains("/stats/")
? java.util.Collections.singletonMap(
"data",
java.util.Collections.singletonMap("points", java.util.Collections.emptyList()))
: java.util.Collections.singletonMap("id", "user_smoke");
return new Response.Builder()
.request(chain.request())
.protocol(Protocol.HTTP_1_1)
.code(200)
.message("OK")
.body(ResponseBody.create(
new ObjectMapper().writeValueAsBytes(body), MediaType.parse("application/json")))
.build();
})
.build();
try (WhopApiClient client = WhopApiClient.builder()
.environment(Environment.SANDBOX)
.token("package-smoke")
.httpClient(transport)
.build();
AsyncWhopApiClient async = AsyncWhopApiClient.builder()
.environment(Environment.SANDBOX)
.token("package-smoke")
.httpClient(transport)
.build()) {
client.users().retrieve("me");
async.users().retrieve("me").get(10, TimeUnit.SECONDS);
client.stats()
.retrieve(
"funnel",
RetrieveStatsRequest.builder()
.from("2026-11-01")
.to("2026-11-02")
.steps(RetrieveStatsRequestSteps.builder()
._1(FunnelStep.builder()
.event("pixel.page")
.page("/pricing*")
.build())
._2(FunnelStep.builder()
.event("payment.completed")
.build())
.build())
.build());
for (Request request : requests) {
require(
version.equals(request.header("X-Fern-SDK-Version")),
"installed jar sent an incorrect SDK version");
require("sandbox-api.whop.com".equals(request.url().host()), "sandbox client selected the wrong host");
require(
"Bearer package-smoke".equals(request.header("Authorization")),
"authentication header is missing");
require(
apiVersion.equals(request.header("Api-Version-Date")),
"API version pin does not match the generated models");
}
require(requests.size() == 3, "sync, async and stats calls did not all complete");
okhttp3.HttpUrl funnelUrl = requests.get(2).url();
require(
"pixel.page".equals(funnelUrl.queryParameter("steps[1][event]")),
"first funnel event lost its one-based deep-object key");
require(
"/pricing*".equals(funnelUrl.queryParameter("steps[1][page]")),
"funnel filter lost its nested key");
require(
"payment.completed".equals(funnelUrl.queryParameter("steps[2][event]")),
"second funnel event lost its one-based deep-object key");
} finally {
transport.dispatcher().executorService().shutdown();
transport.connectionPool().evictAll();
}
try (WhopApiClient syncOidc = WhopOidc.clientBuilder(OidcToken.of("aurl_smoke", () -> "not-requested"))
.build();
AsyncWhopApiClient asyncOidc = WhopOidc.asyncClientBuilder(
OidcToken.of("aurl_smoke", () -> "not-requested"))
.build()) {
require(syncOidc != null && asyncOidc != null, "OIDC helpers are missing from the installed jar");
}
System.out.println(
"Verified Maven consumer, transitive dependencies, sync/async routing, version headers and OIDC entrypoints for "
+ version);
}

private static void require(boolean condition, String message) {
if (!condition) throw new IllegalStateException(message);
}
}
70 changes: 70 additions & 0 deletions .github/release.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
gradle.projectsLoaded {
gradle.rootProject { root ->
root.afterEvaluate {
root.base.archivesName = 'whop-java'
root.tasks.named('jar') {
manifest.attributes('Implementation-Version': root.version)
}

root.publishing {
publications {
maven(MavenPublication) {
groupId = root.group
artifactId = 'whop-java'
version = root.version
from root.components.java

pom {
name = 'Whop Java SDK'
description = 'The official Java SDK for the Whop API.'
url = 'https://github.com/whopio/whopsdk-java'
licenses {
license {
name = 'Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'whop'
name = 'Whop'
email = 'support@whop.com'
organization = 'Whop'
organizationUrl = 'https://whop.com'
}
}
scm {
url = 'https://github.com/whopio/whopsdk-java'
connection = 'scm:git:https://github.com/whopio/whopsdk-java.git'
developerConnection = 'scm:git:ssh://git@github.com/whopio/whopsdk-java.git'
}
}
}
}

repositories {
maven {
name = 'bundle'
url = root.layout.buildDirectory.dir('bundle')
}

// Same publication, same POM, same coordinate as Central — only the
// transport differs, so a consumer who later moves to Central changes
// a repository URL and not a dependency line. Credentials are read
// from the environment rather than a property so that the empty
// default keeps `-I` usable for bundle staging, where the task that
// needs them is never invoked; Gradle only demands them when
// publishMavenPublicationToGitHubPackagesRepository actually runs.
maven {
name = 'gitHubPackages'
url = System.getenv('GITHUB_PACKAGES_URL') ?: 'https://maven.pkg.github.com/whopio/whopsdk-java'
credentials {
username = System.getenv('GITHUB_ACTOR') ?: ''
password = System.getenv('GITHUB_TOKEN') ?: ''
}
}
}
}
}
}
}
Loading
Loading