Skip to content

Commit 193da80

Browse files
committed
feat: thread application requests and related tests
1 parent 34907d8 commit 193da80

40 files changed

+7517
-43
lines changed

.env.example

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Unit API Configuration
2+
# Copy this file to .env and fill in your actual values
3+
4+
# Your Unit API access token (for regular applications)
5+
access_token=your_unit_api_token_here
6+
7+
# Your Unit API access token for Thread applications
8+
# This is used specifically for thread-related application requests
9+
thread_access_token=your_thread_api_token_here
10+
11+
# Token Tests Configuration
12+
# User ID for token-related tests (TokenTests)
13+
token_tests_user_id=your_test_user_id_here
14+
15+
# Plaid Integration
16+
# Plaid token for counterparty tests (PaymentTests, CounterpartyTests)
17+
test_plaid_counterparty_token=your_plaid_token_here
18+
19+
# Wallet Account Configuration
20+
# Terms URL for wallet account creation (AccountTests)
21+
wallet_terms=you_wallet_terms_here

.github/workflows/CI.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
token_tests_user_id: ${{ secrets.TOKEN_TESTS_USER_ID }}
3131
test_plaid_counterparty_token: ${{ secrets.TEST_PLAID_COUNTERPARTY_TOKEN }}
3232
wallet_terms: ${{ secrets.WALLET_TERMS }}
33+
thread_access_token: ${{ secrets.THREAD_ACCESS_TOKEN }}
3334

3435
- name: Store reports
3536
if: failure()

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,9 @@ nb-configuration.xml
8282
##############################
8383
## OS X
8484
##############################
85-
.DS_Store
85+
.DS_Store
86+
87+
##############################
88+
## Environment Variables
89+
##############################
90+
.env

build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ apply plugin: 'java'
1919
apply plugin: 'com.diffplug.spotless'
2020

2121
group = 'co.unit'
22-
version = '0.2.6'
22+
version = '0.3.0'
2323

