@@ -39,7 +39,7 @@ Add this dependency to your project's POM:
39
39
<dependency >
40
40
<groupId >one.talon</groupId >
41
41
<artifactId >talon-one-client</artifactId >
42
- <version >3.0 .0</version >
42
+ <version >3.1 .0</version >
43
43
<scope >compile</scope >
44
44
</dependency >
45
45
```
@@ -70,34 +70,54 @@ Then manually install the following JARs:
70
70
Please follow the [ installation] ( #installation ) instruction and execute the following Java code:
71
71
72
72
``` java
73
+ package com.example.consumer ;
73
74
74
- import one.talon.* ;
75
- import one.talon.auth.* ;
76
- import one.talon.model.* ;
75
+ import one.talon.ApiClient ;
77
76
import one.talon.api.IntegrationApi ;
77
+ import one.talon.api.ManagementApi ;
78
+ import one.talon.model.* ;
78
79
79
- import java.io.File ;
80
- import java.util.* ;
80
+ public class TalonApiTest {
81
+ public static void main ( String [] args ) {
81
82
82
- public class IntegrationApiExample {
83
+ // Management API
84
+ ApiClient mApiClient = new ApiClient (" manager_auth" );
85
+ ManagementApi mApi = new ManagementApi (mApiClient);
86
+ mApi. getApiClient(). setBasePath(" http://localhost" );
87
+ mApi. getApiClient(). setApiKeyPrefix(" Bearer" );
88
+ LoginParams lp = new LoginParams ();
89
+ lp. setEmail(" demo@talon.one" );
90
+ lp. setPassword(" yourpassword" );
91
+
92
+ try {
93
+ Session s = mApi. createSession(lp);
94
+ 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
83
114
84
- public static void main (String [] args ) {
85
- ApiClient defaultClient = Configuration . getDefaultApiClient();
86
-
87
- // Configure API key authorization: integration_auth
88
- ApiKeyAuth integration_auth = (ApiKeyAuth ) defaultClient. getAuthentication(" integration_auth" );
89
- integration_auth. setApiKey(" YOUR API KEY" );
90
- // Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
91
- // integration_auth.setApiKeyPrefix("Token");
92
-
93
- IntegrationApi apiInstance = new IntegrationApi ();
94
- NewReferral newReferral = new NewReferral (); // NewReferral |
95
115
try {
96
- Referral result = apiInstance . createReferral(newReferral );
97
- System . out . println(result );
98
- } catch ( ApiException e) {
99
- System . err . println( " Exception when calling IntegrationApi#createReferral " );
100
- e . printStackTrace( );
116
+ NewCustomerProfile body = new NewCustomerProfile ( );
117
+ IntegrationState ie = iApi . updateCustomerProfile( " testCustomerProfile " , body );
118
+ System . out . println(ie . toString());
119
+ } catch ( Exception e) {
120
+ System . out . println(e );
101
121
}
102
122
}
103
123
}
0 commit comments