{"id":20730844,"url":"https://github.com/saasquatch/saasquatch-java-sdk","last_synced_at":"2026-02-23T04:31:24.879Z","repository":{"id":43273605,"uuid":"210713540","full_name":"saasquatch/saasquatch-java-sdk","owner":"saasquatch","description":"SaaSquatch SDK for Java","archived":false,"fork":false,"pushed_at":"2024-11-22T17:36:29.000Z","size":601,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-23T22:03:36.463Z","etag":null,"topics":["android","java","jitpack","reactive-streams","rxjava","saasquatch-java-sdk","sdk"],"latest_commit_sha":null,"homepage":null,"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/saasquatch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2019-09-24T23:14:48.000Z","updated_at":"2024-11-22T17:35:30.000Z","dependencies_parsed_at":"2024-11-16T04:31:27.469Z","dependency_job_id":"fac1c784-1b2f-446e-9e5f-17c3df0be993","html_url":"https://github.com/saasquatch/saasquatch-java-sdk","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/saasquatch/saasquatch-java-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saasquatch%2Fsaasquatch-java-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saasquatch%2Fsaasquatch-java-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saasquatch%2Fsaasquatch-java-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saasquatch%2Fsaasquatch-java-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saasquatch","download_url":"https://codeload.github.com/saasquatch/saasquatch-java-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saasquatch%2Fsaasquatch-java-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29738079,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-23T02:24:00.660Z","status":"ssl_error","status_checked_at":"2026-02-23T02:22:56.087Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["android","java","jitpack","reactive-streams","rxjava","saasquatch-java-sdk","sdk"],"created_at":"2024-11-17T05:12:52.818Z","updated_at":"2026-02-23T04:31:24.858Z","avatar_url":"https://github.com/saasquatch.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SaaSquatch Java SDK\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![JavaCI](https://github.com/saasquatch/saasquatch-java-sdk/actions/workflows/JavaCI.yml/badge.svg?branch=master)](https://github.com/saasquatch/saasquatch-java-sdk/actions/workflows/JavaCI.yml)\n[![](https://jitpack.io/v/saasquatch/saasquatch-java-sdk.svg)](https://jitpack.io/#saasquatch/saasquatch-java-sdk)\n\nSaaSquatch SDK for Java\n\n## Adding SaaSquatch Java SDK to your project\n\nSaaSquatch Java SDK is hosted on JitPack.\n\nAdd JitPack repository:\n\n### Maven\n\n```xml\n\u003crepositories\u003e\n  \u003crepository\u003e\n    \u003cid\u003ejitpack.io\u003c/id\u003e\n    \u003curl\u003ehttps://jitpack.io\u003c/url\u003e\n  \u003c/repository\u003e\n\u003c/repositories\u003e\n```\n\n### Gradle\n\n```gradle\nallprojects {\n    repositories {\n        ...\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\n\nAdd the dependency:\n\n### Maven\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.github.saasquatch\u003c/groupId\u003e\n  \u003cartifactId\u003esaasquatch-java-sdk\u003c/artifactId\u003e\n  \u003cversion\u003e0.2.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n### Gradle\n\n```gradle\ndependencies {\n    implementation 'com.github.saasquatch:saasquatch-java-sdk:0.2.0'\n}\n```\n\nFor more information and other built tools, [please refer to the JitPack page](https://jitpack.io/#saasquatch/saasquatch-java-sdk).\n\nThis library aims to abstract away the I/O layer and [Reactive Streams](https://www.reactive-streams.org/) implementations to be implementation agnostic. As of right now, this library depends on [RxJava 3](https://github.com/ReactiveX/RxJava), [Gson](https://github.com/google/gson), and [Apache HttpClient 5](https://hc.apache.org/httpcomponents-client-5.0.x/index.html), but never exposes library-specific interfaces other than Reactive Streams interfaces. **It is recommended that you explicitly import the transitive dependencies if you intend to use them directly**, since we may upgrade or switch to other I/O or Reactive Streams libraries in the future.\n\n### Android\n\nSaaSquatch Java SDK works on Java 8+ and Android API level 21+. To use this library on Android, you'll need to configure your project to use Java 8 by adding the following to `build.gradle` (see [Android official docs](https://developer.android.com/studio/write/java8-support) for more information).\n\n[Squatch Android](https://github.com/saasquatch/squatch-android) is an Android wrapper of this library with Android specific features.\n\n## Using the SDK\n\nThe entry point of the SDK is `SaaSquatchClient`. To create a `SaaSquatchClient` for your tenant with default options, use:\n\n```java\nSaaSquatchClient.createForTenant(\"yourTenantAlias\");\n```\n\nIf you are in a multi-tenant environment, you can create a tenant-agnostic `SaaSquatchClient` like this:\n\n```java\nSaaSquatchClient.create(ClientOptions.newBuilder().build());\n```\n\nThe code above will create a `SaaSquatchClient` without a default `tenantAlias`, in which case you'll need to pass in a `tenantAlias` via `RequestOptions` for every request you make.\n\nYou can also use more advanced options like this:\n\n```java\nSaaSquatchClient.create(ClientOptions.newBuilder()\n    .setTenantAlias(\"yourTenantAlias\")\n    /*\n     * This sets the default tenant API key. Note that this option makes more sense\n     * if you are using this SDK on the server side. Use this with caution if you are\n     * building an Android app.\n     */\n    .setAuthMethod(AuthMethod.ofTenantApiKey(\"yourApiKey\"))\n    .setRequestTimeout(5, TimeUnit.SECONDS)\n    // etc.\n    .build());\n```\n\nIt is recommended that you keep a singleton `SaaSquatchClient` for all your requests instead of creating a new `SaaSquatchClient` for every request. `SaaSquatchClient` implements `Closeable`, and it's a good idea to call `close()` to release resources when you are done with it.\n\nEvery API method in `SaaSquatchClient` takes a `RequestOptions`, where you can specify your `tenantAlias` override, authentication method override, etc. The per-method `RequestOptions` always takes precedence over the client-level `ClientOptions`.\n\n`SaaSquatchClient` returns [Reactive Streams](https://www.reactive-streams.org/) interfaces. Assuming you are using RxJava, then a typical API call made with this SDK would look something like this:\n\n```java\nfinal Publisher\u003cJsonObjectApiResponse\u003e responsePublisher = saasquatchClient\n    .userUpsert(userInput,\n        RequestOptions.newBuilder().setAuthMethod(AuthMethods.ofJwt(jwt)).build());\nFlowable.fromPublisher(responsePublisher)\n    .doOnNext(response -\u003e {\n      System.out.printf(\"Status[%d] received\\n\", response.getHttpResponse().getStatusCode());\n      // Getting the raw JSON data as a Map and do whatever you want with it\n      final Map\u003cString, Object\u003e data = response.getData();\n      // Or unmarshal the JSON result to one of the provided model classes\n      final User user = response.toModel(User.class);\n      System.out.printf(\"User with accountId[%s] and id[%s] created\\n\",\n          user.getAccountId(), user.getId());\n    })\n    .onErrorResumeNext(ex -\u003e {\n      if (ex instanceof SaaSquatchApiException) {\n        // Non 2XX received, in which case we should typically get a standard api error\n        final ApiError apiError = ((SaaSquatchApiException) ex).getApiError();\n        System.out.println(apiError.getMessage());\n        return Flowable.empty();\n      }\n      // Catastrophic failure!!!\n      ex.printStackTrace();\n      return Flowable.error(ex);\n    })\n    .subscribe();\n```\n\n## Unstable APIs\n\nAnything marked with the `@Beta` or `@Internal` annotations, as well as anything under the package `com.saasquatch.sdk.internal`, are either experimental or considered private API, and can be modified in breaking ways or removed without warning.\n\n## Development\n\nThis project uses a simple Maven build. Compile with `mvn compile` and run tests with `mvn test`.\n\nSince Android still doesn't fully support Java 8 🤦, Java 8 specific classes like `CompletableFuture`, `java.util.Optional`, and `java.time.Instant` should be avoided. Java 8 language features like lambda expressions, however, can be used. This restriction does not apply to the test suite.\n\nTo run integration tests, you'll need a SaaSquatch account, and run:\n\n```bash\nmvn test -D\"com.saasquatch.sdk.test.appDomain\"=\"REPLACEME\" -D\"com.saasquatch.sdk.test.tenantAlias\"=\"REPLACEME\" -D\"com.saasquatch.sdk.test.tenantApiKey\"=\"REPLACEME\"\n```\n\n## License\n\nUnless explicitly stated otherwise all files in this repository are licensed under the Apache License 2.0.\n\nLicense boilerplate:\n\n```\nCopyright 2023 ReferralSaaSquatch.com, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaasquatch%2Fsaasquatch-java-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaasquatch%2Fsaasquatch-java-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaasquatch%2Fsaasquatch-java-sdk/lists"}