Skip to content

Commit a10c0ca

Browse files
authored
v3.2.1 (#7)
* new 3.1.1 release: - coupn reservations endpoints - loyalty subledgers handling * Makefile to dockerize maven artifacts creation
1 parent 167cd65 commit a10c0ca

34 files changed

+1625
-803
lines changed

.gitignore

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
1-
.idea/
2-
.out/
3-
.bin/
4-
target/
5-
*.iml
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
11+
# exclude jar for gradle wrapper
12+
!gradle/wrapper/*.jar
13+
14+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
15+
hs_err_pid*
16+
17+
# build files
18+
**/target
19+
target
20+
.gradle
21+
build

.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
unset

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Generated by: https://openapi-generator.tech
3+
#
4+
language: java
5+
jdk:
6+
- oraclejdk8
7+
- oraclejdk7
8+
before_install:
9+
# ensure gradlew has proper permission
10+
- chmod a+x ./gradlew
11+
script:
12+
# test using maven
13+
- mvn test
14+
# uncomment below to test using gradle
15+
# - gradle test
16+
# uncomment below to test using sbt
17+
# - sbt test

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
VERSION=$(shell grep -om1 -E '<version>[0-9\.]+<\/version>' pom.xml | head -n 1 | sed 's/<version>\(.*\)<\/version>/\1/')
2+
DIST=target/dist
3+
4+
clean:
5+
rm -rf target
6+
7+
build: clean
8+
docker run \
9+
--rm \
10+
-v "$$(PWD)":/tmp/talon-client \
11+
-w "/tmp/talon-client" \
12+
maven:3.5.2-jdk-9-slim \
13+
/bin/bash -c "mvn clean install && \
14+
cp ~/.m2/repository/one/talon/talon-one-client/$(VERSION)/_remote.repositories target"
15+
16+
bundle:
17+
rm -rf $(DIST) && \
18+
mkdir $(DIST) && \
19+
cp pom.xml $(DIST)/talon-one-client-$(VERSION).pom && \
20+
cp target/_remote.repositories $(DIST) && \
21+
cp target/talon-one-client-$(VERSION)-sources.jar $(DIST) && \
22+
cp target/talon-one-client-$(VERSION).jar $(DIST)
23+
24+
prepare: build bundle

README.md

Lines changed: 65 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Add this dependency to your project's POM:
3939
<dependency>
4040
<groupId>one.talon</groupId>
4141
<artifactId>talon-one-client</artifactId>
42-
<version>3.1.0</version>
42+
<version>3.2.1</version>
4343
<scope>compile</scope>
4444
</dependency>
4545
```
@@ -49,7 +49,7 @@ Add this dependency to your project's POM:
4949
Add this dependency to your project's build file:
5050

5151
```groovy
52-
compile "one.talon:talon-one-client:3.0.0"
52+
compile "one.talon:talon-one-client:3.2.1"
5353
```
5454

5555
### Others
@@ -62,13 +62,15 @@ mvn clean package
6262

6363
Then manually install the following JARs:
6464

65-
* `target/talon-one-client-3.0.0.jar`
65+
* `target/talon-one-client-3.2.1.jar`
6666
* `target/lib/*.jar`
6767

6868
## Getting Started
6969

7070
Please follow the [installation](#installation) instruction and execute the following Java code:
7171

72+
### Integration API
73+
7274
```java
7375
package com.example.consumer;
7476

@@ -79,49 +81,68 @@ import one.talon.model.*;
7981

8082
public class TalonApiTest {
8183
public static void main(String[] args) {
84+
ApiClient iApiClient = new ApiClient("api_key_v1");
85+
IntegrationApi iApi = new IntegrationApi(iApiClient );
86+
87+
// Setup: basePath, apiKeyPrefix and apiKey
88+
iApi.getApiClient().setBasePath("https://mycompany.talon.one");
89+
iApi.getApiClient().setApiKeyPrefix("ApiKey-v1");
90+
iApi.getApiClient().setApiKey("dbc644d33aa74d582bd9479c59e16f970fe13bf34a208c39d6c7fa7586968468");
8291

83-
// Management API
92+
try {
93+
// Integration API example to send a session update
94+
NewCustomerSession customerSession = new NewCustomerSession();
95+
customerSession.setProfileId("Cool_Dude");
96+
customerSession.setState("open");
97+
customerSession.setTotal(42.0);
98+
99+
// Create/update a customer session using `updateCustomerSession` function
100+
IntegrationState ie = iApi.updateCustomerSession("deetdoot", customerSession);
101+
System.out.println(ie.toString());
102+
} catch (Exception e) {
103+
System.out.println(e);
104+
}
105+
}
106+
}
107+
```
108+
109+
### Management API
110+
111+
```java
112+
package com.example.consumer;
113+
114+
import one.talon.ApiClient;
115+
import one.talon.api.IntegrationApi;
116+
import one.talon.api.ManagementApi;
117+
import one.talon.model.*;
118+
119+
public class TalonApiTest {
120+
public static void main(String[] args) {
121+
// Management API example to load application with id 7
84122
ApiClient mApiClient = new ApiClient("manager_auth");
85123
ManagementApi mApi = new ManagementApi(mApiClient);
86-
mApi.getApiClient().setBasePath("http://localhost");
124+
125+
// Setup: basePath and bearer prefix
126+
mApi.getApiClient().setBasePath("https://mycompany.talon.one");
87127
mApi.getApiClient().setApiKeyPrefix("Bearer");
128+
88129
LoginParams lp = new LoginParams();
89-
lp.setEmail("demo@talon.one");
130+
lp.setEmail("admin@talon.one");
90131
lp.setPassword("yourpassword");
91132

92133
try {
134+
// Acquire session token
93135
Session s = mApi.createSession(lp);
94136
mApi.getApiClient().setApiKey(s.getToken());
95-
Account acc = mApi.getAccount(1);
96-
System.out.println(acc.toString());
97-
98-
System.out.println(mApi.getRuleset(1, 1, 1));
99-
} catch (Exception e) {
100-
System.out.println(e);
101-
}
102-
103-
// Integration API
104-
ApiClient iApiClient = new ApiClient("integration_auth");
105-
IntegrationApi iApi = new IntegrationApi(iApiClient );
106-
// setup: applicationId, applicationKey, basePath, apiKeyPrefix and apiKey
107-
iApi.getApiClient().setApplicationId("1");
108-
iApi.getApiClient().setApplicationKey("2f276f93baf3d415");
109-
iApi.getApiClient().setBasePath("http://localhost");
110-
iApi.getApiClient().setApiKeyPrefix("ApiKey-v1");
111-
iApi.getApiClient().setApiKey("dbc644d33aa74d582bd9479c59e16f970fe13bf34a208c39d6c7fa7586968468");
112-
// regarding 'Content-Signature' signing the request body is in process of deprecation
113-
// therefore enforced to do in the client side
114137

115-
try {
116-
NewCustomerProfile body = new NewCustomerProfile();
117-
IntegrationState ie = iApi.updateCustomerProfile("testCustomerProfile", body);
118-
System.out.println(ie.toString());
138+
// Calling `getApplication` function with the desired id (7)
139+
Application application = mApi.getApplication(7);
140+
System.out.println(application.toString());
119141
} catch (Exception e) {
120142
System.out.println(e);
121143
}
122144
}
123145
}
124-
125146
```
126147

127148
## Documentation for API Endpoints
@@ -130,8 +151,12 @@ All URIs are relative to *http://localhost*
130151

131152
Class | Method | HTTP request | Description
132153
------------ | ------------- | ------------- | -------------
154+
*IntegrationApi* | [**createCouponReservation**](docs/IntegrationApi.md#createCouponReservation) | **POST** /v1/coupon_reservations/{couponValue} | Create a new coupon reservation
133155
*IntegrationApi* | [**createReferral**](docs/IntegrationApi.md#createReferral) | **POST** /v1/referrals | Create a referral code for an advocate
156+
*IntegrationApi* | [**deleteCouponReservation**](docs/IntegrationApi.md#deleteCouponReservation) | **DELETE** /v1/coupon_reservations/{couponValue} | Delete coupon reservations
134157
*IntegrationApi* | [**deleteCustomerData**](docs/IntegrationApi.md#deleteCustomerData) | **DELETE** /v1/customer_data/{integrationId} | Delete the personal data of a customer.
158+
*IntegrationApi* | [**getReservedCoupons**](docs/IntegrationApi.md#getReservedCoupons) | **GET** /v1/coupon_reservations/coupons/{integrationId} | Get all valid reserved coupons
159+
*IntegrationApi* | [**getReservedCustomers**](docs/IntegrationApi.md#getReservedCustomers) | **GET** /v1/coupon_reservations/customerprofiles/{couponValue} | Get the users that have this coupon reserved
135160
*IntegrationApi* | [**trackEvent**](docs/IntegrationApi.md#trackEvent) | **POST** /v1/events | Track an Event
136161
*IntegrationApi* | [**updateCustomerProfile**](docs/IntegrationApi.md#updateCustomerProfile) | **PUT** /v1/customer_profiles/{integrationId} | Update a Customer Profile
137162
*IntegrationApi* | [**updateCustomerSession**](docs/IntegrationApi.md#updateCustomerSession) | **PUT** /v1/customer_sessions/{customerSessionId} | Update a Customer Session
@@ -254,6 +279,7 @@ Class | Method | HTTP request | Description
254279
- [Coupon](docs/Coupon.md)
255280
- [CouponConstraints](docs/CouponConstraints.md)
256281
- [CouponRejectionReason](docs/CouponRejectionReason.md)
282+
- [CouponReservations](docs/CouponReservations.md)
257283
- [CouponSearch](docs/CouponSearch.md)
258284
- [CouponValue](docs/CouponValue.md)
259285
- [CreateApplicationAPIKey](docs/CreateApplicationAPIKey.md)
@@ -297,6 +323,7 @@ Class | Method | HTTP request | Description
297323
- [InlineResponse20025](docs/InlineResponse20025.md)
298324
- [InlineResponse20026](docs/InlineResponse20026.md)
299325
- [InlineResponse20027](docs/InlineResponse20027.md)
326+
- [InlineResponse20028](docs/InlineResponse20028.md)
300327
- [InlineResponse2003](docs/InlineResponse2003.md)
301328
- [InlineResponse2004](docs/InlineResponse2004.md)
302329
- [InlineResponse2005](docs/InlineResponse2005.md)
@@ -318,6 +345,8 @@ Class | Method | HTTP request | Description
318345
- [LoyaltyPoints](docs/LoyaltyPoints.md)
319346
- [LoyaltyProgram](docs/LoyaltyProgram.md)
320347
- [LoyaltyProgramBalance](docs/LoyaltyProgramBalance.md)
348+
- [LoyaltyProgramLedgers](docs/LoyaltyProgramLedgers.md)
349+
- [LoyaltySubLedger](docs/LoyaltySubLedger.md)
321350
- [ManagerConfig](docs/ManagerConfig.md)
322351
- [Meta](docs/Meta.md)
323352
- [MiscUpdateUserLatestFeature](docs/MiscUpdateUserLatestFeature.md)
@@ -378,6 +407,12 @@ Class | Method | HTTP request | Description
378407
## Documentation for Authorization
379408

380409
Authentication schemes defined for the API:
410+
### api_key_v1
411+
412+
- **Type**: API key
413+
- **API key parameter name**: Authorization
414+
- **Location**: HTTP header
415+
381416
### integration_auth
382417

383418
- **Type**: API key

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apply plugin: 'idea'
22
apply plugin: 'eclipse'
33

44
group = 'one.talon'
5-
version = '3.0.0'
5+
version = '3.2.1'
66

77
buildscript {
88
repositories {

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ lazy val root = (project in file(".")).
22
settings(
33
organization := "one.talon",
44
name := "talon-one-client",
5-
version := "3.0.0",
5+
version := "3.2.1",
66
scalaVersion := "2.11.4",
77
scalacOptions ++= Seq("-feature"),
88
javacOptions in compile ++= Seq("-Xlint:deprecation"),

0 commit comments

Comments
 (0)