2424
repositories {
2525
mavenCentral()
@@ -175,6 +175,7 @@ dependencies {
175175
implementation "org.apache.httpcomponents:httpmime:$httpmime_version"
176176
implementation "commons-io:commons-io:2.5"
177177
testImplementation "junit:junit:$junit_version"
178+
testImplementation "io.github.cdimascio:dotenv-java:3.0.0"
178179
}
179180

180181
javadoc {

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>openapi-java-client</artifactId>
66
<packaging>jar</packaging>
77
<name>openapi-java-client</name>
8-
<version>0.2.6</version>
8+
<version>0.3.0</version>
99
<url>https://github.com/openapitools/openapi-generator</url>
1010
<description>OpenAPI Java</description>
1111
<scm>

src/main/java/unit/java/sdk/ApiClient.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ public ApiClient() {
168168
this.mapper = createDefaultObjectMapper();
169169
updateBaseUri(getDefaultBaseUri());
170170
interceptor = (req) -> {
171-
req.setHeader("X-UNIT-SDK", "unit-openapi-java-sdk@v0.2.5");
171+
req.setHeader("X-UNIT-SDK", "unit-openapi-java-sdk@v0.2.1");
172172
};
173173
readTimeout = null;
174174
connectTimeout = null;
@@ -188,7 +188,7 @@ public ApiClient(HttpClient.Builder builder, ObjectMapper mapper, String baseUri
188188
this.mapper = mapper;
189189
updateBaseUri(baseUri != null ? baseUri : getDefaultBaseUri());
190190
interceptor = (req) -> {
191-
req.setHeader("X-UNIT-SDK", "unit-openapi-java-sdk@v0.2.5");
191+
req.setHeader("X-UNIT-SDK", "unit-openapi-java-sdk@v0.2.1");
192192
};
193193
readTimeout = null;
194194
connectTimeout = null;
@@ -343,7 +343,7 @@ public ApiClient setScheme(String scheme){
343343
*/
344344
public ApiClient setRequestInterceptor(Consumer<HttpRequest.Builder> interceptor) {
345345
this.interceptor = (req) -> {
346-
req.setHeader("X-UNIT-SDK", "unit-openapi-java-sdk@v0.2.5");
346+
req.setHeader("X-UNIT-SDK", "unit-openapi-java-sdk@v0.2.1");
347347
interceptor.accept(req);
348348
};
349349
return this;

src/main/java/unit/java/sdk/model/CreateApplicationRequestData.java

Lines changed: 170 additions & 5 deletions
Large diffs are not rendered by default.
Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,219 @@
1+
/*
2+
* Unit OpenAPI specifications
3+
* An OpenAPI specifications for unit-sdk clients
4+
*
5+
* The version of the OpenAPI document: 0.2.5
6+
*
7+
*
8+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9+
* https://openapi-generator.tech
10+
* Do not edit the class manually.
11+
*/
12+
13+
14+
package unit.java.sdk.model;
15+
16+
import java.net.URLEncoder;
17+
import java.nio.charset.StandardCharsets;
18+
import java.util.StringJoiner;
19+
import java.util.Objects;
20+
import java.util.Map;
21+
import java.util.HashMap;
22+
import com.fasterxml.jackson.annotation.JsonInclude;
23+
import com.fasterxml.jackson.annotation.JsonProperty;
24+
import com.fasterxml.jackson.annotation.JsonCreator;
25+
import com.fasterxml.jackson.annotation.JsonTypeName;
26+
import com.fasterxml.jackson.annotation.JsonValue;
27+
import java.util.Arrays;
28+
import unit.java.sdk.model.CreateBusinessThreadApplicationAttributes;
29+
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
30+
31+
32+
import unit.java.sdk.ApiClient;
33+
/**
34+
* CreateBusinessThreadApplication
35+
*/
36+
@JsonPropertyOrder({
37+
CreateBusinessThreadApplication.JSON_PROPERTY_TYPE,
38+
CreateBusinessThreadApplication.JSON_PROPERTY_ATTRIBUTES
39+
})
40+
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.9.0")
41+
public class CreateBusinessThreadApplication {
42+
/**
43+
* Gets or Sets type
44+
*/
45+
public enum TypeEnum {
46+
BUSINESS_APPLICATION("businessApplication");
47+
48+
private String value;
49+
50+
TypeEnum(String value) {
51+
this.value = value;
52+
}
53+
54+
@JsonValue
55+
public String getValue() {
56+
return value;
57+
}
58+
59+
@Override
60+
public String toString() {
61+
return String.valueOf(value);
62+
}
63+
64+
@JsonCreator
65+
public static TypeEnum fromValue(String value) {
66+
for (TypeEnum b : TypeEnum.values()) {
67+
if (b.value.equals(value)) {
68+
return b;
69+
}
70+
}
71+
throw new IllegalArgumentException("Unexpected value '" + value + "'");
72+
}
73+
}
74+
75+
public static final String JSON_PROPERTY_TYPE = "type";
76+
private TypeEnum type = TypeEnum.BUSINESS_APPLICATION;
77+
78+
public static final String JSON_PROPERTY_ATTRIBUTES = "attributes";
79+
private CreateBusinessThreadApplicationAttributes attributes;
80+
81+
public CreateBusinessThreadApplication() {
82+
}
83+
84+
public CreateBusinessThreadApplication type(TypeEnum type) {
85+
this.type = type;
86+
return this;
87+
}
88+
89+
/**
90+
* Get type
91+
* @return type
92+
*/
93+
@jakarta.annotation.Nonnull
94+
@JsonProperty(JSON_PROPERTY_TYPE)
95+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
96+
public TypeEnum getType() {
97+
return type;
98+
}
99+
100+
101+
@JsonProperty(JSON_PROPERTY_TYPE)
102+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
103+
public void setType(TypeEnum type) {
104+
this.type = type;
105+
}
106+
107+
108+
public CreateBusinessThreadApplication attributes(CreateBusinessThreadApplicationAttributes attributes) {
109+
this.attributes = attributes;
110+
return this;
111+
}
112+
113+
/**
114+
* Get attributes
115+
* @return attributes
116+
*/
117+
@jakarta.annotation.Nonnull
118+
@JsonProperty(JSON_PROPERTY_ATTRIBUTES)
119+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
120+
public CreateBusinessThreadApplicationAttributes getAttributes() {
121+
return attributes;
122+
}
123+
124+
125+
@JsonProperty(JSON_PROPERTY_ATTRIBUTES)
126+
@JsonInclude(value = JsonInclude.Include.ALWAYS)
127+
public void setAttributes(CreateBusinessThreadApplicationAttributes attributes) {
128+
this.attributes = attributes;
129+
}
130+
131+
132+
/**
133+
* Return true if this CreateBusinessThreadApplication object is equal to o.
134+
*/
135+
@Override
136+
public boolean equals(Object o) {
137+
if (this == o) {
138+
return true;
139+
}
140+
if (o == null || getClass() != o.getClass()) {
141+
return false;
142+
}
143+
CreateBusinessThreadApplication createBusinessThreadApplication = (CreateBusinessThreadApplication) o;
144+
return Objects.equals(this.type, createBusinessThreadApplication.type) &&
145+
Objects.equals(this.attributes, createBusinessThreadApplication.attributes);
146+
}
147+
148+
@Override
149+
public int hashCode() {
150+
return Objects.hash(type, attributes);
151+
}
152+
153+
@Override
154+
public String toString() {
155+
StringBuilder sb = new StringBuilder();
156+
sb.append("class CreateBusinessThreadApplication {\n");
157+
sb.append(" type: ").append(toIndentedString(type)).append("\n");
158+
sb.append(" attributes: ").append(toIndentedString(attributes)).append("\n");
159+
sb.append("}");
160+
return sb.toString();
161+
}
162+
163+
/**
164+
* Convert the given object to string with each line indented by 4 spaces
165+
* (except the first line).
166+
*/
167+
private String toIndentedString(Object o) {
168+
if (o == null) {
169+
return "null";
170+
}
171+
return o.toString().replace("\n", "\n ");
172+
}
173+
174+
/**
175+
* Convert the instance into URL query string.
176+
*
177+
* @return URL query string
178+
*/
179+
public String toUrlQueryString() {
180+
return toUrlQueryString(null);
181+
}
182+
183+
/**
184+
* Convert the instance into URL query string.
185+
*
186+
* @param prefix prefix of the query string
187+
* @return URL query string
188+
*/
189+
public String toUrlQueryString(String prefix) {
190+
String suffix = "";
191+
String containerSuffix = "";
192+
String containerPrefix = "";
193+
if (prefix == null) {
194+
// style=form, explode=true, e.g. /pet?name=cat&type=manx
195+
prefix = "";
196+
} else {
197+
// deepObject style e.g. /pet?id[name]=cat&id[type]=manx
198+
prefix = prefix + "[";
199+
suffix = "]";
200+
containerSuffix = "]";
201+
containerPrefix = "[";
202+
}
203+
204+
StringJoiner joiner = new StringJoiner("&");
205+
206+
// add `type` to the URL query string
207+
if (getType() != null) {
208+
joiner.add(String.format("%stype%s=%s", prefix, suffix, URLEncoder.encode(ApiClient.valueToString(getType()), StandardCharsets.UTF_8).replaceAll("\\+", "%20")));
209+
}
210+
211+
// add `attributes` to the URL query string
212+
if (getAttributes() != null) {
213+
joiner.add(getAttributes().toUrlQueryString(prefix + "attributes" + suffix));
214+
}
215+
216+
return joiner.toString();
217+
}
218+
}
219+

0 commit comments

Comments
 (0)