diff --git a/.fern/metadata.json b/.fern/metadata.json
index 3430f57..4d61a92 100644
--- a/.fern/metadata.json
+++ b/.fern/metadata.json
@@ -1,7 +1,7 @@
{
- "cliVersion": "5.17.0",
+ "cliVersion": "5.37.12",
"generatorName": "fernapi/fern-java-sdk",
- "generatorVersion": "4.8.4",
+ "generatorVersion": "4.8.11",
"generatorConfig": {
"publish-to": "central",
"client-class-name": "BaseClient",
@@ -10,9 +10,8 @@
],
"retry-status-codes": "legacy"
},
- "originGitCommit": "fa2fad94474bee68b5a4c87f25775ff6701a0fe6",
- "originGitCommitIsDirty": false,
- "invokedBy": "ci",
- "ciProvider": "github",
- "sdkVersion": "2.0.4"
+ "originGitCommit": "320eac6d2809f95097ec1bb8cdb630cf13316b22",
+ "originGitCommitIsDirty": true,
+ "invokedBy": "manual",
+ "sdkVersion": "2.0.5"
}
\ No newline at end of file
diff --git a/README.md b/README.md
index 5ee2fb3..3e9bf5c 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ Add the dependency in your `build.gradle` file:
```groovy
dependencies {
- implementation 'com.pipedream:pipedream:2.0.4'
+ implementation 'com.pipedream:pipedream:2.0.5'
}
```
@@ -42,7 +42,7 @@ Add the dependency in your `pom.xml` file:
com.pipedream
pipedream
- 2.0.4
+ 2.0.5
```
diff --git a/build.gradle b/build.gradle
index d037e3f..8c6b958 100644
--- a/build.gradle
+++ b/build.gradle
@@ -48,7 +48,7 @@ java {
group = 'com.pipedream'
-version = '2.0.4'
+version = '2.0.5'
jar {
dependsOn(":generatePomFileForMavenPublication")
@@ -79,7 +79,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.pipedream'
artifactId = 'pipedream'
- version = '2.0.4'
+ version = '2.0.5'
from components.java
pom {
name = 'pipedream'
diff --git a/reference.md b/reference.md
index 7376761..4d75a73 100644
--- a/reference.md
+++ b/reference.md
@@ -1,5 +1,7 @@
# Reference
+
## AppCategories
+
client.appCategories.list() -> List<AppCategory>
@@ -29,12 +31,12 @@ Retrieve all available categories for integrated apps
```java
client.appCategories().list();
```
+
-
@@ -68,6 +70,7 @@ Get details of a specific app category by its ID
```java
client.appCategories().retrieve("id");
```
+
@@ -82,18 +85,18 @@ client.appCategories().retrieve("id");
**id:** `String` — The ID of the app category to retrieve
-
+
-
## Apps
+
client.apps.list() -> SyncPagingIterable<App>
@@ -139,6 +142,7 @@ client.apps().list(
.build()
);
```
+
@@ -153,7 +157,7 @@ client.apps().list(
**after:** `Optional` — The cursor to start from for pagination
-
+
@@ -161,7 +165,7 @@ client.apps().list(
**before:** `Optional` — The cursor to end before for pagination
-
+
@@ -169,7 +173,7 @@ client.apps().list(
**limit:** `Optional` — The maximum number of results to return
-
+
@@ -177,7 +181,7 @@ client.apps().list(
**q:** `Optional` — A search query to filter the apps
-
+
@@ -185,7 +189,7 @@ client.apps().list(
**sortKey:** `Optional` — The key to sort the apps by
-
+
@@ -193,7 +197,7 @@ client.apps().list(
**sortDirection:** `Optional` — The direction to sort the apps
-
+
@@ -201,7 +205,7 @@ client.apps().list(
**categoryIds:** `Optional` — Only return apps in these categories
-
+
@@ -209,7 +213,7 @@ client.apps().list(
**hasComponents:** `Optional` — Only return apps that have components (actions or triggers)
-
+
@@ -217,7 +221,7 @@ client.apps().list(
**hasActions:** `Optional` — Only return apps that have actions
-
+
@@ -225,13 +229,12 @@ client.apps().list(
**hasTriggers:** `Optional` — Only return apps that have triggers
-
+
-
@@ -265,6 +268,7 @@ Get detailed information about a specific app by ID or name slug
```java
client.apps().retrieve("app_id");
```
+
@@ -279,18 +283,18 @@ client.apps().retrieve("app_id");
**appId:** `String` — The name slug or ID of the app (e.g., 'slack', 'github')
-
+
-
## Accounts
+
client.accounts.list(projectId) -> SyncPagingIterable<Account>
@@ -331,6 +335,7 @@ client.accounts().list(
.build()
);
```
+
@@ -345,15 +350,15 @@ client.accounts().list(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**externalUserId:** `Optional`
-
+**externalUserId:** `Optional`
+
@@ -361,7 +366,7 @@ client.accounts().list(
**oauthAppId:** `Optional` — The OAuth app ID to filter by, if applicable
-
+
@@ -369,7 +374,7 @@ client.accounts().list(
**after:** `Optional` — The cursor to start from for pagination
-
+
@@ -377,7 +382,7 @@ client.accounts().list(
**before:** `Optional` — The cursor to end before for pagination
-
+
@@ -385,7 +390,7 @@ client.accounts().list(
**limit:** `Optional` — The maximum number of results to return
-
+
@@ -393,7 +398,7 @@ client.accounts().list(
**app:** `Optional` — The app slug or ID to filter accounts by.
-
+
@@ -401,13 +406,12 @@ client.accounts().list(
**includeCredentials:** `Optional` — Whether to retrieve the account's credentials or not
-
+
-
@@ -450,6 +454,7 @@ client.accounts().create(
.build()
);
```
+
@@ -464,15 +469,15 @@ client.accounts().create(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**externalUserId:** `Optional`
-
+**externalUserId:** `Optional`
+
@@ -480,7 +485,7 @@ client.accounts().create(
**oauthAppId:** `Optional` — The OAuth app ID to filter by, if applicable
-
+
@@ -488,7 +493,7 @@ client.accounts().create(
**appSlug:** `String` — The app slug for the account
-
+
@@ -496,7 +501,7 @@ client.accounts().create(
**cfmapJson:** `String` — JSON string containing the custom fields mapping
-
+
@@ -504,7 +509,7 @@ client.accounts().create(
**connectToken:** `String` — The connect token for authentication
-
+
@@ -512,7 +517,7 @@ client.accounts().create(
**name:** `Optional` — Optional name for the account
-
+
@@ -520,13 +525,12 @@ client.accounts().create(
**accountId:** `Optional` — An existing account ID to reconnect. When provided, the account's credentials are updated instead of creating a new account. Must belong to the same external user and project environment as the connect token, and match the app identified by app_slug.
-
+
-
@@ -566,6 +570,7 @@ client.accounts().retrieve(
.build()
);
```
+
@@ -580,15 +585,15 @@ client.accounts().retrieve(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**accountId:** `String`
-
+**accountId:** `String`
+
@@ -596,13 +601,12 @@ client.accounts().retrieve(
**includeCredentials:** `Optional` — Whether to retrieve the account's credentials or not
-
+
-
@@ -636,6 +640,7 @@ Remove a connected account and its associated credentials
```java
client.accounts().delete("account_id");
```
+
@@ -650,21 +655,20 @@ client.accounts().delete("account_id");
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**accountId:** `String`
-
+**accountId:** `String`
+
-
@@ -698,6 +702,76 @@ Remove all connected accounts for a specific app
```java
client.accounts().deleteByApp("app_id");
```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+
+
+
+
+
+**projectId:** `String` — The project ID, which starts with `proj_`.
+
+
+
+
+
+
+
+**appId:** `String`
+
+
+
+
+
+
+
+
+
+
+client.accounts.listByExternalUser(projectId, externalUserId) -> List<Account>
+
+
+
+#### 📝 Description
+
+
+
+
+
+
+
+List all connected accounts for a specific external user. Equivalent to GET /accounts with external_user_id filter but uses path-based routing.
+
+
+
+
+
+#### 🔌 Usage
+
+
+
+
+
+
+
+```java
+client.accounts().listByExternalUser(
+ "external_user_id",
+ AccountsListByExternalUserRequest
+ .builder()
+ .includeCredentials(true)
+ .app("app")
+ .build()
+);
+```
+
@@ -712,26 +786,42 @@ client.accounts().deleteByApp("app_id");
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**appId:** `String`
-
+**externalUserId:** `String`
+
+
+
+
+
+**includeCredentials:** `Optional`
+
+
+
+
+**app:** `Optional`
+
+
+
+
+
## Users
+
client.users.deleteExternalUser(projectId, externalUserId)
@@ -761,6 +851,7 @@ Remove an external user and all their associated accounts and resources
```java
client.users().deleteExternalUser("external_user_id");
```
+
@@ -775,21 +866,20 @@ client.users().deleteExternalUser("external_user_id");
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**externalUserId:** `String`
-
+**externalUserId:** `String`
+
-
@@ -831,6 +921,7 @@ client.users().list(
.build()
);
```
+
@@ -845,7 +936,7 @@ client.users().list(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -853,7 +944,7 @@ client.users().list(
**after:** `Optional` — The cursor to start from for pagination
-
+
@@ -861,7 +952,7 @@ client.users().list(
**before:** `Optional` — The cursor to end before for pagination
-
+
@@ -869,7 +960,7 @@ client.users().list(
**limit:** `Optional` — The maximum number of results to return
-
+
@@ -877,18 +968,18 @@ client.users().list(
**q:** `Optional` — Filter users by external_id (partial match)
-
+
-
## Components
+
client.components.list(projectId) -> SyncPagingIterable<Component>
@@ -929,6 +1020,7 @@ client.components().list(
.build()
);
```
+
@@ -943,7 +1035,7 @@ client.components().list(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -951,7 +1043,7 @@ client.components().list(
**after:** `Optional` — The cursor to start from for pagination
-
+
@@ -959,7 +1051,7 @@ client.components().list(
**before:** `Optional` — The cursor to end before for pagination
-
+
@@ -967,7 +1059,7 @@ client.components().list(
**limit:** `Optional` — The maximum number of results to return
-
+
@@ -975,7 +1067,7 @@ client.components().list(
**q:** `Optional` — A search query to filter the components
-
+
@@ -983,7 +1075,7 @@ client.components().list(
**app:** `Optional` — The ID or name slug of the app to filter the components
-
+
@@ -991,7 +1083,7 @@ client.components().list(
**registry:** `Optional` — The registry to retrieve components from. Defaults to 'all' ('public', 'private', or 'all')
-
+
@@ -999,13 +1091,12 @@ client.components().list(
**componentType:** `Optional` — The type of the component to filter the components
-
+
-
@@ -1045,6 +1136,7 @@ client.components().retrieve(
.build()
);
```
+
@@ -1059,7 +1151,7 @@ client.components().retrieve(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -1067,7 +1159,7 @@ client.components().retrieve(
**componentId:** `String` — The key that uniquely identifies the component (e.g., 'slack-send-message')
-
+
@@ -1075,13 +1167,12 @@ client.components().retrieve(
**version:** `Optional` — Optional semantic version of the component to retrieve (for example '1.0.0')
-
+
-
@@ -1122,6 +1213,7 @@ client.components().configureProp(
.build()
);
```
+
@@ -1136,21 +1228,20 @@ client.components().configureProp(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**request:** `ConfigurePropOpts`
-
+**request:** `ConfigurePropOpts`
+
-
@@ -1190,6 +1281,7 @@ client.components().reloadProps(
.build()
);
```
+
@@ -1204,26 +1296,26 @@ client.components().reloadProps(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**request:** `ReloadPropsOpts`
-
+**request:** `ReloadPropsOpts`
+
-
## Actions
+
client.actions.list(projectId) -> SyncPagingIterable<Component>
@@ -1263,6 +1355,7 @@ client.actions().list(
.build()
);
```
+
@@ -1277,7 +1370,7 @@ client.actions().list(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -1285,7 +1378,7 @@ client.actions().list(
**after:** `Optional` — The cursor to start from for pagination
-
+
@@ -1293,7 +1386,7 @@ client.actions().list(
**before:** `Optional` — The cursor to end before for pagination
-
+
@@ -1301,7 +1394,7 @@ client.actions().list(
**limit:** `Optional` — The maximum number of results to return
-
+
@@ -1309,7 +1402,7 @@ client.actions().list(
**q:** `Optional` — A search query to filter the actions
-
+
@@ -1317,7 +1410,7 @@ client.actions().list(
**app:** `Optional` — The ID or name slug of the app to filter the actions
-
+
@@ -1325,13 +1418,12 @@ client.actions().list(
**registry:** `Optional` — The registry to retrieve actions from. Defaults to 'all' ('public', 'private', or 'all')
-
+
-
@@ -1371,6 +1463,7 @@ client.actions().retrieve(
.build()
);
```
+
@@ -1385,7 +1478,7 @@ client.actions().retrieve(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -1393,7 +1486,7 @@ client.actions().retrieve(
**componentId:** `String` — The key that uniquely identifies the component (e.g., 'slack-send-message')
-
+
@@ -1401,13 +1494,12 @@ client.actions().retrieve(
**version:** `Optional` — Optional semantic version of the component to retrieve (for example '1.0.0')
-
+
-
@@ -1448,6 +1540,7 @@ client.actions().configureProp(
.build()
);
```
+
@@ -1462,21 +1555,20 @@ client.actions().configureProp(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**request:** `ConfigurePropOpts`
-
+**request:** `ConfigurePropOpts`
+
-
@@ -1516,6 +1608,7 @@ client.actions().reloadProps(
.build()
);
```
+
@@ -1530,21 +1623,20 @@ client.actions().reloadProps(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**request:** `ReloadPropsOpts`
-
+**request:** `ReloadPropsOpts`
+
-
@@ -1584,6 +1676,7 @@ client.actions().run(
.build()
);
```
+
@@ -1598,7 +1691,7 @@ client.actions().run(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -1606,7 +1699,7 @@ client.actions().run(
**id:** `String` — The action component ID
-
+
@@ -1614,7 +1707,7 @@ client.actions().run(
**version:** `Optional` — Optional action component version (in SemVer format, for example '1.0.0'), defaults to latest
-
+
@@ -1622,15 +1715,15 @@ client.actions().run(
**externalUserId:** `String` — The external user ID
-
+
-**configuredProps:** `Optional>`
-
+**configuredProps:** `Optional>`
+
@@ -1638,26 +1731,26 @@ client.actions().run(
**dynamicPropsId:** `Optional` — The ID for dynamic props
-
+
-**stashId:** `Optional`
-
+**stashId:** `Optional`
+
-
## Triggers
+
client.triggers.list(projectId) -> SyncPagingIterable<Component>
@@ -1697,6 +1790,7 @@ client.triggers().list(
.build()
);
```
+
@@ -1711,7 +1805,7 @@ client.triggers().list(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -1719,7 +1813,7 @@ client.triggers().list(
**after:** `Optional` — The cursor to start from for pagination
-
+
@@ -1727,7 +1821,7 @@ client.triggers().list(
**before:** `Optional` — The cursor to end before for pagination
-
+
@@ -1735,7 +1829,7 @@ client.triggers().list(
**limit:** `Optional` — The maximum number of results to return
-
+
@@ -1743,7 +1837,7 @@ client.triggers().list(
**q:** `Optional` — A search query to filter the triggers
-
+
@@ -1751,7 +1845,7 @@ client.triggers().list(
**app:** `Optional` — The ID or name slug of the app to filter the triggers
-
+
@@ -1759,13 +1853,12 @@ client.triggers().list(
**registry:** `Optional` — The registry to retrieve triggers from. Defaults to 'all' ('public', 'private', or 'all')
-
+
-
@@ -1805,6 +1898,7 @@ client.triggers().retrieve(
.build()
);
```
+
@@ -1819,7 +1913,7 @@ client.triggers().retrieve(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -1827,7 +1921,7 @@ client.triggers().retrieve(
**componentId:** `String` — The key that uniquely identifies the component (e.g., 'slack-send-message')
-
+
@@ -1835,13 +1929,12 @@ client.triggers().retrieve(
**version:** `Optional` — Optional semantic version of the component to retrieve (for example '1.0.0')
-
+
-
@@ -1882,6 +1975,7 @@ client.triggers().configureProp(
.build()
);
```
+
@@ -1896,21 +1990,20 @@ client.triggers().configureProp(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**request:** `ConfigurePropOpts`
-
+**request:** `ConfigurePropOpts`
+
-
@@ -1950,6 +2043,7 @@ client.triggers().reloadProps(
.build()
);
```
+
@@ -1964,21 +2058,20 @@ client.triggers().reloadProps(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**request:** `ReloadPropsOpts`
-
+**request:** `ReloadPropsOpts`
+
-
@@ -2018,6 +2111,7 @@ client.triggers().deploy(
.build()
);
```
+
@@ -2032,7 +2126,7 @@ client.triggers().deploy(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -2040,7 +2134,7 @@ client.triggers().deploy(
**id:** `String` — The trigger component ID
-
+
@@ -2048,7 +2142,7 @@ client.triggers().deploy(
**version:** `Optional` — Optional trigger component version (in SemVer format, for example '1.0.0'), defaults to latest
-
+
@@ -2056,15 +2150,15 @@ client.triggers().deploy(
**externalUserId:** `String` — The external user ID
-
+
-**configuredProps:** `Optional>`
-
+**configuredProps:** `Optional>`
+
@@ -2072,7 +2166,7 @@ client.triggers().deploy(
**dynamicPropsId:** `Optional` — The ID for dynamic props
-
+
@@ -2080,7 +2174,7 @@ client.triggers().deploy(
**workflowId:** `Optional` — Optional ID of a workflow to receive trigger events
-
+
@@ -2088,7 +2182,7 @@ client.triggers().deploy(
**webhookUrl:** `Optional` — Optional webhook URL to receive trigger events
-
+
@@ -2096,18 +2190,18 @@ client.triggers().deploy(
**emitOnDeploy:** `Optional` — Whether the trigger should emit events during the deploy hook execution. Defaults to true if not specified.
-
+
-
## DeployedTriggers
+
client.deployedTriggers.list(projectId) -> SyncPagingIterable<Emitter>
@@ -2146,6 +2240,7 @@ client.deployedTriggers().list(
.build()
);
```
+
@@ -2160,7 +2255,7 @@ client.deployedTriggers().list(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -2168,7 +2263,7 @@ client.deployedTriggers().list(
**after:** `Optional` — The cursor to start from for pagination
-
+
@@ -2176,7 +2271,7 @@ client.deployedTriggers().list(
**before:** `Optional` — The cursor to end before for pagination
-
+
@@ -2184,7 +2279,7 @@ client.deployedTriggers().list(
**limit:** `Optional` — The maximum number of results to return
-
+
@@ -2192,7 +2287,7 @@ client.deployedTriggers().list(
**externalUserId:** `String` — Your end user ID, for whom you deployed the trigger
-
+
@@ -2200,13 +2295,12 @@ client.deployedTriggers().list(
**emitterType:** `Optional` — Filter deployed triggers by emitter type (defaults to 'source' if not provided)
-
+
-
@@ -2246,6 +2340,7 @@ client.deployedTriggers().retrieve(
.build()
);
```
+
@@ -2260,15 +2355,15 @@ client.deployedTriggers().retrieve(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**triggerId:** `String`
-
+**triggerId:** `String`
+
@@ -2276,13 +2371,12 @@ client.deployedTriggers().retrieve(
**externalUserId:** `String` — Your end user ID, for whom you deployed the trigger
-
+
-
@@ -2322,6 +2416,7 @@ client.deployedTriggers().update(
.build()
);
```
+
@@ -2336,15 +2431,15 @@ client.deployedTriggers().update(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**triggerId:** `String`
-
+**triggerId:** `String`
+
@@ -2352,7 +2447,7 @@ client.deployedTriggers().update(
**externalUserId:** `String` — The external user ID who owns the trigger
-
+
@@ -2360,15 +2455,15 @@ client.deployedTriggers().update(
**active:** `Optional` — Whether the trigger should be active
-
+
-**configuredProps:** `Optional>`
-
+**configuredProps:** `Optional>`
+
@@ -2376,7 +2471,7 @@ client.deployedTriggers().update(
**name:** `Optional` — The name of the trigger
-
+
@@ -2384,13 +2479,12 @@ client.deployedTriggers().update(
**emitOnDeploy:** `Optional` — Whether the trigger should emit events during deployment
-
+
-
@@ -2431,6 +2525,7 @@ client.deployedTriggers().delete(
.build()
);
```
+
@@ -2445,15 +2540,15 @@ client.deployedTriggers().delete(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**triggerId:** `String`
-
+**triggerId:** `String`
+
@@ -2461,7 +2556,7 @@ client.deployedTriggers().delete(
**externalUserId:** `String` — The external user ID who owns the trigger
-
+
@@ -2469,13 +2564,12 @@ client.deployedTriggers().delete(
**ignoreHookErrors:** `Optional` — Whether to ignore errors during deactivation hook
-
+
-
@@ -2516,6 +2610,7 @@ client.deployedTriggers().listEvents(
.build()
);
```
+
@@ -2530,15 +2625,15 @@ client.deployedTriggers().listEvents(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**triggerId:** `String`
-
+**triggerId:** `String`
+
@@ -2546,7 +2641,7 @@ client.deployedTriggers().listEvents(
**externalUserId:** `String` — Your end user ID, for whom you deployed the trigger
-
+
@@ -2554,13 +2649,12 @@ client.deployedTriggers().listEvents(
**n:** `Optional` — The number of events to retrieve (defaults to 20 if not provided)
-
+
-
@@ -2600,6 +2694,7 @@ client.deployedTriggers().listWorkflows(
.build()
);
```
+
@@ -2614,15 +2709,15 @@ client.deployedTriggers().listWorkflows(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**triggerId:** `String`
-
+**triggerId:** `String`
+
@@ -2630,13 +2725,12 @@ client.deployedTriggers().listWorkflows(
**externalUserId:** `String` — The external user ID who owns the trigger
-
+
-
@@ -2679,6 +2773,7 @@ client.deployedTriggers().updateWorkflows(
.build()
);
```
+
@@ -2693,15 +2788,15 @@ client.deployedTriggers().updateWorkflows(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**triggerId:** `String`
-
+**triggerId:** `String`
+
@@ -2709,7 +2804,7 @@ client.deployedTriggers().updateWorkflows(
**externalUserId:** `String` — The external user ID who owns the trigger
-
+
@@ -2717,13 +2812,12 @@ client.deployedTriggers().updateWorkflows(
**workflowIds:** `List` — Array of workflow IDs to set
-
+
-
@@ -2763,6 +2857,7 @@ client.deployedTriggers().listWebhooks(
.build()
);
```
+
@@ -2777,15 +2872,15 @@ client.deployedTriggers().listWebhooks(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**triggerId:** `String`
-
+**triggerId:** `String`
+
@@ -2793,13 +2888,12 @@ client.deployedTriggers().listWebhooks(
**externalUserId:** `String` — The external user ID who owns the trigger
-
+
-
@@ -2842,6 +2936,7 @@ client.deployedTriggers().updateWebhooks(
.build()
);
```
+
@@ -2856,15 +2951,15 @@ client.deployedTriggers().updateWebhooks(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**triggerId:** `String`
-
+**triggerId:** `String`
+
@@ -2872,7 +2967,7 @@ client.deployedTriggers().updateWebhooks(
**externalUserId:** `String` — The external user ID who owns the trigger
-
+
@@ -2880,13 +2975,12 @@ client.deployedTriggers().updateWebhooks(
**webhookUrls:** `List` — Array of webhook URLs to set
-
+
-
@@ -2927,6 +3021,7 @@ client.deployedTriggers().retrieveWebhook(
.build()
);
```
+
@@ -2941,23 +3036,23 @@ client.deployedTriggers().retrieveWebhook(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**triggerId:** `String`
-
+**triggerId:** `String`
+
-**webhookId:** `String`
-
+**webhookId:** `String`
+
@@ -2965,13 +3060,12 @@ client.deployedTriggers().retrieveWebhook(
**externalUserId:** `String` — The external user ID who owns the trigger
-
+
-
@@ -3012,6 +3106,7 @@ client.deployedTriggers().regenerateWebhookSigningKey(
.build()
);
```
+
@@ -3026,23 +3121,23 @@ client.deployedTriggers().regenerateWebhookSigningKey(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**triggerId:** `String`
-
+**triggerId:** `String`
+
-**webhookId:** `String`
-
+**webhookId:** `String`
+
@@ -3050,18 +3145,18 @@ client.deployedTriggers().regenerateWebhookSigningKey(
**externalUserId:** `String` — The external user ID who owns the trigger
-
+
-
## ProjectEnvironment
+
client.projectEnvironment.retrieveWebhook(projectId) -> GetWebhookResponse
@@ -3091,6 +3186,7 @@ Retrieve the webhook configured for a project environment
```java
client.projectEnvironment().retrieveWebhook();
```
+
@@ -3105,13 +3201,12 @@ client.projectEnvironment().retrieveWebhook();
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-
@@ -3150,6 +3245,7 @@ client.projectEnvironment().updateWebhook(
.build()
);
```
+
@@ -3164,7 +3260,7 @@ client.projectEnvironment().updateWebhook(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -3172,13 +3268,12 @@ client.projectEnvironment().updateWebhook(
**url:** `String` — The webhook URL to set
-
+
-
@@ -3212,6 +3307,7 @@ Remove the webhook configured for a project environment
```java
client.projectEnvironment().deleteWebhook();
```
+
@@ -3226,13 +3322,12 @@ client.projectEnvironment().deleteWebhook();
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-
@@ -3266,6 +3361,7 @@ Regenerate the signing key for the project environment webhook
```java
client.projectEnvironment().regenerateWebhookSigningKey();
```
+
@@ -3280,18 +3376,18 @@ client.projectEnvironment().regenerateWebhookSigningKey();
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-
## Projects
+
client.projects.list() -> SyncPagingIterable<Project>
@@ -3329,6 +3425,7 @@ client.projects().list(
.build()
);
```
+
@@ -3343,7 +3440,7 @@ client.projects().list(
**after:** `Optional` — The cursor to start from for pagination
-
+
@@ -3351,7 +3448,7 @@ client.projects().list(
**before:** `Optional` — The cursor to end before for pagination
-
+
@@ -3359,7 +3456,7 @@ client.projects().list(
**limit:** `Optional` — The maximum number of results to return
-
+
@@ -3367,13 +3464,12 @@ client.projects().list(
**q:** `Optional` — A search query to filter the projects
-
+
-
@@ -3412,6 +3508,7 @@ client.projects().create(
.build()
);
```
+
@@ -3426,7 +3523,7 @@ client.projects().create(
**name:** `String` — Name of the project
-
+
@@ -3434,7 +3531,7 @@ client.projects().create(
**appName:** `Optional` — Display name for the Connect application
-
+
@@ -3442,7 +3539,7 @@ client.projects().create(
**supportEmail:** `Optional` — Support email displayed to end users
-
+
@@ -3450,13 +3547,12 @@ client.projects().create(
**connectRequireKeyAuthTest:** `Optional` — Send a test request to the upstream API when adding Connect accounts for key-based apps
-
+
-
@@ -3490,6 +3586,7 @@ Get the project details for a specific project
```java
client.projects().retrieve("project_id");
```
+
@@ -3504,13 +3601,12 @@ client.projects().retrieve("project_id");
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-
@@ -3544,6 +3640,7 @@ Delete a project owned by the authenticated workspace
```java
client.projects().delete("project_id");
```
+
@@ -3558,13 +3655,12 @@ client.projects().delete("project_id");
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-
@@ -3603,6 +3699,7 @@ client.projects().update(
.build()
);
```
+
@@ -3617,7 +3714,7 @@ client.projects().update(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -3625,7 +3722,7 @@ client.projects().update(
**name:** `Optional` — Name of the project
-
+
@@ -3633,7 +3730,7 @@ client.projects().update(
**appName:** `Optional` — Display name for the Connect application
-
+
@@ -3641,7 +3738,7 @@ client.projects().update(
**supportEmail:** `Optional` — Support email displayed to end users
-
+
@@ -3649,13 +3746,12 @@ client.projects().update(
**connectRequireKeyAuthTest:** `Optional` — Send a test request to the upstream API when adding Connect accounts for key-based apps
-
+
-
@@ -3695,6 +3791,7 @@ client.projects().updateLogo(
.build()
);
```
+
@@ -3709,7 +3806,7 @@ client.projects().updateLogo(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -3717,13 +3814,12 @@ client.projects().updateLogo(
**logo:** `String` — Data URI containing the new Base64 encoded image
-
+
-
@@ -3757,6 +3853,7 @@ Retrieve project configuration and environment details
```java
client.projects().retrieveInfo();
```
+
@@ -3771,18 +3868,18 @@ client.projects().retrieveInfo();
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-
## FileStash
+
client.fileStash.downloadFile(projectId) -> InputStream
@@ -3817,6 +3914,7 @@ client.fileStash().downloadFile(
.build()
);
```
+
@@ -3831,27 +3929,50 @@ client.fileStash().downloadFile(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
-**s3Key:** `String`
-
+**s3Key:** `String`
+
-
## Proxy
-client.proxy.get(projectId, url64) -> InputStream
+
+The Proxy client forwards authenticated HTTP requests to a third-party API using credentials
+from a connected account stored in Pipedream Connect. Pass the target URL as a `String` (or
+`okhttp3.HttpUrl`) — the client Base64-encodes it internally before calling the Pipedream API.
+
+Every method returns a `ProxyResponse`, which is a closeable union of either a parsed JSON
+value (`response.isJson()` / `response.json()`) or a raw `InputStream` (`response.isStream()` /
+`response.stream()`), determined by the upstream `Content-Type`. Stream responses should be
+consumed inside a try-with-resources block to release the underlying HTTP connection:
+
+```java
+try (ProxyResponse response = client.proxy().get("https://api.example.com/users", request)) {
+ if (response.isJson()) {
+ Object json = response.json();
+ } else {
+ InputStream body = response.stream();
+ }
+}
+```
+
+For full HTTP metadata (status code, headers), use `client.proxy().withRawResponse()`. The
+async client (`asyncClient.proxy().get(...)`) exposes the same surface with
+`CompletableFuture` return types.
+
+client.proxy.get(url, request) -> ProxyResponse
@@ -3879,7 +4000,7 @@ Forward an authenticated GET request to an external API using an external user's
```java
client.proxy().get(
- "url_64",
+ "https://api.example.com/users",
ProxyGetRequest
.builder()
.externalUserId("external_user_id")
@@ -3887,6 +4008,7 @@ client.proxy().get(
.build()
);
```
+
@@ -3900,16 +4022,8 @@ client.proxy().get(
-**projectId:** `String` — The project ID, which starts with `proj_`.
-
-
-
-
-
-
+**url:** `String` — Target URL to forward the request to. Base64-encoded internally before being sent to Pipedream. An `okhttp3.HttpUrl` overload is also available.
-**url64:** `String` — Base64-encoded target URL
-
@@ -3917,7 +4031,7 @@ client.proxy().get(
**externalUserId:** `String` — The external user ID for the proxy request
-
+
@@ -3925,18 +4039,17 @@ client.proxy().get(
**accountId:** `String` — The account ID to use for authentication
-
+
-
-client.proxy.post(projectId, url64, request) -> InputStream
+client.proxy.post(url, request) -> ProxyResponse
@@ -3964,21 +4077,21 @@ Forward an authenticated POST request to an external API using an external user'
```java
client.proxy().post(
- "url_64",
+ "https://api.example.com/users",
ProxyPostRequest
.builder()
.externalUserId("external_user_id")
.accountId("account_id")
.body(
new HashMap() {{
- put("string", new
- HashMap() {{put("key", "value");
- }});
+ put("name", "Jane Doe");
+ put("email", "jane@example.com");
}}
)
.build()
);
```
+
@@ -3992,16 +4105,8 @@ client.proxy().post(
-**projectId:** `String` — The project ID, which starts with `proj_`.
-
-
-
+**url:** `String` — Target URL to forward the request to. Base64-encoded internally before being sent to Pipedream. An `okhttp3.HttpUrl` overload is also available.
-
-
-
-**url64:** `String` — Base64-encoded target URL
-
@@ -4009,7 +4114,7 @@ client.proxy().post(
**externalUserId:** `String` — The external user ID for the proxy request
-
+
@@ -4017,26 +4122,25 @@ client.proxy().post(
**accountId:** `String` — The account ID to use for authentication
-
+
-**request:** `Map` — Request body to forward to the target API
-
+**body:** `Map` — Request body to forward to the target API
+
-
-client.proxy.put(projectId, url64, request) -> InputStream
+client.proxy.put(url, request) -> ProxyResponse
@@ -4064,21 +4168,21 @@ Forward an authenticated PUT request to an external API using an external user's
```java
client.proxy().put(
- "url_64",
+ "https://api.example.com/users/42",
ProxyPutRequest
.builder()
.externalUserId("external_user_id")
.accountId("account_id")
.body(
new HashMap() {{
- put("string", new
- HashMap() {{put("key", "value");
- }});
+ put("name", "Jane Doe");
+ put("email", "jane@example.com");
}}
)
.build()
);
```
+
@@ -4092,16 +4196,8 @@ client.proxy().put(
-**projectId:** `String` — The project ID, which starts with `proj_`.
-
-
-
-
-
-
+**url:** `String` — Target URL to forward the request to. Base64-encoded internally before being sent to Pipedream. An `okhttp3.HttpUrl` overload is also available.
-**url64:** `String` — Base64-encoded target URL
-
@@ -4109,7 +4205,7 @@ client.proxy().put(
**externalUserId:** `String` — The external user ID for the proxy request
-
+
@@ -4117,26 +4213,25 @@ client.proxy().put(
**accountId:** `String` — The account ID to use for authentication
-
+
-**request:** `Map` — Request body to forward to the target API
-
+**body:** `Map` — Request body to forward to the target API
+
-
-client.proxy.delete(projectId, url64) -> InputStream
+client.proxy.delete(url, request) -> ProxyResponse
@@ -4164,7 +4259,7 @@ Forward an authenticated DELETE request to an external API using an external use
```java
client.proxy().delete(
- "url_64",
+ "https://api.example.com/users/42",
ProxyDeleteRequest
.builder()
.externalUserId("external_user_id")
@@ -4172,6 +4267,7 @@ client.proxy().delete(
.build()
);
```
+
@@ -4185,16 +4281,8 @@ client.proxy().delete(
-**projectId:** `String` — The project ID, which starts with `proj_`.
-
-
-
-
-
-
+**url:** `String` — Target URL to forward the request to. Base64-encoded internally before being sent to Pipedream. An `okhttp3.HttpUrl` overload is also available.
-**url64:** `String` — Base64-encoded target URL
-
@@ -4202,7 +4290,7 @@ client.proxy().delete(
**externalUserId:** `String` — The external user ID for the proxy request
-
+
@@ -4210,18 +4298,17 @@ client.proxy().delete(
**accountId:** `String` — The account ID to use for authentication
-
+
-
-client.proxy.patch(projectId, url64, request) -> InputStream
+client.proxy.patch(url, request) -> ProxyResponse
@@ -4249,21 +4336,20 @@ Forward an authenticated PATCH request to an external API using an external user
```java
client.proxy().patch(
- "url_64",
+ "https://api.example.com/users/42",
ProxyPatchRequest
.builder()
.externalUserId("external_user_id")
.accountId("account_id")
.body(
new HashMap() {{
- put("string", new
- HashMap() {{put("key", "value");
- }});
+ put("email", "jane.new@example.com");
}}
)
.build()
);
```
+
@@ -4277,16 +4363,8 @@ client.proxy().patch(
-**projectId:** `String` — The project ID, which starts with `proj_`.
-
-
-
+**url:** `String` — Target URL to forward the request to. Base64-encoded internally before being sent to Pipedream. An `okhttp3.HttpUrl` overload is also available.
-
-
-
-**url64:** `String` — Base64-encoded target URL
-
@@ -4294,7 +4372,7 @@ client.proxy().patch(
**externalUserId:** `String` — The external user ID for the proxy request
-
+
@@ -4302,26 +4380,26 @@ client.proxy().patch(
**accountId:** `String` — The account ID to use for authentication
-
+
-**request:** `Map` — Request body to forward to the target API
-
+**body:** `Map` — Request body to forward to the target API
+
-
## Tokens
+
client.tokens.create(projectId, request) -> CreateTokenResponse
@@ -4356,6 +4434,7 @@ client.tokens().create(
.build()
);
```
+
@@ -4370,7 +4449,7 @@ client.tokens().create(
**projectId:** `String` — The project ID, which starts with `proj_`.
-
+
@@ -4378,7 +4457,7 @@ client.tokens().create(
**allowedOrigins:** `Optional>` — List of allowed origins for CORS
-
+
@@ -4386,7 +4465,7 @@ client.tokens().create(
**errorRedirectUri:** `Optional` — URI to redirect to on error
-
+
@@ -4394,7 +4473,7 @@ client.tokens().create(
**expiresIn:** `Optional` — Token TTL in seconds (max 14400 = 4 hours). Defaults to 4 hours if not specified.
-
+
@@ -4402,15 +4481,15 @@ client.tokens().create(
**externalUserId:** `String` — Your end user ID, for whom you're creating the token
-
+
-**scope:** `Optional` — Space-separated scopes to restrict token permissions. Defaults to 'connect:*' if not specified. See https://pipedream.com/docs/connect/api-reference/authentication#connect-token-scopes for more information.
-
+**scope:** `Optional` — Space-separated scopes to restrict token permissions. Defaults to 'connect:*' if not specified. See for more information.
+
@@ -4418,7 +4497,7 @@ client.tokens().create(
**successRedirectUri:** `Optional` — URI to redirect to on success
-
+
@@ -4426,7 +4505,7 @@ client.tokens().create(
**webhookUri:** `Optional` — Webhook URI for notifications
-
+
@@ -4434,13 +4513,12 @@ client.tokens().create(
**allowProgressiveScopes:** `Optional` — When true, end users may authorize a subset of the app's OAuth scopes; only the app's functional scopes (needed for the post-OAuth test request) are enforced. Defaults to false.
-
+
-
@@ -4482,6 +4560,7 @@ client.tokens().validate(
.build()
);
```
+
@@ -4495,8 +4574,8 @@ client.tokens().validate(
-**ctok:** `String`
-
+**ctok:** `String`
+
@@ -4504,7 +4583,7 @@ client.tokens().validate(
**appId:** `String` — The app ID to validate against
-
+
@@ -4512,7 +4591,7 @@ client.tokens().validate(
**accountId:** `Optional` — An existing account ID to reconnect. Must belong to the app identified by app_id.
-
+
@@ -4520,18 +4599,18 @@ client.tokens().validate(
**oauthAppId:** `Optional` — The OAuth app ID to validate against (if the token is for an OAuth app)
-
+
-
## Usage
+
client.usage.list() -> ConnectUsageResponse
@@ -4567,6 +4646,7 @@ client.usage().list(
.build()
);
```
+
@@ -4581,7 +4661,7 @@ client.usage().list(
**startTs:** `Integer` — Usage window start timestamp (seconds)
-
+
@@ -4589,18 +4669,18 @@ client.usage().list(
**endTs:** `Integer` — Usage window end timestamp (seconds)
-
+
-
## OauthTokens
+
client.oauthTokens.create(request) -> CreateOAuthTokenResponse
@@ -4636,6 +4716,7 @@ client.oauthTokens().create(
.build()
);
```
+
@@ -4649,24 +4730,24 @@ client.oauthTokens().create(
-**grantType:** `String`
-
+**grantType:** `String`
+
-**clientId:** `String`
-
+**clientId:** `String`
+
-**clientSecret:** `String`
-
+**clientSecret:** `String`
+
@@ -4674,14 +4755,219 @@ client.oauthTokens().create(
**scope:** `Optional` — Optional space-separated scopes for the access token. Defaults to `*`.
-
+
+
+
+
+
+
+
+
+
+
+## Workflows
+
+The Workflows client invokes a Pipedream workflow via its HTTP interface. Pass either a full
+workflow URL (`https://eo3xxxx.m.pipedream.net`) or just the endpoint ID (`eo3xxxx`). Both
+methods return the workflow's response body as a deserialized `Object` (typically a `Map`,
+`List`, or scalar — see Jackson's default deserialization). The async client
+(`asyncClient.workflows().invoke(...)` / `invokeForExternalUser(...)`) exposes the same two
+methods returning `CompletableFuture`.
+
+client.workflows.invoke(urlOrEndpoint) -> Object
+
+
+
+#### 🔌 Usage
+
+
+
+
+
+
+
+```java
+// Simple workflow invocation (uses OAuth authentication by default)
+client.workflows().invoke("eo3xxxx");
+
+// Advanced workflow invocation with all options
+client.workflows().invoke(
+ InvokeWorkflowOpts
+ .builder()
+ .urlOrEndpoint("https://eo3xxxx.m.pipedream.net")
+ .body(
+ new HashMap() {{
+ put("name", "John Doe");
+ put("email", "john@example.com");
+ }}
+ )
+ .headers(
+ new HashMap() {{
+ put("Content-Type", "application/json");
+ put("Authorization", "Bearer your-token"); // For STATIC_BEARER auth
+ }}
+ )
+ .method("POST")
+ .authType(HTTPAuthType.STATIC_BEARER)
+ .build()
+);
+```
+
+
+
+
+#### ⚙️ Parameters
+
+
+
+
+
+
+
+**urlOrEndpoint:** `String` — Either a workflow endpoint ID (e.g., `eo3xxxx`) or a full workflow URL
+
+
+
+
+**body:** `Optional` — Request body to send to the workflow (will be JSON serialized)
+
+
+
+
+
+
+
+**headers:** `Optional>` — Additional headers to include in the request
+
+
+
+
+
+
+
+**method:** `Optional` — HTTP method to use (defaults to `POST`)
+
+
+
+
+
+
+
+**authType:** `Optional` — Authentication type: `OAUTH` (default), `STATIC_BEARER`, or `NONE`
+
+
+
+
+
+client.workflows.invokeForExternalUser(urlOrEndpoint, externalUserId) -> Object
+
+
+
+#### 🔌 Usage
+
+
+
+
+
+
+
+```java
+// Simple external user invocation (uses OAuth authentication by default)
+client.workflows().invokeForExternalUser("eo3xxxx", "user123");
+
+// Advanced external user invocation with all options
+client.workflows().invokeForExternalUser(
+ InvokeWorkflowForExternalUserOpts
+ .builder()
+ .url("https://eo3xxxx.m.pipedream.net")
+ .externalUserId("user123")
+ .body(
+ new HashMap() {{
+ put("action", "process_data");
+ put("data", Arrays.asList("item1", "item2"));
+ }}
+ )
+ .headers(
+ new HashMap() {{
+ put("X-Custom-Header", "value");
+ }}
+ )
+ .method("POST")
+ .authType(HTTPAuthType.OAUTH)
+ .build()
+);
+```
+
+
+
+
+
+
+#### ⚙️ Parameters
+
+
+
+
+
+
+
+**url:** `String` — The full workflow URL to invoke
+
+
+
+
+
+
+
+**externalUserId:** `String` — Your end user ID, for whom you're invoking the workflow (Pipedream Connect)
+
+
+
+
+
+
+
+**body:** `Optional` — Request body to send to the workflow (will be JSON serialized)
+
+
+
+
+
+
+
+**headers:** `Optional>` — Additional headers to include in the request
+
+
+
+
+
+
+
+**method:** `Optional` — HTTP method to use (defaults to `POST`)
+
+
+
+
+
+
+
+**authType:** `Optional` — Authentication type: `OAUTH` (default), `STATIC_BEARER`, or `NONE`
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/com/pipedream/api/core/ClientOptions.java b/src/main/java/com/pipedream/api/core/ClientOptions.java
index 09c0bdf..2b7f8c0 100644
--- a/src/main/java/com/pipedream/api/core/ClientOptions.java
+++ b/src/main/java/com/pipedream/api/core/ClientOptions.java
@@ -41,10 +41,10 @@ private ClientOptions(
this.headers.putAll(headers);
this.headers.putAll(new HashMap() {
{
- put("User-Agent", "com.pipedream:pipedream/2.0.4");
+ put("User-Agent", "com.pipedream:pipedream/2.0.5");
put("X-Fern-Language", "JAVA");
put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk");
- put("X-Fern-SDK-Version", "2.0.4");
+ put("X-Fern-SDK-Version", "2.0.5");
}
});
this.headerSuppliers = headerSuppliers;
diff --git a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java
index f956f17..dbf3dd6 100644
--- a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java
+++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java
@@ -94,6 +94,10 @@ public interface AccountIdStage {
public interface _FinalStage {
ProxyDeleteRequest build();
+
+ _FinalStage additionalProperty(String key, Object value);
+
+ _FinalStage additionalProperties(Map additionalProperties);
}
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -142,5 +146,17 @@ public _FinalStage accountId(@NotNull String accountId) {
public ProxyDeleteRequest build() {
return new ProxyDeleteRequest(externalUserId, accountId, additionalProperties);
}
+
+ @java.lang.Override
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
}
}
diff --git a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java
index bf09229..13e092f 100644
--- a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java
+++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java
@@ -94,6 +94,10 @@ public interface AccountIdStage {
public interface _FinalStage {
ProxyGetRequest build();
+
+ _FinalStage additionalProperty(String key, Object value);
+
+ _FinalStage additionalProperties(Map additionalProperties);
}
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -142,5 +146,17 @@ public _FinalStage accountId(@NotNull String accountId) {
public ProxyGetRequest build() {
return new ProxyGetRequest(externalUserId, accountId, additionalProperties);
}
+
+ @java.lang.Override
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
}
}
diff --git a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java
index c221032..55e165b 100644
--- a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java
+++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java
@@ -114,6 +114,10 @@ public interface AccountIdStage {
public interface _FinalStage {
ProxyPatchRequest build();
+ _FinalStage additionalProperty(String key, Object value);
+
+ _FinalStage additionalProperties(Map additionalProperties);
+
/**
* Request body to forward to the target API
*/
@@ -208,5 +212,17 @@ public _FinalStage body(Map body) {
public ProxyPatchRequest build() {
return new ProxyPatchRequest(externalUserId, accountId, body, additionalProperties);
}
+
+ @java.lang.Override
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
}
}
diff --git a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java
index 3c052fd..5d0230a 100644
--- a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java
+++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java
@@ -114,6 +114,10 @@ public interface AccountIdStage {
public interface _FinalStage {
ProxyPostRequest build();
+ _FinalStage additionalProperty(String key, Object value);
+
+ _FinalStage additionalProperties(Map additionalProperties);
+
/**
* Request body to forward to the target API
*/
@@ -208,5 +212,17 @@ public _FinalStage body(Map body) {
public ProxyPostRequest build() {
return new ProxyPostRequest(externalUserId, accountId, body, additionalProperties);
}
+
+ @java.lang.Override
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
}
}
diff --git a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java
index 9ba3dc8..4026aca 100644
--- a/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java
+++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java
@@ -114,6 +114,10 @@ public interface AccountIdStage {
public interface _FinalStage {
ProxyPutRequest build();
+ _FinalStage additionalProperty(String key, Object value);
+
+ _FinalStage additionalProperties(Map additionalProperties);
+
/**
* Request body to forward to the target API
*/
@@ -208,5 +212,17 @@ public _FinalStage body(Map body) {
public ProxyPutRequest build() {
return new ProxyPutRequest(externalUserId, accountId, body, additionalProperties);
}
+
+ @java.lang.Override
+ public Builder additionalProperty(String key, Object value) {
+ this.additionalProperties.put(key, value);
+ return this;
+ }
+
+ @java.lang.Override
+ public Builder additionalProperties(Map additionalProperties) {
+ this.additionalProperties.putAll(additionalProperties);
+ return this;
+ }
}
}
diff --git a/src/test/java/com/pipedream/api/OauthTokensWireTest.java b/src/test/java/com/pipedream/api/OauthTokensWireTest.java
deleted file mode 100644
index 5ded14b..0000000
--- a/src/test/java/com/pipedream/api/OauthTokensWireTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package com.pipedream.api;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.pipedream.api.core.ObjectMappers;
-import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts;
-import com.pipedream.api.testutil.MockResponse;
-import com.pipedream.api.testutil.MockWebServer;
-import com.pipedream.api.testutil.RecordedRequest;
-import com.pipedream.api.types.CreateOAuthTokenResponse;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-public class OauthTokensWireTest {
- private MockWebServer server;
- private BaseClient client;
- private ObjectMapper objectMapper = ObjectMappers.JSON_MAPPER;
-
- @BeforeEach
- public void setup() throws Exception {
- server = new MockWebServer();
- server.start();
- client = PipedreamClient.builder().url(server.url("/").toString()).build();
- }
-
- @AfterEach
- public void teardown() throws Exception {
- server.shutdown();
- }
-
- @Test
- public void testCreate() throws Exception {
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setBody("{\"access_token\":\"access_token\",\"token_type\":\"token_type\",\"expires_in\":1}"));
- CreateOAuthTokenResponse response = client.oauthTokens()
- .create(CreateOAuthTokenOpts.builder()
- .clientId("client_id")
- .clientSecret("client_secret")
- .build());
- RecordedRequest request = server.takeRequest();
- Assertions.assertNotNull(request);
- Assertions.assertEquals("POST", request.getMethod());
- // Validate request body
- String actualRequestBody = request.getBody().readUtf8();
- String expectedRequestBody = ""
- + "{\n"
- + " \"grant_type\": \"client_credentials\",\n"
- + " \"client_id\": \"client_id\",\n"
- + " \"client_secret\": \"client_secret\"\n"
- + "}";
- JsonNode actualJson = objectMapper.readTree(actualRequestBody);
- JsonNode expectedJson = objectMapper.readTree(expectedRequestBody);
- Assertions.assertEquals(expectedJson, actualJson, "Request body structure does not match expected");
- if (actualJson.has("type") || actualJson.has("_type") || actualJson.has("kind")) {
- String discriminator = null;
- if (actualJson.has("type")) discriminator = actualJson.get("type").asText();
- else if (actualJson.has("_type"))
- discriminator = actualJson.get("_type").asText();
- else if (actualJson.has("kind"))
- discriminator = actualJson.get("kind").asText();
- Assertions.assertNotNull(discriminator, "Union type should have a discriminator field");
- Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty");
- }
-
- if (!actualJson.isNull()) {
- Assertions.assertTrue(
- actualJson.isObject() || actualJson.isArray() || actualJson.isValueNode(),
- "request should be a valid JSON value");
- }
-
- if (actualJson.isArray()) {
- Assertions.assertTrue(actualJson.size() >= 0, "Array should have valid size");
- }
- if (actualJson.isObject()) {
- Assertions.assertTrue(actualJson.size() >= 0, "Object should have valid field count");
- }
-
- // Validate response body
- Assertions.assertNotNull(response, "Response should not be null");
- String actualResponseJson = objectMapper.writeValueAsString(response);
- String expectedResponseBody = ""
- + "{\n"
- + " \"access_token\": \"access_token\",\n"
- + " \"token_type\": \"token_type\",\n"
- + " \"expires_in\": 1\n"
- + "}";
- JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson);
- JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody);
- Assertions.assertEquals(
- expectedResponseNode, actualResponseNode, "Response body structure does not match expected");
- if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) {
- String discriminator = null;
- if (actualResponseNode.has("type"))
- discriminator = actualResponseNode.get("type").asText();
- else if (actualResponseNode.has("_type"))
- discriminator = actualResponseNode.get("_type").asText();
- else if (actualResponseNode.has("kind"))
- discriminator = actualResponseNode.get("kind").asText();
- Assertions.assertNotNull(discriminator, "Union type should have a discriminator field");
- Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty");
- }
-
- if (!actualResponseNode.isNull()) {
- Assertions.assertTrue(
- actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(),
- "response should be a valid JSON value");
- }
-
- if (actualResponseNode.isArray()) {
- Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size");
- }
- if (actualResponseNode.isObject()) {
- Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count");
- }
- }
-}
diff --git a/src/test/java/com/pipedream/api/ProxyClientWireTest.java b/src/test/java/com/pipedream/api/ProxyClientWireTest.java
deleted file mode 100644
index 1069e10..0000000
--- a/src/test/java/com/pipedream/api/ProxyClientWireTest.java
+++ /dev/null
@@ -1,379 +0,0 @@
-package com.pipedream.api;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import com.pipedream.api.resources.proxy.requests.ProxyGetRequest;
-import com.pipedream.api.resources.proxy.types.ProxyResponse;
-import com.pipedream.api.testutil.MockResponse;
-import com.pipedream.api.testutil.MockWebServer;
-import com.pipedream.api.testutil.RecordedRequest;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
-import okhttp3.HttpUrl;
-import okio.Buffer;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-public class ProxyClientWireTest {
- private MockWebServer server;
- private BaseClient client;
- private AsyncBaseClient asyncClient;
-
- private static final String TEST_EXTERNAL_USER_ID = "test-user-123";
- private static final String TEST_ACCOUNT_ID = "test-account-456";
- private static final String TEST_URL = "https://api.example.com/data";
-
- @BeforeEach
- public void setup() throws Exception {
- server = new MockWebServer();
- server.start();
- String baseUrl = server.url("/").toString();
- // Explicitly set credentials to null to avoid OAuth token fetching
- // (environment variables might be set, which would trigger network calls)
- client =
- PipedreamClient.builder().url(baseUrl).projectId("test-project").build();
- asyncClient = AsyncPipedreamClient.builder()
- .url(baseUrl)
- .projectId("test-project")
- .build();
- }
-
- @AfterEach
- public void teardown() throws Exception {
- server.shutdown();
- }
-
- private ProxyGetRequest createGetRequest() {
- return ProxyGetRequest.builder()
- .externalUserId(TEST_EXTERNAL_USER_ID)
- .accountId(TEST_ACCOUNT_ID)
- .build();
- }
-
- /**
- * Java 8-compatible replacement for InputStream.readAllBytes() (Java 9+).
- */
- private byte[] readAllBytes(InputStream is) throws IOException {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
- byte[] data = new byte[1024];
- int bytesRead;
- while ((bytesRead = is.read(data, 0, data.length)) != -1) {
- buffer.write(data, 0, bytesRead);
- }
- return buffer.toByteArray();
- }
-
- // ==================== Sync Client Tests ====================
-
- @Test
- public void testGetJsonResponse() throws Exception {
- String jsonBody = "{\"key\":\"value\",\"number\":42}";
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setHeader("Content-Type", "application/json")
- .setBody(jsonBody));
-
- try (ProxyResponse response = client.proxy().get(TEST_URL, createGetRequest())) {
-
- // Verify response type
- assertTrue(response.isJson(), "Response should be JSON");
- assertFalse(response.isStream(), "Response should not be a stream");
-
- // Verify parsed JSON content
- Object json = response.json();
- assertNotNull(json, "JSON body should not be null");
- assertInstanceOf(Map.class, json, "JSON body should be a Map");
-
- @SuppressWarnings("unchecked")
- Map jsonMap = (Map) json;
- assertEquals("value", jsonMap.get("key"));
- assertEquals(42, jsonMap.get("number"));
-
- // Verify content type is preserved
- assertTrue(response.getContentType().isPresent());
- assertEquals("application/json", response.getContentType().get());
- }
-
- // Verify request was made correctly
- RecordedRequest request = server.takeRequest();
- assertNotNull(request);
- assertEquals("GET", request.getMethod());
- }
-
- @Test
- public void testGetJsonResponseWithCharset() throws Exception {
- String jsonBody = "{\"message\":\"hello\"}";
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setHeader("Content-Type", "application/json; charset=utf-8")
- .setBody(jsonBody));
-
- try (ProxyResponse response = client.proxy().get(TEST_URL, createGetRequest())) {
-
- // Should still be detected as JSON even with charset parameter
- assertTrue(response.isJson(), "Response should be JSON even with charset");
-
- @SuppressWarnings("unchecked")
- Map jsonMap = (Map) response.json();
- assertEquals("hello", jsonMap.get("message"));
- }
- }
-
- @Test
- public void testGetOctetStreamResponse() throws Exception {
- byte[] binaryData = new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05};
- Buffer buffer = new Buffer();
- buffer.write(binaryData);
-
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setHeader("Content-Type", "application/octet-stream")
- .setBody(buffer));
-
- try (ProxyResponse response = client.proxy().get(TEST_URL, createGetRequest())) {
-
- // Verify response type
- assertTrue(response.isStream(), "Response should be a stream");
- assertFalse(response.isJson(), "Response should not be JSON");
-
- // Verify binary content
- byte[] actualData = readAllBytes(response.stream());
- assertArrayEquals(binaryData, actualData, "Binary data should match");
-
- // Verify content type is preserved
- assertTrue(response.getContentType().isPresent());
- assertEquals("application/octet-stream", response.getContentType().get());
- }
-
- // Verify request was made correctly
- RecordedRequest request = server.takeRequest();
- assertNotNull(request);
- assertEquals("GET", request.getMethod());
- }
-
- @Test
- public void testGetRedirectFollowed() throws Exception {
- // First response: 302 redirect
- server.enqueue(new MockResponse()
- .setResponseCode(302)
- .setHeader("Location", server.url("/redirected").toString()));
-
- // Second response: 200 OK with JSON
- String jsonBody = "{\"redirected\":true,\"status\":\"success\"}";
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setHeader("Content-Type", "application/json")
- .setBody(jsonBody));
-
- try (ProxyResponse response = client.proxy().get(TEST_URL, createGetRequest())) {
-
- // Verify we got the final response (redirect was followed)
- assertTrue(response.isJson(), "Response should be JSON after redirect");
-
- @SuppressWarnings("unchecked")
- Map jsonMap = (Map) response.json();
- assertEquals(true, jsonMap.get("redirected"));
- assertEquals("success", jsonMap.get("status"));
- }
-
- // Verify both requests were made (original + redirect)
- RecordedRequest firstRequest = server.takeRequest();
- assertNotNull(firstRequest);
- assertEquals("GET", firstRequest.getMethod());
-
- RecordedRequest secondRequest = server.takeRequest();
- assertNotNull(secondRequest);
- assertEquals("GET", secondRequest.getMethod());
- assertNotNull(secondRequest.getPath());
- assertTrue(secondRequest.getPath().contains("redirected"));
- }
-
- // ==================== Async Client Tests ====================
-
- @Test
- public void testAsyncGetJsonResponse() throws Exception {
- String jsonBody = "{\"async\":true,\"data\":\"test\"}";
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setHeader("Content-Type", "application/json")
- .setBody(jsonBody));
-
- CompletableFuture future = asyncClient.proxy().get(TEST_URL, createGetRequest());
- try (ProxyResponse response = future.get(10, TimeUnit.SECONDS)) {
-
- // Verify response type
- assertTrue(response.isJson(), "Response should be JSON");
- assertFalse(response.isStream(), "Response should not be a stream");
-
- // Verify parsed JSON content
- @SuppressWarnings("unchecked")
- Map jsonMap = (Map) response.json();
- assertEquals(true, jsonMap.get("async"));
- assertEquals("test", jsonMap.get("data"));
- }
-
- // Verify request was made correctly
- RecordedRequest request = server.takeRequest();
- assertNotNull(request);
- assertEquals("GET", request.getMethod());
- }
-
- @Test
- public void testAsyncGetOctetStreamResponse() throws Exception {
- byte[] binaryData = new byte[] {(byte) 0xFF, (byte) 0xFE, (byte) 0xFD};
- Buffer buffer = new Buffer();
- buffer.write(binaryData);
-
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setHeader("Content-Type", "application/octet-stream")
- .setBody(buffer));
-
- CompletableFuture future = asyncClient.proxy().get(TEST_URL, createGetRequest());
- try (ProxyResponse response = future.get(10, TimeUnit.SECONDS)) {
-
- // Verify response type
- assertTrue(response.isStream(), "Response should be a stream");
- assertFalse(response.isJson(), "Response should not be JSON");
-
- // Verify binary content
- byte[] actualData = readAllBytes(response.stream());
- assertArrayEquals(binaryData, actualData, "Binary data should match");
- }
-
- // Verify request was made correctly
- RecordedRequest request = server.takeRequest();
- assertNotNull(request);
- assertEquals("GET", request.getMethod());
- }
-
- @Test
- public void testAsyncGetRedirectFollowed() throws Exception {
- // First response: 302 redirect
- server.enqueue(new MockResponse()
- .setResponseCode(302)
- .setHeader("Location", server.url("/async-redirected").toString()));
-
- // Second response: 200 OK with JSON
- String jsonBody = "{\"asyncRedirected\":true}";
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setHeader("Content-Type", "application/json")
- .setBody(jsonBody));
-
- CompletableFuture future = asyncClient.proxy().get(TEST_URL, createGetRequest());
- try (ProxyResponse response = future.get(10, TimeUnit.SECONDS)) {
-
- // Verify we got the final response (redirect was followed)
- assertTrue(response.isJson(), "Response should be JSON after redirect");
-
- @SuppressWarnings("unchecked")
- Map jsonMap = (Map) response.json();
- assertEquals(true, jsonMap.get("asyncRedirected"));
- }
-
- // Verify both requests were made (original + redirect)
- RecordedRequest firstRequest = server.takeRequest();
- assertNotNull(firstRequest);
-
- RecordedRequest secondRequest = server.takeRequest();
- assertNotNull(secondRequest);
- assertNotNull(secondRequest.getPath());
- assertTrue(secondRequest.getPath().contains("async-redirected"));
- }
-
- // ==================== HttpUrl Overload Tests ====================
-
- @Test
- public void testGetWithHttpUrl() throws Exception {
- String jsonBody = "{\"key\":\"value\"}";
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setHeader("Content-Type", "application/json")
- .setBody(jsonBody));
-
- // Build URL with query parameters using HttpUrl
- HttpUrl url = HttpUrl.parse(TEST_URL)
- .newBuilder()
- .addQueryParameter("fields", "name,mimeType")
- .addQueryParameter("limit", "10")
- .build();
-
- try (ProxyResponse response = client.proxy().get(url, createGetRequest())) {
- assertTrue(response.isJson(), "Response should be JSON");
-
- @SuppressWarnings("unchecked")
- Map jsonMap = (Map) response.json();
- assertEquals("value", jsonMap.get("key"));
- }
-
- // Verify request was made correctly
- RecordedRequest request = server.takeRequest();
- assertNotNull(request);
- assertEquals("GET", request.getMethod());
-
- // Verify the base64-encoded URL in the path contains the query parameters
- String path = request.getPath();
- assertNotNull(path);
- // The URL with query params should be base64-encoded in the path
- // We can't easily decode it here, but we verify the request was made
- }
-
- @Test
- public void testGetWithHttpUrlAndSpecialCharacters() throws Exception {
- String jsonBody = "{\"result\":\"ok\"}";
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setHeader("Content-Type", "application/json")
- .setBody(jsonBody));
-
- // Build URL with query parameters containing special characters
- HttpUrl url = HttpUrl.parse(TEST_URL)
- .newBuilder()
- .addQueryParameter("filter", "status=active&type=user")
- .addQueryParameter("name", "John Doe")
- .build();
-
- try (ProxyResponse response = client.proxy().get(url, createGetRequest())) {
- assertTrue(response.isJson(), "Response should be JSON");
- }
-
- RecordedRequest request = server.takeRequest();
- assertNotNull(request);
- assertEquals("GET", request.getMethod());
- }
-
- @Test
- public void testAsyncGetWithHttpUrl() throws Exception {
- String jsonBody = "{\"async\":true}";
- server.enqueue(new MockResponse()
- .setResponseCode(200)
- .setHeader("Content-Type", "application/json")
- .setBody(jsonBody));
-
- // Build URL with query parameters using HttpUrl
- HttpUrl url = HttpUrl.parse(TEST_URL)
- .newBuilder()
- .addQueryParameter("page", "1")
- .addQueryParameter("size", "20")
- .build();
-
- CompletableFuture future = asyncClient.proxy().get(url, createGetRequest());
- try (ProxyResponse response = future.get(10, TimeUnit.SECONDS)) {
- assertTrue(response.isJson(), "Response should be JSON");
-
- @SuppressWarnings("unchecked")
- Map jsonMap = (Map) response.json();
- assertEquals(true, jsonMap.get("async"));
- }
-
- RecordedRequest request = server.takeRequest();
- assertNotNull(request);
- assertEquals("GET", request.getMethod());
- }
-}
diff --git a/src/test/java/com/pipedream/api/TokensWireTest.java b/src/test/java/com/pipedream/api/TokensWireTest.java
deleted file mode 100644
index d503c8c..0000000
--- a/src/test/java/com/pipedream/api/TokensWireTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package com.pipedream.api;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.pipedream.api.core.ObjectMappers;
-import com.pipedream.api.resources.tokens.requests.TokensValidateRequest;
-import com.pipedream.api.testutil.MockResponse;
-import com.pipedream.api.testutil.MockWebServer;
-import com.pipedream.api.testutil.RecordedRequest;
-import com.pipedream.api.types.ValidateTokenResponse;
-import org.junit.jupiter.api.AfterEach;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-
-public class TokensWireTest {
- private MockWebServer server;
- private BaseClient client;
- private ObjectMapper objectMapper = ObjectMappers.JSON_MAPPER;
-
- @BeforeEach
- public void setup() throws Exception {
- server = new MockWebServer();
- server.start();
- client = PipedreamClient.builder().url(server.url("/").toString()).build();
- }
-
- @AfterEach
- public void teardown() throws Exception {
- server.shutdown();
- }
-
- @Test
- public void testValidate() throws Exception {
- server.enqueue(
- new MockResponse()
- .setResponseCode(200)
- .setBody(
- "{\"app\":{\"id\":\"id\",\"name_slug\":\"name_slug\",\"name\":\"name\",\"auth_type\":\"keys\",\"description\":\"description\",\"img_src\":\"img_src\",\"custom_fields_json\":\"custom_fields_json\",\"categories\":[\"categories\"],\"featured_weight\":1.1},\"error\":\"error\",\"error_redirect_uri\":\"error_redirect_uri\",\"oauth_app_id\":\"oauth_app_id\",\"project_app_name\":\"project_app_name\",\"project_environment\":\"project_environment\",\"project_id\":\"project_id\",\"project_support_email\":\"project_support_email\",\"success\":true,\"success_redirect_uri\":\"success_redirect_uri\"}"));
- ValidateTokenResponse response = client.tokens()
- .validate(
- "ctok",
- TokensValidateRequest.builder()
- .appId("app_id")
- .oauthAppId("oauth_app_id")
- .build());
- RecordedRequest request = server.takeRequest();
- Assertions.assertNotNull(request);
- Assertions.assertEquals("GET", request.getMethod());
-
- // Validate response body
- Assertions.assertNotNull(response, "Response should not be null");
- String actualResponseJson = objectMapper.writeValueAsString(response);
- String expectedResponseBody = ""
- + "{\n"
- + " \"app\": {\n"
- + " \"id\": \"id\",\n"
- + " \"name_slug\": \"name_slug\",\n"
- + " \"name\": \"name\",\n"
- + " \"auth_type\": \"keys\",\n"
- + " \"description\": \"description\",\n"
- + " \"img_src\": \"img_src\",\n"
- + " \"custom_fields_json\": \"custom_fields_json\",\n"
- + " \"categories\": [\n"
- + " \"categories\"\n"
- + " ],\n"
- + " \"featured_weight\": 1.1,\n"
- + " \"scope_profiles\": []\n"
- + " },\n"
- + " \"error\": \"error\",\n"
- + " \"error_redirect_uri\": \"error_redirect_uri\",\n"
- + " \"oauth_app_id\": \"oauth_app_id\",\n"
- + " \"project_app_name\": \"project_app_name\",\n"
- + " \"project_environment\": \"project_environment\",\n"
- + " \"project_id\": \"project_id\",\n"
- + " \"project_support_email\": \"project_support_email\",\n"
- + " \"success\": true,\n"
- + " \"success_redirect_uri\": \"success_redirect_uri\"\n"
- + "}";
- JsonNode actualResponseNode = objectMapper.readTree(actualResponseJson);
- JsonNode expectedResponseNode = objectMapper.readTree(expectedResponseBody);
- Assertions.assertEquals(
- expectedResponseNode, actualResponseNode, "Response body structure does not match expected");
- if (actualResponseNode.has("type") || actualResponseNode.has("_type") || actualResponseNode.has("kind")) {
- String discriminator = null;
- if (actualResponseNode.has("type"))
- discriminator = actualResponseNode.get("type").asText();
- else if (actualResponseNode.has("_type"))
- discriminator = actualResponseNode.get("_type").asText();
- else if (actualResponseNode.has("kind"))
- discriminator = actualResponseNode.get("kind").asText();
- Assertions.assertNotNull(discriminator, "Union type should have a discriminator field");
- Assertions.assertFalse(discriminator.isEmpty(), "Union discriminator should not be empty");
- }
-
- if (!actualResponseNode.isNull()) {
- Assertions.assertTrue(
- actualResponseNode.isObject() || actualResponseNode.isArray() || actualResponseNode.isValueNode(),
- "response should be a valid JSON value");
- }
-
- if (actualResponseNode.isArray()) {
- Assertions.assertTrue(actualResponseNode.size() >= 0, "Array should have valid size");
- }
- if (actualResponseNode.isObject()) {
- Assertions.assertTrue(actualResponseNode.size() >= 0, "Object should have valid field count");
- }
- }
-}
diff --git a/src/test/java/com/pipedream/api/testutil/MockResponse.java b/src/test/java/com/pipedream/api/testutil/MockResponse.java
deleted file mode 100644
index 84f54c2..0000000
--- a/src/test/java/com/pipedream/api/testutil/MockResponse.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.pipedream.api.testutil;
-
-import java.nio.charset.StandardCharsets;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import okio.Buffer;
-
-/**
- * Drop-in replacement for {@code okhttp3.mockwebserver.MockResponse} backed by JDK primitives.
- * Exposes only the surface used by the wire tests in this repo.
- */
-public final class MockResponse {
- int code = 200;
- final Map headers = new LinkedHashMap<>();
- byte[] body = new byte[0];
-
- public MockResponse setResponseCode(int code) {
- this.code = code;
- return this;
- }
-
- public MockResponse setHeader(String name, String value) {
- this.headers.put(name, value);
- return this;
- }
-
- public MockResponse setBody(String body) {
- this.body = body.getBytes(StandardCharsets.UTF_8);
- return this;
- }
-
- public MockResponse setBody(Buffer body) {
- this.body = body.readByteArray();
- return this;
- }
-}
diff --git a/src/test/java/com/pipedream/api/testutil/MockWebServer.java b/src/test/java/com/pipedream/api/testutil/MockWebServer.java
deleted file mode 100644
index d1e5315..0000000
--- a/src/test/java/com/pipedream/api/testutil/MockWebServer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package com.pipedream.api.testutil;
-
-import com.sun.net.httpserver.HttpExchange;
-import com.sun.net.httpserver.HttpServer;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.util.Map;
-import java.util.concurrent.BlockingDeque;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.LinkedBlockingDeque;
-import java.util.concurrent.TimeUnit;
-import okhttp3.HttpUrl;
-
-/**
- * Drop-in replacement for {@code okhttp3.mockwebserver.MockWebServer} that uses the JDK's
- * built-in {@link HttpServer}. Exists so the wire tests in this repo do not require an
- * external mock-server dependency that would have to be threaded into the Fern-managed
- * {@code build.gradle}.
- *
- * Implements only the surface used here: {@code start()}, {@code shutdown()},
- * {@code url(String)}, {@code enqueue(MockResponse)}, and {@code takeRequest()}.
- */
-public final class MockWebServer {
- private final HttpServer server;
- private final ExecutorService executor;
- private final BlockingDeque responses = new LinkedBlockingDeque<>();
- private final BlockingDeque requests = new LinkedBlockingDeque<>();
-
- public MockWebServer() throws IOException {
- this.server = HttpServer.create(new InetSocketAddress("127.0.0.1", 0), 0);
- this.executor = Executors.newCachedThreadPool();
- this.server.setExecutor(executor);
- this.server.createContext("/", this::handle);
- }
-
- public void start() {
- server.start();
- }
-
- public void shutdown() {
- server.stop(0);
- executor.shutdownNow();
- }
-
- public HttpUrl url(String path) {
- if (!path.startsWith("/")) path = "/" + path;
- return HttpUrl.parse("http://" + server.getAddress().getHostString() + ":"
- + server.getAddress().getPort() + path);
- }
-
- public void enqueue(MockResponse response) {
- responses.add(response);
- }
-
- public RecordedRequest takeRequest() throws InterruptedException {
- return requests.poll(10, TimeUnit.SECONDS);
- }
-
- private void handle(HttpExchange exchange) throws IOException {
- byte[] requestBody = readAllBytes(exchange.getRequestBody());
- requests.add(new RecordedRequest(
- exchange.getRequestMethod(), exchange.getRequestURI().toString(), requestBody));
-
- MockResponse response = responses.poll();
- if (response == null) {
- exchange.sendResponseHeaders(503, -1);
- exchange.close();
- return;
- }
-
- for (Map.Entry header : response.headers.entrySet()) {
- exchange.getResponseHeaders().add(header.getKey(), header.getValue());
- }
-
- if (response.body.length == 0) {
- exchange.sendResponseHeaders(response.code, -1);
- } else {
- exchange.sendResponseHeaders(response.code, response.body.length);
- try (OutputStream out = exchange.getResponseBody()) {
- out.write(response.body);
- }
- }
- exchange.close();
- }
-
- private static byte[] readAllBytes(InputStream is) throws IOException {
- ByteArrayOutputStream buf = new ByteArrayOutputStream();
- byte[] chunk = new byte[1024];
- int n;
- while ((n = is.read(chunk)) != -1) {
- buf.write(chunk, 0, n);
- }
- return buf.toByteArray();
- }
-}
diff --git a/src/test/java/com/pipedream/api/testutil/RecordedRequest.java b/src/test/java/com/pipedream/api/testutil/RecordedRequest.java
deleted file mode 100644
index 8e7e319..0000000
--- a/src/test/java/com/pipedream/api/testutil/RecordedRequest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package com.pipedream.api.testutil;
-
-import java.nio.charset.StandardCharsets;
-
-/**
- * Drop-in replacement for {@code okhttp3.mockwebserver.RecordedRequest}. Exposes only
- * the {@code getMethod()}, {@code getPath()}, and {@code getBody().readUtf8()} surface
- * used by the wire tests in this repo.
- */
-public final class RecordedRequest {
- private final String method;
- private final String path;
- private final byte[] body;
-
- public RecordedRequest(String method, String path, byte[] body) {
- this.method = method;
- this.path = path;
- this.body = body;
- }
-
- public String getMethod() {
- return method;
- }
-
- public String getPath() {
- return path;
- }
-
- public Body getBody() {
- return new Body(body);
- }
-
- /** Minimal stand-in for {@code okio.Buffer} as exposed by {@code RecordedRequest.getBody()}. */
- public static final class Body {
- private final byte[] bytes;
-
- Body(byte[] bytes) {
- this.bytes = bytes;
- }
-
- public String readUtf8() {
- return new String(bytes, StandardCharsets.UTF_8);
- }
- }
-}