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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The Developer Portal UI can also be used to help build your integration by showi
### Gradle

```groovy
implementation 'com.airbyte.api:public-api:0.14.2'
implementation 'com.airbyte.api:public-api:0.15.0'
```
<!-- End SDK Installation -->

Expand Down
10 changes: 9 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,12 @@ Based on:
- OpenAPI Doc 1.0.0
- Speakeasy CLI 1.40.3 (2.34.7) https://github.com/speakeasy-api/speakeasy
### Releases
- [Maven Central v0.14.2] https://central.sonatype.com/artifact/com.airbyte/api/0.14.2 - .
- [Maven Central v0.14.2] https://central.sonatype.com/artifact/com.airbyte/api/0.14.2 - .

## 2023-06-03 00:12:41
### Changes
Based on:
- OpenAPI Doc 1.0.0
- Speakeasy CLI 1.43.0 (2.35.3) https://github.com/speakeasy-api/speakeasy
### Releases
- [Maven Central v0.15.0] https://central.sonatype.com/artifact/com.airbyte/api/0.15.0 - .
1 change: 1 addition & 0 deletions files.gen
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
lib/src/main/java/com/airbyte/api/SDKConfiguration.java
lib/src/main/java/com/airbyte/api/Connections.java
lib/src/main/java/com/airbyte/api/Destinations.java
lib/src/main/java/com/airbyte/api/Jobs.java
Expand Down
6 changes: 3 additions & 3 deletions gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ configVersion: 1.0.0
management:
docChecksum: e82f3e11abf47c2509f115468e75bb06
docVersion: 1.0.0
speakeasyVersion: 1.40.3
generationVersion: 2.34.7
speakeasyVersion: 1.43.0
generationVersion: 2.35.3
generation:
sdkClassName: airbyte
singleTagPerOp: false
telemetryEnabled: true
java:
version: 0.14.2
version: 0.15.0
artifactID: api
companyEmail: info@airbyte.com
companyName: Airbyte
Expand Down
2 changes: 1 addition & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.airbyte'
artifactId = 'api'
version = '0.14.2'
version = '0.15.0'

from components.java

