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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Voucherify's OpenAPI Specification and SDK

[![JAVA SDK](https://img.shields.io/badge/JAVA-SDK-FF0000?logo=openjdk&logoColor=red)](https://github.com/voucherifyio/sdk-java-openapi-based)
[![PHP SDK](https://img.shields.io/badge/PHP-SDK-777BB4?logo=php&logoColor=white)](https://github.com/voucherifyio/sdk-php-openapi-based)
[![PYTHON SDK](https://img.shields.io/badge/PYTHON-SDK-58ad09?logo=python&logoColor=green)](https://github.com/voucherifyio/sdk-python-openapi-based)
[![RUBY SDK](https://img.shields.io/badge/RUBY-SDK-c71628?logo=ruby&logoColor=c71628)](https://github.com/voucherifyio/sdk-ruby-openapi-based)
[![JAVA SDK](https://img.shields.io/badge/JAVA-SDK-FF0000?logo=openjdk&logoColor=red)](https://github.com/voucherifyio/voucherify-java-sdk)
[![PHP SDK](https://img.shields.io/badge/PHP-SDK-777BB4?logo=php&logoColor=white)](https://github.com/voucherifyio/voucherify-php-sdk)
[![PYTHON SDK](https://img.shields.io/badge/PYTHON-SDK-58ad09?logo=python&logoColor=green)](https://github.com/voucherifyio/voucherify-python-sdk)
[![RUBY SDK](https://img.shields.io/badge/RUBY-SDK-c71628?logo=ruby&logoColor=c71628)](https://github.com/voucherifyio/voucherify-ruby-sdk)

This repository contains OpenAPI specification for Voucherify's API.

Expand Down
195 changes: 107 additions & 88 deletions mustache-templates/java/libraries/okhttp-gson/README.mustache
Original file line number Diff line number Diff line change
@@ -1,38 +1,54 @@
![Voucherify Java SDK](./voucherify-java-sdk.png)

## Official [Voucherify](https://www.voucherify.io/) SDK for Java
<h3 align="center">Official <a href="https://www.voucherify.io">Voucherify</a> SDK for Java</h3>

Voucherify empowers marketers and developers with flexible building blocks to come up with, implement, and track targeted promotional campaigns.
## 👋 Intro

Learn more about Voucherify by visiting [our site](https://www.voucherify.io).
Voucherify is an Incentive Optimization Engine that helps digital teams launch, test, and optimize targeted incentives – from coupons and promotions to loyalty programs and personalized offers – all with API.

This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) based on our [Documentation](https://docs.voucherify.io/docs/introduction) with v2018-08-01 version.
We build Voucherify so you can run fewer incentives, but better ones.

The legacy version of Java SDK could be found [here](https://github.com/voucherifyio/voucherify-java-sdk/tree/11.2.2)
**Launch fast.**

## 📝 Documentation
**Test every day.**

You will find detailed description and example responses at our [official documentation](https://docs.voucherify.io/reference). Most method headers point to more detailed descriptions of arguments you can use.
**Drop what doesn’t work.**

📚 Want to learn more? Visit our [official site](https://www.voucherify.io) or our [Success Portal](https://success.voucherify.io).
**And optimize what does.**

👽 Having troubles? Check our [Help center](https://support.voucherify.io/).
Integrate easily with your existing stack to make experimentation and optimization effortless.

🧪 Looking for promotion ideas? Check our [Cookbook](https://cookbook.voucherify.io/) to get an inspiration.
## 📝 Useful info

🐛 Encounter a bug? Please file a report in the [Issues](https://github.com/voucherifyio/voucherify-java-sdk/issues).
This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) based on Voucherify [API reference](https://docs.voucherify.io/api-reference/introduction-api), `v2018-08-01` version.

✅ Supported endpoint can be found [here](./ENDPOINTS-COVERAGE.md)
For more info, visit those places:
- ✅ [Supported endpoints](./ENDPOINTS-COVERAGE.md).
- 📘 [API docs](https://docs.voucherify.io/api-reference/introduction-api "Voucherify API documentation").
- 🧑‍🍳 [Promotion cookbook](https://www.voucherify.io/promotion-examples "Explore promotion examples").
- 💬 [Help center](https://support.voucherify.io "Voucherify dashboard documentation").
- 🐛 Caught a bug? [Add an issue](https://github.com/voucherifyio/voucherify-java-sdk/issues "Visit issues in Voucherify Java SDK")!
- 🧑‍💻 Need help? [Contact support](https://www.voucherify.io/contact-support "Visit contact support page").

## Requirements
## 🧱 Requirements

Building the API client library requires:
To build the API client library, you'll need:
1. Java 1.8+
2. Maven (3.8.3+)/Gradle (7.2+)

## Installation
## 🔒 Get your keys and address

To install the API client library to your local Maven repository, simply execute:
Get your Voucherify keys for valid authorization and setting the basePath (cluster) to match your server URL:
1. In Voucherify dashboard, go to **Project settings**.
2. In **Application information**, find your basePath (cluster) address. For shared clusters:
- Europe (default): `https://api.voucherify.io`
- United States: `https://us1.api.voucherify.io`
- Asia (Singapore): `https://as1.api.voucherify.io`
3. Scroll down to **Application Keys** to grab your Application ID and Secret key.

## ⚙️ Install

To install the API client library to your local Maven repository, run:

```shell
mvn clean install
Expand All @@ -44,7 +60,7 @@ To deploy it to a remote Maven repository instead, configure the settings of the
mvn clean deploy
```

Refer to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html) for more information.
To learn more, go to the [OSSRH Guide](http://central.sonatype.org/pages/ossrh-guide.html).

### Maven users

Expand Down Expand Up @@ -73,22 +89,22 @@ Add this dependency to your project's build file:
}
```

### Others
### Other

At first generate the JAR by executing:
To generate the JAR, run:

```shell
mvn clean package
```

Then manually install the following JARs:
Next, install manually the following JARs:

* `target/{{{artifactId}}}-{{{artifactVersion}}}.jar`
* `target/lib/*.jar`

## 🚀 Running code
## 🚀 Run code

Please follow the [installation](#installation) instruction and execute the following Java code:
Once installed, run:

```java
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
Expand Down Expand Up @@ -144,28 +160,86 @@ public class Example {
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
```

It may be useful to check the test implementation in the folder **test** `(./src/test)`
> [!NOTE]
>
> It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.

## 🐳 Running local tests automatically - with docker
> [!TIP]
>
> Check the test implementation in the [Test folder](./src/test).

## 🐳 Run local tests automatically with docker

To run tests locally with docker:
1. Copy `.env.example` to `.env` and fill in the values.
2. Run `docker build -t java .` to build the image.
3. Run `docker run --rm java` to run the tests and delete container immediately after.

## Running local tests manually - with commands
## 🏠 Run local tests manually with commands

To run tests locally with commands:
1. Check if you have OpenJDK (desired version) installed (with Homebrew).
2. From the main java folder, run `mvn test`.

1. Make sure you have OpenJDK (desired version) installed (via Homebrew)
2. From the main java folder run `mvn test`
## 🛠️ Contribute

## 🛠️ Contributing
Do you want to contribute?

Read more about how to Contribute to Voucherify Java SDK by visiting main repo [GENERATING-SDKS.md](https://github.com/voucherifyio/voucherify-openapi/blob/master/GENERATING-SDKS.md)
Read more about how to contribute to this SDK in the [Contributing guide](https://github.com/voucherifyio/voucherify-openapi/blob/master/GENERATING-SDKS.md) in the main repo.

Remember that this SDK is auto generated (except of the tests) so changes made here will be overwritten by generator.
This SDK is auto-generated (except for tests), so changes made here will be overwritten by the generator.

## Link tags
[OpenAPI generated from tag](https://github.com/voucherifyio/voucherify-openapi/releases/tag/sdk-java-17.0.1)
[OpenAPI generated from tag](https://github.com/voucherifyio/voucherify-openapi/releases/tag/sdk-java-{{{artifactVersion}}})

## 🔐 Authorization

To authorize your requests, run:

```java
// Setup ApiClient Authorization:

import io.voucherify.client.ApiClient;
import io.voucherify.client.Configuration;
import io.voucherify.client.auth.ApiKeyAuth;

public class Main {
public static ApiClient getClient() {}
ApiClient defaultClient = Configuration.getDefaultApiClient();

defaultClient.setBasePath("https://api.voucherify.io");
defaultClient.setAuthentication("X-App-Id", "YOUR_X_APP_ID");
defaultClient.setAuthentication("X-App-Token", "YOUR_X_APP_TOKEN");

return defaultClient;
}
}
```

{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
{{#hasAuthMethods}}Authorization schemes defined for the API.{{/hasAuthMethods}}
{{#authMethods}}
### {{name}}

{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}
## 📅 Changelog
- **2025-10-02** - `17.0.1`
UPDATED:
Expand All @@ -178,7 +252,7 @@ UPDATED:
- **2025-07-06** - `17.0.0`
ADDED:
- ParameterFiltersListCampaigns model:
- campaigns (ParameterFiltersListCampaignsCampaigns model),
- campaigns (ParameterFiltersListCampaignsCampaigns model),
- campaigns_id (ParameterFiltersListCampaignsCampaignsId model)
- status (ParameterFiltersListCampaignsStatus model)
- type (ParameterFiltersListCampaignsType model)
Expand All @@ -202,7 +276,7 @@ ADDED:
- `operation_status` enum in AsyncActionBase model
- `$contains`, `$not_contains` in FilterConditionsString model
- `properties` in MemberActivity model
- EventSource model
- EventSource model
- MemberActivityData model
- ListPublicationsItemValidSingleVoucher model
- SimpleCampaign model
Expand Down Expand Up @@ -580,28 +654,6 @@ REMOVED:

*Changelog for previous versions could be found in the [DEPRECATED_CHANGELOG.md file](./DEPRECATED_CHANGELOG.md)*

## 🔐 Documentation for Authorization

```java
// Setup ApiClient Authorization:

import io.voucherify.client.ApiClient;
import io.voucherify.client.Configuration;
import io.voucherify.client.auth.ApiKeyAuth;

public class Main {
public static ApiClient getClient() {}
ApiClient defaultClient = Configuration.getDefaultApiClient();

defaultClient.setBasePath("https://api.voucherify.io");
defaultClient.setAuthentication("X-App-Id", "YOUR_X_APP_ID");
defaultClient.setAuthentication("X-App-Token", "YOUR_X_APP_TOKEN");

return defaultClient;
}
}
```

## Documentation for API Endpoints

All URIs are relative to *{{basePath}}*
Expand All @@ -615,36 +667,3 @@ Class | Method | HTTP request | Description

{{#models}}{{#model}}- [{{classname}}]({{modelDocPath}}{{classname}}.md)
{{/model}}{{/models}}

<a id="documentation-for-authorization"></a>
## Documentation for Authorization

{{^authMethods}}Endpoints do not require authorization.{{/authMethods}}
{{#hasAuthMethods}}Authentication schemes defined for the API:{{/hasAuthMethods}}
{{#authMethods}}
<a id="{{name}}"></a>
### {{name}}

{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasicBasic}}- **Type**: HTTP basic authentication
{{/isBasicBasic}}
{{#isBasicBearer}}- **Type**: HTTP Bearer Token authentication{{#bearerFormat}} ({{{.}}}){{/bearerFormat}}
{{/isBasicBearer}}
{{#isHttpSignature}}- **Type**: HTTP signature authentication
{{/isHttpSignature}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}

{{/authMethods}}

## Recommendation

It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues.
Loading