|
1 |
| -undefined |
| 1 | +undefined |
| 2 | +<!-- Start Summary [summary] --> |
| 3 | +## Summary |
| 4 | + |
| 5 | +airbyte-api: Programmatically control Airbyte Cloud, OSS & Enterprise. |
| 6 | +<!-- End Summary [summary] --> |
| 7 | + |
| 8 | +<!-- Start Table of Contents [toc] --> |
| 9 | +## Table of Contents |
| 10 | +<!-- $toc-max-depth=2 --> |
| 11 | + * [SDK Installation](#sdk-installation) |
| 12 | + * [SDK Example Usage](#sdk-example-usage) |
| 13 | + * [Authentication](#authentication) |
| 14 | + * [Available Resources and Operations](#available-resources-and-operations) |
| 15 | + * [Error Handling](#error-handling) |
| 16 | + * [Server Selection](#server-selection) |
| 17 | + |
| 18 | +<!-- End Table of Contents [toc] --> |
| 19 | + |
| 20 | +<!-- Start SDK Installation [installation] --> |
| 21 | +## SDK Installation |
| 22 | + |
| 23 | +### Getting started |
| 24 | + |
| 25 | +JDK 11 or later is required. |
| 26 | + |
| 27 | +The samples below show how a published SDK artifact is used: |
| 28 | + |
| 29 | +Gradle: |
| 30 | +```groovy |
| 31 | +implementation 'com.airbyte:api:1.7.0' |
| 32 | +``` |
| 33 | + |
| 34 | +Maven: |
| 35 | +```xml |
| 36 | +<dependency> |
| 37 | + <groupId>com.airbyte</groupId> |
| 38 | + <artifactId>api</artifactId> |
| 39 | + <version>1.7.0</version> |
| 40 | +</dependency> |
| 41 | +``` |
| 42 | + |
| 43 | +### How to build |
| 44 | +After cloning the git repository to your file system you can build the SDK artifact from source to the `build` directory by running `./gradlew build` on *nix systems or `gradlew.bat` on Windows systems. |
| 45 | + |
| 46 | +If you wish to build from source and publish the SDK artifact to your local Maven repository (on your filesystem) then use the following command (after cloning the git repo locally): |
| 47 | + |
| 48 | +On *nix: |
| 49 | +```bash |
| 50 | +./gradlew publishToMavenLocal -Pskip.signing |
| 51 | +``` |
| 52 | +On Windows: |
| 53 | +```bash |
| 54 | +gradlew.bat publishToMavenLocal -Pskip.signing |
| 55 | +``` |
| 56 | +<!-- End SDK Installation [installation] --> |
| 57 | + |
| 58 | +<!-- Start SDK Example Usage [usage] --> |
| 59 | +## SDK Example Usage |
| 60 | + |
| 61 | +### Example |
| 62 | + |
| 63 | +```java |
| 64 | +package hello.world; |
| 65 | + |
| 66 | +import com.airbyte.api.Airbyte; |
| 67 | +import com.airbyte.api.models.operations.CreateConnectionResponse; |
| 68 | +import com.airbyte.api.models.shared.ConnectionCreateRequest; |
| 69 | +import com.airbyte.api.models.shared.SchemeBasicAuth; |
| 70 | +import com.airbyte.api.models.shared.Security; |
| 71 | +import java.lang.Exception; |
| 72 | + |
| 73 | +public class Application { |
| 74 | + |
| 75 | + public static void main(String[] args) throws Exception { |
| 76 | + |
| 77 | + Airbyte sdk = Airbyte.builder() |
| 78 | + .security(Security.builder() |
| 79 | + .basicAuth(SchemeBasicAuth.builder() |
| 80 | + .password("") |
| 81 | + .username("") |
| 82 | + .build()) |
| 83 | + .build()) |
| 84 | + .build(); |
| 85 | + |
| 86 | + ConnectionCreateRequest req = ConnectionCreateRequest.builder() |
| 87 | + .destinationId("e478de0d-a3a0-475c-b019-25f7dd29e281") |
| 88 | + .sourceId("95e66a59-8045-4307-9678-63bc3c9b8c93") |
| 89 | + .name("Postgres-to-Bigquery") |
| 90 | + .build(); |
| 91 | + |
| 92 | + CreateConnectionResponse res = sdk.connections().createConnection() |
| 93 | + .request(req) |
| 94 | + .call(); |
| 95 | + |
| 96 | + if (res.connectionResponse().isPresent()) { |
| 97 | + // handle response |
| 98 | + } |
| 99 | + } |
| 100 | +} |
| 101 | +``` |
| 102 | +<!-- End SDK Example Usage [usage] --> |
| 103 | + |
| 104 | +<!-- Start Authentication [security] --> |
| 105 | +## Authentication |
| 106 | + |
| 107 | +### Per-Client Security Schemes |
| 108 | + |
| 109 | +This SDK supports the following security schemes globally: |
| 110 | + |
| 111 | +| Name | Type | Scheme | |
| 112 | +| ------------------- | ------ | ------------ | |
| 113 | +| `basicAuth` | http | HTTP Basic | |
| 114 | +| `bearerAuth` | http | HTTP Bearer | |
| 115 | +| `clientCredentials` | oauth2 | OAuth2 token | |
| 116 | + |
| 117 | +You can set the security parameters through the `security` builder method when initializing the SDK client instance. The selected scheme will be used by default to authenticate with the API for all operations that support it. For example: |
| 118 | +```java |
| 119 | +package hello.world; |
| 120 | + |
| 121 | +import com.airbyte.api.Airbyte; |
| 122 | +import com.airbyte.api.models.operations.CreateConnectionResponse; |
| 123 | +import com.airbyte.api.models.shared.ConnectionCreateRequest; |
| 124 | +import com.airbyte.api.models.shared.SchemeBasicAuth; |
| 125 | +import com.airbyte.api.models.shared.Security; |
| 126 | +import java.lang.Exception; |
| 127 | + |
| 128 | +public class Application { |
| 129 | + |
| 130 | + public static void main(String[] args) throws Exception { |
| 131 | + |
| 132 | + Airbyte sdk = Airbyte.builder() |
| 133 | + .security(Security.builder() |
| 134 | + .basicAuth(SchemeBasicAuth.builder() |
| 135 | + .password("") |
| 136 | + .username("") |
| 137 | + .build()) |
| 138 | + .build()) |
| 139 | + .build(); |
| 140 | + |
| 141 | + ConnectionCreateRequest req = ConnectionCreateRequest.builder() |
| 142 | + .destinationId("e478de0d-a3a0-475c-b019-25f7dd29e281") |
| 143 | + .sourceId("95e66a59-8045-4307-9678-63bc3c9b8c93") |
| 144 | + .name("Postgres-to-Bigquery") |
| 145 | + .build(); |
| 146 | + |
| 147 | + CreateConnectionResponse res = sdk.connections().createConnection() |
| 148 | + .request(req) |
| 149 | + .call(); |
| 150 | + |
| 151 | + if (res.connectionResponse().isPresent()) { |
| 152 | + // handle response |
| 153 | + } |
| 154 | + } |
| 155 | +} |
| 156 | +``` |
| 157 | +<!-- End Authentication [security] --> |
| 158 | + |
| 159 | +<!-- Start Available Resources and Operations [operations] --> |
| 160 | +## Available Resources and Operations |
| 161 | + |
| 162 | +<details open> |
| 163 | +<summary>Available methods</summary> |
| 164 | + |
| 165 | + |
| 166 | +### [connections()](docs/sdks/connections/README.md) |
| 167 | + |
| 168 | +* [createConnection](docs/sdks/connections/README.md#createconnection) - Create a connection |
| 169 | +* [deleteConnection](docs/sdks/connections/README.md#deleteconnection) - Delete a Connection |
| 170 | +* [getConnection](docs/sdks/connections/README.md#getconnection) - Get Connection details |
| 171 | +* [listConnections](docs/sdks/connections/README.md#listconnections) - List connections |
| 172 | +* [patchConnection](docs/sdks/connections/README.md#patchconnection) - Update Connection details |
| 173 | + |
| 174 | +### [destinations()](docs/sdks/destinations/README.md) |
| 175 | + |
| 176 | +* [createDestination](docs/sdks/destinations/README.md#createdestination) - Create a destination |
| 177 | +* [deleteDestination](docs/sdks/destinations/README.md#deletedestination) - Delete a Destination |
| 178 | +* [getDestination](docs/sdks/destinations/README.md#getdestination) - Get Destination details |
| 179 | +* [listDestinations](docs/sdks/destinations/README.md#listdestinations) - List destinations |
| 180 | +* [patchDestination](docs/sdks/destinations/README.md#patchdestination) - Update a Destination |
| 181 | +* [putDestination](docs/sdks/destinations/README.md#putdestination) - Update a Destination and fully overwrite it |
| 182 | + |
| 183 | +### [health()](docs/sdks/health/README.md) |
| 184 | + |
| 185 | +* [getHealthCheck](docs/sdks/health/README.md#gethealthcheck) - Health Check |
| 186 | + |
| 187 | +### [jobs()](docs/sdks/jobs/README.md) |
| 188 | + |
| 189 | +* [cancelJob](docs/sdks/jobs/README.md#canceljob) - Cancel a running Job |
| 190 | +* [createJob](docs/sdks/jobs/README.md#createjob) - Trigger a sync or reset job of a connection |
| 191 | +* [getJob](docs/sdks/jobs/README.md#getjob) - Get Job status and details |
| 192 | +* [listJobs](docs/sdks/jobs/README.md#listjobs) - List Jobs by sync type |
| 193 | + |
| 194 | +### [organizations()](docs/sdks/organizations/README.md) |
| 195 | + |
| 196 | +* [listOrganizationsForUser](docs/sdks/organizations/README.md#listorganizationsforuser) - List all organizations for a user |
| 197 | + |
| 198 | +### [permissions()](docs/sdks/permissions/README.md) |
| 199 | + |
| 200 | +* [createPermission](docs/sdks/permissions/README.md#createpermission) - Create a permission |
| 201 | +* [deletePermission](docs/sdks/permissions/README.md#deletepermission) - Delete a Permission |
| 202 | +* [getPermission](docs/sdks/permissions/README.md#getpermission) - Get Permission details |
| 203 | +* [listPermissions](docs/sdks/permissions/README.md#listpermissions) - List Permissions by user id |
| 204 | +* [updatePermission](docs/sdks/permissions/README.md#updatepermission) - Update a permission |
| 205 | + |
| 206 | +### [sources()](docs/sdks/sources/README.md) |
| 207 | + |
| 208 | +* [createSource](docs/sdks/sources/README.md#createsource) - Create a source |
| 209 | +* [deleteSource](docs/sdks/sources/README.md#deletesource) - Delete a Source |
| 210 | +* [getSource](docs/sdks/sources/README.md#getsource) - Get Source details |
| 211 | +* [initiateOAuth](docs/sdks/sources/README.md#initiateoauth) - Initiate OAuth for a source |
| 212 | +* [listSources](docs/sdks/sources/README.md#listsources) - List sources |
| 213 | +* [patchSource](docs/sdks/sources/README.md#patchsource) - Update a Source |
| 214 | +* [putSource](docs/sdks/sources/README.md#putsource) - Update a Source and fully overwrite it |
| 215 | + |
| 216 | +### [streams()](docs/sdks/streams/README.md) |
| 217 | + |
| 218 | +* [getStreamProperties](docs/sdks/streams/README.md#getstreamproperties) - Get stream properties |
| 219 | + |
| 220 | +### [tags()](docs/sdks/tags/README.md) |
| 221 | + |
| 222 | +* [createTag](docs/sdks/tags/README.md#createtag) - Create a tag |
| 223 | +* [deleteTag](docs/sdks/tags/README.md#deletetag) - Delete a tag |
| 224 | +* [getTag](docs/sdks/tags/README.md#gettag) - Get a tag |
| 225 | +* [listTags](docs/sdks/tags/README.md#listtags) - List all tags |
| 226 | +* [updateTag](docs/sdks/tags/README.md#updatetag) - Update a tag |
| 227 | + |
| 228 | +### [users()](docs/sdks/users/README.md) |
| 229 | + |
| 230 | +* [listUsersWithinAnOrganization](docs/sdks/users/README.md#listuserswithinanorganization) - List all users within an organization |
| 231 | + |
| 232 | +### [workspaces()](docs/sdks/workspaces/README.md) |
| 233 | + |
| 234 | +* [createOrUpdateWorkspaceOAuthCredentials](docs/sdks/workspaces/README.md#createorupdateworkspaceoauthcredentials) - Create OAuth override credentials for a workspace and source type. |
| 235 | +* [createWorkspace](docs/sdks/workspaces/README.md#createworkspace) - Create a workspace |
| 236 | +* [deleteWorkspace](docs/sdks/workspaces/README.md#deleteworkspace) - Delete a Workspace |
| 237 | +* [getWorkspace](docs/sdks/workspaces/README.md#getworkspace) - Get Workspace details |
| 238 | +* [listWorkspaces](docs/sdks/workspaces/README.md#listworkspaces) - List workspaces |
| 239 | +* [updateWorkspace](docs/sdks/workspaces/README.md#updateworkspace) - Update a workspace |
| 240 | + |
| 241 | +</details> |
| 242 | +<!-- End Available Resources and Operations [operations] --> |
| 243 | + |
| 244 | +<!-- Start Error Handling [errors] --> |
| 245 | +## Error Handling |
| 246 | + |
| 247 | +Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an exception. |
| 248 | + |
| 249 | +By default, an API error will throw a `models/errors/SDKError` exception. When custom error responses are specified for an operation, the SDK may also throw their associated exception. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `createConnection` method throws the following exceptions: |
| 250 | + |
| 251 | +| Error Type | Status Code | Content Type | |
| 252 | +| ---------------------- | ----------- | ------------ | |
| 253 | +| models/errors/SDKError | 4XX, 5XX | \*/\* | |
| 254 | + |
| 255 | +### Example |
| 256 | + |
| 257 | +```java |
| 258 | +package hello.world; |
| 259 | + |
| 260 | +import com.airbyte.api.Airbyte; |
| 261 | +import com.airbyte.api.models.operations.CreateConnectionResponse; |
| 262 | +import com.airbyte.api.models.shared.ConnectionCreateRequest; |
| 263 | +import com.airbyte.api.models.shared.SchemeBasicAuth; |
| 264 | +import com.airbyte.api.models.shared.Security; |
| 265 | +import java.lang.Exception; |
| 266 | + |
| 267 | +public class Application { |
| 268 | + |
| 269 | + public static void main(String[] args) throws Exception { |
| 270 | + |
| 271 | + Airbyte sdk = Airbyte.builder() |
| 272 | + .security(Security.builder() |
| 273 | + .basicAuth(SchemeBasicAuth.builder() |
| 274 | + .password("") |
| 275 | + .username("") |
| 276 | + .build()) |
| 277 | + .build()) |
| 278 | + .build(); |
| 279 | + |
| 280 | + ConnectionCreateRequest req = ConnectionCreateRequest.builder() |
| 281 | + .destinationId("e478de0d-a3a0-475c-b019-25f7dd29e281") |
| 282 | + .sourceId("95e66a59-8045-4307-9678-63bc3c9b8c93") |
| 283 | + .name("Postgres-to-Bigquery") |
| 284 | + .build(); |
| 285 | + |
| 286 | + CreateConnectionResponse res = sdk.connections().createConnection() |
| 287 | + .request(req) |
| 288 | + .call(); |
| 289 | + |
| 290 | + if (res.connectionResponse().isPresent()) { |
| 291 | + // handle response |
| 292 | + } |
| 293 | + } |
| 294 | +} |
| 295 | +``` |
| 296 | +<!-- End Error Handling [errors] --> |
| 297 | + |
| 298 | +<!-- Start Server Selection [server] --> |
| 299 | +## Server Selection |
| 300 | + |
| 301 | +### Override Server URL Per-Client |
| 302 | + |
| 303 | +The default server can be overridden globally using the `.serverURL(String serverUrl)` builder method when initializing the SDK client instance. For example: |
| 304 | +```java |
| 305 | +package hello.world; |
| 306 | + |
| 307 | +import com.airbyte.api.Airbyte; |
| 308 | +import com.airbyte.api.models.operations.CreateConnectionResponse; |
| 309 | +import com.airbyte.api.models.shared.ConnectionCreateRequest; |
| 310 | +import com.airbyte.api.models.shared.SchemeBasicAuth; |
| 311 | +import com.airbyte.api.models.shared.Security; |
| 312 | +import java.lang.Exception; |
| 313 | + |
| 314 | +public class Application { |
| 315 | + |
| 316 | + public static void main(String[] args) throws Exception { |
| 317 | + |
| 318 | + Airbyte sdk = Airbyte.builder() |
| 319 | + .serverURL("https://api.airbyte.com/v1") |
| 320 | + .security(Security.builder() |
| 321 | + .basicAuth(SchemeBasicAuth.builder() |
| 322 | + .password("") |
| 323 | + .username("") |
| 324 | + .build()) |
| 325 | + .build()) |
| 326 | + .build(); |
| 327 | + |
| 328 | + ConnectionCreateRequest req = ConnectionCreateRequest.builder() |
| 329 | + .destinationId("e478de0d-a3a0-475c-b019-25f7dd29e281") |
| 330 | + .sourceId("95e66a59-8045-4307-9678-63bc3c9b8c93") |
| 331 | + .name("Postgres-to-Bigquery") |
| 332 | + .build(); |
| 333 | + |
| 334 | + CreateConnectionResponse res = sdk.connections().createConnection() |
| 335 | + .request(req) |
| 336 | + .call(); |
| 337 | + |
| 338 | + if (res.connectionResponse().isPresent()) { |
| 339 | + // handle response |
| 340 | + } |
| 341 | + } |
| 342 | +} |
| 343 | +``` |
| 344 | +<!-- End Server Selection [server] --> |
| 345 | + |
| 346 | +<!-- Placeholder for Future Speakeasy SDK Sections --> |
0 commit comments