Expand Down
142 changes: 48 additions & 94 deletions lib/src/main/java/com/airbyte/api/Airbyte.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,13 @@ public class Airbyte {
public Streams streams;
public Workspaces workspaces;

private HTTPClient _defaultClient;
private HTTPClient _securityClient;
private com.airbyte.api.models.shared.Security _security;
private String _serverUrl;
private String _language = "java";
private String _sdkVersion = "0.14.2";
private String _genVersion = "2.34.7";
private SDKConfiguration sdkConfiguration;

/**
* The Builder class allows the configuration of a new instance of the SDK.
*/
public static class Builder {
private HTTPClient client;
private com.airbyte.api.models.shared.Security security;
private String serverUrl;
private java.util.Map<String, String> params = new java.util.HashMap<String, String>();
private SDKConfiguration sdkConfiguration = new SDKConfiguration();

private Builder() {
}
Expand All @@ -50,7 +42,7 @@ private Builder() {
* @return The builder instance.
*/
public Builder setClient(HTTPClient client) {
this.client = client;
this.sdkConfiguration.defaultClient = client;
return this;
}

Expand All @@ -60,7 +52,7 @@ public Builder setClient(HTTPClient client) {
* @return The builder instance.
*/
public Builder setSecurity(com.airbyte.api.models.shared.Security security) {
this.security = security;
this.sdkConfiguration.security = security;
return this;
}

Expand All @@ -70,7 +62,7 @@ public Builder setSecurity(com.airbyte.api.models.shared.Security security) {
* @return The builder instance.
*/
public Builder setServerURL(String serverUrl) {
this.serverUrl = serverUrl;
this.sdkConfiguration.serverUrl = serverUrl;
return this;
}

Expand All @@ -81,8 +73,18 @@ public Builder setServerURL(String serverUrl) {
* @return The builder instance.
*/
public Builder setServerURL(String serverUrl, java.util.Map<String, String> params) {
this.serverUrl = serverUrl;
this.params = params;
this.sdkConfiguration.serverUrl = com.airbyte.api.utils.Utils.templateUrl(serverUrl, params);
return this;
}

/**
* Allows the overriding of the default server by index
* @param serverIdx The server to use for all requests.
* @return The builder instance.
*/
public Builder setServerIndex(int serverIdx) {
this.sdkConfiguration.serverIdx = serverIdx;
this.sdkConfiguration.serverUrl = SERVERS[serverIdx];
return this;
}

Expand All @@ -92,7 +94,28 @@ public Builder setServerURL(String serverUrl, java.util.Map<String, String> para
* @throws Exception Thrown if the SDK could not be built.
*/
public Airbyte build() throws Exception {
return new Airbyte(this.client, this.security, this.serverUrl, this.params);
if (this.sdkConfiguration.defaultClient == null) {
this.sdkConfiguration.defaultClient = new SpeakeasyHTTPClient();
}

if (this.sdkConfiguration.security != null) {
this.sdkConfiguration.securityClient = com.airbyte.api.utils.Utils.configureSecurityClient(this.sdkConfiguration.defaultClient, this.sdkConfiguration.security);
}

if (this.sdkConfiguration.securityClient == null) {
this.sdkConfiguration.securityClient = this.sdkConfiguration.defaultClient;
}

if (this.sdkConfiguration.serverUrl == null || this.sdkConfiguration.serverUrl.isBlank()) {
this.sdkConfiguration.serverUrl = SERVERS[0];
this.sdkConfiguration.serverIdx = 0;
}

if (this.sdkConfiguration.serverUrl.endsWith("/")) {
this.sdkConfiguration.serverUrl = this.sdkConfiguration.serverUrl.substring(0, this.sdkConfiguration.serverUrl.length() - 1);
}

return new Airbyte(this.sdkConfiguration);
}
}

Expand All @@ -104,88 +127,19 @@ public static Builder builder() {
return new Builder();
}

private Airbyte(HTTPClient client, com.airbyte.api.models.shared.Security security, String serverUrl, java.util.Map<String, String> params) throws Exception {
this._defaultClient = client;

if (this._defaultClient == null) {
this._defaultClient = new SpeakeasyHTTPClient();
}

if (security != null) {
this._security = security;
this._securityClient = com.airbyte.api.utils.Utils.configureSecurityClient(this._defaultClient, this._security);
}

if (this._securityClient == null) {
this._securityClient = this._defaultClient;
}

if (serverUrl != null && !serverUrl.isBlank()) {
this._serverUrl = com.airbyte.api.utils.Utils.templateUrl(serverUrl, params);
}

if (this._serverUrl == null) {
this._serverUrl = SERVERS[0];
}

if (this._serverUrl.endsWith("/")) {
this._serverUrl = this._serverUrl.substring(0, this._serverUrl.length() - 1);
}


private Airbyte(SDKConfiguration sdkConfiguration) throws Exception {
this.sdkConfiguration = sdkConfiguration;

this.connections = new Connections(
this._defaultClient,
this._securityClient,
this._serverUrl,
this._language,
this._sdkVersion,
this._genVersion
);
this.connections = new Connections(this.sdkConfiguration);

this.destinations = new Destinations(
this._defaultClient,
this._securityClient,
this._serverUrl,
this._language,
this._sdkVersion,
this._genVersion
);
this.destinations = new Destinations(this.sdkConfiguration);

this.jobs = new Jobs(
this._defaultClient,
this._securityClient,
this._serverUrl,
this._language,
this._sdkVersion,
this._genVersion
);
this.jobs = new Jobs(this.sdkConfiguration);

this.sources = new Sources(
this._defaultClient,
this._securityClient,
this._serverUrl,
this._language,
this._sdkVersion,
this._genVersion
);
this.sources = new Sources(this.sdkConfiguration);

this.streams = new Streams(
this._defaultClient,
this._securityClient,
this._serverUrl,
this._language,
this._sdkVersion,
this._genVersion
);
this.streams = new Streams(this.sdkConfiguration);

this.workspaces = new Workspaces(
this._defaultClient,
this._securityClient,
this._serverUrl,
this._language,
this._sdkVersion,
this._genVersion
);
this.workspaces = new Workspaces(this.sdkConfiguration);
}
}
42 changes: 16 additions & 26 deletions lib/src/main/java/com/airbyte/api/Connections.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,10 @@

public class Connections {

private HTTPClient _defaultClient;
private HTTPClient _securityClient;
private String _serverUrl;
private String _language;
private String _sdkVersion;
private String _genVersion;

public Connections(HTTPClient defaultClient, HTTPClient securityClient, String serverUrl, String language, String sdkVersion, String genVersion) {
this._defaultClient = defaultClient;
this._securityClient = securityClient;
this._serverUrl = serverUrl;
this._language = language;
this._sdkVersion = sdkVersion;
this._genVersion = genVersion;
private SDKConfiguration sdkConfiguration;

public Connections(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
}

/**
Expand All @@ -38,7 +28,7 @@ public Connections(HTTPClient defaultClient, HTTPClient securityClient, String s
* @throws Exception if the API call fails
*/
public com.airbyte.api.models.operations.CreateConnectionResponse createConnection(com.airbyte.api.models.shared.ConnectionCreateRequest request) throws Exception {
String baseUrl = this._serverUrl;
String baseUrl = this.sdkConfiguration.serverUrl;
String url = com.airbyte.api.utils.Utils.generateURL(baseUrl, "/connections");

HTTPRequest req = new HTTPRequest();
Expand All @@ -51,9 +41,9 @@ public com.airbyte.api.models.operations.CreateConnectionResponse createConnecti
req.setBody(serializedRequestBody);

req.addHeader("Accept", "application/json");
req.addHeader("user-agent", String.format("speakeasy-sdk/%s %s %s", this._language, this._sdkVersion, this._genVersion));
req.addHeader("user-agent", String.format("speakeasy-sdk/%s %s %s", this.sdkConfiguration.language, this.sdkConfiguration.sdkVersion, this.sdkConfiguration.genVersion));

HTTPClient client = this._securityClient;
HTTPClient client = this.sdkConfiguration.securityClient;

HttpResponse<byte[]> httpRes = client.send(req);

Expand Down Expand Up @@ -84,17 +74,17 @@ else if (httpRes.statusCode() == 400 || httpRes.statusCode() == 403) {
* @throws Exception if the API call fails
*/
public com.airbyte.api.models.operations.DeleteConnectionResponse deleteConnection(com.airbyte.api.models.operations.DeleteConnectionRequest request) throws Exception {
String baseUrl = this._serverUrl;
String baseUrl = this.sdkConfiguration.serverUrl;
String url = com.airbyte.api.utils.Utils.generateURL(com.airbyte.api.models.operations.DeleteConnectionRequest.class, baseUrl, "/connections/{connectionId}", request, null);

HTTPRequest req = new HTTPRequest();
req.setMethod("DELETE");
req.setURL(url);

req.addHeader("Accept", "*/*");
req.addHeader("user-agent", String.format("speakeasy-sdk/%s %s %s", this._language, this._sdkVersion, this._genVersion));
req.addHeader("user-agent", String.format("speakeasy-sdk/%s %s %s", this.sdkConfiguration.language, this.sdkConfiguration.sdkVersion, this.sdkConfiguration.genVersion));

HTTPClient client = this._securityClient;
HTTPClient client = this.sdkConfiguration.securityClient;

HttpResponse<byte[]> httpRes = client.send(req);

Expand All @@ -117,17 +107,17 @@ public com.airbyte.api.models.operations.DeleteConnectionResponse deleteConnecti
* @throws Exception if the API call fails
*/
public com.airbyte.api.models.operations.GetConnectionResponse getConnection(com.airbyte.api.models.operations.GetConnectionRequest request) throws Exception {
String baseUrl = this._serverUrl;
String baseUrl = this.sdkConfiguration.serverUrl;
String url = com.airbyte.api.utils.Utils.generateURL(com.airbyte.api.models.operations.GetConnectionRequest.class, baseUrl, "/connections/{connectionId}", request, null);

HTTPRequest req = new HTTPRequest();
req.setMethod("GET");
req.setURL(url);

req.addHeader("Accept", "application/json");
req.addHeader("user-agent", String.format("speakeasy-sdk/%s %s %s", this._language, this._sdkVersion, this._genVersion));
req.addHeader("user-agent", String.format("speakeasy-sdk/%s %s %s", this.sdkConfiguration.language, this.sdkConfiguration.sdkVersion, this.sdkConfiguration.genVersion));

HTTPClient client = this._securityClient;
HTTPClient client = this.sdkConfiguration.securityClient;

HttpResponse<byte[]> httpRes = client.send(req);

Expand Down Expand Up @@ -158,23 +148,23 @@ else if (httpRes.statusCode() == 403 || httpRes.statusCode() == 404) {
* @throws Exception if the API call fails
*/
public com.airbyte.api.models.operations.ListConnectionsResponse listConnections(com.airbyte.api.models.operations.ListConnectionsRequest request) throws Exception {
String baseUrl = this._serverUrl;
String baseUrl = this.sdkConfiguration.serverUrl;
String url = com.airbyte.api.utils.Utils.generateURL(baseUrl, "/connections");

HTTPRequest req = new HTTPRequest();
req.setMethod("GET");
req.setURL(url);

req.addHeader("Accept", "application/json");
req.addHeader("user-agent", String.format("speakeasy-sdk/%s %s %s", this._language, this._sdkVersion, this._genVersion));
req.addHeader("user-agent", String.format("speakeasy-sdk/%s %s %s", this.sdkConfiguration.language, this.sdkConfiguration.sdkVersion, this.sdkConfiguration.genVersion));
java.util.List<NameValuePair> queryParams = com.airbyte.api.utils.Utils.getQueryParams(com.airbyte.api.models.operations.ListConnectionsRequest.class, request, null);
if (queryParams != null) {
for (NameValuePair queryParam : queryParams) {
req.addQueryParam(queryParam);
}
}

HTTPClient client = this._securityClient;
HTTPClient client = this.sdkConfiguration.securityClient;

HttpResponse<byte[]> httpRes = client.send(req);

Expand Down
Loading