{"id":37022754,"url":"https://github.com/p2-inc/phasetwo-java","last_synced_at":"2026-01-14T02:43:17.443Z","repository":{"id":61922019,"uuid":"555485387","full_name":"p2-inc/phasetwo-java","owner":"p2-inc","description":"Phase Two API Java SDK","archived":false,"fork":false,"pushed_at":"2025-08-25T10:42:06.000Z","size":192,"stargazers_count":13,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-25T11:49:25.783Z","etag":null,"topics":["alpha","java","sdk"],"latest_commit_sha":null,"homepage":"https://phasetwo.io","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/p2-inc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-21T17:16:19.000Z","updated_at":"2025-08-25T10:42:09.000Z","dependencies_parsed_at":"2024-06-18T23:40:38.692Z","dependency_job_id":"e534add6-0edd-449c-a1bc-650852c33e9d","html_url":"https://github.com/p2-inc/phasetwo-java","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/p2-inc/phasetwo-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2-inc%2Fphasetwo-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2-inc%2Fphasetwo-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2-inc%2Fphasetwo-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2-inc%2Fphasetwo-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/p2-inc","download_url":"https://codeload.github.com/p2-inc/phasetwo-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/p2-inc%2Fphasetwo-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpha","java","sdk"],"created_at":"2026-01-14T02:43:16.150Z","updated_at":"2026-01-14T02:43:17.434Z","avatar_url":"https://github.com/p2-inc.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e :bug: **This is alpha software**\n\n# Java SDK for Phase Two API\n\nThe Phase Two Java SDK library provides access to the Phase Two API from applications written in JVM-compatible languages.\n\n## Documentation\n\nSee the [API Reference]([https://phasetwo.io/api/](https://phasetwo.io/api/phase-two-admin-rest-api)) and [Javadoc](https://javadoc.io/doc/io.phasetwo/phasetwo-admin-client)\n\n## Installation\n\n### Maven\n\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003eio.phasetwo\u003c/groupId\u003e\n  \u003cartifactId\u003ephasetwo-admin-client\u003c/artifactId\u003e\n  \u003cversion\u003eVERSION\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n\n```\ndependencies {\n  implementation 'io.phasetwo:phasetwo-admin-client:VERSION'\n}\n```\n\n## Use\n\nThe Java SDK assumes the use of the offical Keycloak Admin API Client to create a connection to the Phase Two API.\n\n```java\nimport org.keycloak.OAuth2Constants;\nimport org.keycloak.admin.client.Keycloak;\nimport org.keycloak.admin.client.KeycloakBuilder;\nimport io.phasetwo.client.PhaseTwo;\nimport java.util.Optional;\n\n// Configure the API connection\n// use they Keycloak \"authServerUrl\" that contains the relative path\nString serverUrl = \"https://my-phasetwo-host/auth\";\nString realm = \"my_realm_name\";\n\nKeycloak keycloak = KeycloakBuilder.builder()\n    .serverUrl(serverUrl)\n    .realm(realm)\n    .grantType(OAuth2Constants.CLIENT_CREDENTIALS)\n    .clientId(\"my_client_id\")\n    .clientSecret(\"my_client_secret\")\n    .build();\n\nPhaseTwo phaseTwo = new PhaseTwo(keycloak, serverUrl);\n\n// Create an Organization\nOrganizationRepresentation org = new OrganizationRepresentation().name(\"example\");\nString orgId = phaseTwo.organizations(realm).create(org);\n\n// Create an Admin Portal link for the Organization\nphaseTwo.organizations(realm).organization(orgId).portalLink(Optional.empty());\n\n// Create and publish an Audit Event\nphaseTwo.events(realm).send(new EventRepresentation()\n    .type(\"foo.bar\")\n    .organizationId(orgId)\n    .time(System.currentTimeMillis()));\n```\n\n## Generating sources from openapi.yaml\n\n1. create an empty directory `local`\n2. copy the current `openapi.yml` from the `phasetwo-docs` repo to that directory\n3. run the generator in the `local` directory\n```\ndocker run --rm --user $(id -u):$(id -g) -v $PWD:/local openapitools/openapi-generator-cli generate -i /local/openapi.yaml -g jaxrs-spec -o /local/java-sdk  --additional-properties=groupId=io.phasetwo,artifactId=phasetwo-admin-client,apiPackage=io.phasetwo.client.openapi.api,modelPackage=io.phasetwo.client.openapi.model,useSwaggerAnnotations=false,useBeanValidation=false,useTags=true,interfaceOnly=true,useJakartaEe=true,hideGenerationTimestamp=true\n```\n4. copy the relevant files\n```\ncp java-sdk/src/gen/java/io/phasetwo/client/openapi/*.java $PWD/../src/gen/java/io/phasetwo/client/openapi/\ncp java-sdk/src/gen/java/io/phasetwo/client/openapi/api/*.java $PWD/../src/gen/java/io/phasetwo/client/openapi/api/\ncp java-sdk/src/gen/java/io/phasetwo/client/openapi/model/*.java $PWD/../src/gen/java/io/phasetwo/client/openapi/model/\ncp java-sdk/src/main/openapi/openapi.yaml $PWD/../src/main/openapi/openapi.yaml\n```\n5. resolve all of the `Response` issues in the `*Api` classes. This is because we need the response object in order to get the status code and `Location` header, but openapi and this generator doesn't give us a good way to specify that or do it by default.\n6. push a pr and merge to main. auto releases using `.github/workflows/release.yml`\n\n---\n\nAll documentation, source code and other files in this repository are Copyright 2025 Phase Two, Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp2-inc%2Fphasetwo-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fp2-inc%2Fphasetwo-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fp2-inc%2Fphasetwo-java/lists"}