From 84509c9592d263864746c1c56994f2dbf3bc7062 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 17 Jul 2025 20:23:15 +0000 Subject: [PATCH] SDK regeneration --- .gradle/8.14.3/checksums/checksums.lock | Bin 0 -> 17 bytes .gradle/8.14.3/checksums/md5-checksums.bin | Bin 0 -> 21897 bytes .gradle/8.14.3/checksums/sha1-checksums.bin | Bin 0 -> 25679 bytes .../executionHistory/executionHistory.bin | Bin 0 -> 64263 bytes .../executionHistory/executionHistory.lock | Bin 0 -> 17 bytes .gradle/8.14.3/fileChanges/last-build.bin | Bin 0 -> 1 bytes .gradle/8.14.3/fileHashes/fileHashes.bin | Bin 0 -> 35447 bytes .gradle/8.14.3/fileHashes/fileHashes.lock | Bin 0 -> 17 bytes .gradle/8.14.3/gc.properties | 0 .../buildOutputCleanup.lock | Bin 0 -> 17 bytes .gradle/buildOutputCleanup/cache.properties | 2 + .gradle/buildOutputCleanup/outputFiles.bin | Bin 0 -> 18749 bytes .gradle/vcs-1/gc.properties | 0 .publish/prepare.sh | 8 + README.md | 178 +++++ build.gradle | 130 ++++ build/reports/problems/problems-report.html | 663 ++++++++++++++++++ .../api/AsyncPipedreamApiClient.java | 116 +++ .../api/AsyncPipedreamApiClientBuilder.java | 99 +++ .../com/pipedream/api/PipedreamApiClient.java | 116 +++ .../api/PipedreamApiClientBuilder.java | 99 +++ .../com/pipedream/api/core/ClientOptions.java | 186 +++++ .../api/core/DateTimeDeserializer.java | 55 ++ .../com/pipedream/api/core/Environment.java | 26 + .../com/pipedream/api/core/FileStream.java | 60 ++ .../api/core/InputStreamRequestBody.java | 79 +++ .../com/pipedream/api/core/MediaTypes.java | 13 + .../java/com/pipedream/api/core/Nullable.java | 140 ++++ .../api/core/NullableNonemptyFilter.java | 19 + .../api/core/OAuthTokenSupplier.java | 54 ++ .../com/pipedream/api/core/ObjectMappers.java | 36 + .../api/core/PipedreamApiApiException.java | 73 ++ .../api/core/PipedreamApiException.java | 17 + .../api/core/PipedreamApiHttpResponse.java | 37 + .../pipedream/api/core/QueryStringMapper.java | 142 ++++ .../pipedream/api/core/RequestOptions.java | 101 +++ .../api/core/ResponseBodyInputStream.java | 45 ++ .../api/core/ResponseBodyReader.java | 44 ++ .../pipedream/api/core/RetryInterceptor.java | 78 +++ .../java/com/pipedream/api/core/Stream.java | 272 +++++++ .../com/pipedream/api/core/Suppliers.java | 23 + .../api/core/pagination/BasePage.java | 24 + .../api/core/pagination/SyncPage.java | 24 + .../core/pagination/SyncPagingIterable.java | 61 ++ .../resources/accounts/AccountsClient.java | 78 +++ .../accounts/AsyncAccountsClient.java | 81 +++ .../accounts/AsyncRawAccountsClient.java | 391 +++++++++++ .../resources/accounts/RawAccountsClient.java | 312 +++++++++ .../requests/AccountsListRequest.java | 285 ++++++++ .../requests/AccountsRetrieveRequest.java | 101 +++ .../requests/CreateAccountRequest.java | 354 ++++++++++ .../api/resources/actions/ActionsClient.java | 78 +++ .../resources/actions/AsyncActionsClient.java | 82 +++ .../actions/AsyncRawActionsClient.java | 397 +++++++++++ .../resources/actions/RawActionsClient.java | 315 +++++++++ .../requests/ActionsConfigurePropRequest.java | 134 ++++ .../actions/requests/ActionsListRequest.java | 223 ++++++ .../requests/ActionsReloadPropsRequest.java | 134 ++++ .../actions/requests/RunActionOpts.java | 269 +++++++ .../appcategories/AppCategoriesClient.java | 43 ++ .../AsyncAppCategoriesClient.java | 44 ++ .../AsyncRawAppCategoriesClient.java | 135 ++++ .../appcategories/RawAppCategoriesClient.java | 104 +++ .../api/resources/apps/AppsClient.java | 49 ++ .../api/resources/apps/AsyncAppsClient.java | 50 ++ .../resources/apps/AsyncRawAppsClient.java | 189 +++++ .../api/resources/apps/RawAppsClient.java | 149 ++++ .../apps/requests/AppsListRequest.java | 294 ++++++++ .../types/AppsListRequestSortDirection.java | 24 + .../apps/types/AppsListRequestSortKey.java | 26 + .../components/AsyncComponentsClient.java | 72 ++ .../components/AsyncRawComponentsClient.java | 321 +++++++++ .../components/ComponentsClient.java | 68 ++ .../components/RawComponentsClient.java | 253 +++++++ .../ComponentsConfigurePropRequest.java | 134 ++++ .../requests/ComponentsListRequest.java | 223 ++++++ .../ComponentsReloadPropsRequest.java | 134 ++++ .../AsyncDeployedTriggersClient.java | 129 ++++ .../AsyncRawDeployedTriggersClient.java | 630 +++++++++++++++++ .../DeployedTriggersClient.java | 121 ++++ .../RawDeployedTriggersClient.java | 493 +++++++++++++ .../DeployedTriggersDeleteRequest.java | 157 +++++ .../DeployedTriggersListEventsRequest.java | 157 +++++ .../requests/DeployedTriggersListRequest.java | 246 +++++++ .../DeployedTriggersListWebhooksRequest.java | 114 +++ .../DeployedTriggersListWorkflowsRequest.java | 114 +++ .../DeployedTriggersRetrieveRequest.java | 113 +++ .../requests/UpdateTriggerOpts.java | 246 +++++++ .../requests/UpdateTriggerWebhooksOpts.java | 171 +++++ .../requests/UpdateTriggerWorkflowsOpts.java | 171 +++++ .../oauthtokens/AsyncOauthTokensClient.java | 37 + .../AsyncRawOauthTokensClient.java | 95 +++ .../oauthtokens/OauthTokensClient.java | 35 + .../oauthtokens/RawOauthTokensClient.java | 77 ++ .../requests/CreateOAuthTokenOpts.java | 129 ++++ .../projects/AsyncProjectsClient.java | 35 + .../projects/AsyncRawProjectsClient.java | 84 +++ .../resources/projects/ProjectsClient.java | 34 + .../resources/projects/RawProjectsClient.java | 66 ++ .../api/resources/proxy/AsyncProxyClient.java | 77 ++ .../resources/proxy/AsyncRawProxyClient.java | 347 +++++++++ .../api/resources/proxy/ProxyClient.java | 71 ++ .../api/resources/proxy/RawProxyClient.java | 275 ++++++++ .../proxy/requests/ProxyDeleteRequest.java | 146 ++++ .../proxy/requests/ProxyGetRequest.java | 146 ++++ .../proxy/requests/ProxyPatchRequest.java | 208 ++++++ .../proxy/requests/ProxyPostRequest.java | 208 ++++++ .../proxy/requests/ProxyPutRequest.java | 208 ++++++ .../tokens/AsyncRawTokensClient.java | 158 +++++ .../resources/tokens/AsyncTokensClient.java | 51 ++ .../api/resources/tokens/RawTokensClient.java | 127 ++++ .../api/resources/tokens/TokensClient.java | 49 ++ .../tokens/requests/CreateTokenRequest.java | 338 +++++++++ .../requests/TokensValidateRequest.java | 96 +++ .../triggers/AsyncRawTriggersClient.java | 386 ++++++++++ .../triggers/AsyncTriggersClient.java | 82 +++ .../resources/triggers/RawTriggersClient.java | 305 ++++++++ .../resources/triggers/TriggersClient.java | 78 +++ .../triggers/requests/DeployTriggerOpts.java | 282 ++++++++ .../TriggersConfigurePropRequest.java | 134 ++++ .../requests/TriggersListRequest.java | 223 ++++++ .../requests/TriggersReloadPropsRequest.java | 134 ++++ .../resources/users/AsyncRawUsersClient.java | 81 +++ .../api/resources/users/AsyncUsersClient.java | 34 + .../api/resources/users/RawUsersClient.java | 63 ++ .../api/resources/users/UsersClient.java | 33 + .../java/com/pipedream/api/types/Account.java | 485 +++++++++++++ .../java/com/pipedream/api/types/App.java | 472 +++++++++++++ .../com/pipedream/api/types/AppAuthType.java | 26 + .../com/pipedream/api/types/AppCategory.java | 161 +++++ .../api/types/BackendClientOpts.java | 163 +++++ .../com/pipedream/api/types/ClientOpts.java | 163 +++++ .../com/pipedream/api/types/Component.java | 365 ++++++++++ .../pipedream/api/types/ComponentStash.java | 24 + .../pipedream/api/types/ConfigurableProp.java | 420 +++++++++++ .../api/types/ConfigurablePropAlert.java | 484 +++++++++++++ .../types/ConfigurablePropAlertAlertType.java | 28 + .../api/types/ConfigurablePropAny.java | 420 +++++++++++ .../api/types/ConfigurablePropApp.java | 452 ++++++++++++ .../api/types/ConfigurablePropBoolean.java | 420 +++++++++++ .../api/types/ConfigurablePropDiscord.java | 420 +++++++++++ .../api/types/ConfigurablePropInteger.java | 484 +++++++++++++ .../api/types/ConfigurablePropObject.java | 420 +++++++++++ .../api/types/ConfigurablePropString.java | 452 ++++++++++++ .../types/ConfigurablePropStringArray.java | 452 ++++++++++++ .../api/types/ConfigurePropOpts.java | 509 ++++++++++++++ .../api/types/ConfigurePropResponse.java | 133 ++++ .../api/types/ConnectTokenCreateOpts.java | 338 +++++++++ .../api/types/ConnectTokenResponse.java | 183 +++++ .../api/types/CreateBrowserClientOpts.java | 101 +++ .../api/types/CreateOAuthTokenResponse.java | 149 ++++ .../api/types/CreateTokenResponse.java | 183 +++++ .../api/types/DeleteTriggerOpts.java | 101 +++ .../api/types/DeployTriggerResponse.java | 102 +++ .../api/types/DeployedComponent.java | 539 ++++++++++++++ .../com/pipedream/api/types/EmittedEvent.java | 235 +++++++ .../pipedream/api/types/ErrorResponse.java | 201 ++++++ .../api/types/GetAccountsResponse.java | 142 ++++ .../pipedream/api/types/GetAppResponse.java | 102 +++ .../pipedream/api/types/GetAppsResponse.java | 142 ++++ .../api/types/GetComponentResponse.java | 102 +++ .../api/types/GetComponentsResponse.java | 142 ++++ .../api/types/GetTriggerEventsResponse.java | 102 +++ .../api/types/GetTriggerResponse.java | 102 +++ .../api/types/GetTriggerWebhooksResponse.java | 102 +++ .../types/GetTriggerWorkflowsResponse.java | 102 +++ .../api/types/GetTriggersResponse.java | 143 ++++ .../api/types/ListAccountsResponse.java | 142 ++++ .../pipedream/api/types/ListAppsResponse.java | 142 ++++ .../com/pipedream/api/types/PageInfo.java | 169 +++++ .../api/types/ProjectEnvironment.java | 24 + .../api/types/ProjectInfoResponse.java | 102 +++ .../types/ProjectInfoResponseAppsItem.java | 157 +++++ .../com/pipedream/api/types/PropOption.java | 135 ++++ .../pipedream/api/types/ProxyResponse.java | 155 ++++ .../pipedream/api/types/ReloadPropsOpts.java | 331 +++++++++ .../api/types/ReloadPropsResponse.java | 103 +++ .../api/types/RunActionResponse.java | 175 +++++ .../pipedream/api/types/StartConnectOpts.java | 101 +++ .../api/types/ValidateTokenParams.java | 156 +++++ .../api/types/ValidateTokenResponse.java | 511 ++++++++++++++ .../java/com/pipedream/api/StreamTest.java | 86 +++ .../java/com/pipedream/api/TestClient.java | 11 + .../api/core/QueryStringMapperTest.java | 339 +++++++++ build/tmp/spotless-register-dependencies | 1 + gradle.properties | 0 gradle/wrapper/gradle-wrapper.properties | 7 + gradlew | 251 +++++++ gradlew.bat | 94 +++ sample-app/build.gradle | 19 + sample-app/src/main/java/sample/App.java | 13 + settings.gradle | 3 + .../api/AsyncPipedreamApiClient.java | 116 +++ .../api/AsyncPipedreamApiClientBuilder.java | 99 +++ .../com/pipedream/api/PipedreamApiClient.java | 116 +++ .../api/PipedreamApiClientBuilder.java | 99 +++ .../com/pipedream/api/core/ClientOptions.java | 186 +++++ .../api/core/DateTimeDeserializer.java | 55 ++ .../com/pipedream/api/core/Environment.java | 26 + .../com/pipedream/api/core/FileStream.java | 60 ++ .../api/core/InputStreamRequestBody.java | 79 +++ .../com/pipedream/api/core/MediaTypes.java | 13 + .../java/com/pipedream/api/core/Nullable.java | 140 ++++ .../api/core/NullableNonemptyFilter.java | 19 + .../api/core/OAuthTokenSupplier.java | 54 ++ .../com/pipedream/api/core/ObjectMappers.java | 36 + .../api/core/PipedreamApiApiException.java | 73 ++ .../api/core/PipedreamApiException.java | 17 + .../api/core/PipedreamApiHttpResponse.java | 37 + .../pipedream/api/core/QueryStringMapper.java | 142 ++++ .../pipedream/api/core/RequestOptions.java | 101 +++ .../api/core/ResponseBodyInputStream.java | 45 ++ .../api/core/ResponseBodyReader.java | 44 ++ .../pipedream/api/core/RetryInterceptor.java | 78 +++ .../java/com/pipedream/api/core/Stream.java | 272 +++++++ .../com/pipedream/api/core/Suppliers.java | 23 + .../api/core/pagination/BasePage.java | 24 + .../api/core/pagination/SyncPage.java | 24 + .../core/pagination/SyncPagingIterable.java | 61 ++ .../resources/accounts/AccountsClient.java | 78 +++ .../accounts/AsyncAccountsClient.java | 81 +++ .../accounts/AsyncRawAccountsClient.java | 391 +++++++++++ .../resources/accounts/RawAccountsClient.java | 312 +++++++++ .../requests/AccountsListRequest.java | 285 ++++++++ .../requests/AccountsRetrieveRequest.java | 101 +++ .../requests/CreateAccountRequest.java | 354 ++++++++++ .../api/resources/actions/ActionsClient.java | 78 +++ .../resources/actions/AsyncActionsClient.java | 82 +++ .../actions/AsyncRawActionsClient.java | 397 +++++++++++ .../resources/actions/RawActionsClient.java | 315 +++++++++ .../requests/ActionsConfigurePropRequest.java | 134 ++++ .../actions/requests/ActionsListRequest.java | 223 ++++++ .../requests/ActionsReloadPropsRequest.java | 134 ++++ .../actions/requests/RunActionOpts.java | 269 +++++++ .../appcategories/AppCategoriesClient.java | 43 ++ .../AsyncAppCategoriesClient.java | 44 ++ .../AsyncRawAppCategoriesClient.java | 135 ++++ .../appcategories/RawAppCategoriesClient.java | 104 +++ .../api/resources/apps/AppsClient.java | 49 ++ .../api/resources/apps/AsyncAppsClient.java | 50 ++ .../resources/apps/AsyncRawAppsClient.java | 189 +++++ .../api/resources/apps/RawAppsClient.java | 149 ++++ .../apps/requests/AppsListRequest.java | 294 ++++++++ .../types/AppsListRequestSortDirection.java | 24 + .../apps/types/AppsListRequestSortKey.java | 26 + .../components/AsyncComponentsClient.java | 72 ++ .../components/AsyncRawComponentsClient.java | 321 +++++++++ .../components/ComponentsClient.java | 68 ++ .../components/RawComponentsClient.java | 253 +++++++ .../ComponentsConfigurePropRequest.java | 134 ++++ .../requests/ComponentsListRequest.java | 223 ++++++ .../ComponentsReloadPropsRequest.java | 134 ++++ .../AsyncDeployedTriggersClient.java | 129 ++++ .../AsyncRawDeployedTriggersClient.java | 630 +++++++++++++++++ .../DeployedTriggersClient.java | 121 ++++ .../RawDeployedTriggersClient.java | 493 +++++++++++++ .../DeployedTriggersDeleteRequest.java | 157 +++++ .../DeployedTriggersListEventsRequest.java | 157 +++++ .../requests/DeployedTriggersListRequest.java | 246 +++++++ .../DeployedTriggersListWebhooksRequest.java | 114 +++ .../DeployedTriggersListWorkflowsRequest.java | 114 +++ .../DeployedTriggersRetrieveRequest.java | 113 +++ .../requests/UpdateTriggerOpts.java | 246 +++++++ .../requests/UpdateTriggerWebhooksOpts.java | 171 +++++ .../requests/UpdateTriggerWorkflowsOpts.java | 171 +++++ .../oauthtokens/AsyncOauthTokensClient.java | 37 + .../AsyncRawOauthTokensClient.java | 95 +++ .../oauthtokens/OauthTokensClient.java | 35 + .../oauthtokens/RawOauthTokensClient.java | 77 ++ .../requests/CreateOAuthTokenOpts.java | 129 ++++ .../projects/AsyncProjectsClient.java | 35 + .../projects/AsyncRawProjectsClient.java | 84 +++ .../resources/projects/ProjectsClient.java | 34 + .../resources/projects/RawProjectsClient.java | 66 ++ .../api/resources/proxy/AsyncProxyClient.java | 77 ++ .../resources/proxy/AsyncRawProxyClient.java | 347 +++++++++ .../api/resources/proxy/ProxyClient.java | 71 ++ .../api/resources/proxy/RawProxyClient.java | 275 ++++++++ .../proxy/requests/ProxyDeleteRequest.java | 146 ++++ .../proxy/requests/ProxyGetRequest.java | 146 ++++ .../proxy/requests/ProxyPatchRequest.java | 208 ++++++ .../proxy/requests/ProxyPostRequest.java | 208 ++++++ .../proxy/requests/ProxyPutRequest.java | 208 ++++++ .../tokens/AsyncRawTokensClient.java | 158 +++++ .../resources/tokens/AsyncTokensClient.java | 51 ++ .../api/resources/tokens/RawTokensClient.java | 127 ++++ .../api/resources/tokens/TokensClient.java | 49 ++ .../tokens/requests/CreateTokenRequest.java | 338 +++++++++ .../requests/TokensValidateRequest.java | 96 +++ .../triggers/AsyncRawTriggersClient.java | 386 ++++++++++ .../triggers/AsyncTriggersClient.java | 82 +++ .../resources/triggers/RawTriggersClient.java | 305 ++++++++ .../resources/triggers/TriggersClient.java | 78 +++ .../triggers/requests/DeployTriggerOpts.java | 282 ++++++++ .../TriggersConfigurePropRequest.java | 134 ++++ .../requests/TriggersListRequest.java | 223 ++++++ .../requests/TriggersReloadPropsRequest.java | 134 ++++ .../resources/users/AsyncRawUsersClient.java | 81 +++ .../api/resources/users/AsyncUsersClient.java | 34 + .../api/resources/users/RawUsersClient.java | 63 ++ .../api/resources/users/UsersClient.java | 33 + .../java/com/pipedream/api/types/Account.java | 485 +++++++++++++ .../java/com/pipedream/api/types/App.java | 472 +++++++++++++ .../com/pipedream/api/types/AppAuthType.java | 26 + .../com/pipedream/api/types/AppCategory.java | 161 +++++ .../api/types/BackendClientOpts.java | 163 +++++ .../com/pipedream/api/types/ClientOpts.java | 163 +++++ .../com/pipedream/api/types/Component.java | 365 ++++++++++ .../pipedream/api/types/ComponentStash.java | 24 + .../pipedream/api/types/ConfigurableProp.java | 420 +++++++++++ .../api/types/ConfigurablePropAlert.java | 484 +++++++++++++ .../types/ConfigurablePropAlertAlertType.java | 28 + .../api/types/ConfigurablePropAny.java | 420 +++++++++++ .../api/types/ConfigurablePropApp.java | 452 ++++++++++++ .../api/types/ConfigurablePropBoolean.java | 420 +++++++++++ .../api/types/ConfigurablePropDiscord.java | 420 +++++++++++ .../api/types/ConfigurablePropInteger.java | 484 +++++++++++++ .../api/types/ConfigurablePropObject.java | 420 +++++++++++ .../api/types/ConfigurablePropString.java | 452 ++++++++++++ .../types/ConfigurablePropStringArray.java | 452 ++++++++++++ .../api/types/ConfigurePropOpts.java | 509 ++++++++++++++ .../api/types/ConfigurePropResponse.java | 133 ++++ .../api/types/ConnectTokenCreateOpts.java | 338 +++++++++ .../api/types/ConnectTokenResponse.java | 183 +++++ .../api/types/CreateBrowserClientOpts.java | 101 +++ .../api/types/CreateOAuthTokenResponse.java | 149 ++++ .../api/types/CreateTokenResponse.java | 183 +++++ .../api/types/DeleteTriggerOpts.java | 101 +++ .../api/types/DeployTriggerResponse.java | 102 +++ .../api/types/DeployedComponent.java | 539 ++++++++++++++ .../com/pipedream/api/types/EmittedEvent.java | 235 +++++++ .../pipedream/api/types/ErrorResponse.java | 201 ++++++ .../api/types/GetAccountsResponse.java | 142 ++++ .../pipedream/api/types/GetAppResponse.java | 102 +++ .../pipedream/api/types/GetAppsResponse.java | 142 ++++ .../api/types/GetComponentResponse.java | 102 +++ .../api/types/GetComponentsResponse.java | 142 ++++ .../api/types/GetTriggerEventsResponse.java | 102 +++ .../api/types/GetTriggerResponse.java | 102 +++ .../api/types/GetTriggerWebhooksResponse.java | 102 +++ .../types/GetTriggerWorkflowsResponse.java | 102 +++ .../api/types/GetTriggersResponse.java | 143 ++++ .../api/types/ListAccountsResponse.java | 142 ++++ .../pipedream/api/types/ListAppsResponse.java | 142 ++++ .../com/pipedream/api/types/PageInfo.java | 169 +++++ .../api/types/ProjectEnvironment.java | 24 + .../api/types/ProjectInfoResponse.java | 102 +++ .../types/ProjectInfoResponseAppsItem.java | 157 +++++ .../com/pipedream/api/types/PropOption.java | 135 ++++ .../pipedream/api/types/ProxyResponse.java | 155 ++++ .../pipedream/api/types/ReloadPropsOpts.java | 331 +++++++++ .../api/types/ReloadPropsResponse.java | 103 +++ .../api/types/RunActionResponse.java | 175 +++++ .../pipedream/api/types/StartConnectOpts.java | 101 +++ .../api/types/ValidateTokenParams.java | 156 +++++ .../api/types/ValidateTokenResponse.java | 511 ++++++++++++++ .../java/com/pipedream/api/StreamTest.java | 86 +++ .../java/com/pipedream/api/TestClient.java | 11 + .../api/core/QueryStringMapperTest.java | 339 +++++++++ 359 files changed, 58337 insertions(+) create mode 100644 .gradle/8.14.3/checksums/checksums.lock create mode 100644 .gradle/8.14.3/checksums/md5-checksums.bin create mode 100644 .gradle/8.14.3/checksums/sha1-checksums.bin create mode 100644 .gradle/8.14.3/executionHistory/executionHistory.bin create mode 100644 .gradle/8.14.3/executionHistory/executionHistory.lock create mode 100644 .gradle/8.14.3/fileChanges/last-build.bin create mode 100644 .gradle/8.14.3/fileHashes/fileHashes.bin create mode 100644 .gradle/8.14.3/fileHashes/fileHashes.lock create mode 100644 .gradle/8.14.3/gc.properties create mode 100644 .gradle/buildOutputCleanup/buildOutputCleanup.lock create mode 100644 .gradle/buildOutputCleanup/cache.properties create mode 100644 .gradle/buildOutputCleanup/outputFiles.bin create mode 100644 .gradle/vcs-1/gc.properties create mode 100755 .publish/prepare.sh create mode 100644 README.md create mode 100644 build.gradle create mode 100644 build/reports/problems/problems-report.html create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Environment.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/FileStream.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/MediaTypes.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Nullable.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ObjectMappers.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiException.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/QueryStringMapper.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RequestOptions.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyReader.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RetryInterceptor.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Stream.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Suppliers.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/BasePage.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPage.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AppsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/UsersClient.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Account.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/App.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppAuthType.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppCategory.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/BackendClientOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ClientOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Component.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ComponentStash.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurableProp.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropString.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateTokenResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployedComponent.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/EmittedEvent.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ErrorResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAccountsResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppsResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentsResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggersResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAccountsResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAppsResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PageInfo.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectEnvironment.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PropOption.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProxyResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/RunActionResponse.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/StartConnectOpts.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenParams.java create mode 100644 build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java create mode 100644 build/spotless/spotlessJava/src/test/java/com/pipedream/api/StreamTest.java create mode 100644 build/spotless/spotlessJava/src/test/java/com/pipedream/api/TestClient.java create mode 100644 build/spotless/spotlessJava/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java create mode 100644 build/tmp/spotless-register-dependencies create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 sample-app/build.gradle create mode 100644 sample-app/src/main/java/sample/App.java create mode 100644 settings.gradle create mode 100644 src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java create mode 100644 src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java create mode 100644 src/main/java/com/pipedream/api/PipedreamApiClient.java create mode 100644 src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java create mode 100644 src/main/java/com/pipedream/api/core/ClientOptions.java create mode 100644 src/main/java/com/pipedream/api/core/DateTimeDeserializer.java create mode 100644 src/main/java/com/pipedream/api/core/Environment.java create mode 100644 src/main/java/com/pipedream/api/core/FileStream.java create mode 100644 src/main/java/com/pipedream/api/core/InputStreamRequestBody.java create mode 100644 src/main/java/com/pipedream/api/core/MediaTypes.java create mode 100644 src/main/java/com/pipedream/api/core/Nullable.java create mode 100644 src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java create mode 100644 src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java create mode 100644 src/main/java/com/pipedream/api/core/ObjectMappers.java create mode 100644 src/main/java/com/pipedream/api/core/PipedreamApiApiException.java create mode 100644 src/main/java/com/pipedream/api/core/PipedreamApiException.java create mode 100644 src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java create mode 100644 src/main/java/com/pipedream/api/core/QueryStringMapper.java create mode 100644 src/main/java/com/pipedream/api/core/RequestOptions.java create mode 100644 src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java create mode 100644 src/main/java/com/pipedream/api/core/ResponseBodyReader.java create mode 100644 src/main/java/com/pipedream/api/core/RetryInterceptor.java create mode 100644 src/main/java/com/pipedream/api/core/Stream.java create mode 100644 src/main/java/com/pipedream/api/core/Suppliers.java create mode 100644 src/main/java/com/pipedream/api/core/pagination/BasePage.java create mode 100644 src/main/java/com/pipedream/api/core/pagination/SyncPage.java create mode 100644 src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java create mode 100644 src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/actions/ActionsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java create mode 100644 src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java create mode 100644 src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java create mode 100644 src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java create mode 100644 src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java create mode 100644 src/main/java/com/pipedream/api/resources/apps/AppsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java create mode 100644 src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java create mode 100644 src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/components/ComponentsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java create mode 100644 src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java create mode 100644 src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java create mode 100644 src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java create mode 100644 src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java create mode 100644 src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java create mode 100644 src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java create mode 100644 src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java create mode 100644 src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java create mode 100644 src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java create mode 100644 src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java create mode 100644 src/main/java/com/pipedream/api/resources/tokens/TokensClient.java create mode 100644 src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java create mode 100644 src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java create mode 100644 src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/users/RawUsersClient.java create mode 100644 src/main/java/com/pipedream/api/resources/users/UsersClient.java create mode 100644 src/main/java/com/pipedream/api/types/Account.java create mode 100644 src/main/java/com/pipedream/api/types/App.java create mode 100644 src/main/java/com/pipedream/api/types/AppAuthType.java create mode 100644 src/main/java/com/pipedream/api/types/AppCategory.java create mode 100644 src/main/java/com/pipedream/api/types/BackendClientOpts.java create mode 100644 src/main/java/com/pipedream/api/types/ClientOpts.java create mode 100644 src/main/java/com/pipedream/api/types/Component.java create mode 100644 src/main/java/com/pipedream/api/types/ComponentStash.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurableProp.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurablePropAny.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurablePropApp.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurablePropObject.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurablePropString.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurePropOpts.java create mode 100644 src/main/java/com/pipedream/api/types/ConfigurePropResponse.java create mode 100644 src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java create mode 100644 src/main/java/com/pipedream/api/types/ConnectTokenResponse.java create mode 100644 src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java create mode 100644 src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java create mode 100644 src/main/java/com/pipedream/api/types/CreateTokenResponse.java create mode 100644 src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java create mode 100644 src/main/java/com/pipedream/api/types/DeployTriggerResponse.java create mode 100644 src/main/java/com/pipedream/api/types/DeployedComponent.java create mode 100644 src/main/java/com/pipedream/api/types/EmittedEvent.java create mode 100644 src/main/java/com/pipedream/api/types/ErrorResponse.java create mode 100644 src/main/java/com/pipedream/api/types/GetAccountsResponse.java create mode 100644 src/main/java/com/pipedream/api/types/GetAppResponse.java create mode 100644 src/main/java/com/pipedream/api/types/GetAppsResponse.java create mode 100644 src/main/java/com/pipedream/api/types/GetComponentResponse.java create mode 100644 src/main/java/com/pipedream/api/types/GetComponentsResponse.java create mode 100644 src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java create mode 100644 src/main/java/com/pipedream/api/types/GetTriggerResponse.java create mode 100644 src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java create mode 100644 src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java create mode 100644 src/main/java/com/pipedream/api/types/GetTriggersResponse.java create mode 100644 src/main/java/com/pipedream/api/types/ListAccountsResponse.java create mode 100644 src/main/java/com/pipedream/api/types/ListAppsResponse.java create mode 100644 src/main/java/com/pipedream/api/types/PageInfo.java create mode 100644 src/main/java/com/pipedream/api/types/ProjectEnvironment.java create mode 100644 src/main/java/com/pipedream/api/types/ProjectInfoResponse.java create mode 100644 src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java create mode 100644 src/main/java/com/pipedream/api/types/PropOption.java create mode 100644 src/main/java/com/pipedream/api/types/ProxyResponse.java create mode 100644 src/main/java/com/pipedream/api/types/ReloadPropsOpts.java create mode 100644 src/main/java/com/pipedream/api/types/ReloadPropsResponse.java create mode 100644 src/main/java/com/pipedream/api/types/RunActionResponse.java create mode 100644 src/main/java/com/pipedream/api/types/StartConnectOpts.java create mode 100644 src/main/java/com/pipedream/api/types/ValidateTokenParams.java create mode 100644 src/main/java/com/pipedream/api/types/ValidateTokenResponse.java create mode 100644 src/test/java/com/pipedream/api/StreamTest.java create mode 100644 src/test/java/com/pipedream/api/TestClient.java create mode 100644 src/test/java/com/pipedream/api/core/QueryStringMapperTest.java diff --git a/.gradle/8.14.3/checksums/checksums.lock b/.gradle/8.14.3/checksums/checksums.lock new file mode 100644 index 0000000000000000000000000000000000000000..f2ac8c40a213a4fde3aa01e17e8a74c3f445b1c5 GIT binary patch literal 17 UcmZSPpTnq>d0FQ&0|Zv zRoS)+Tm2--(kc{Eid|;W{pNR`Ip^4#r$2vx{a)w1US{U?cHYnTJfG(|XS`mXvy8z| zXOE-C__wM4`;mMi36KOx0we*F07-x(KoTGckOW8qBmt5DNq{6k5+DhX1V{oT0g?bo z;Qu87A8;aa@MP5IOrkz0e#c;#OaUL3C3nh=evv*c6#m*}AO8OVUp~Mn_szktAb0b@ zd{>uBo<`J?PRKpVFyCAC(yq`oXEx-n=@a~gS2G^OPF{2 zvN>N8F2Ft7Q-RqyEL1KOUDh z)3P&Zf!yUK=1(2=F6}joy9xR7Ow0#Ndu}?Ou&{^R%L4Piww>k|ZNH!kIj2?Y zpbqREpp4bj;Xs>o3A~6Ig>Fa8ZmoK)CiQ;mv1&;_@YE`01fi#F<&Mw|?I8CzO0CU7 zmYiy1T{EM-$UyrSIA`gGzn4&hHTOtjl9n-pd8phS8FxTW(4tuFu z_|&mI)}42kKqELpBrufC=tg1i8H4f%n{o#Dfv-Ay_k*X{sq+Ya4h?1?-RP0{@koq8 zr@jx1w{WG3lru73Lql4UZlp{KS3NGvDKuF&uo(yrg@9$=RKGRX;;x4Y>AHlcS#A7Bh4zdQO(H zGLjsun>)7OUJN==qgsDTy1G$-mX}_rCsAq#YC#r#F?aW-dvF%%V zueZ4=#WR`;+ed%voq~+>u!dY1-H@-&?p#$mXtlTC??97f$_>z1s|pSCVY;DYv(?74 zfwl9F+H>L24cTDa)Tpqb_?cO|mMJx$FqYakt0{vuZd}lhMl}FyD7>ZDFbyy2>zeu7 zeiP}L0pUS4OOb*0vP=b6RQw8-#Bq*}*GByA$LjZ=uMz<6a?z*~VGW=Cbi>AW&&$!E zq%q(At19Jt8y6y@3L46H=|-CS>FIXe`n`_tgR1KEGeD1zYs_k)8_^3o7%pjg3c^g2 z>y@c7Ab*iD0&B1@(hc8SW1sQMTV~F$Pq;V!P2e_YgxW%b`I$NB5Va<`e0Z(z1NTEw zm+cF{z7MKKC^~alJ$jA!eQvKuOiKLUt(jvjm{AU9(8q>yE#1%xmp&9#X>V$jcXey( zvk-k`+=HWF?JKjWD!cO|_#N4oz#5fnNNAMbykM~ zGCW}oxzBt@&33GxDHzMM+@qD!rDzigc72IPRSpel6MBs;D-Bl~Smx+w${*>h$Q=OR zNg@N?SCVmbqy7y$@96q-n;p$9bBz_1(CSl!uDNy_-O#FNQLk;E&4|6hUhnuzS`VyI z>%1#q+0?R-fp)t{AE6t52jXmkd>+>FmJHfG`_>BV zb-H6rrU_aw>%a3Ot7G;hPKe=SK02yfA)dGK~h#Nt|PVW6ksm9js z8!wXeZ-*j7gQ~z_m{NQB#A>KXt!}e2jCsgA+QRROjt9pUokx>MU}#e7ubAe&#O#+2xzMqM0{X zH??Ao%5cPRtn>r7{Tre8Y+nsJj*;Mi6|7Q(14JXA%#p08YokuBt1n>qKHCf zlBsA$kMizw)>`NNobCPN^F7!5$9L^@T^;B8S@*uzy7%5|t#hoMHi;z2H3JLj--Ykr zZ;5wA0z?8t0z?8t0z?8t0z?8t0z?8t0z?8t0z?8t0z?8t0z?8t0z?8t0z?A;UlOpw zI>HJ%BPc^pe#03=BCTV?-b5TrXJoR=I(Gy7S~nm4{UFLL)Uuo*;wj(;*;Kw~*V@x% zjnjZzSs{M1WhE(jKOgy+Sg|~Uc(gW0fbW^97l1pnARbe+?|R=%Whmgbj}bp@WSCj+ zZ&L!eDJPZp)N7qFFWU#Wdq3i5D}@eS95CAexFt8@2@Xp6TIrQtfII$8<@pnusfJ0? zfSc?=Jdx$BQk@~Q5#VOgRL*l>pgC^MbHE*rBA!$`@M@LpxHaJ0Um||4s75tkVof{X z_6reDao2s5?zH9$tS^iBg?2uU#`cO2fLkp?JX7O?Wu@gS%Gn~3jGYnBUS9tsV7UQ2 zojZgO&*6HzlWq(`) z_08)M&+o4Bx%E;m32;3V#BY0lc20I!u?cX~t%w)qwkVzMDb57k<_?vA99ix#zCZqvU7_j~{_}nV<2oh5ef{05>v2yu2zsHl)`h7;vYHh*$0z`78BGswCis z>{MRzW_WZ%n<3!F$%t3ewG7xTQ9A;-y9VM3_+}xGQ_X|lWaK^%XT*|5Z zyh6X7KzTE$?^uoavn@rVSAVqq0^H#vmG2JkSa;{!UC8eu-dO9GWsn{I25_SXh`-u7 z$g!4b-6_DGny5UGm3j9^AvM4)ixGcq;A>Y}#FGxVvl^AB_qv2F_f!JhTpIC~dd?l@ zm%D2Lx06G>_4U+%>?%noz}*)i-ob5Nn^bQEuTNd-{n&BT|H9i4mkXf2?G&ot<-ima z9KrS&aFa`j_iw6FOv#}82)N;G#NXvQ<(w-X0I?qWpc!#kKH?DU!dH-3)zNOAYNLt$Ub05`Khd{j6?&!(YE8}RKH5dWZU6UK4z zFL_x1A>w0vOVuB-4z~erI*9nVeVbdQBMTegPV!V9Aigqpd$=j!E&^13=;`GfT@%*< z*GG6}{L;8c)MB=CfV)bfUwmfRvF#5*;bFi{lo0>wPQP1nS;Kz7EmRQy9{S#^xa!3W z;ClBFpZGo65IwV)5paD+#D9u5duua=_yTUANab#)xau-gF2dsoQF&)X{*_fZg@9W# zA^v-`(3(H}RR`qz5TB`)^b3qGb^+YY3vtGZP#JXtW|+U_HpCZb37^}lVv5aMlcz!LeATF{vCog?x$zD)jH;BqT#XFRixx;bW^bnQ% zY-D{$3O@_#8%0rhd-~ahBSJ6-z0Zh?3QpyId35X#P~V+;e6fA%F_ZEsAK-DmqWa?W zoQ8jR@ihW&IDojs?~e7^9M*k+JK7??BK2lfK{pp1-?qCWF3CA$AC&(V&a+mrh)cuNxKmvO{ZE-b&KnyCF2aMMD>H<4^=!fj!bt#0^|cPN zxWD-N$R2Q;Fe)Ex;{Eeg@cDVO(T!bT>cU+DmZgG2}qD4&$j{g>Zh}&=v)4RXW zhU2hxE|uqvZQu}N+zyU!CW^R&LAaHO{|0!!SPoNp({J04S`2XhGND7<@ukTj?zL8M zes?fH+$mMQ&U#`7j;q$4h`X*llkMlU7hcbXT8O)u^RomUzheU0f(J# zfLlF6eAn)afhNBb3<0Jb66c9&0 zNhG#ta4h1LNPtLyNPtLyNPtLyNPtLyNPtLyNPtLyNPtLyNPtLyNPtLyNPtLyNPtLy zNPtLyNPtLyNPtLyNPtLyNPtLyNPtM-|B`?LCYHtikvF$VE`Bfg_Vp4qxxhH{ZhO0T zOoN4d%2p&2-Fabl2S?ySPu`Wi{-03Y+7zC2Xf)qE_vejbUFn~Njw_F)0xu_V==Biq zH9ys<<1Rj`YW7@A)k0S|_RD{2dvf&=@N$8>KCQQ(w}4iO8P3XwnQz4Lit z_2IxS=;Zuj^Wd9Z7GPxwSx61MA^e7;;>11~1>(+4zO z^HZ64^kr2h#~$_mQFcT-(QLDRzW8F`;Kl5W_j1185}awcf=R8h+r{)-|Mm4Lz1W^LavH8vK(&Cp=b5I3wH}Fk zXSQ7v)E?e7^Q3|9%WE(0dZ_vZR10(PsOM0^}kdLQ&#`|G4P`S|oFVO|_JSkVFt{SxU(&8+c8?eYfEH&6xl zhKh#cRpmOW?^H80%=7i$byOJD2xV1XaD}Qk;Kf7Uc}tUq^m#khySo)m@APwtvB}v( z?{@a;Zm5F$FWK|(s>03^M}NN*v39BGlch%@EvNT}V7q|H$-89(uj4oWDV174jC85n z78?b}9(H;TQ>%`+3T!ta*~^_9cr99n_u^7E|L7CEt|^hPY3RVu_q&qU)L{FvDJmhL z5|hBIUhrk!R(SN@qxWlW#FaO}IYo446;LG(R4bD4syCwUX@d2GNh=Si{N&Y8sOk&0 z+YD8@N zqNh`F85j%OCmVnD%X`7AGi&3{Ux%t;pyK!&ud3>k(4&8`!gx~F|JmxWM1>?tOLM6D z2voe}{na!XHofFvYqx2tnanyRK46oiDc2&2wTzs`4nCk#9K)+N^)ZL%t2$mStoMR()_FY;LY z-O>%X-cg^CVt>~=Z0wWfRFx@>IJq@1tMz>AB#3!SEgW+f^Uae{fzM4-KGVo@vTu+J}LHJ zDvlEO4hR*>3r4({t>U?dSMAmm4LK2{vG_#&yIm|dHXbp)DYOu(+CU50$h*pE`t|dO z>cYBk%TQUqhq@|FD-XLL-XRB6JL!OmR}-&F<6eFzIZf~8Xv~=p+?-p6@0LCL0afHh z9abE|u@@Szz)Y{?!Z)_U8iz0c5~_dj_Fk_ab}f)I+-XMEU{8NIV@&YO)cI+pO*ZfqA79Z<-=(@H;-tGH`ixc++gj>t8*^bgeZ2TaX z1?#XE8n3|np*poo-^pJJGOqcibo8xQ_A^!fInB>k9Tl)35dQ{`#670aNK&CoCF;4a&BVHek=`l3VC0 zN)ge=VlytSDs6|qy7`*Y!z9(=(!Da*gsUDoO+yv9Ht3qM^GB;H&TkHGR+bJP5i9iM zJ#)>5Bsb~TWHpC{NsBcVNTwp{b%ts8XbOF>RS64GYf|OV}KBl&gl6xK`&hrm}uD+YVJ*K?_f$ z;k^c8b@}tmLes0eMGMS$*xZ}z-(y!TB}1SR-ZY2T2~pueV}qw5Pn!!De0F5q)e-U( z&aj?9CB61C-fOIn*^V=M>#DpHOPESDJzV+vqTu?_6B~oE!gG|oGNMUi%=ItR^POs5 z5uN!yi|luCeyDt22V3Y$QITGf&o+%pa%62Rn?g)f0Ph1G|EAwezPa((T}bH{)<1GF z>cL)URGN$X&-F)(6lQcay>PNIymw~(FYHMjiVBQ}3>&=hssIM7L7#=o<$b<)XVN_p zn9AdqaDu9{SZ%BrlgAGlud|u#zlG#VdfW%!)^-g}-cMcWe;ul9DI$_~I9|n=wOOSi z(Yr9

JvYh0oWvCNp5qW>H$`K~XK-G=WzcUF3CcS@xcuPsM<$S z(fu`ySKVJUuryXF_Qw03RzLG&^~zBTJXD~nlcHMC8;(~UZu;?&b!&vnw787Si!~Cz zB>DT`2;kXEQISgKxaMV^?JND0Meotf`Nqo?flG&UvyztsuU%3URan(YyjQu5f3D59 zUGEL7`eP~=+`bmjRgcX)$ECX_85JBF2?K3(T7%Lc7^%;)g)7c^AT!iG8e?@XCHZb40?fnkwjkNRpQMY zLchFB*atk0JU>WxyJc|jJG|!8p^Et?Ue)k{e|1Ndv96;3Vt%fT{>sLec>QL3tsy@( zOp`{WIFl;t@^Cvz@jhN{)%Qu;D!0LV8F?+3=;)G*JT6fL_elik9|H z`OjV%5uk;0eg4|k)0w#1vCdmTP=L20H0I;ZK&c(j3#wRa@m?u%?EwPLFL<4Tt<1eX z4*k_s>=!s&#jK83EeX1JaH{BTcXO{(?tS*{aZcsW;b?^$V(2J;8e^Pxg-(eyOx0jVJ{CWM`4@s+q>VnV?*~ zP{sZhuVUYOGB)QBpQWmM+M=GI!iG0Zr_^VwR)55+2I`-@+8o)EuI0!7`xUdrYU9Xw z51`6q$7*9m2wPXtp5_0h*ZeXp5jXd7mhw-|9~U|4Yp(P7qJ9mw5+Y}q30IZODfoWP zZ{3^r=c1&hJWbv7A1{__nx;qom~_pa?X@NNf8&*T0jrIbxz^ZgtkoN~rpkR8wW?Ho zNIyAosrUgu^tuRCB6EDdagV`Fup%~3sbzd3h~&?5A+PN`Hcn8|NCqkiBkU*5Y<}1G zX}{aEf;A5ISHmtQB-XWb>9WpNt-$U#T2qLjI>$ zqzhgp`ckz2Sk}YjORWVbl6C%y&ErXcvmQ!=hXt=XEjd~&XLUDIB*C-x=Wp@Is49Nd zS!vMeCg4?lsnfgL-7h6XHpNx-u=8sORLNo2I;DjmLx%N1c-5!lPx3g+ifhVVm&&}> zkdQe2LuL%Bu(OR7I@WD?RV@9PI153w?i8EBK2Eu=p#!|v;WvSqK*i)}jaPkE^a|$= z`_Uri&>H)0LLxZt=sU?-UQ8`Z@T%{x^hIClkQn%z*-p6%`RI0T52}W$e5^K!#CJmw zuj0?oVUWGLSd2@#i8*FL(O0!Rfj4%o P0?-Sr^h8=WkiGr|2qe2G literal 0 HcmV?d00001 diff --git a/.gradle/8.14.3/executionHistory/executionHistory.bin b/.gradle/8.14.3/executionHistory/executionHistory.bin new file mode 100644 index 0000000000000000000000000000000000000000..da9dccc62f7d8e72702e66e84570a3f7a507c73f GIT binary patch literal 64263 zcmeHwc|26#|Np(VcBWk`l}cq7l2o=N%APiP4+dkKX=dy#Docw{h(eYYrL+-kNV_&m zMT3TPKx6@t1wfj0~h_Mpj7-`G-sZ1gQ-M{}7)(2%q)p)d(8>#};Fm>j!Es<5q|bIdXvheX#-a zyOVwXidNc>I{Npe0nG2rzrpvF^q-0T6j?xI0g(kn77$rLWC4){L>3TPKx6@t1w3TPKx6@t1w3TPKx6@t1w{9 zc)A3Wowfb_g7HLL+})A&y0)fYv<^FuTK{BF<^ge@PtYk6#a+dnf_L>MsNl&&6&jxE zMO6u);K^hHMa6;sx05l!g+#&A2(Gw#=ew&W(Dc=!LoJT4S`qpO{%eMTQFw}r2hpEk zh^G?zpX`l33RZZU2a;i2)@ETg$wthYk2h1*rOz5BAt2`UCsgJxJqz{q|yhR^^NkOIO5i@zB^9xh3f^PfFCN0&PFXKa4?X3d|YB({0tDT|2S1o#vN zSe03A*c4|&n!_F7*|AI3DC_$zUg5aHgzC@ZOT1Q~cl5zGU zdb_I9e8{Ry?UgAE?Uh~G)Q52AZvEHlrL0vtHP!0=t(7HtyRIW;4 z^st34BU#{moL%t>ChPowi=hP}&f3+|*Oovbg8v8Oku1r|oW3;9Hsc&PCl^Qt85oL4 zR6!)F*ii@sAoWF(Ra`<#mg5Y8$|?(IRYh z34t^UUd5D1GoaDC7XsCSMXO*#@Fuz7X?SOE0$qglI^~<4dFIuK<`hT?o74gy90ZIX zfTtkJF%7|pCSWv6Ak&7};2tzG!n=47Tp8J}smw{dw969M5ftMPR|0T0-Zc8pXwWcv zIeO!L-BpoN_jLzFIotzJT}JXX=1e-*0_dXZP9nK`gIK|ppz1>Mb@8K62)@871OinR zgc!s?Rio~&Hpu^xqS6Z_(;#>t$j%%jJ1hznE(#TtLIs1Od2e1iafaKX32lcyB*Kei}*d_OMVVF{JmBB?3p}gVbABcLF<%2FbG3DE6PA zl>h>UP-L}Zmbp|=bAe6^)FukvmxkEQ&Hkv8(rwT8s6+{BkS}mas)CHofmW~u0J`aC z_g10;sP%4mA_ajGwrMolh7=E?H)7>pQy|#$6EowpjaRLwW3>ce4V*#53Tm>oAHk2{ zieNn`Bwu1MfdX=G z34(p#BxoRN#ppH67!Gj)61NguyoqEgLB-RZNK^49I;&VZdlFn|X09C0DqsZTzZ`!B z(!2k`FouwnVGJp1NX6|AWVpH}5W*l`3ew9e*wXO6uE1e31=H<2y_axK)XZL>fI!ZU z@UQ*34z^UZRITv94bzB}C7_?9cgsk|kxbJFEZu<<$GM@MHn0pMi09+S`-6BHMbjX8 z)WvvDIXz=Fnz{8wlfViSE95nji35&{RI6kf^yk z8StSvAG|-o*N8+yIzW&`jHm*2oKvuM;h*qZhM;Tm#rqJDC`t;Y24e?}0H7WC*@^biKcxEG)iI^Y&rh$Z)?4a*_SfvfjgOvH zJ=X|^-{)*Ny|!TcLjT+<9(66=!b|K z1^y?WY4)hn@mIv7iQZd&YdU@nl}#I*)_T0gcFKa1H&Xo+GHB3b0);}NIDtWvFTn}# z>q`Q46ohP4WqJ+bCLcC{MV_&))q=XT^4Zpn=A(*IzqpOweL&= z>H-(+4XP5}1q^Pf%IZK_buPy7PiC_ihX>8e^6_68cgMSHcbbx=lY_RRZJFZGfEzy) zBsH>6HqoF_ZhoNi01D#0k(Q=BTV)Oxp|W#-7UAQf_^P#$g_F{9$IPv;4#~DZcs{0d z!lW|lifPAJeTuw5gGRXfAv~I>Zpxk%;2b&4Ie96IZqg~W(#h_H_{mr5@+t@4%Xb~C z^X}*Jn|9LI*F6qvNcZWVB~6zDwgjoF zWXa48dDgnRLMOB`q1xS0{ZthV8pmV=lMQ$Ql^oV@%|*Dt1^i7+`t%>rW`<|dC*IOOR!}1IF{h-!|T;LQpVovZ*jwRKx${4 zONsP(CDWMSCHUFS?bZ`;G)Ruj=r7UOOqt#%@^L`pi&)GXmc@jNKWUj@R}iZn-{I2S z@@85{#;@p``^w(VBlWZVK!c`WGE>P!cJ^KlNMRbJiF9C0N|0xNJYCnh%x~-&m`nGd zfq`%&4Nq|=&~C$N95YQ+ii@fbp6IKJ5P>n64-AKaKaUAcq)H}|39i7Wg5=R4IqUy9 zy#=a*$zvGa!vRLV-GTeUplUz`L9P{38v`=Y$eRd)e$+1FxbL0z1N7{?V%8`t9shD> zOBH;IN1i~2ihrVvAu=HaCdUyIi{nahnu)se7wWBd4PS8jQKl1|-)o)NiO%-POo(rV z;Y40Z$PaGxEtd#Hm2PHBbhe1f$XPqtJgHyeEHDc@WJN*U_G&mATOJ1Zo)9V+gD4M~ zUp6LyscUqir`yKAbrOplt2VtLeB59W_hh6Be1?xEd^xTOp^%BMKM{m5KCJpTDCOmx z^dt?t*uW+!?I$5OA4Yk^CDhO+Lyzb0jE1)PT|cQ0XYrBF zg?u1{a5G;pSr5iHK)MYw0YIf0l3arrifrqujXyi>)PMLwm**bq4~oILd=wGDB8)|r z5?qORWa)!hLr-11RCz+i<=pG&`%MRemcHR@5iaBvAuNJSbsz(0h7B&vH0h_i_0_2x zKNG98ebh|h!+dPOffJ@Em;_+<0qrzF>4NT_p~h|74*j`fPH6u6zHCOK?66IIi$VZP zA6+!+FDwoGXdZSXFM_YFADIk%G*cm;l+0_Z?R@W#Isg7@S>V98ST0%+gD}pEKI5aF;e`GBdhPWfA?^6o2&z$?ok0wioa9`nMq<(XIo%2DSUdp|0R@o%oQI3!x%= zPy^zc?ll!gL)L0~1b0T;swQVAr(HyM>~N$_y1BcZmpzzD5d-HH|BV~Upek> zPVgJ}Y%jFpB>7ugEe7k^HUu#3=Zj1-q9NA_%h0i}zRf$nH)mbLzE?71dSxpfo>C!f z1twxCLG+any1QX$wS^DoOmU3*vCn@}xE*|wkDagyZVI6aqg&<-*>1ay415z4 zeYeT?kQOQLBMCmvM-L2inNUj53kC@e*gAWLRo<@nJX$mQ`3IxN&y#+&E}9SL@zsVu zjWE3vv%Vl|*%0uoVEuDog_eUfJXY_@-q%JNmwxi?o%k@^7Rp963NQ|EM#yR`iP=%6 zydWQz4O|fulHp;tbl>jba1LMNVBm}T-bc}+IY!YeGEUeYu_o2|<2G?jtz{kP8n6-JVeO z-J*gut;8og>o-U$KTXf;kHMR0Svm zD#;JjKq?HU@S42)r+ti!yK$;uI+o<;O9S*6fiQ2fM}4bHyacKS41pZwOWwZQ?lpeU z=fwTLiB1ZOCE*JK^4hI47T43iSC9$7PX55UycF*~ksbIg$$CYyaEf0joD!zIYpBGwcUGRvciRX~Wk*re5etuZ#QIIews z>SX8NZn?E1txJauT~x#HjBzRTw$4g^yX7MPsa{MVWz8#wW^&P&koSf`)-bwX zTtHCAReyLn`#3~nYer-;*dI%9CxH$g1WFi-OnlPT3T+{FiK+%tL%uL&;TUeO94R&dgzT@zo`E28`Fb~Rg_GVJ50H{~O`j`kE*^qyPz z;Eq=Y(iiZ}Lb~=0=LS1M+|qHg{c0QzjqWM9>l1zbzo|O{GY~Lz%v0qr^ZZwBy}#M! zzW5{fW*@4L0OrfW26kjJXkQru`+tz6j}sjnjgyMBCMriG%Bn6J6?aK@-{&HwS0voV z1y~auf;sxQYR^r^XegXoozh8~>vrZ(lIBFqfaWV66XY#*^0|W>$CouOrMCMtS=Q=j19k_Qd=b1)>R?l%jFKC4>W8lBRVi?$z z(o-3;621_&j9CNuXANW{#r{{HV9hsxNYc4(Ktg%9bzQUQ$U}=5XDf z*(d5dS~uOF@l~gXfWB|^E&rR+;WIcF$6clA+WhBoD0-x$fn#36XnDBuFUp3G6rm@w zz_Dm=QV_uv%$d8pgOmI{Ok{B<7kVO#n~2_N7&El7V`#(Cb^P?WvMKd&;h%ehTIE9z zx=rk1BCF35J_uVcuq6R^Conr(Z`ubF!<4oxak`?o&3D6mxI$pH5Jrg50UM7nfjMce z(aAVHS!MU_q261(7f}Ox2-x~UF7y-~kC2{i5&iy#vWVV0jFXiFE6X9KLnKKFXnX`mIa)RG+bCBK-UxWfeBU5s#qH|LdGF zt3O-TT<6R(A92M|bA4V*=Ccb=2g6nWBx^j9`goX$HL4}y!Kn=za%uw%2{6tsVWxa3 ztR>l`(FX#Sh0EB7yuZjK%HzJ16XMfkcvyY-Uy)j!i4M49|l->^33 zBI%goFAqmwi346YoqE_q#iKf3YN6+=*+uZvx=W)p+AM9i@8v_C7aAVaT@XB9-7}-m z^NZ}%d`%&a8>StK&5g_L6mAmm>7H6O))4cSym{e|3>h3+#U&q-j2)344MO`ws(dqy}LWA z;KsAz-xhflTrKNiJ8o}CgiMc5sl@*#g?YAk2eTUvoK^*lT zS9W&Cm?tWc2bLFj8wXb$g3tHRBKc8O{R8#r1;wSIyY;6zxiTA;Zr!l#h1AU;2)@)y z4KdjIcm$WL1XQh%vf?nGcG`+_U+&$kmg?sit9T3nmS{u&^esI^{z8Nvoz^ z5ZhHYDrK84sfQKa-q8xZoQ6ejO5ob9U+z;dr_1wTQd`=BmnFv>2K2C;)(cLdqc$vV zaPy~&hYiQE*Z|)&#>lN$YbgsZ{an=kg68Dh^t;U9vH-~zr zq^CtbRb4wVsprnMN78>+5+!)Cw-nzMU*&IX337 z@}Qt*PEREC0y!N{@5g}8!x&0FjFH^9u(;rT)4-%bl=my_1TT>H#3%G-cXnb7Eq||> z+NsjiuKMOjuxogKNio5j-35{f9TG5DvCY`@Id{1K;NNW@9*_6>wr})n!6AVFs$0VL z9t=)qgN5M}J=d%5<}LJ;1(#IDu*wdZG2!%W>vqs+K2qO@m>+*OUiRSnxE`h~ddVyF zlm$0GsxcMZ%!*#n&Z&B;(u}Z4)IdF)Z>;`aZ>I@8Oj-1vx{oLQxm|}UU1^TkYD(_b zcb=x>Vsa)$Z#t(@s*H8gzh@qy2dS*}bAf|YW-_5WCnf>QvtccjPc--LGNOEpy!K`6 zqV~}94Lx*Dy&)BPSj|apho!Dx`{tVy@#>2wdiV#I5P74!{-z;DqthGV za)GnWyqV}xhVX8jyAE{chj%ws%Hzdw^Xsf}6Xe8ZXJuvt_vFTVO)d29AO4o&v%g6k zcf+=E=bE;N%N2PB=?!y&w)C+3r_U0Ep4sY_)Lq!@_Yhh~PfqkBtsODJaQ$RyT3o2$ znJqzF!cH0afjjcR+$qLgQ>^X~O(XQ242tgVkn9n899{E@1@|s|`#o!lMX1-Uhu7j0 z1kcF`W)nJyWuxWQ(ALHKVd{iY5sJ6;b#I!zFBBZa3ZN2tc81Og`W;^7w$EMPl3$gj z>w3oH##)X2Lj}*y@Ffy@HjB>4tCzuY{OzQYcg2ah-nU+`8;st>2abF&1YfP1J7m(aaM`twYfnDail~N< z@i8oNuz~|CtOAVFlg!f+8*>&eQmy@vv+c(EFy~EMz6ex+1KY=|p6C`Z1ov2jCyeO6 zi7i&Ct>3?NY@G8z&we{Y7G68jf_2rCAcj6JveT(}w5Zwa^EGv3IpjCR;>OCxb^Wkb z-7%q8g{cij%;Oo1x^UxE9#j-NVRPhG<2F;p5MQh_K@8~}$UctRxhTM+0#px%2J_}` zd^sj#z%~zci}ulxGflCE@qFQZjHQ`8^vDl=a0eXPW++04$tztnF=Q8bH$#4!b-%q> z7qSQ-=%b&-W-{;w&yO+m$z4BhSz~g`yO9MQj~aBvM_~Eco>=-gBoaV}YG%iBBIk!5 zoHg>5<{1fPJ*%XhdInfSqF&SWaiyIPuP@WTZ2q}ZN~=S%-E9{xJK?!i3)a%RV2*#I zP`9g}X3|(XRClh|*ZMcZ6f+v@`k)YlqmMHu*ts(#k-Q0b=6Smu?{7tEn)_3v;%X1H zy~-blHFMH4&p%NNyblO&e0611e0z(?xeu#0yv^IzcqWDff9<_u>^%QOG2~J{a6E#c zm_>QKzFTOOb83~rms_5@OM0&uJ5L`E++r62{Z3kjUfZMA58ZvKBX3`2-l$I<4Fy;S zZhNHpCu-3zzGSG?0xiz7&swpl?Y7j?Szh;@d#@H7O&`Z+*x97>8Bi#Ari)07S~53I zW{*|F%m~_tJnI&$@mcSB5@==d)pL6+lFt_H&tEpi>i<{%czMv|7uTsl>A$-C5B1y$@v;b8vwXqsA9Ti-v2}@cH_7`cZTD}rEvuMO zr{eW_n)n}qHH#n3ec|FK-)=q|&O2wfjL31@C*C+dX5z>29lPvJv2Mccu2R?}!uc%p z>M%nJ*xXH^@PwCb{SKMro%H-O9G5wAWu(y)0X|CrPans(jBKKWtQ}`u_R^oCe@3hM z{u1L`5^kB3hZkavZ+k%`Tvv^%hE^^vt^SnWP?Hd$IG`=I#84m>BRr9 zy3pZIpu4| zQI#RBXDfofCJq(nKNjhUODGqCEFAK2;+xGr>^->T`R#R@lavYLr&sWI5qwF6nxRA4 zz#T|jhPv~g&-IX!Pg8?R3NA1AmAS%yh7OaUkGIp)s|50HiJ7k(iP6g|3=JE8d-}xI zg-0m~PiN21$GV*!11MC(x1t|K;C?Ae9OrR$roo#5g}4X19WHPExPi#O;q##os^K%Z z5Mywa%aWJ_@A?nECLb|NW0Pun?h5`5pC5-%EenGTxmylA>cV^vi;}cdF;6*^s*r-4 z|8&~q6Z~6NPh3LH^#f8eh~-&VT+MxQM1Cs#b=a$?i=98@&R@WPuAd7kRD=jP0>R@J z935F=K()HJ|KM{P<&6Q6%2C7lM~J*=p&}u+g?+YR&HQ)z?msVm+wk$eL*EY zJRIWz{)|!Rag%tWb*XNq>A6?p3pu` zUiW~1z{;P6_kB*}G3y@R=j2GlIv&^a`<#4${NCr}eRom-fhzKH8{c;)G2)Y+xKw%G zL$U+LVf4oH60HY^>egO;)bHEChN_iF1|%6 zRXSlUb8*=~to=4zpuR~&WO3}OQJQ;ejk#%J-bnqKBdyQxBw|VA0*NK_-)@1kf%pA3 zkbe3_I{I2<)xznjylJ})f~%ZKm>S$tZ9}F7+N%4G(#Ab&xDj9ZUU%-R$hJ{q2GCOB zSdt$NybDRc+mS>Gf;iumbw(aWWxXB`x+a=8c%yp>c(e-&125A;;mFgpP&o367Ze7z zB|tmK%%@(VFz}2BoGR%3R|t3I^dhnh{=}r_M|J)Nd$SI7JkKxRtoe8{e25Q@{mmT+ z7lc<{iQBPCxoLa2^AnRvWnXF#__;AqI9jjcx~Eq`pHBBm5YF-bt1P<_yT6{+3)I!V z5D*bli(uX;!~6NZH45RLI@#v5g^%`6UcKl<>4sNZ+fY!K47{5=+=FmAn{B97=H_eW zpRU(l^>TXM*_VibvyyNu*E60FPJGXTQB_|gFP?W?m9})nH>(ab>E|JE3ftRTjLqKN z&vin$iMy`6-2DwIzw||^eti9cC%5Vl3FRZec*CeT_)Uk%r@VUv307 zgf!~S_=8(=;;uE0TV3(Ks18m2W+1ea^?)KA&GCXFg!`PoQgZ8s6^R+eSr0v5y_;xQjX6EI$hz7^SImPijj|bt_ zx|$ZOz9aW*K-(diu^X*M{y~8m{oq6%hs!9dDM~HF_3jftHw?WdYi8aO|D_QT6*&`* zXVgl1yv%G{>qq=2+4hO{DEr3ti?eUNe|*0QNnSh}PG$DPSntX~xZMvb&ReP#zno7t zA#~}=Jc(*XaF>R_N$fZq*28ZQPG)iAlxHeq=Pw^W|Lu28s#i4%X&nsjMJ{;Zd7cfz zy>{3!;oa%cX`8o(E#G-CuQL4|A|rel97T8dj2shTqfEm$Hrs0Knm$_Hyff&)dnDOG zQ#giMjhUGp>9wRe!%i;pFg{96NB5rd3p8b%B&Z0*A;WamH%4g4`rwj+0@pdgN$lmx z);~ZvlKrX?U%yCtep7UwV!mE>-=zzjSf_w?Bqrf!^6ZEf z1o=}I+CgDH4F+w;)A!9$;dthp0f+Sb(btO~o-#8%Zd&0V9wVpHh;lTHfcK&P7Zamz z6L##ULAcvY#jxy)#Nyv)S`oS6?c@{`12#uu!jiQl@($Okja&c4(lRRe;@s1p5!kLo z5Pk52{LWoMAWg&7mmkpidiI;@{9^?XKs-PdNMMIOd&ApB%>sEYUwU(o))@d zvb}jj{1?j0+I9rpX$1Nt1_tXYAPBeVN9j80w?DUw zH2odoaX7%J2-?PcqbH8{`5XwhE_&JQeb1y_7v%bFvt1aOeE1teUNH(zVw4j4mIFt@ zKE9ltVEjsUx>(bkA$U!{1)<*&$melzGOLhyQ6x3@yoQ6cS%X_NoboFahd%v*puQ)= zpj9Eo%8OV7sqF}GHu@kfyPo*2t87KZPXuu*fUSr!m^gkr_#s@#4_URe*b}2i&8yb5 z)IV*R*nzNYnFKOOm&seY6MwkiA6H#H*3^GeSbgn*ZH*|TSq)BOKsW|}>yQVp8TBG_ zx^%)z@v()Ujk&szly?W2SrrA(5p8XXAP+j@FjsW2f zj{9TS8aUL%Nc);;>#2F=Cx0VqJskiapcgV<;M`vW;>u30H$O^Tc5?VKx0ZJ(uw@XO z(OuMhu@|131+E!2?ztvR*)AqGN3EFipyyGS#5&-1$9S z2<-C|U;(Ggd+0V*wfac5?`4UH#@lCU2iMT*m2 zX%!&}*Q#d776yM%DvPa6xQ@y>C(Ed?z{GrjBNVn@*>m)oT6vnzn67e&1~qgHr_JHmY9wL2XQ&lQ4au zLWsxa)|1;2T=pzDttW}&m81hISMAjbULH7Vp(n*Eeg}g5dIx4J;e*_=d9RLua09*f zFB%rRC}wr&Oo>qvCflk}qR^Re7B?CxX6AY$dyn$y%H7*@4k*^>J9T`!w<&T|!cIh$ zU(?|XEC$XfWpzMIN=w4CCF?xm2SnTsq1K|#d|&=tTA~U68Qy16wZUwI1tP{ zvvtZ^C*7J)94a&4;hi(2y2Q+FPV>{M$vJlj8lqsa^^MpKi5Y9EtDR{x(f&aLRaB?Qc*N+ihBmfY%c9 z5m+($&{LYZzlLvKbD~CABsg}ed!PH7a->Ofj{lW1CxeoN5Pg8i~EnR zK|wpmvNa$^$jchbvsv=>a*Db0#7n2WwCYvuK7KAw-i^qNmIG!hy*3Vt?fB2MQ~QBM zvuAr8__XBAGDUl-_zbwwxP8KOm;!AlGcOFIk2Syo2KP-~0CmJL-|2m%tA3lNVY_zg zrE*lp<^im+1}5x_U48kVRXcI@4)bS^wf2dR-Giw1b37c6nOtoIAu!Q8@@>wJmlZyh zf$fE8@`qqt46KKV*#FG#>82(6Bco2<@YnMyk?BAY_eO$@l2x?Uq{bZ1SvxRp$D2&s z`A`HIy$xzFTIzs}1y-gRnC^Vtq7Yc9! z3IPk^oZjz;am?KG^Yh-ONVh*cXf}Ff#$H6&Wd%49P0w=&4Hzou8`;dIZCbwc{R!_S zw{zdTKoK1p@LoEC>joIm4BvO=*@u7FJt!*IF*ESy`J_Zd#77N=N?ezvKsekQ`SHsn z8_R?0{Zs0qQioNb=^Hda(b{`mja8rX39k9!qT6DDQvsiDosEV&yP(|3hotsQ{1ht= zMbhZEaqed}a&%pUGjdw{GH>niZB!Gh`KgF$K23mt1 z2C0zO$-OyKiy~TO-~>>H80l#v<%W*AbLsj*;RdjRlEziCC5s}wM z10(%@{lPlNlRUz*>swRj$3rjSJs2uqjGMT3%!r~#Yfnp))?BZBa}UMu9|G{-aD?T_ zz6vdkfA)@hb-E!E+D>B}erEXr<^~mxpk}mDO4X;XO(eGprQy+g=Q`9TBRZ8O!HmX* z3G(*St=+b!uC1aiqfMuBXk>f}0!kT=dIL;^p5%!o+K-mV+<6(`tXiL){T4+O(Acb< zNbf`$a5gVGxc2z;6N%X>k&je1$-HmdcQO@~wg}Gb7R5g{EsyTnGE8%htG&wnM7vA% zGa68E^dxv66U-Z#rmq@UnE0;$-GPVoOM(iPl%*d)1b$b8)0r5)ajC+v-F^kC+8V3< zI`X>a9oY8>g}##qMP&Bw&)GkV3a#(_DJ$N6BOwBgXR>h=h(pTfrE|s4E!2@$YZzOp z+b=8)5&nA=U|5iq_f{=-<=wY;#a6``f4Blgpl4B8Zjk$ED}+;0F&~ii#8myvrOSuC zP9FBWg0dBkgXzAO7hv<+!DRL&qrqh(f4r@8E4uX&1^nrcx!`j z{M-q7yVBDUZBLDWck`y*c6~fvrbc;^jBM<;JEau$hiKYs{Xot_LbD(K{Pn8;g33ly zKmE+De5YO|+GJ%Q z3Ow_Nw}TNNBaOS7l;zQ_Q6vMy|H^)^ylV3sO>>O`?*?f&j)Out<8yby@r!Fb%ZXlw zou|lKvojIC5^*#w$H`3ySA$!>!9^*tcFrKPW~YT~PrX6YzM29jVjs{1^U_)UTGAI! ze`cv9v+|P%IWFrU!rnX;j-}TDwpu@S<%A7inl7JSHD&`%+@`+fHJbGIR5+%4c*MwF zN5qs==bx&}-af8+{Ym26yF-Ui6Rd*cyHm1`CqlSuR(zqmCiCTkGKzZavu!Qh}LTwQ?nsWv6NH-+XiU zKKoJUV-$9k#0#UJC}LEpYGr($>Dlltccjj%zSvtiIz1ba78w9%a7&}ZSO<|H-28D~ zDO)neUkvQrbo{M-*|4uDHZK59WMa_+HEdPgdc%pj=DBrlN`&V}qlTF}UOSFR3kzmd zFy13L5H4-Sq~+V3?|9rTSwM=O0M&M&sOxfQ*1AulaGkUP6|2Un%4@dt)_zxP;W;z= zUAcS$5%$3z%w5wri!i!-woOLBjC#d>rOB@9XLKHu+Xq;${)U2XDuL2Q&rD#SRe^9@ zN?dL1o*88Nj>?>I^U3FN$8!*2r$@sF7T(ksxqHL8W3)CbLFV6q37OzH%@pd)8=J)_#`6ik`fGhR^%NMMt8$z_-7&UAx9)@ zr&hTt_&i_wV0RUYI5Gx7U>$b=?(xcvgX+%bX z1{`O?b3y>ZwYIK4rMV;PEHsq>RfJB=eTb%hq6F^)p)_k5gTuOQ=Yp~Z*Pd%_)jt^h z@r$DrJH(N?nEb={;eFmAEfX0$y_E98#Y*qaHl?^Q5v^z=l&^qXU`%!?Hvs# zvxB%r9jjjwX8LRAO_LpZA3E>(hrCBo4f5~-fMOIlb3TT{1Y1hKcZr`WCzs}irx3S< zZqCR>#MO?5lUP754JXU$t$#ZD?x|+lMh$b_qvxwp2&l}6rJ1n|7v|V~)2uzlOYRuF zY&5jn`1N~q9wO%WBsiUgVa{G~K@DjOF0Z+MBDHILVfE;}q1o3_Xw(=ugAK}@zTm9}G<$blzNk7oS++<>O2Z~J?1Mf$oJwCPK<{V2}y&?v14o&h*ke`>>-Oc9iVP;iruzX+1@;tqO1~z_Rc8 zgm7`S-;R%|)_nhcyyS8>y9-$f=Mgbw6W}7~02W(X zK2GM@_McBt%&Dejo(mz~zhuqKBhdC-`5)&>$K80d{~{vg&UAP$2$gvE4MMn% zOe3c?R(PXJTT@D%oeSFX+({I82pe=_dbw^x}`|Z8x)b+#lmk}d8ascvn&fYg5lQ7E1$uIP0 zP=Z1@982G4z=p0fQMlU`GiRV~NdVRU*O<_Qg$VkdEF6m@;utucHxC?9e9u$D##(Q( z?EEJt)o9Z1Fc386(ZV)mFQdsPyj~20UynqlEh8qlkH!1XjlEO6RMrmv#|V51A9bcm za{t1Xep1!baqeTLf=^9wS?n0kVehe9|(Oza)2m`L@pBT#0X?naUC{1m#5iKMln?UjP6A literal 0 HcmV?d00001 diff --git a/.gradle/8.14.3/executionHistory/executionHistory.lock b/.gradle/8.14.3/executionHistory/executionHistory.lock new file mode 100644 index 0000000000000000000000000000000000000000..7d371c6537d1a564fb7bc836be40b49f73c4d5e4 GIT binary patch literal 17 TcmZR++8Ah+ATGI>0Rq?oD7*t7 literal 0 HcmV?d00001 diff --git a/.gradle/8.14.3/fileChanges/last-build.bin b/.gradle/8.14.3/fileChanges/last-build.bin new file mode 100644 index 0000000000000000000000000000000000000000..f76dd238ade08917e6712764a16a22005a50573d GIT binary patch literal 1 IcmZPo000310RR91 literal 0 HcmV?d00001 diff --git a/.gradle/8.14.3/fileHashes/fileHashes.bin b/.gradle/8.14.3/fileHashes/fileHashes.bin new file mode 100644 index 0000000000000000000000000000000000000000..3257e7cbd92a4f7932ed91a4a3cb259d0e69ee31 GIT binary patch literal 35447 zcmeI4i9c4&8~<;zJlU1C6hcvotRW&v_G}?r$dWx<_Fa~giXxFx(I#X|iYTPbk}M@E zm6T*{SHC&;%sJoR@7(@^-^;vS&v^QDz0Wn*H8a=Dx!upRjY1LN`iC0je~tHl|GMyR z3mI6*z(NKVGO&<=g$yiYU?Bqw8Cb}`LIxHxu#ka;3@l_|Ap;8;SjfOa1{N}~kb#8^ z{Qr^xOArVP3`Rhj9{U&00~CrZ8-+q=9(y64vGz+y3H)oDE%@&bV&AbQTP0v;4Wj7zO9}nRl;>^=`yZ%#suOzgfAVHrD{Y{jGJ@+#ei6RLQd?r7zAqTp z56T9dkG!UN9_pdxguYFKBYAkE1k`sD<2>k+ELcC#vLEUJ?1X)Bh5OeQ!IMxw*of=N zi7ne6^;_yg-L(PNQ=Ie1b9vQUpuUHf&~K}JfAwGh#T#u)=nYqTcb?f(4(-i1;(DrC zU*^ldL3g2UtwZR(hj@dwiT{OqN&>DQDr;FfqI19(>PEG=p8g^C%juTI8cE2{oHZTJ}MKpKU$!AOVMe%7U~}SxPDx2vHGZKem&IvOL0B3 zUif9i$q`AY#}W2fA}m+sRQ{WSx}g+qpQRa>yn~^Y3F;Ax3EhRV`Oq_~E~xK+iR&lQ z9m?LcEX#m;bOWxRWO_6yA-GZ*>LF`zJzI2z!g#Rp0MvtLasAZxa*2vmzZs~9y(08; zH`kgphhKua9xr8tyCD{ySHo%>YmSV`}4w`29alki=l2DhwDYN z>i_aj*$P43fLJHR+s)0!tr~`)9`zl!FE;qGYWmv|RDVM5;QHkPo*;FGEgzu0tt+ly zDG8Bv4HH}g^+a6$cP*u?WSP(09jM!X#s8v&gMIJ%6z=;_-`P*-8hnD+F2|cfJ&mX{ zW!pHr_MNPM3U!AX+`i1-CbcQ$LNC<4iTzmiL#uaUm#8Xwelc!eo|DWXbL9a))V+v( zR9=)F8eMB74|RV*+`dAkeJo2pvE5$mer^Jnctr{vJQ8ztlR zRk3G(wYl&ugZBE12>n!Dvcpf^G^pzp;Cl7t(x?+rxV?ERuGi%9=w_*HIR))w#BlxQ zR?%HTv);?zobpz{J#55N zv?A;s)T3kw{hCkRhOrS;5AAJm{l3@1?v&XoBlLV?oXt6EuWXrq9)h|RalW)9XGgo~ zfBS}X1N=Fy8o8yhg>8aR*Ym;k2l_b$dRA4Zq3%kYk8Sin*6#Y#b`|P-opAd$9na>6 z#iKq@HyI-IQl{DKQagB{p2&#nkHjL}BYcXjpl(mppGQ*1i>`VmZG`&ncEaB3-$e6) z;TWjLl@NM?_`w*aGCin=bK?4AP3})s27%k5o~A?SMkX61hDK4{uuR4EcDB%&HPN|} z(BAepp$p#r(lWCjtIBnO?3 z&P1L&zwTC8t(b=HIex@?=vo^$o3exxJ;$5aFI@)9mMV@#9)N!B*5l9b%2=7S>}`e& z)Xj+TbR7?#xN|t306|r$^X#dX4Hhl%RSTNz|oY$sgX{OnDEW zz0W$_zW3cX)yI@2;LeP-Jz==s*UTw%!O|-n>e0mhdZEz!jNiB()vJBPx$wg8dRj%O zjt;apWyPN}aJt6CUP)~g)FX&_c_lVlX||8q4(bl(xcv~n=<3D77uG@Di>RMN8+n?< zwoWrZ-L{RePpD>VytjN3>H+%+{fKK@kMaR@4~!?qIdpYJKv(?-FKC~jPT1Ea`FhCP z8AILmFs{Eg)jG=^dg?jUqooM_>gwsU(Ty9Ro_Lzjd(W)RXKzRI7<>=c-;Cc#V+xu@ z_05{N*S$TZ`}zLQ@H+S$TRPl+*lcT=<7p36KX+B(`o~1O9OiQ$w?X@4q8^U&G3%D@ zunUH|Nd#{HiC;YTt~whl8s|Pjk2U}Hgws?P>fywC`}8XP*OfiS98mYM$L+uDO%Lu9 zPmM(SG@<)hth(&<_!!jn-EsY^cB1c3``u{19AgOGXzTfONp@anzn{3De2qvuQ>d$m z&KG~8etwOL$kGaAI}7b?5U;6mi*`(EJ{T(1<34K6a{BvPsAAHW9tGNE})H1P- z*4o=p->rh{l*r9R>YZmkLETpZ*XhOMt|*>9Rs{9^I)whJJM_SY-HuR?jl*>YnI_?! z4^`;i6++~b;n>{MuikVc(B9<{VSg`IGTguljo)q-*BJwK4AL$qK0?o5f$L0^ujd*K zlg~okg4lOV_dl=cK3P2u^$_BI!W^omdo(#3?Ym?mF6QL%>Eqs)P~C_;g+HGqT>tn( zzU&|HIYHTk{>r#z%H&cg)Du{7o%QaevzI;iPe46Bn9%=B2JKK1KzbZeXV_~~*A9z* zQG)h{4Y)lgv)b;0%(0tLKVVMiK0Bk!Zcm^*TOYu6t}p``9_KAt&^|1T(4X)Ny{k0a z4fW6%T;~>y3{v|h@)+t)oVdPZ<7qyMyEJ;gb{Hje<6PzOjz4FiecTYPFWsbjYAe+J5^#H-EiWb>JBNlqeWx~|Uq5fZ=!YKKUmhj6&b#;aVz17X zXnlJ65&FYVvDI&W_rvGdoX2%OiLKv)WIgnuZa~xrK3C7+4-*2zP??(GQ;tQU zdTaRw*98`R^)jl};Dq)8&k6m&UHbs9-bGM1Cf1=q4!wtPPl5o{gW3rDzQJpf=>siL zcmJRLM`f!#_2uZE;9P*)3+9*a_;0qC3)%-C!}aCTu0Q;PhK7DKXn$~;u>V?BV|sV$5YpG-`ic!=w`Zbi(Rlo-aD64$c2n6-L3Az{ zI1&2!NvC+X0aV9~-{ZRQey=sV7^YL;^Sy|3Q@AdyIb=xI73z^hJr`Xu$G> zPh1yY!M`^2%9D-I-ibH|#ls$Ky=uE|J=6oX5cXHbqRO21eTDkL3|yBOoS8Ws=A;O9 z6Jp&;d>0l-xG^FNb8B_jG>{E*l zLfzmyZZGpIWz!$ok?&BCYQ}Zh{=yr}6m`)(*140=-w4d+U93X(ej~WPF*@gjmpljB z?~dh!KBP1pl;<1`pTC#zD_8r^w9jE!6Y2+QaC^C4#eTlz{$)@%vcz@y#PaA%f)CL8 zG$YoVV&S01(Y!q5*Rl?`S1d2}PE)uZ51+G-SSO18rnmBbi@QO6M=x%#WHlhiCYIw4 zbxY#BP(Ea-FU%`C0Cjib{8eKKcb$lGPk{RV%lLCPFLMoMTkg0N>H$Q(+I)1Nz5PNt zswbwz{@q-}EHqa(cploDKEt1*ZdCSs^>4}dP!FObbg!@5r%JYTLOp_*7xm=3;`!&8 zRzdxsJ#MdItTbDiqqZ38k&6gD^5^3}B_Xj;caOt$&5rsPU-ZS#LfwV1-?~PE^D`Ue z1JvD!dD*Jsw0A|c$ZM#FUB#cHZQi{zD`3q}sCy9Wd|PC--s+)0d!Qb=9Jk+gmOmu& zlb|xxQw?xkheIOgi=?_G)DMUf`o+GWF#bphsP7WS^&M$rr61hxRzThDGofFta;_iR zKMeJlT3pxPQnT^q$$WHwFemDU{?3Ux*5`?O&_3ulZf{`ZlXiXO=4Pln4ioyZP;+sy z>H?_m%_Q{ST?yh(y-;29CDx}=4O%BMV{-X0YhB&WnmYZ|;4Y>$Idkdlt+Z=m%KgrkgH`MoW6VDkGVSl*j zH_B%+alYHklrWe(iK03j=!M(c@fO5x<$Ze`KF4u6p{u9`PwA_pc{fwWbqBrwp5;vW zm_qwqMBQ_U(+{4xrDp+kGa{c3j|@6H(l?)PSf7sN`>wl> z#H01&NSuRvY$qao*Na6!``yI&_grNRThunx4Rt-D4($2)K0rU`<{qd!Y2kjITwFv> z{G=R)x&cw=on`+_4`0gUh5Bx0+}_#Z#ut-zM|4jJ{GXn|TIOe%hwd#0l5l&M0WrhN z9$9D~nW_`|I}6YC1s~D5=Aww}d#}Wv@xFH}ANq|@BlM?yRfj*^H-UOMF@D#zbRsF2 z1kpXmpE%cC&D+gG(t8}CeV8u(95?46{yr;ibdTB@jO*@_A^VgbY`PBZZP*F@mH+LC zi__9j4|2tIj}?0U{VGc69<_&fzK53TZq4Ike$d_{g0SB$z`s^kd7E` z8<(L@OyfUKuABW_MRWX6w|S1+dx>Ss?_df@g}R?Gp)1@pm1SCjp6_ys&@(axuevy) z{Ob|<^cw4*VBpY_PBSQOo9(w*d+&)C*{+Ec>Pp6^oK&-=%@@Rv&v@1+dk0`+H52$*bzrogR z3w0l&o`fo9YyGw2L-!MBB5z@L&5PT!U*CfE2S)MdM2L6AF21B?1$8$uLcbtUq48^w z73xO+)B6Y9XC(ghK|Qq;w~uW2Ch%YQ)J3Q#Jj3-UvGsE08-6oGJ*5iQW13&u4(%x_ zf_mg5T*rS>D8lF+30f@l3mI6*z(NKVGO&<=g$yiYU?Bqw8Cb}`LIxHxu#ka;3@l{e z|IUCs_=6PqM-=;qD}2#=AtAcP0^tw^g%XuO@CiFz&NB9tFi5asKR5ipMElMGv%i;L zzuf)&qe)MWssbdEcS7RI3@wqxI?G?#7we<8DEv;_aQ{j~=s~h765r=67pqx#W!SBkzB*GL--C#~a8z8_r&gp~T{DSY_V(N6 zt0znLzdQAoQxFnz?;)}194*1*6VR6H)V#^-v(55HCE>sl8WDy}YcoyK65F?(NIhtmzx8%W5!c};!K;V>Gl?}Z?2|2$5BFx{dz#NS ziP@+BI29tAWPu3u89DENw8UsLyr*S z%@}9kQIx&tQe_Pyz^ca@{RPmGh}@}uVcCPMgHH}JT3!rt;z0zqB|u~L1RaS`{Mb!5 zcf?#K=P$=`qiI-(f5L)U*%V@j;N8dPyq_dQ(B_* zUR~EUPM50TBTqh_2{S^gT^@ZNN{7u0$w$iH!K@prOZPb4ae3(xc^*tM)d%{7mZgK1 znD#fwVa{IX?MlaPUGqA%7ZK<);HBoYgrVV~ICr&+Ht5#Kvb-fWo+&mUv+POI=m)n*8tY#!}e=OJWd#KGCOs zgNo#%cC8MxO2XUH=AYR;N

    hTJ)Qik4!7oB#DN-uMXu-u36>kQgkeXPx?60IbAFH3OsnUyMo1{2-{2~D z(Gnv!Qvc+y`Yn8^vh#KA*_+^ZY*Zg;N3qT`A468n%d=~edRABWim~VX9z+CIJwao| z>J}+i+3EVKnViRWzFT`RXspuo3mVlCDnL=3r|$kMm8(B0@y`0r%&3=~LP0C?!3YVS zOSC?2a-Uzv`&Pc3VZGYUoI`3_kdOy!7;E%c`5}$UqiLECoESA6_DVV=QQXS9(Gil+v@I+^J>k&R}Qdd zso9N#1S|GUCeo-%yuZ~K$mixUWe%R1dRx65`H+KzoGLA$pK<2Xe{AD7l&MY!<+^u*^d;L52gT?zo ziVwSi-xgAHWenqByG2W=_7#ap(9JG++rPtktU_Z8BCu;AXzU;^vX5XJA>PH?ZuMVQ zUn>0k^#GbdMXcU}#(5ufq&PNfL=Op`Tb$yt(QukSc`b@u9@~4M(KUgNMEs-QP~un| zS26pIukZ|K3@03wBAO3=@Mkh1bH`rvt*_VfzSrrK4`!|;p*Y+z51=xDwM-^%b-cYU zY2_FEW~%n_yJ5?6NXVl*oZJIiqVKxc?5|53*vD^lhRtSkgWXEqQCP&Fu}OfA6i4=f z-i_WNY*lg{BL|Y#r!PgL0_O4P;Z$2Bhnoak53s77&orvj8E zBeVp?rlG0oxZ&v=^|{r?f_it64^V}$ri868l8;jYk*yIol9MY>NS@N`2$w`Y&`RW) z=gz>n+57hu{fT;kUz_dZCS<1(Ax3pUQ3b1p>?1WjlKWWQugX(hm3$Mw-hur<-L>e9 zlEZ%2Od3^Fk1D(9HuvuxXqG%sEetWD~>+V-`2|DR=8>@m@(?8PI1V z5uG@SHzC1>Rcw+E)tygzDtl&)?^c3u!JT_#2Yo1JLV`1mmY8C`pi_C>^WRdgLSCC> zZBW^$k)v~vbq6gmoPFMQ!}nwCg@ZToQV)BE2_qOK(r z<+O#N$hSj6;Snt{_$JqAS*A0KC-b2Q&3i?tQp?9ff*bqB5-IZ4IwNh|Dym+yZ{9DF zJU8+h#UTPLK~szc9f@czt)$c+T@ja@ux(0LGQt;)3frxqNwI^DL}Zq>1iVT<*O)GP zxKS@WwE#tq?F-OYu``!MG)`>Iu0Fl?nOw5D+^CH{P6SW^3MU&a5vMnH^1S}b2m9qk z*SiX>=|nyT5aC5jJlx}RKcaC$BCN6I_AXz}yNDP?1V1gI?zKy;X14wCXiE0T4$m`h zA)yoq3GS7&M4xu}Vx8iOY4Md8YDdKF@!F2gbIv`qM0APfcA3Gkl9cAiMCX|J8R$bE z`QU1%B@VKf_3KIr_ZrpQ-RRJFP8t%*`M?si)mVifW%tdKt(QmEKA7+-j$89@^#yrE zV5=N7VQ_~a6L$_JTp1~J7MuCClUsLfktiat^#mGQ59mlfriJoXIsb91800l=`^qgWZcYwn@;DeAr*fyc3sEB&8GQ!}zl! zJskNsKm{nIR4m4%x(BME%W|I_}--d z80irKa)veLR?v}%kCPQkL)iXIjXf9g`gV$c7!hcn^UPCA#3~X#dFn3DC=oppQzh57 z9uXl_7Zj#>a`h~OF1Uu9!)_X z@-mR1dr3nRP0sChMi&`f){XLBvBiD#m&4iDDVLS&Zr~VGIq9{``M`7eYdr z0TRO4-I_G#>g5_X%jc#OF0SE-&l?}!42jKJkl^1>OUwyJFmuQh)Y2br=gUh`@k0cd zNvv_(f{x@vapc|g7H-eHvjxfhG7c+q5V3&@Q1~NhiSSp4^>+oPU3S*V7qv=wBs$k1d<7KPGh`?^GpmD2$jx;Kz0_&=o$1S}~%=Skmn`2Kv zLJf=#Yb;oWAQA4S6PqeHql^-wj9)RefP)i`iW#$~P_*(uMG$w>+->_Gg`#VXRl{vwK-6a^=^MV8eDV$w#VcGhl!UmsVv z_U6}k%oC|u+=mtP!8gxa>P?Qyr))-UuiI}WW`^$%0Cko+gW&B5Yl|B}NAj^!?}S@@ z@cDFq-SVy>_O!ETRNF9n3PsrjbR;6=)0>3NnGvrK9*?@{D!9`K5i(SO!a6`p7)9zB zp5w82CbA>jXzEkG4jR=TNUVKFONj4Jf4B79^1L_Z&eFk$Ex-!I;@ET$`M~xfX;jgJ zStgeiysq^4OLK+h1%x63dp2m><~cb-j;;EowYBK}xBbS8bxt>|MFiS|d`AIB@?n!z zBI}Ybb>p#_Uzm3kt0^Q@)=^zhR?bry;s(>+27i9)V0D%|(*H1?D;0i7aGs*|VJEp* zL5?%?+>HPO1Hb9~!^j7!KJ%>-AA{!&b&Q{Q?6X|1*IpkJL2+b3AByu-I6<%c_0r`G zwj&j8@PD>>Hx_@L{U6Rl*zwsRH>2y>})Hg#P98YP9<2I(!Ho03k zMvpG}Jk7pI68QkPCaf`l8cB|0iBgt>fa|m9zvjCY8@KuyqB!QL0EM-QmPlx^4BwY1 z9k1_rS2D#nN&^zA;C_O&cplJ^R>|mq^0~5A8;(8T_Kx@79tid~7P;yoDnQ}+LQ4pB zhJU6TYhbX-ayeJOUpWR6YMhYZnCDa*nace3UkTnI3waF^syX_l1x0~ z*_+JpinqFQh4>30uJ2$6QGH+$gT_M#I+Bm2fp5eA=(s$TFlV{vp37}E^gFcpE zRfseypRAF8k&#-<26)t}m{w$g>PhvX3kjaRw8T%3yD|9}@BDkrIxZ4>-VM(#+Jgdr zX$fnEhzow@KdOFQ{iv6F=r;!%)e`8#HHen5Ivp%E?BrhN5z2b`&Aw6a#)XYa#S9Yi zL$pNjbX?0yr;R&SdW3{-Hdhis1R51P*u~_?^PcaZ8yzlQzCxH@p}6o|I3gOL556{`5;t_$3A2d#EXOZUP z5x@1xq}V^+?G582%FDUHJWwN_rUDd^O|*pRkyY8jehxeRT*sRX8y+VPND;x8`!Ai z9#H|xx_NGW(yFa?2D;gmyy|OtO>Z6orx-@4V-aI*9v`oD#2@|5*u@sqNClf zL$pp7gFS~4CBGms-=~}odv$AU9}53oJavI{S@cd`NL0i?V!rQ8Jed>9XUUTbxXO0o z+vC$2=^GG%uM-;tx4(yZu^Q)LU?0$3|5e0Da8&oe9nzBVsQ$EYsK} zr19aqe4rO3Dp9VOd})0wI=+RkXNK|CP5a#iM%LeUA|EL7`Mxu;k50RA>wB}50gI1c zceXrag+vurr$7@s4?5DEi%EZ3s`g~x9Y>Yv_D=Am$> zLQ8s9wbn;rtLYiz-KqK*nX%|K%g105+2Nt;HA zFZVxscgLy(Ij9W)ON=Pbrven_^|ZvXr=2%VWE+Mw{B>Oas&Mu}qB0#4Om(!xuvOZM zPi6cCaS4gL4xO*;f<%=FBo;H$5+!kFfjtHWb{b`Gly(oTc@2ru8<3#Kev;yd-uupO)yk7q{Y^m-4A?2|?;~Rx5)L0Z6Q|Uj`j1yJ1f2 zZMf2Qum6~uUNIJPXUreV*+=qv~s=0u)wRTH<<2 z@tH?u(NS$2HS3hdM!{znSmfPkC2C;vLh>=N>PJVJu=rVPRfETLbOm5vV?-}{$6@WH zCF0w@|6Nqt;onw~l(#QF7OW18=s$->HAqWnEceQbKPPl6bS~!V2g~*)ka!*p3AIXE zB5t&c?=N@N=kME23~^3*nV?ZgK!OiD6-aSRF+_iOfBl-k@#vnp)m-7nA@NKU67)>8 zgmAU8@P7=(k=oC;s?=WIgl?8ET_7>vcP0v~MR%n*KlFIixW(_t3JQo6i~KpNyYu~~ zntllzlk3Ab2S+%#P94e>1Cdg5B?o=5o}?XBy5C6Quc5Q6nj>Pfzi-q%f#N{*N*TKe zkRsQd)``9}6|sI3gM)ptcM}67Ugkg_Y|ChgRh`{+ZiR7HjN-vtIu2hkhD28`B$Tn$ zLh`Zbzec;YMU>PEksnoU%bUS2#o~B{JsY&84?#yF#JD{7R*%LTOfEKjw%b$+><5hK z0yi40ZMg$F67jP@%8OaiT=JRy9KG4^VQ>S(h;D5vK$$Oc`+$uRA6RqCo$T6Xn+*I< zL*khSB8q8!#Hcj{x1HX*v0VAN|MX&0TS)YPeS$TA zf^lP!5AZ^Qqn(zx{6x3-_%{8AT0rNdMoO}?p2`8_nirs4CSngGm|by88x9lU@9fcrF5cs3p@9wT-toTk9N7(Hvd( zzV7^eE=at@ZWo~OU^|NxxoOn3*Q2Vh-K1S#UP@o0Yma=~qXHCluK!D!DmfNY`fd6nXsX;kM91;FEUs2hau66?mk3F&LZW9gW>2B49RnSSXywq{A4?y&vDCnA=N(h@1< z7k#75In_n8?g)7Yh@(5)vvSM>@ByAc_VMeWSibX58RHMndxj?%zI}o|y2PmfW&J#( zS|y+s+0Xx|bTlYh&OqhTO-S^kH?R3}m9(n!f@!rk-{k(cD)|qDuR)>@ta_|*V(W_( zc?+v|LTQ0j-hj|wWuY!f^se@zk_u3`bZ80lOTC{JKmUFztdtvgak5$t`gk!32~O-M z$%miR7yrrr4d-iYIMen?=!5!%W%pGgB$i-1i$qLSg%z_6R*jFVpFi?-M#%!jkpc-W zRa#BMOI(u*vtKO)irb8(tINAhv7Rv}+bB#SSxXKjIH6F;g~x4?&0Xh<)ZkBlYr&f~NTFJyK zxArxFvk4<=Hc|l!J4TX-(~1n07YAjRN6wg-q=(-E*~EyO*xm!p;4tV&L^c2YhG(UE zx>t2OLy|ItH$b9#gbGkt=Go`UXA;G{eNqhD*qiP5dv=0%Gt9?hY#u;c3o0Jj$B##g zZRl9kt{orvTi>#y)e{m=(0R^^og<`CweOKkNYqkfvtr%gzhC%0*n3nT4wwh&ZZ7-9T!C8QUMAdR!vF7t<04t1$pYb9m+WT?CuYuo8=QjNHAd} ziEtRIbhw%lsI&8G%AKOrAS>iU3KAv*8N$?2Y4gK+I-)c z*jXbUH~e|s;S-NHY`Q2}gZ4T8f1agh02nFq>Z3{`X1=bw$E{Rm*SkfCBOj(z7nEh4 zw8T#Pr3HP7N(U~TYk$T0{>m{F#|}s^PS6rDe}`RmMyA$?8m=B`7=8B&`Cx&B7^ryU zQE}Oc2pKbubcDSL$$OoizXTGGu+e}f2(nEkRxn#lJRDPxzjgYLx9)Zq6vxAlRDiMs zR0=W?^m(q*GHL7>YkGx!VQ34g)Q@r?A?Qa-M5t?1KD>6TZ-qqrS4c3#&=NBiZ#w?%KE(CLN<(3psSnzN zZCsGx2%{xrd0a!YO_M*Aqz!fYbcIesA8qQ8SoDmR$bDhaAEU3%n|{4HM9r&_6A{>Y z0*&P{=t%RSU$nK_@pJNC^(pzS(@NuYka*BR1t<)0v;@ytv;XWO?o}J!7_a!G^41s< zP1hm8RYXgq-Iu!lq_p?r=+ENS9_~PsS^L zH#90ANXUX}L?-qhF;+PBf@ANNir^G;&17&N!F<$7Kmz-=0-5lWb+3GPK4=}=7dgl3 zPDyS^+y)f_YewHeN1F4MKU|!i_cUGp_@8Lvo53^SUWNI%<4y%A0{du*iCFs%wu?Ku zqQ6U7NSaEvBLaIiXrgAIBl##?!*OD0(XtCsOtMSuPv1kU$NL|rT-*e7WTnInE`oNc<_M_q$^pECrab@f0T5)47K1j7!-6A2uv zpL}1NbME8c4O^j)R_xiJam{nf7~U0N;JmV~%uDf&jK$YUu=lX}cmU=eYn))ekmCp% z;}HqCtj+7`+;q&vtMmZ!fwIdeLrc6o^KW_^OAfbEI-SYNhW|iTsXpv558xAFR?v~= z!$NPLWG>UidKH@`4?AKXp*P6;0aSpJ2&yWXh?c4Q5jc{)>BJgM@d%H&ap>dzbx81H zqa*p4>e|*iF{t%VVBnkZu6t)d?Z8IWf@(VlcIJ|Z2^F5G;YqWE0E4i;#*2|!h*%DN zaJ-@=$_LN94`S@%HLX=tpC}3h@BUODXjB|+w1n+}jJz)=Ug+=l$Xa~xK|~-Vn$b;v z#VuNb#XEQVlB3%*Y-86l@G7pY!3+0cV*vSHL>L z;&=+GDb`e#K}Q;ucd*J}irwp}&Z%=#%3a(jyHAl14k23N>~5Aj*`NM<#Bx!+F|0-( zRk(H$UioB zAfffT3f*@bu+t1Q?s?{1_4ne;_Un-bm-ZQ7Uux`zR!Kb;F=&k7&txCxm;c*39?Gqw zt#nU!ymT|FiS-+(0EJVs5(!WM=R{|5(Y7rW8Dv=s{fjX|DK^%;rh6!&)j%HgaG86kiG z0tg_000IagfB*srAb1iVsDF+YcbEU>gUqq_N;&0T?|`2P$xaPaOb<%Z&PZ%U;1U|dP@Je4yk@9 zJv-sND%m22>buelNAs&bV`@e9E$Mb6(tT2TeO5gr-J59}%q1^gR4+>J&jwHT-n(?w zGtx(M-u8iXZprEaxAb6rKEGjXcBuKY(&uIhX?@#sqvrQW4?mq{5|8^$YJOC@+%?TM zZ9U_P00IagfB*srAb armored_key.asc +gpg -o publish_key.gpg --dearmor armored_key.asc + +# Generate gradle.properties file +echo "signing.keyId=$MAVEN_SIGNATURE_KID" > gradle.properties +echo "signing.secretKeyRingFile=publish_key.gpg" >> gradle.properties +echo "signing.password=$MAVEN_SIGNATURE_PASSWORD" >> gradle.properties diff --git a/README.md b/README.md new file mode 100644 index 0000000..2fc833f --- /dev/null +++ b/README.md @@ -0,0 +1,178 @@ +# Pipedream Java Library + +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2FPipedreamHQ%2Fpipedream-sdk-java) +[![Maven Central](https://img.shields.io/maven-central/v/com.pipedream/pipedream)](https://central.sonatype.com/artifact/com.pipedream/pipedream) + +The Pipedream Java library provides convenient access to the Pipedream API from Java. + +## Installation + +### Gradle + +Add the dependency in your `build.gradle` file: + +```groovy +dependencies { + implementation 'com.pipedream:pipedream' +} +``` + +### Maven + +Add the dependency in your `pom.xml` file: + +```xml + + com.pipedream + pipedream + 0.0.190 + +``` + +## Usage + +Instantiate and use the client with the following: + +```java +package com.example.usage; + +import com.pipedream.api.PipedreamApiClient; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; + +public class Example { + public static void main(String[] args) { + PipedreamApiClient client = PipedreamApiClient + .builder() + .clientId("") + .clientSecret("") + .build(); + + client.accounts().create( + "project_id", + CreateAccountRequest + .builder() + .appSlug("app_slug") + .cfmapJson("cfmap_json") + .connectToken("connect_token") + .build() + ); + } +} +``` + +## Environments + +This SDK allows you to configure different environments for API requests. + +```java +import com.pipedream.api.PipedreamApiClient; +import com.pipedream.api.core.Environment; + +PipedreamApiClient client = PipedreamApiClient + .builder() + .environment(Environment.Prod) + .build(); +``` + +## Base Url + +You can set a custom base URL when constructing the client. + +```java +import com.pipedream.api.PipedreamApiClient; + +PipedreamApiClient client = PipedreamApiClient + .builder() + .url("https://example.com") + .build(); +``` + +## Exception Handling + +When the API returns a non-success status code (4xx or 5xx response), an API exception will be thrown. + +```java +import com.pipedream.api.core.PipedreamApiApiException; + +try { + client.accounts().create(...); +} catch (PipedreamApiApiException e) { + // Do something with the API exception... +} +``` + +## Advanced + +### Custom Client + +This SDK is built to work with any instance of `OkHttpClient`. By default, if no client is provided, the SDK will construct one. +However, you can pass your own client like so: + +```java +import com.pipedream.api.PipedreamApiClient; +import okhttp3.OkHttpClient; + +OkHttpClient customClient = ...; + +PipedreamApiClient client = PipedreamApiClient + .builder() + .httpClient(customClient) + .build(); +``` + +### Retries + +The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long +as the request is deemed retryable and the number of retry attempts has not grown larger than the configured +retry limit (default: 2). + +A request is deemed retryable when any of the following HTTP status codes is returned: + +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) + +Use the `maxRetries` client option to configure this behavior. + +```java +import com.pipedream.api.PipedreamApiClient; + +PipedreamApiClient client = PipedreamApiClient + .builder() + .maxRetries(1) + .build(); +``` + +### Timeouts + +The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level. + +```java +import com.pipedream.api.PipedreamApiClient; +import com.pipedream.api.core.RequestOptions; + +// Client level +PipedreamApiClient client = PipedreamApiClient + .builder() + .timeout(10) + .build(); + +// Request level +client.accounts().create( + ..., + RequestOptions + .builder() + .timeout(10) + .build() +); +``` + +## Contributing + +While we value open-source contributions to this SDK, this library is generated programmatically. +Additions made directly to this library would have to be moved over to our generation code, +otherwise they would be overwritten upon the next generated release. Feel free to open a PR as +a proof of concept, but know that we will not be able to merge it as-is. We suggest opening +an issue first to discuss with us! + +On the other hand, contributions to the README are always very welcome! \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..f74d5fa --- /dev/null +++ b/build.gradle @@ -0,0 +1,130 @@ +plugins { + id 'java-library' + id 'maven-publish' + id 'com.diffplug.spotless' version '6.11.0' + id 'signing' + id 'cl.franciscosolis.sonatype-central-upload' version '1.0.3' +} + +repositories { + mavenCentral() + maven { + url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' + } +} + +dependencies { + api 'com.squareup.okhttp3:okhttp:4.12.0' + api 'com.fasterxml.jackson.core:jackson-databind:2.17.2' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.17.2' + api 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.17.2' + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2' + testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.8.2' +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + +tasks.withType(Javadoc) { + failOnError false + options.addStringOption('Xdoclint:none', '-quiet') +} + +spotless { + java { + palantirJavaFormat() + } +} + + +java { + withSourcesJar() + withJavadocJar() +} + + +group = 'com.pipedream' + +version = '0.0.190' + +jar { + dependsOn(":generatePomFileForMavenPublication") + archiveBaseName = "pipedream" +} + +sourcesJar { + archiveBaseName = "pipedream" +} + +javadocJar { + archiveBaseName = "pipedream" +} + +signing { + sign(publishing.publications) +} + +test { + useJUnitPlatform() + testLogging { + showStandardStreams = true + } +} + +publishing { + publications { + maven(MavenPublication) { + groupId = 'com.pipedream' + artifactId = 'pipedream' + version = '0.0.190' + from components.java + pom { + name = 'pipedream' + description = 'The official SDK of pipedream' + url = 'https://buildwithfern.com' + licenses { + license { + name = 'The MIT License (MIT)' + url = 'https://mit-license.org/' + } + } + developers { + developer { + name = 'pipedream' + email = 'developers@pipedream.com' + } + } + scm { + connection = 'scm:git:git://github.com/PipedreamHQ/pipedream-sdk-java.git' + developerConnection = 'scm:git:git://github.com/PipedreamHQ/pipedream-sdk-java.git' + url = 'https://github.com/PipedreamHQ/pipedream-sdk-java' + } + } + } + } +} + +sonatypeCentralUpload { + username = "$System.env.MAVEN_USERNAME" + password = "$System.env.MAVEN_PASSWORD" + + archives = files( + "$buildDir/libs/pipedream-" + version + ".jar", + "$buildDir/libs/pipedream-" + version + "-sources.jar", + "$buildDir/libs/pipedream-" + version + "-javadoc.jar" + ) + + pom = file("$buildDir/publications/maven/pom-default.xml") + signingKey = "$System.env.MAVEN_SIGNATURE_SECRET_KEY" + signingKeyPassphrase = "$System.env.MAVEN_SIGNATURE_PASSWORD" +} + +signing { + def signingKeyId = "$System.env.MAVEN_SIGNATURE_SECRET_KEY" + def signingPassword = "$System.env.MAVEN_SIGNATURE_PASSWORD" + useInMemoryPgpKeys(signingKeyId, signingPassword) + sign publishing.publications.maven +} + +sonatypeCentralUpload.dependsOn build diff --git a/build/reports/problems/problems-report.html b/build/reports/problems/problems-report.html new file mode 100644 index 0000000..bea792b --- /dev/null +++ b/build/reports/problems/problems-report.html @@ -0,0 +1,663 @@ + + + + + + + + + + + + + Gradle Configuration Cache + + + +
    + +
    + Loading... +
    + + + + + + diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java new file mode 100644 index 0000000..ee61fa8 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Suppliers; +import com.pipedream.api.resources.accounts.AsyncAccountsClient; +import com.pipedream.api.resources.actions.AsyncActionsClient; +import com.pipedream.api.resources.appcategories.AsyncAppCategoriesClient; +import com.pipedream.api.resources.apps.AsyncAppsClient; +import com.pipedream.api.resources.components.AsyncComponentsClient; +import com.pipedream.api.resources.deployedtriggers.AsyncDeployedTriggersClient; +import com.pipedream.api.resources.oauthtokens.AsyncOauthTokensClient; +import com.pipedream.api.resources.projects.AsyncProjectsClient; +import com.pipedream.api.resources.proxy.AsyncProxyClient; +import com.pipedream.api.resources.tokens.AsyncTokensClient; +import com.pipedream.api.resources.triggers.AsyncTriggersClient; +import com.pipedream.api.resources.users.AsyncUsersClient; +import java.util.function.Supplier; + +public class AsyncPipedreamApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier appCategoriesClient; + + protected final Supplier appsClient; + + protected final Supplier accountsClient; + + protected final Supplier usersClient; + + protected final Supplier componentsClient; + + protected final Supplier actionsClient; + + protected final Supplier triggersClient; + + protected final Supplier deployedTriggersClient; + + protected final Supplier projectsClient; + + protected final Supplier proxyClient; + + protected final Supplier tokensClient; + + protected final Supplier oauthTokensClient; + + public AsyncPipedreamApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.appCategoriesClient = Suppliers.memoize(() -> new AsyncAppCategoriesClient(clientOptions)); + this.appsClient = Suppliers.memoize(() -> new AsyncAppsClient(clientOptions)); + this.accountsClient = Suppliers.memoize(() -> new AsyncAccountsClient(clientOptions)); + this.usersClient = Suppliers.memoize(() -> new AsyncUsersClient(clientOptions)); + this.componentsClient = Suppliers.memoize(() -> new AsyncComponentsClient(clientOptions)); + this.actionsClient = Suppliers.memoize(() -> new AsyncActionsClient(clientOptions)); + this.triggersClient = Suppliers.memoize(() -> new AsyncTriggersClient(clientOptions)); + this.deployedTriggersClient = Suppliers.memoize(() -> new AsyncDeployedTriggersClient(clientOptions)); + this.projectsClient = Suppliers.memoize(() -> new AsyncProjectsClient(clientOptions)); + this.proxyClient = Suppliers.memoize(() -> new AsyncProxyClient(clientOptions)); + this.tokensClient = Suppliers.memoize(() -> new AsyncTokensClient(clientOptions)); + this.oauthTokensClient = Suppliers.memoize(() -> new AsyncOauthTokensClient(clientOptions)); + } + + public AsyncAppCategoriesClient appCategories() { + return this.appCategoriesClient.get(); + } + + public AsyncAppsClient apps() { + return this.appsClient.get(); + } + + public AsyncAccountsClient accounts() { + return this.accountsClient.get(); + } + + public AsyncUsersClient users() { + return this.usersClient.get(); + } + + public AsyncComponentsClient components() { + return this.componentsClient.get(); + } + + public AsyncActionsClient actions() { + return this.actionsClient.get(); + } + + public AsyncTriggersClient triggers() { + return this.triggersClient.get(); + } + + public AsyncDeployedTriggersClient deployedTriggers() { + return this.deployedTriggersClient.get(); + } + + public AsyncProjectsClient projects() { + return this.projectsClient.get(); + } + + public AsyncProxyClient proxy() { + return this.proxyClient.get(); + } + + public AsyncTokensClient tokens() { + return this.tokensClient.get(); + } + + public AsyncOauthTokensClient oauthTokens() { + return this.oauthTokensClient.get(); + } + + public static AsyncPipedreamApiClientBuilder builder() { + return new AsyncPipedreamApiClientBuilder(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java new file mode 100644 index 0000000..0ebee7b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Environment; +import com.pipedream.api.core.OAuthTokenSupplier; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import okhttp3.OkHttpClient; + +public final class AsyncPipedreamApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); + + private String clientSecret = System.getenv("PIPEDREAM_CLIENT_SECRET"); + + private String projectEnvironment = null; + + private Environment environment = Environment.PROD; + + /** + * Sets clientId. + * Defaults to the PIPEDREAM_CLIENT_ID environment variable. + */ + public AsyncPipedreamApiClientBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets clientSecret. + * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. + */ + public AsyncPipedreamApiClientBuilder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Sets projectEnvironment + */ + public AsyncPipedreamApiClientBuilder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public AsyncPipedreamApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public AsyncPipedreamApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public AsyncPipedreamApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public AsyncPipedreamApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public AsyncPipedreamApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public AsyncPipedreamApiClientBuilder projectId(String projectId) { + clientOptionsBuilder.projectId(projectId); + return this; + } + + public AsyncPipedreamApiClient build() { + OauthTokensClient authClient = new OauthTokensClient( + ClientOptions.builder().environment(this.environment).build()); + OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); + this.clientOptionsBuilder.addHeader("Authorization", oAuthTokenSupplier); + if (projectEnvironment != null) { + this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); + } + clientOptionsBuilder.environment(this.environment); + return new AsyncPipedreamApiClient(clientOptionsBuilder.build()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClient.java new file mode 100644 index 0000000..fbe892b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Suppliers; +import com.pipedream.api.resources.accounts.AccountsClient; +import com.pipedream.api.resources.actions.ActionsClient; +import com.pipedream.api.resources.appcategories.AppCategoriesClient; +import com.pipedream.api.resources.apps.AppsClient; +import com.pipedream.api.resources.components.ComponentsClient; +import com.pipedream.api.resources.deployedtriggers.DeployedTriggersClient; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import com.pipedream.api.resources.projects.ProjectsClient; +import com.pipedream.api.resources.proxy.ProxyClient; +import com.pipedream.api.resources.tokens.TokensClient; +import com.pipedream.api.resources.triggers.TriggersClient; +import com.pipedream.api.resources.users.UsersClient; +import java.util.function.Supplier; + +public class PipedreamApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier appCategoriesClient; + + protected final Supplier appsClient; + + protected final Supplier accountsClient; + + protected final Supplier usersClient; + + protected final Supplier componentsClient; + + protected final Supplier actionsClient; + + protected final Supplier triggersClient; + + protected final Supplier deployedTriggersClient; + + protected final Supplier projectsClient; + + protected final Supplier proxyClient; + + protected final Supplier tokensClient; + + protected final Supplier oauthTokensClient; + + public PipedreamApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.appCategoriesClient = Suppliers.memoize(() -> new AppCategoriesClient(clientOptions)); + this.appsClient = Suppliers.memoize(() -> new AppsClient(clientOptions)); + this.accountsClient = Suppliers.memoize(() -> new AccountsClient(clientOptions)); + this.usersClient = Suppliers.memoize(() -> new UsersClient(clientOptions)); + this.componentsClient = Suppliers.memoize(() -> new ComponentsClient(clientOptions)); + this.actionsClient = Suppliers.memoize(() -> new ActionsClient(clientOptions)); + this.triggersClient = Suppliers.memoize(() -> new TriggersClient(clientOptions)); + this.deployedTriggersClient = Suppliers.memoize(() -> new DeployedTriggersClient(clientOptions)); + this.projectsClient = Suppliers.memoize(() -> new ProjectsClient(clientOptions)); + this.proxyClient = Suppliers.memoize(() -> new ProxyClient(clientOptions)); + this.tokensClient = Suppliers.memoize(() -> new TokensClient(clientOptions)); + this.oauthTokensClient = Suppliers.memoize(() -> new OauthTokensClient(clientOptions)); + } + + public AppCategoriesClient appCategories() { + return this.appCategoriesClient.get(); + } + + public AppsClient apps() { + return this.appsClient.get(); + } + + public AccountsClient accounts() { + return this.accountsClient.get(); + } + + public UsersClient users() { + return this.usersClient.get(); + } + + public ComponentsClient components() { + return this.componentsClient.get(); + } + + public ActionsClient actions() { + return this.actionsClient.get(); + } + + public TriggersClient triggers() { + return this.triggersClient.get(); + } + + public DeployedTriggersClient deployedTriggers() { + return this.deployedTriggersClient.get(); + } + + public ProjectsClient projects() { + return this.projectsClient.get(); + } + + public ProxyClient proxy() { + return this.proxyClient.get(); + } + + public TokensClient tokens() { + return this.tokensClient.get(); + } + + public OauthTokensClient oauthTokens() { + return this.oauthTokensClient.get(); + } + + public static PipedreamApiClientBuilder builder() { + return new PipedreamApiClientBuilder(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java new file mode 100644 index 0000000..9983f98 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Environment; +import com.pipedream.api.core.OAuthTokenSupplier; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import okhttp3.OkHttpClient; + +public final class PipedreamApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); + + private String clientSecret = System.getenv("PIPEDREAM_CLIENT_SECRET"); + + private String projectEnvironment = null; + + private Environment environment = Environment.PROD; + + /** + * Sets clientId. + * Defaults to the PIPEDREAM_CLIENT_ID environment variable. + */ + public PipedreamApiClientBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets clientSecret. + * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. + */ + public PipedreamApiClientBuilder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Sets projectEnvironment + */ + public PipedreamApiClientBuilder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public PipedreamApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public PipedreamApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public PipedreamApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public PipedreamApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public PipedreamApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public PipedreamApiClientBuilder projectId(String projectId) { + clientOptionsBuilder.projectId(projectId); + return this; + } + + public PipedreamApiClient build() { + OauthTokensClient authClient = new OauthTokensClient( + ClientOptions.builder().environment(this.environment).build()); + OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); + this.clientOptionsBuilder.addHeader("Authorization", oAuthTokenSupplier); + if (projectEnvironment != null) { + this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); + } + clientOptionsBuilder.environment(this.environment); + return new PipedreamApiClient(clientOptionsBuilder.build()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java new file mode 100644 index 0000000..71e9632 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -0,0 +1,186 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import okhttp3.OkHttpClient; + +public final class ClientOptions { + private final Environment environment; + + private final Map headers; + + private final Map> headerSuppliers; + + private final OkHttpClient httpClient; + + private final int timeout; + + private String projectId; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient, + int timeout, + String projectId) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("X-Fern-Language", "JAVA"); + put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); + put("X-Fern-SDK-Version", "0.0.190"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + this.timeout = timeout; + this.projectId = projectId; + } + + public Environment environment() { + return this.environment; + } + + public Map headers(RequestOptions requestOptions) { + Map values = new HashMap<>(this.headers); + headerSuppliers.forEach((key, supplier) -> { + values.put(key, supplier.get()); + }); + if (requestOptions != null) { + values.putAll(requestOptions.getHeaders()); + } + return values; + } + + public int timeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.timeout; + } + return requestOptions.getTimeout().orElse(this.timeout); + } + + public OkHttpClient httpClient() { + return this.httpClient; + } + + public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.httpClient; + } + return this.httpClient + .newBuilder() + .callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit()) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .build(); + } + + public String projectId() { + return this.projectId; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private int maxRetries = 2; + + private Optional timeout = Optional.empty(); + + private OkHttpClient httpClient = null; + + private String projectId; + + public Builder environment(Environment environment) { + this.environment = environment; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(Optional timeout) { + this.timeout = timeout; + return this; + } + + /** + * Override the maximum number of retries. Defaults to 2 retries. + */ + public Builder maxRetries(int maxRetries) { + this.maxRetries = maxRetries; + return this; + } + + public Builder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + public ClientOptions build() { + OkHttpClient.Builder httpClientBuilder = + this.httpClient != null ? this.httpClient.newBuilder() : new OkHttpClient.Builder(); + + if (this.httpClient != null) { + timeout.ifPresent(timeout -> httpClientBuilder + .callTimeout(timeout, TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS)); + } else { + httpClientBuilder + .callTimeout(this.timeout.orElse(60), TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .addInterceptor(new RetryInterceptor(this.maxRetries)); + } + + this.httpClient = httpClientBuilder.build(); + this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); + + return new ClientOptions( + environment, headers, headerSuppliers, httpClient, this.timeout.get(), this.projectId); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java new file mode 100644 index 0000000..e9083a3 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; + +/** + * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + */ +class DateTimeDeserializer extends JsonDeserializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); + } + + /** + * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + JsonToken token = parser.currentToken(); + if (token == JsonToken.VALUE_NUMBER_INT) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); + } else { + TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + + if (temporal.query(TemporalQueries.offset()) == null) { + return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); + } else { + return OffsetDateTime.from(temporal); + } + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Environment.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Environment.java new file mode 100644 index 0000000..def399b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Environment.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +public final class Environment { + public static final Environment CANARY = new Environment("https://api2.pipedream.com"); + + public static final Environment DEV = new Environment("https://api.${DEV_NAMESPACE}.gkes.pipedream.net"); + + public static final Environment PROD = new Environment("https://api.pipedream.com"); + + private final String url; + + private Environment(String url) { + this.url = url; + } + + public String getUrl() { + return this.url; + } + + public static Environment custom(String url) { + return new Environment(url); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/FileStream.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/FileStream.java new file mode 100644 index 0000000..d5500e2 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a file stream with associated metadata for file uploads. + */ +public class FileStream { + private final InputStream inputStream; + private final String fileName; + private final MediaType contentType; + + /** + * Constructs a FileStream with the given input stream and optional metadata. + * + * @param inputStream The input stream of the file content. Must not be null. + * @param fileName The name of the file, or null if unknown. + * @param contentType The MIME type of the file content, or null if unknown. + * @throws NullPointerException if inputStream is null + */ + public FileStream(InputStream inputStream, @Nullable String fileName, @Nullable MediaType contentType) { + this.inputStream = Objects.requireNonNull(inputStream, "Input stream cannot be null"); + this.fileName = fileName; + this.contentType = contentType; + } + + public FileStream(InputStream inputStream) { + this(inputStream, null, null); + } + + public InputStream getInputStream() { + return inputStream; + } + + @Nullable + public String getFileName() { + return fileName; + } + + @Nullable + public MediaType getContentType() { + return contentType; + } + + /** + * Creates a RequestBody suitable for use with OkHttp client. + * + * @return A RequestBody instance representing this file stream. + */ + public RequestBody toRequestBody() { + return new InputStreamRequestBody(contentType, inputStream); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java new file mode 100644 index 0000000..a91bea5 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.internal.Util; +import okio.BufferedSink; +import okio.Okio; +import okio.Source; +import org.jetbrains.annotations.Nullable; + +/** + * A custom implementation of OkHttp's RequestBody that wraps an InputStream. + * This class allows streaming of data from an InputStream directly to an HTTP request body, + * which is useful for file uploads or sending large amounts of data without loading it all into memory. + */ +public class InputStreamRequestBody extends RequestBody { + private final InputStream inputStream; + private final MediaType contentType; + + /** + * Constructs an InputStreamRequestBody with the specified content type and input stream. + * + * @param contentType the MediaType of the content, or null if not known + * @param inputStream the InputStream containing the data to be sent + * @throws NullPointerException if inputStream is null + */ + public InputStreamRequestBody(@Nullable MediaType contentType, InputStream inputStream) { + this.contentType = contentType; + this.inputStream = Objects.requireNonNull(inputStream, "inputStream == null"); + } + + /** + * Returns the content type of this request body. + * + * @return the MediaType of the content, or null if not specified + */ + @Nullable + @Override + public MediaType contentType() { + return contentType; + } + + /** + * Returns the content length of this request body, if known. + * This method attempts to determine the length using the InputStream's available() method, + * which may not always accurately reflect the total length of the stream. + * + * @return the content length, or -1 if the length is unknown + * @throws IOException if an I/O error occurs + */ + @Override + public long contentLength() throws IOException { + return inputStream.available() == 0 ? -1 : inputStream.available(); + } + + /** + * Writes the content of the InputStream to the given BufferedSink. + * This method is responsible for transferring the data from the InputStream to the network request. + * + * @param sink the BufferedSink to write the content to + * @throws IOException if an I/O error occurs during writing + */ + @Override + public void writeTo(BufferedSink sink) throws IOException { + Source source = null; + try { + source = Okio.source(inputStream); + sink.writeAll(source); + } finally { + Util.closeQuietly(Objects.requireNonNull(source)); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/MediaTypes.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/MediaTypes.java new file mode 100644 index 0000000..6b6288f --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import okhttp3.MediaType; + +public final class MediaTypes { + + public static final MediaType APPLICATION_JSON = MediaType.parse("application/json"); + + private MediaTypes() {} +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Nullable.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Nullable.java new file mode 100644 index 0000000..2b6af74 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Nullable.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Optional; +import java.util.function.Function; + +public final class Nullable { + + private final Either, Null> value; + + private Nullable() { + this.value = Either.left(Optional.empty()); + } + + private Nullable(T value) { + if (value == null) { + this.value = Either.right(Null.INSTANCE); + } else { + this.value = Either.left(Optional.of(value)); + } + } + + public static Nullable ofNull() { + return new Nullable<>(null); + } + + public static Nullable of(T value) { + return new Nullable<>(value); + } + + public static Nullable empty() { + return new Nullable<>(); + } + + public static Nullable ofOptional(Optional value) { + if (value.isPresent()) { + return of(value.get()); + } else { + return empty(); + } + } + + public boolean isNull() { + return this.value.isRight(); + } + + public boolean isEmpty() { + return this.value.isLeft() && !this.value.getLeft().isPresent(); + } + + public T get() { + if (this.isNull()) { + return null; + } + + return this.value.getLeft().get(); + } + + public Nullable map(Function mapper) { + if (this.isNull()) { + return Nullable.ofNull(); + } + + return Nullable.ofOptional(this.value.getLeft().map(mapper)); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof Nullable)) { + return false; + } + + if (((Nullable) other).isNull() && this.isNull()) { + return true; + } + + return this.value.getLeft().equals(((Nullable) other).value.getLeft()); + } + + private static final class Either { + private L left = null; + private R right = null; + + private Either(L left, R right) { + if (left != null && right != null) { + throw new IllegalArgumentException("Left and right argument cannot both be non-null."); + } + + if (left == null && right == null) { + throw new IllegalArgumentException("Left and right argument cannot both be null."); + } + + if (left != null) { + this.left = left; + } + + if (right != null) { + this.right = right; + } + } + + public static Either left(L left) { + return new Either<>(left, null); + } + + public static Either right(R right) { + return new Either<>(null, right); + } + + public boolean isLeft() { + return this.left != null; + } + + public boolean isRight() { + return this.right != null; + } + + public L getLeft() { + if (!this.isLeft()) { + throw new IllegalArgumentException("Cannot get left from right Either."); + } + return this.left; + } + + public R getRight() { + if (!this.isRight()) { + throw new IllegalArgumentException("Cannot get right from left Either."); + } + return this.right; + } + } + + private static final class Null { + private static final Null INSTANCE = new Null(); + + private Null() {} + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java new file mode 100644 index 0000000..afad6eb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Optional; + +public final class NullableNonemptyFilter { + @Override + public boolean equals(Object o) { + boolean isOptionalEmpty = isOptionalEmpty(o); + + return isOptionalEmpty; + } + + private boolean isOptionalEmpty(Object o) { + return o instanceof Optional && !((Optional) o).isPresent(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java new file mode 100644 index 0000000..ddbde79 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.function.Supplier; + +public final class OAuthTokenSupplier implements Supplier { + private static final long BUFFER_IN_MINUTES = 2; + + private final String clientId; + + private final String clientSecret; + + private final OauthTokensClient authClient; + + private String accessToken; + + private Instant expiresAt; + + public OAuthTokenSupplier(String clientId, String clientSecret, OauthTokensClient authClient) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.authClient = authClient; + this.expiresAt = Instant.now(); + } + + public CreateOAuthTokenResponse fetchToken() { + CreateOAuthTokenOpts getTokenRequest = CreateOAuthTokenOpts.builder() + .clientId(clientId) + .clientSecret(clientSecret) + .build(); + return authClient.create(getTokenRequest); + } + + @java.lang.Override + public String get() { + if (accessToken == null || expiresAt.isBefore(Instant.now())) { + CreateOAuthTokenResponse authResponse = fetchToken(); + this.accessToken = authResponse.getAccessToken(); + this.expiresAt = getExpiresAt(authResponse.getExpiresIn()); + } + return "Bearer " + accessToken; + } + + private Instant getExpiresAt(long expiresInSeconds) { + return Instant.now().plus(expiresInSeconds, ChronoUnit.SECONDS).minus(BUFFER_IN_MINUTES, ChronoUnit.MINUTES); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ObjectMappers.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ObjectMappers.java new file mode 100644 index 0000000..6dd6c3c --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ObjectMappers.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .addModule(DateTimeDeserializer.getModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .build(); + + private ObjectMappers() {} + + public static String stringify(Object o) { + try { + return JSON_MAPPER + .setSerializationInclusion(JsonInclude.Include.ALWAYS) + .writerWithDefaultPrettyPrinter() + .writeValueAsString(o); + } catch (IOException e) { + return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java new file mode 100644 index 0000000..d4d2e56 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class PipedreamApiApiException extends PipedreamApiException { + /** + * The error code of the response that triggered the exception. + */ + private final int statusCode; + + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + private final Map> headers; + + public PipedreamApiApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + } + + public PipedreamApiApiException(String message, int statusCode, Object body, Response rawResponse) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + this.headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + /** + * @return the headers + */ + public Map> headers() { + return this.headers; + } + + @java.lang.Override + public String toString() { + return "PipedreamApiApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + + body + "}"; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiException.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiException.java new file mode 100644 index 0000000..866b47e --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class PipedreamApiException extends RuntimeException { + public PipedreamApiException(String message) { + super(message); + } + + public PipedreamApiException(String message, Exception e) { + super(message, e); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java new file mode 100644 index 0000000..59f2804 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +public final class PipedreamApiHttpResponse { + + private final T body; + + private final Map> headers; + + public PipedreamApiHttpResponse(T body, Response rawResponse) { + this.body = body; + + Map> headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + this.headers = headers; + } + + public T body() { + return this.body; + } + + public Map> headers() { + return headers; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/QueryStringMapper.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/QueryStringMapper.java new file mode 100644 index 0000000..70723d0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/QueryStringMapper.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import okhttp3.MultipartBody; + +public class QueryStringMapper { + + private static final ObjectMapper MAPPER = ObjectMappers.JSON_MAPPER; + + public static void addQueryParameter(HttpUrl.Builder httpUrl, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + httpUrl.addQueryParameter(key, valueNode.textValue()); + } else { + httpUrl.addQueryParameter(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().textValue()); + } else { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().toString()); + } + } + } + + public static void addFormDataPart( + MultipartBody.Builder multipartBody, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + multipartBody.addFormDataPart(key, valueNode.textValue()); + } else { + multipartBody.addFormDataPart(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().textValue()); + } else { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().toString()); + } + } + } + + public static List> flattenObject(ObjectNode object, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator> fields = object.fields(); + while (fields.hasNext()) { + Map.Entry field = fields.next(); + + String key = "[" + field.getKey() + "]"; + + if (field.getValue().isObject()) { + List> flatField = + flattenObject((ObjectNode) field.getValue(), arraysAsRepeats); + addAll(flat, flatField, key); + } else if (field.getValue().isArray()) { + List> flatField = + flattenArray((ArrayNode) field.getValue(), key, arraysAsRepeats); + addAll(flat, flatField, ""); + } else { + flat.add(new AbstractMap.SimpleEntry<>(key, field.getValue())); + } + } + + return flat; + } + + private static List> flattenArray( + ArrayNode array, String key, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator elements = array.elements(); + + int index = 0; + while (elements.hasNext()) { + JsonNode element = elements.next(); + + String indexKey = key + "[" + index + "]"; + + if (arraysAsRepeats) { + indexKey = key; + } + + if (element.isObject()) { + List> flatField = flattenObject((ObjectNode) element, arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else if (element.isArray()) { + List> flatField = flattenArray((ArrayNode) element, "", arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else { + flat.add(new AbstractMap.SimpleEntry<>(indexKey, element)); + } + + index++; + } + + return flat; + } + + private static void addAll( + List> target, List> source, String prefix) { + for (Map.Entry entry : source) { + Map.Entry entryToAdd = + new AbstractMap.SimpleEntry<>(prefix + entry.getKey(), entry.getValue()); + target.add(entryToAdd); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RequestOptions.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RequestOptions.java new file mode 100644 index 0000000..559f48d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RequestOptions.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +public final class RequestOptions { + private final String projectEnvironment; + + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private final Map headers; + + private final Map> headerSuppliers; + + private RequestOptions( + String projectEnvironment, + Optional timeout, + TimeUnit timeoutTimeUnit, + Map headers, + Map> headerSuppliers) { + this.projectEnvironment = projectEnvironment; + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + this.headers = headers; + this.headerSuppliers = headerSuppliers; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + if (this.projectEnvironment != null) { + headers.put("x-pd-environment", this.projectEnvironment); + } + headers.putAll(this.headers); + this.headerSuppliers.forEach((key, supplier) -> { + headers.put(key, supplier.get()); + }); + return headers; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private String projectEnvironment = null; + + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + public Builder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public Builder timeout(Integer timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { + this.timeout = Optional.of(timeout); + this.timeoutTimeUnit = timeoutTimeUnit; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + public RequestOptions build() { + return new RequestOptions(projectEnvironment, timeout, timeoutTimeUnit, headers, headerSuppliers); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java new file mode 100644 index 0000000..56b0fb5 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.FilterInputStream; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the stream is closed. + * + * This class extends FilterInputStream and takes an OkHttp Response object as a parameter. + * It retrieves the InputStream from the Response and overrides the close method to close + * both the InputStream and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyInputStream extends FilterInputStream { + private final Response response; + + /** + * Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp + * Response object. + * + * @param response the OkHttp Response object from which the InputStream is retrieved + * @throws IOException if an I/O error occurs while retrieving the InputStream + */ + public ResponseBodyInputStream(Response response) throws IOException { + super(response.body().byteStream()); + this.response = response; + } + + /** + * Closes the InputStream and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the stream is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the stream is closed + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyReader.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyReader.java new file mode 100644 index 0000000..54dff9f --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.FilterReader; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom Reader that wraps the Reader from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the reader is closed. + * + * This class extends FilterReader and takes an OkHttp Response object as a parameter. + * It retrieves the Reader from the Response and overrides the close method to close + * both the Reader and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyReader extends FilterReader { + private final Response response; + + /** + * Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. + * + * @param response the OkHttp Response object from which the Reader is retrieved + * @throws IOException if an I/O error occurs while retrieving the Reader + */ + public ResponseBodyReader(Response response) throws IOException { + super(response.body().charStream()); + this.response = response; + } + + /** + * Closes the Reader and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the reader is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the reader is closed + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RetryInterceptor.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RetryInterceptor.java new file mode 100644 index 0000000..66b6be4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/RetryInterceptor.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.IOException; +import java.time.Duration; +import java.util.Optional; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Response; + +public class RetryInterceptor implements Interceptor { + + private static final Duration ONE_SECOND = Duration.ofSeconds(1); + private final ExponentialBackoff backoff; + private final Random random = new Random(); + + public RetryInterceptor(int maxRetries) { + this.backoff = new ExponentialBackoff(maxRetries); + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + + if (shouldRetry(response.code())) { + return retryChain(response, chain); + } + + return response; + } + + private Response retryChain(Response response, Chain chain) throws IOException { + Optional nextBackoff = this.backoff.nextBackoff(); + while (nextBackoff.isPresent()) { + try { + Thread.sleep(nextBackoff.get().toMillis()); + } catch (InterruptedException e) { + throw new IOException("Interrupted while trying request", e); + } + response.close(); + response = chain.proceed(chain.request()); + if (shouldRetry(response.code())) { + nextBackoff = this.backoff.nextBackoff(); + } else { + return response; + } + } + + return response; + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || statusCode == 429 || statusCode >= 500; + } + + private final class ExponentialBackoff { + + private final int maxNumRetries; + + private int retryNumber = 0; + + ExponentialBackoff(int maxNumRetries) { + this.maxNumRetries = maxNumRetries; + } + + public Optional nextBackoff() { + retryNumber += 1; + if (retryNumber > maxNumRetries) { + return Optional.empty(); + } + + int upperBound = (int) Math.pow(2, retryNumber); + return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Stream.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Stream.java new file mode 100644 index 0000000..3781dcc --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Stream.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.Closeable; +import java.io.IOException; +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implements {@link Iterable} to provide a simple mechanism for reading and parsing + * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. + *

    + * {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a + * {@code Scanner} to block during iteration if the next object is not available. + * Iterable stream for parsing JSON and Server-Sent Events (SSE) data. + * Supports both newline-delimited JSON and SSE with optional stream termination. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable, Closeable { + + private static final String NEWLINE = "\n"; + private static final String DATA_PREFIX = "data:"; + + public enum StreamType { + JSON, + SSE + } + + private final Class valueType; + private final Scanner scanner; + private final StreamType streamType; + private final String messageTerminator; + private final String streamTerminator; + private final Reader sseReader; + private boolean isClosed = false; + + /** + * Constructs a new {@code Stream} with the specified value type, reader, and delimiter. + * + * @param valueType The class of the objects in the stream. + * @param reader The reader that provides the streamed data. + * @param delimiter The delimiter used to separate elements in the stream. + */ + public Stream(Class valueType, Reader reader, String delimiter) { + this.valueType = valueType; + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.streamType = StreamType.JSON; + this.messageTerminator = delimiter; + this.streamTerminator = null; + this.sseReader = null; + } + + private Stream(Class valueType, StreamType type, Reader reader, String terminator) { + this.valueType = valueType; + this.streamType = type; + if (type == StreamType.JSON) { + this.scanner = new Scanner(reader).useDelimiter(terminator); + this.messageTerminator = terminator; + this.streamTerminator = null; + this.sseReader = null; + } else { + this.scanner = null; + this.messageTerminator = NEWLINE; + this.streamTerminator = terminator; + this.sseReader = reader; + } + } + + public static Stream fromJson(Class valueType, Reader reader, String delimiter) { + return new Stream<>(valueType, reader, delimiter); + } + + public static Stream fromJson(Class valueType, Reader reader) { + return new Stream<>(valueType, reader, NEWLINE); + } + + public static Stream fromSse(Class valueType, Reader sseReader) { + return new Stream<>(valueType, StreamType.SSE, sseReader, null); + } + + public static Stream fromSse(Class valueType, Reader sseReader, String streamTerminator) { + return new Stream<>(valueType, StreamType.SSE, sseReader, streamTerminator); + } + + @Override + public void close() throws IOException { + if (!isClosed) { + isClosed = true; + if (scanner != null) { + scanner.close(); + } + if (sseReader != null) { + sseReader.close(); + } + } + } + + private boolean isStreamClosed() { + return isClosed; + } + + /** + * Returns an iterator over the elements in this stream that blocks during iteration when the next object is + * not yet available. + * + * @return An iterator that can be used to traverse the elements in the stream. + */ + @Override + public Iterator iterator() { + if (streamType == StreamType.SSE) { + return new SSEIterator(); + } else { + return new JsonIterator(); + } + } + + private final class JsonIterator implements Iterator { + + /** + * Returns {@code true} if there are more elements in the stream. + *

    + * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return {@code true} if there are more elements, {@code false} otherwise. + */ + @Override + public boolean hasNext() { + if (isStreamClosed()) { + return false; + } + return scanner.hasNext(); + } + + /** + * Returns the next element in the stream. + *

    + * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return The next element in the stream. + * @throws NoSuchElementException If there are no more elements in the stream. + */ + @Override + public T next() { + if (isStreamClosed()) { + throw new NoSuchElementException("Stream is closed"); + } + + if (!scanner.hasNext()) { + throw new NoSuchElementException(); + } else { + try { + T parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(scanner.next().trim(), valueType); + return parsedResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + } + + private final class SSEIterator implements Iterator { + private Scanner sseScanner; + private T nextItem; + private boolean hasNextItem = false; + private boolean endOfStream = false; + private StringBuilder buffer = new StringBuilder(); + private boolean prefixSeen = false; + + private SSEIterator() { + if (sseReader != null && !isStreamClosed()) { + this.sseScanner = new Scanner(sseReader); + } else { + this.endOfStream = true; + } + } + + @Override + public boolean hasNext() { + if (isStreamClosed() || endOfStream) { + return false; + } + + if (hasNextItem) { + return true; + } + + return readNextMessage(); + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException("No more elements in stream"); + } + + T result = nextItem; + nextItem = null; + hasNextItem = false; + return result; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + private boolean readNextMessage() { + if (sseScanner == null || isStreamClosed()) { + endOfStream = true; + return false; + } + + try { + while (sseScanner.hasNextLine()) { + String chunk = sseScanner.nextLine(); + buffer.append(chunk).append(NEWLINE); + + int terminatorIndex; + while ((terminatorIndex = buffer.indexOf(messageTerminator)) >= 0) { + String line = buffer.substring(0, terminatorIndex + messageTerminator.length()); + buffer.delete(0, terminatorIndex + messageTerminator.length()); + + line = line.trim(); + if (line.isEmpty()) { + continue; + } + + if (!prefixSeen && line.startsWith(DATA_PREFIX)) { + prefixSeen = true; + line = line.substring(DATA_PREFIX.length()).trim(); + } else if (!prefixSeen) { + continue; + } + + if (streamTerminator != null && line.contains(streamTerminator)) { + endOfStream = true; + return false; + } + + try { + nextItem = ObjectMappers.JSON_MAPPER.readValue(line, valueType); + hasNextItem = true; + prefixSeen = false; + return true; + } catch (Exception parseEx) { + continue; + } + } + } + + endOfStream = true; + return false; + + } catch (Exception e) { + System.err.println("Failed to parse SSE stream: " + e.getMessage()); + endOfStream = true; + return false; + } + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Suppliers.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Suppliers.java new file mode 100644 index 0000000..b907552 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public final class Suppliers { + private Suppliers() {} + + public static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/BasePage.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/BasePage.java new file mode 100644 index 0000000..ca83fe4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/BasePage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.List; + +public abstract class BasePage { + private final boolean hasNext; + private final List items; + + public BasePage(boolean hasNext, List items) { + this.hasNext = hasNext; + this.items = items; + } + + public boolean hasNext() { + return !items.isEmpty() && hasNext; + } + + public List getItems() { + return items; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPage.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPage.java new file mode 100644 index 0000000..86fc5b7 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.List; +import java.util.NoSuchElementException; +import java.util.function.Supplier; + +public class SyncPage extends BasePage { + protected final Supplier> nextSupplier; + + public SyncPage(boolean hasNext, List items, Supplier> nextSupplier) { + super(hasNext, items); + this.nextSupplier = nextSupplier; + } + + public SyncPage nextPage() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return nextSupplier.get(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java new file mode 100644 index 0000000..fd5fca3 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.function.Supplier; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +public class SyncPagingIterable extends SyncPage implements Iterable { + + public SyncPagingIterable(boolean hasNext, List items, Supplier> getNext) { + super(hasNext, items, getNext); + } + + public SyncPagingIterable(boolean hasNext, Optional> items, Supplier> getNext) { + super(hasNext, items.orElse(new ArrayList<>()), getNext); + } + + public Stream streamItems() { + return StreamSupport.stream(this.spliterator(), false); + } + + @Override + public Iterator iterator() { + return new Iterator() { + private Iterator itemsIterator = getItems().iterator(); + private SyncPage currentPage = SyncPagingIterable.this; + + @Override + public boolean hasNext() { + if (itemsIterator.hasNext()) { + return true; + } + if (currentPage.hasNext()) { + advancePage(); + return itemsIterator.hasNext(); + } + return false; + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return itemsIterator.next(); + } + + private void advancePage() { + currentPage = currentPage.nextPage(); + itemsIterator = currentPage.getItems().iterator(); + } + }; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java new file mode 100644 index 0000000..81f9441 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; + +public class AccountsClient { + protected final ClientOptions clientOptions; + + private final RawAccountsClient rawClient; + + public AccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAccountsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(AccountsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(AccountsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Account create(CreateAccountRequest request) { + return this.rawClient.create(request).body(); + } + + public Account create(CreateAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + public Account retrieve(String accountId) { + return this.rawClient.retrieve(accountId).body(); + } + + public Account retrieve(String accountId, AccountsRetrieveRequest request) { + return this.rawClient.retrieve(accountId, request).body(); + } + + public Account retrieve(String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, request, requestOptions).body(); + } + + public void delete(String accountId) { + this.rawClient.delete(accountId).body(); + } + + public void delete(String accountId, RequestOptions requestOptions) { + this.rawClient.delete(accountId, requestOptions).body(); + } + + public void deleteByApp(String appId) { + this.rawClient.deleteByApp(appId).body(); + } + + public void deleteByApp(String appId, RequestOptions requestOptions) { + this.rawClient.deleteByApp(appId, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java new file mode 100644 index 0000000..761a206 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import java.util.concurrent.CompletableFuture; + +public class AsyncAccountsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAccountsClient rawClient; + + public AsyncAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAccountsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(AccountsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + AccountsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateAccountRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String accountId) { + return this.rawClient.retrieve(accountId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String accountId, AccountsRetrieveRequest request) { + return this.rawClient.retrieve(accountId, request).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String accountId) { + return this.rawClient.delete(accountId).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String accountId, RequestOptions requestOptions) { + return this.rawClient.delete(accountId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture deleteByApp(String appId) { + return this.rawClient.deleteByApp(appId).thenApply(response -> response.body()); + } + + public CompletableFuture deleteByApp(String appId, RequestOptions requestOptions) { + return this.rawClient.deleteByApp(appId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java new file mode 100644 index 0000000..1c4a9bb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java @@ -0,0 +1,391 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import com.pipedream.api.types.ListAccountsResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAccountsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(AccountsListRequest.builder().build()); + } + + public CompletableFuture>> list(AccountsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + AccountsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + ListAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAccountsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + AccountsListRequest nextRequest = AccountsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> create(CreateAccountRequest request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateAccountRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + Map properties = new HashMap<>(); + properties.put("app_slug", request.getAppSlug()); + properties.put("cfmap_json", request.getCfmapJson()); + properties.put("connect_token", request.getConnectToken()); + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String accountId) { + return retrieve(accountId, AccountsRetrieveRequest.builder().build()); + } + + public CompletableFuture> retrieve( + String accountId, AccountsRetrieveRequest request) { + return retrieve(accountId, request, null); + } + + public CompletableFuture> retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId); + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> delete(String accountId) { + return delete(accountId, null); + } + + public CompletableFuture> delete(String accountId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> deleteByApp(String appId) { + return deleteByApp(appId, null); + } + + public CompletableFuture> deleteByApp(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("apps") + .addPathSegment(appId) + .addPathSegments("accounts") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java new file mode 100644 index 0000000..114533c --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import com.pipedream.api.types.ListAccountsResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAccountsClient { + protected final ClientOptions clientOptions; + + public RawAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(AccountsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(AccountsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + AccountsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + ListAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAccountsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + AccountsListRequest nextRequest = AccountsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse create(CreateAccountRequest request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create(CreateAccountRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + Map properties = new HashMap<>(); + properties.put("app_slug", request.getAppSlug()); + properties.put("cfmap_json", request.getCfmapJson()); + properties.put("connect_token", request.getConnectToken()); + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String accountId) { + return retrieve(accountId, AccountsRetrieveRequest.builder().build()); + } + + public PipedreamApiHttpResponse retrieve(String accountId, AccountsRetrieveRequest request) { + return retrieve(accountId, request, null); + } + + public PipedreamApiHttpResponse retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId); + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse delete(String accountId) { + return delete(accountId, null); + } + + public PipedreamApiHttpResponse delete(String accountId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse deleteByApp(String appId) { + return deleteByApp(appId, null); + } + + public PipedreamApiHttpResponse deleteByApp(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("apps") + .addPathSegment(appId) + .addPathSegments("accounts") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java new file mode 100644 index 0000000..2d67f6d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java @@ -0,0 +1,285 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountsListRequest.Builder.class) +public final class AccountsListRequest { + private final Optional appId; + + private final Optional externalUserId; + + private final Optional oauthAppId; + + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional includeCredentials; + + private final Map additionalProperties; + + private AccountsListRequest( + Optional appId, + Optional externalUserId, + Optional oauthAppId, + Optional after, + Optional before, + Optional limit, + Optional includeCredentials, + Map additionalProperties) { + this.appId = appId; + this.externalUserId = externalUserId; + this.oauthAppId = oauthAppId; + this.after = after; + this.before = before; + this.limit = limit; + this.includeCredentials = includeCredentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app slug or ID to filter accounts by. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + @JsonProperty("external_user_id") + public Optional getExternalUserId() { + return externalUserId; + } + + /** + * @return The OAuth app ID to filter by, if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Whether to retrieve the account's credentials or not + */ + @JsonProperty("include_credentials") + public Optional getIncludeCredentials() { + return includeCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountsListRequest && equalTo((AccountsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountsListRequest other) { + return appId.equals(other.appId) + && externalUserId.equals(other.externalUserId) + && oauthAppId.equals(other.oauthAppId) + && after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && includeCredentials.equals(other.includeCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.externalUserId, + this.oauthAppId, + this.after, + this.before, + this.limit, + this.includeCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional appId = Optional.empty(); + + private Optional externalUserId = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional includeCredentials = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AccountsListRequest other) { + appId(other.getAppId()); + externalUserId(other.getExternalUserId()); + oauthAppId(other.getOauthAppId()); + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + includeCredentials(other.getIncludeCredentials()); + return this; + } + + /** + *

    The app slug or ID to filter accounts by.

    + */ + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public Builder appId(Optional appId) { + this.appId = appId; + return this; + } + + public Builder appId(String appId) { + this.appId = Optional.ofNullable(appId); + return this; + } + + @JsonSetter(value = "external_user_id", nulls = Nulls.SKIP) + public Builder externalUserId(Optional externalUserId) { + this.externalUserId = externalUserId; + return this; + } + + public Builder externalUserId(String externalUserId) { + this.externalUserId = Optional.ofNullable(externalUserId); + return this; + } + + /** + *

    The OAuth app ID to filter by, if applicable

    + */ + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public Builder oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + public Builder oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    Whether to retrieve the account's credentials or not

    + */ + @JsonSetter(value = "include_credentials", nulls = Nulls.SKIP) + public Builder includeCredentials(Optional includeCredentials) { + this.includeCredentials = includeCredentials; + return this; + } + + public Builder includeCredentials(Boolean includeCredentials) { + this.includeCredentials = Optional.ofNullable(includeCredentials); + return this; + } + + public AccountsListRequest build() { + return new AccountsListRequest( + appId, externalUserId, oauthAppId, after, before, limit, includeCredentials, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java new file mode 100644 index 0000000..3844f9d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountsRetrieveRequest.Builder.class) +public final class AccountsRetrieveRequest { + private final Optional includeCredentials; + + private final Map additionalProperties; + + private AccountsRetrieveRequest(Optional includeCredentials, Map additionalProperties) { + this.includeCredentials = includeCredentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether to retrieve the account's credentials or not + */ + @JsonProperty("include_credentials") + public Optional getIncludeCredentials() { + return includeCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountsRetrieveRequest && equalTo((AccountsRetrieveRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountsRetrieveRequest other) { + return includeCredentials.equals(other.includeCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.includeCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional includeCredentials = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AccountsRetrieveRequest other) { + includeCredentials(other.getIncludeCredentials()); + return this; + } + + /** + *

    Whether to retrieve the account's credentials or not

    + */ + @JsonSetter(value = "include_credentials", nulls = Nulls.SKIP) + public Builder includeCredentials(Optional includeCredentials) { + this.includeCredentials = includeCredentials; + return this; + } + + public Builder includeCredentials(Boolean includeCredentials) { + this.includeCredentials = Optional.ofNullable(includeCredentials); + return this; + } + + public AccountsRetrieveRequest build() { + return new AccountsRetrieveRequest(includeCredentials, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java new file mode 100644 index 0000000..aeec52a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java @@ -0,0 +1,354 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAccountRequest.Builder.class) +public final class CreateAccountRequest { + private final Optional appId; + + private final Optional externalUserId; + + private final Optional oauthAppId; + + private final String appSlug; + + private final String cfmapJson; + + private final String connectToken; + + private final Optional name; + + private final Map additionalProperties; + + private CreateAccountRequest( + Optional appId, + Optional externalUserId, + Optional oauthAppId, + String appSlug, + String cfmapJson, + String connectToken, + Optional name, + Map additionalProperties) { + this.appId = appId; + this.externalUserId = externalUserId; + this.oauthAppId = oauthAppId; + this.appSlug = appSlug; + this.cfmapJson = cfmapJson; + this.connectToken = connectToken; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app slug or ID to filter accounts by. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + @JsonProperty("external_user_id") + public Optional getExternalUserId() { + return externalUserId; + } + + /** + * @return The OAuth app ID to filter by, if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return The app slug for the account + */ + @JsonProperty("app_slug") + public String getAppSlug() { + return appSlug; + } + + /** + * @return JSON string containing the custom fields mapping + */ + @JsonProperty("cfmap_json") + public String getCfmapJson() { + return cfmapJson; + } + + /** + * @return The connect token for authentication + */ + @JsonProperty("connect_token") + public String getConnectToken() { + return connectToken; + } + + /** + * @return Optional name for the account + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAccountRequest && equalTo((CreateAccountRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAccountRequest other) { + return appId.equals(other.appId) + && externalUserId.equals(other.externalUserId) + && oauthAppId.equals(other.oauthAppId) + && appSlug.equals(other.appSlug) + && cfmapJson.equals(other.cfmapJson) + && connectToken.equals(other.connectToken) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.externalUserId, + this.oauthAppId, + this.appSlug, + this.cfmapJson, + this.connectToken, + this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppSlugStage builder() { + return new Builder(); + } + + public interface AppSlugStage { + /** + *

    The app slug for the account

    + */ + CfmapJsonStage appSlug(@NotNull String appSlug); + + Builder from(CreateAccountRequest other); + } + + public interface CfmapJsonStage { + /** + *

    JSON string containing the custom fields mapping

    + */ + ConnectTokenStage cfmapJson(@NotNull String cfmapJson); + } + + public interface ConnectTokenStage { + /** + *

    The connect token for authentication

    + */ + _FinalStage connectToken(@NotNull String connectToken); + } + + public interface _FinalStage { + CreateAccountRequest build(); + + /** + *

    The app slug or ID to filter accounts by.

    + */ + _FinalStage appId(Optional appId); + + _FinalStage appId(String appId); + + _FinalStage externalUserId(Optional externalUserId); + + _FinalStage externalUserId(String externalUserId); + + /** + *

    The OAuth app ID to filter by, if applicable

    + */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); + + /** + *

    Optional name for the account

    + */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppSlugStage, CfmapJsonStage, ConnectTokenStage, _FinalStage { + private String appSlug; + + private String cfmapJson; + + private String connectToken; + + private Optional name = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional externalUserId = Optional.empty(); + + private Optional appId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAccountRequest other) { + appId(other.getAppId()); + externalUserId(other.getExternalUserId()); + oauthAppId(other.getOauthAppId()); + appSlug(other.getAppSlug()); + cfmapJson(other.getCfmapJson()); + connectToken(other.getConnectToken()); + name(other.getName()); + return this; + } + + /** + *

    The app slug for the account

    + *

    The app slug for the account

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app_slug") + public CfmapJsonStage appSlug(@NotNull String appSlug) { + this.appSlug = Objects.requireNonNull(appSlug, "appSlug must not be null"); + return this; + } + + /** + *

    JSON string containing the custom fields mapping

    + *

    JSON string containing the custom fields mapping

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cfmap_json") + public ConnectTokenStage cfmapJson(@NotNull String cfmapJson) { + this.cfmapJson = Objects.requireNonNull(cfmapJson, "cfmapJson must not be null"); + return this; + } + + /** + *

    The connect token for authentication

    + *

    The connect token for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("connect_token") + public _FinalStage connectToken(@NotNull String connectToken) { + this.connectToken = Objects.requireNonNull(connectToken, "connectToken must not be null"); + return this; + } + + /** + *

    Optional name for the account

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Optional name for the account

    + */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

    The OAuth app ID to filter by, if applicable

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

    The OAuth app ID to filter by, if applicable

    + */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + @java.lang.Override + public _FinalStage externalUserId(String externalUserId) { + this.externalUserId = Optional.ofNullable(externalUserId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "external_user_id", nulls = Nulls.SKIP) + public _FinalStage externalUserId(Optional externalUserId) { + this.externalUserId = externalUserId; + return this; + } + + /** + *

    The app slug or ID to filter accounts by.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appId(String appId) { + this.appId = Optional.ofNullable(appId); + return this; + } + + /** + *

    The app slug or ID to filter accounts by.

    + */ + @java.lang.Override + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public _FinalStage appId(Optional appId) { + this.appId = appId; + return this; + } + + @java.lang.Override + public CreateAccountRequest build() { + return new CreateAccountRequest( + appId, externalUserId, oauthAppId, appSlug, cfmapJson, connectToken, name, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java new file mode 100644 index 0000000..52efedb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; + +public class ActionsClient { + protected final ClientOptions clientOptions; + + private final RawActionsClient rawClient; + + public ActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawActionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawActionsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(ActionsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(ActionsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(ActionsConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(ActionsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(ActionsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(ActionsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } + + public RunActionResponse run(RunActionOpts request) { + return this.rawClient.run(request).body(); + } + + public RunActionResponse run(RunActionOpts request, RequestOptions requestOptions) { + return this.rawClient.run(request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java new file mode 100644 index 0000000..19ff8e7 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncActionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawActionsClient rawClient; + + public AsyncActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawActionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawActionsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(ActionsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + ActionsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(ActionsConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(ActionsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture run(RunActionOpts request) { + return this.rawClient.run(request).thenApply(response -> response.body()); + } + + public CompletableFuture run(RunActionOpts request, RequestOptions requestOptions) { + return this.rawClient.run(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java new file mode 100644 index 0000000..9686990 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java @@ -0,0 +1,397 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawActionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(ActionsListRequest.builder().build()); + } + + public CompletableFuture>> list(ActionsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + ActionsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ActionsListRequest nextRequest = ActionsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + ActionsConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + ActionsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> run(RunActionOpts request) { + return run(request, null); + } + + public CompletableFuture> run( + RunActionOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/run") + .build(); + Map properties = new HashMap<>(); + properties.put("id", request.getId()); + properties.put("external_user_id", request.getExternalUserId()); + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getDynamicPropsId().isPresent()) { + properties.put("dynamic_props_id", request.getDynamicPropsId()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java new file mode 100644 index 0000000..eee1aa6 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawActionsClient { + protected final ClientOptions clientOptions; + + public RawActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(ActionsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(ActionsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + ActionsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ActionsListRequest nextRequest = ActionsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(ActionsConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(ActionsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse run(RunActionOpts request) { + return run(request, null); + } + + public PipedreamApiHttpResponse run(RunActionOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/run") + .build(); + Map properties = new HashMap<>(); + properties.put("id", request.getId()); + properties.put("external_user_id", request.getExternalUserId()); + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getDynamicPropsId().isPresent()) { + properties.put("dynamic_props_id", request.getDynamicPropsId()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java new file mode 100644 index 0000000..5da951b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ConfigurePropOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ActionsConfigurePropRequest.Builder.class) +public final class ActionsConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private ActionsConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsConfigurePropRequest && equalTo((ActionsConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(ActionsConfigurePropRequest other); + } + + public interface _FinalStage { + ActionsConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ActionsConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ActionsConfigurePropRequest build() { + return new ActionsConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java new file mode 100644 index 0000000..60f1e37 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ActionsListRequest.Builder.class) +public final class ActionsListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private ActionsListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the actions + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the actions + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsListRequest && equalTo((ActionsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ActionsListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    A search query to filter the actions

    + */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

    The ID or name slug of the app to filter the actions

    + */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public ActionsListRequest build() { + return new ActionsListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java new file mode 100644 index 0000000..afefa8a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ReloadPropsOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ActionsReloadPropsRequest.Builder.class) +public final class ActionsReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private ActionsReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsReloadPropsRequest && equalTo((ActionsReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(ActionsReloadPropsRequest other); + } + + public interface _FinalStage { + ActionsReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ActionsReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ActionsReloadPropsRequest build() { + return new ActionsReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java new file mode 100644 index 0000000..6a16af8 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java @@ -0,0 +1,269 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RunActionOpts.Builder.class) +public final class RunActionOpts { + private final Optional asyncHandle; + + private final String id; + + private final String externalUserId; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Map additionalProperties; + + private RunActionOpts( + Optional asyncHandle, + String id, + String externalUserId, + Optional> configuredProps, + Optional dynamicPropsId, + Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.id = id; + this.externalUserId = externalUserId; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + /** + * @return The action component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The configured properties for the action + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunActionOpts && equalTo((RunActionOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunActionOpts other) { + return asyncHandle.equals(other.asyncHandle) + && id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.id, this.externalUserId, this.configuredProps, this.dynamicPropsId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

    The action component ID

    + */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(RunActionOpts other); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + RunActionOpts build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + + /** + *

    The configured properties for the action

    + */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

    The ID for dynamic props

    + */ + _FinalStage dynamicPropsId(Optional dynamicPropsId); + + _FinalStage dynamicPropsId(String dynamicPropsId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RunActionOpts other) { + asyncHandle(other.getAsyncHandle()); + id(other.getId()); + externalUserId(other.getExternalUserId()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + return this; + } + + /** + *

    The action component ID

    + *

    The action component ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ExternalUserIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The external user ID

    + *

    The external user ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The ID for dynamic props

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dynamicPropsId(String dynamicPropsId) { + this.dynamicPropsId = Optional.ofNullable(dynamicPropsId); + return this; + } + + /** + *

    The ID for dynamic props

    + */ + @java.lang.Override + @JsonSetter(value = "dynamic_props_id", nulls = Nulls.SKIP) + public _FinalStage dynamicPropsId(Optional dynamicPropsId) { + this.dynamicPropsId = dynamicPropsId; + return this; + } + + /** + *

    The configured properties for the action

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps = Optional.ofNullable(configuredProps); + return this; + } + + /** + *

    The configured properties for the action

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public RunActionOpts build() { + return new RunActionOpts( + asyncHandle, id, externalUserId, configuredProps, dynamicPropsId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java new file mode 100644 index 0000000..357d245 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.util.List; + +public class AppCategoriesClient { + protected final ClientOptions clientOptions; + + private final RawAppCategoriesClient rawClient; + + public AppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppCategoriesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppCategoriesClient withRawResponse() { + return this.rawClient; + } + + public List list() { + return this.rawClient.list().body(); + } + + public List list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + public AppCategory retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + public AppCategory retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java new file mode 100644 index 0000000..d374614 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppCategoriesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppCategoriesClient rawClient; + + public AsyncAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppCategoriesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppCategoriesClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java new file mode 100644 index 0000000..c7a7bf5 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppCategoriesClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(null); + } + + public CompletableFuture>> list(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String id) { + return retrieve(id, null); + } + + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java new file mode 100644 index 0000000..497bd77 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppCategoriesClient { + protected final ClientOptions clientOptions; + + public RawAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(null); + } + + public PipedreamApiHttpResponse> list(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String id) { + return retrieve(id, null); + } + + public PipedreamApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AppsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AppsClient.java new file mode 100644 index 0000000..39bcb35 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AppsClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; + +public class AppsClient { + protected final ClientOptions clientOptions; + + private final RawAppsClient rawClient; + + public AppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(AppsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(AppsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public GetAppResponse retrieve(String appId) { + return this.rawClient.retrieve(appId).body(); + } + + public GetAppResponse retrieve(String appId, RequestOptions requestOptions) { + return this.rawClient.retrieve(appId, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java new file mode 100644 index 0000000..fbe87f5 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppsClient rawClient; + + public AsyncAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(AppsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list(AppsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String appId) { + return this.rawClient.retrieve(appId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String appId, RequestOptions requestOptions) { + return this.rawClient.retrieve(appId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java new file mode 100644 index 0000000..42967c0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import com.pipedream.api.types.ListAppsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(AppsListRequest.builder().build()); + } + + public CompletableFuture>> list(AppsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + AppsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getSortKey().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_key", request.getSortKey().get(), false); + } + if (request.getSortDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_direction", request.getSortDirection().get(), false); + } + if (request.getCategoryIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "category_ids", request.getCategoryIds().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + ListAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + AppsListRequest nextRequest = AppsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String appId) { + return retrieve(appId, null); + } + + public CompletableFuture> retrieve( + String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps") + .addPathSegment(appId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java new file mode 100644 index 0000000..37619d9 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import com.pipedream.api.types.ListAppsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppsClient { + protected final ClientOptions clientOptions; + + public RawAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(AppsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(AppsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + AppsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getSortKey().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_key", request.getSortKey().get(), false); + } + if (request.getSortDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_direction", request.getSortDirection().get(), false); + } + if (request.getCategoryIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "category_ids", request.getCategoryIds().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + ListAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + AppsListRequest nextRequest = AppsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String appId) { + return retrieve(appId, null); + } + + public PipedreamApiHttpResponse retrieve(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps") + .addPathSegment(appId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java new file mode 100644 index 0000000..5e13f36 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java @@ -0,0 +1,294 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.resources.apps.types.AppsListRequestSortDirection; +import com.pipedream.api.resources.apps.types.AppsListRequestSortKey; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppsListRequest.Builder.class) +public final class AppsListRequest { + private final Optional> categoryIds; + + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional sortKey; + + private final Optional sortDirection; + + private final Map additionalProperties; + + private AppsListRequest( + Optional> categoryIds, + Optional after, + Optional before, + Optional limit, + Optional q, + Optional sortKey, + Optional sortDirection, + Map additionalProperties) { + this.categoryIds = categoryIds; + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.sortKey = sortKey; + this.sortDirection = sortDirection; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return apps in these categories + */ + @JsonProperty("category_ids") + public Optional> getCategoryIds() { + return categoryIds; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the apps + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The key to sort the apps by + */ + @JsonProperty("sort_key") + public Optional getSortKey() { + return sortKey; + } + + /** + * @return The direction to sort the apps + */ + @JsonProperty("sort_direction") + public Optional getSortDirection() { + return sortDirection; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppsListRequest && equalTo((AppsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppsListRequest other) { + return categoryIds.equals(other.categoryIds) + && after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && sortKey.equals(other.sortKey) + && sortDirection.equals(other.sortDirection); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.categoryIds, this.after, this.before, this.limit, this.q, this.sortKey, this.sortDirection); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> categoryIds = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional sortKey = Optional.empty(); + + private Optional sortDirection = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppsListRequest other) { + categoryIds(other.getCategoryIds()); + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + sortKey(other.getSortKey()); + sortDirection(other.getSortDirection()); + return this; + } + + /** + *

    Only return apps in these categories

    + */ + @JsonSetter(value = "category_ids", nulls = Nulls.SKIP) + public Builder categoryIds(Optional> categoryIds) { + this.categoryIds = categoryIds; + return this; + } + + public Builder categoryIds(List categoryIds) { + this.categoryIds = Optional.ofNullable(categoryIds); + return this; + } + + public Builder categoryIds(String categoryIds) { + this.categoryIds = Optional.of(Collections.singletonList(categoryIds)); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    A search query to filter the apps

    + */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

    The key to sort the apps by

    + */ + @JsonSetter(value = "sort_key", nulls = Nulls.SKIP) + public Builder sortKey(Optional sortKey) { + this.sortKey = sortKey; + return this; + } + + public Builder sortKey(AppsListRequestSortKey sortKey) { + this.sortKey = Optional.ofNullable(sortKey); + return this; + } + + /** + *

    The direction to sort the apps

    + */ + @JsonSetter(value = "sort_direction", nulls = Nulls.SKIP) + public Builder sortDirection(Optional sortDirection) { + this.sortDirection = sortDirection; + return this; + } + + public Builder sortDirection(AppsListRequestSortDirection sortDirection) { + this.sortDirection = Optional.ofNullable(sortDirection); + return this; + } + + public AppsListRequest build() { + return new AppsListRequest( + categoryIds, after, before, limit, q, sortKey, sortDirection, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java new file mode 100644 index 0000000..18cc793 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppsListRequestSortDirection { + ASC("asc"), + + DESC("desc"); + + private final String value; + + AppsListRequestSortDirection(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java new file mode 100644 index 0000000..7260231 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppsListRequestSortKey { + NAME("name"), + + NAME_SLUG("name_slug"), + + FEATURED_WEIGHT("featured_weight"); + + private final String value; + + AppsListRequestSortKey(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java new file mode 100644 index 0000000..c5934f3 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncComponentsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawComponentsClient rawClient; + + public AsyncComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawComponentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawComponentsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(ComponentsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + ComponentsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(ComponentsConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(ComponentsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java new file mode 100644 index 0000000..43e8178 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java @@ -0,0 +1,321 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawComponentsClient { + protected final ClientOptions clientOptions; + + public AsyncRawComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(ComponentsListRequest.builder().build()); + } + + public CompletableFuture>> list( + ComponentsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + ComponentsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ComponentsListRequest nextRequest = ComponentsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + ComponentsConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + ComponentsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java new file mode 100644 index 0000000..f273dcb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java @@ -0,0 +1,68 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; + +public class ComponentsClient { + protected final ClientOptions clientOptions; + + private final RawComponentsClient rawClient; + + public ComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawComponentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawComponentsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(ComponentsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(ComponentsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(ComponentsConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(ComponentsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java new file mode 100644 index 0000000..cd8521d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java @@ -0,0 +1,253 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawComponentsClient { + protected final ClientOptions clientOptions; + + public RawComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(ComponentsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(ComponentsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + ComponentsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ComponentsListRequest nextRequest = ComponentsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(ComponentsConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(ComponentsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java new file mode 100644 index 0000000..541a93e --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ConfigurePropOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ComponentsConfigurePropRequest.Builder.class) +public final class ComponentsConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private ComponentsConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsConfigurePropRequest && equalTo((ComponentsConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(ComponentsConfigurePropRequest other); + } + + public interface _FinalStage { + ComponentsConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ComponentsConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ComponentsConfigurePropRequest build() { + return new ComponentsConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java new file mode 100644 index 0000000..8d5b23b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ComponentsListRequest.Builder.class) +public final class ComponentsListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private ComponentsListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the components + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the components + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsListRequest && equalTo((ComponentsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ComponentsListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    A search query to filter the components

    + */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

    The ID or name slug of the app to filter the components

    + */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public ComponentsListRequest build() { + return new ComponentsListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java new file mode 100644 index 0000000..960dc66 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ReloadPropsOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ComponentsReloadPropsRequest.Builder.class) +public final class ComponentsReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private ComponentsReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsReloadPropsRequest && equalTo((ComponentsReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(ComponentsReloadPropsRequest other); + } + + public interface _FinalStage { + ComponentsReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ComponentsReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ComponentsReloadPropsRequest build() { + return new ComponentsReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java new file mode 100644 index 0000000..bc6b458 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +public class AsyncDeployedTriggersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDeployedTriggersClient rawClient; + + public AsyncDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDeployedTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDeployedTriggersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list(DeployedTriggersListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String triggerId, DeployedTriggersRetrieveRequest request) { + return this.rawClient.retrieve(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture update(String triggerId, UpdateTriggerOpts request) { + return this.rawClient.update(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.update(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String triggerId, DeployedTriggersDeleteRequest request) { + return this.rawClient.delete(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return this.rawClient.listEvents(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.listEvents(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return this.rawClient.listWorkflows(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + return this.rawClient.listWorkflows(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return this.rawClient.updateWorkflows(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + return this.rawClient + .updateWorkflows(triggerId, request, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return this.rawClient.listWebhooks(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.listWebhooks(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return this.rawClient.updateWebhooks(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + return this.rawClient.updateWebhooks(triggerId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java new file mode 100644 index 0000000..cbee597 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java @@ -0,0 +1,630 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerEventsResponse; +import com.pipedream.api.types.GetTriggerResponse; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import com.pipedream.api.types.GetTriggersResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDeployedTriggersClient { + protected final ClientOptions clientOptions; + + public AsyncRawDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list( + DeployedTriggersListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve( + String triggerId, DeployedTriggersRetrieveRequest request) { + return retrieve(triggerId, request, null); + } + + public CompletableFuture> retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> update( + String triggerId, UpdateTriggerOpts request) { + return update(triggerId, request, null); + } + + public CompletableFuture> update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + if (request.getActive().isPresent()) { + properties.put("active", request.getActive()); + } + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> delete( + String triggerId, DeployedTriggersDeleteRequest request) { + return delete(triggerId, request, null); + } + + public CompletableFuture> delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getIgnoreHookErrors().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ignore_hook_errors", request.getIgnoreHookErrors().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return listEvents(triggerId, request, null); + } + + public CompletableFuture>> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("events"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getN().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "n", request.getN().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerEventsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerEventsResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return listWorkflows(triggerId, request, null); + } + + public CompletableFuture> listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWorkflowsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return updateWorkflows(triggerId, request, null); + } + + public CompletableFuture> updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("workflow_ids", request.getWorkflowIds()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWorkflowsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return listWebhooks(triggerId, request, null); + } + + public CompletableFuture> listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWebhooksResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return updateWebhooks(triggerId, request, null); + } + + public CompletableFuture> updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("webhook_urls", request.getWebhookUrls()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWebhooksResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java new file mode 100644 index 0000000..891ce12 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import java.util.List; + +public class DeployedTriggersClient { + protected final ClientOptions clientOptions; + + private final RawDeployedTriggersClient rawClient; + + public DeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDeployedTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDeployedTriggersClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list(DeployedTriggersListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public DeployedComponent retrieve(String triggerId, DeployedTriggersRetrieveRequest request) { + return this.rawClient.retrieve(triggerId, request).body(); + } + + public DeployedComponent retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(triggerId, request, requestOptions).body(); + } + + public DeployedComponent update(String triggerId, UpdateTriggerOpts request) { + return this.rawClient.update(triggerId, request).body(); + } + + public DeployedComponent update(String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.update(triggerId, request, requestOptions).body(); + } + + public void delete(String triggerId, DeployedTriggersDeleteRequest request) { + this.rawClient.delete(triggerId, request).body(); + } + + public void delete(String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + this.rawClient.delete(triggerId, request, requestOptions).body(); + } + + public List listEvents(String triggerId, DeployedTriggersListEventsRequest request) { + return this.rawClient.listEvents(triggerId, request).body(); + } + + public List listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.listEvents(triggerId, request, requestOptions).body(); + } + + public GetTriggerWorkflowsResponse listWorkflows(String triggerId, DeployedTriggersListWorkflowsRequest request) { + return this.rawClient.listWorkflows(triggerId, request).body(); + } + + public GetTriggerWorkflowsResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + return this.rawClient.listWorkflows(triggerId, request, requestOptions).body(); + } + + public GetTriggerWorkflowsResponse updateWorkflows(String triggerId, UpdateTriggerWorkflowsOpts request) { + return this.rawClient.updateWorkflows(triggerId, request).body(); + } + + public GetTriggerWorkflowsResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + return this.rawClient + .updateWorkflows(triggerId, request, requestOptions) + .body(); + } + + public GetTriggerWebhooksResponse listWebhooks(String triggerId, DeployedTriggersListWebhooksRequest request) { + return this.rawClient.listWebhooks(triggerId, request).body(); + } + + public GetTriggerWebhooksResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.listWebhooks(triggerId, request, requestOptions).body(); + } + + public GetTriggerWebhooksResponse updateWebhooks(String triggerId, UpdateTriggerWebhooksOpts request) { + return this.rawClient.updateWebhooks(triggerId, request).body(); + } + + public GetTriggerWebhooksResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + return this.rawClient.updateWebhooks(triggerId, request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java new file mode 100644 index 0000000..0e1e09f --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java @@ -0,0 +1,493 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerEventsResponse; +import com.pipedream.api.types.GetTriggerResponse; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import com.pipedream.api.types.GetTriggersResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDeployedTriggersClient { + protected final ClientOptions clientOptions; + + public RawDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list(DeployedTriggersListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve( + String triggerId, DeployedTriggersRetrieveRequest request) { + return retrieve(triggerId, request, null); + } + + public PipedreamApiHttpResponse retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse update(String triggerId, UpdateTriggerOpts request) { + return update(triggerId, request, null); + } + + public PipedreamApiHttpResponse update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + if (request.getActive().isPresent()) { + properties.put("active", request.getActive()); + } + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse delete(String triggerId, DeployedTriggersDeleteRequest request) { + return delete(triggerId, request, null); + } + + public PipedreamApiHttpResponse delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getIgnoreHookErrors().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ignore_hook_errors", request.getIgnoreHookErrors().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return listEvents(triggerId, request, null); + } + + public PipedreamApiHttpResponse> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("events"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getN().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "n", request.getN().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerEventsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerEventsResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return listWorkflows(triggerId, request, null); + } + + public PipedreamApiHttpResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return updateWorkflows(triggerId, request, null); + } + + public PipedreamApiHttpResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("workflow_ids", request.getWorkflowIds()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return listWebhooks(triggerId, request, null); + } + + public PipedreamApiHttpResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return updateWebhooks(triggerId, request, null); + } + + public PipedreamApiHttpResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("webhook_urls", request.getWebhookUrls()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java new file mode 100644 index 0000000..3989d6e --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersDeleteRequest.Builder.class) +public final class DeployedTriggersDeleteRequest { + private final String externalUserId; + + private final Optional ignoreHookErrors; + + private final Map additionalProperties; + + private DeployedTriggersDeleteRequest( + String externalUserId, Optional ignoreHookErrors, Map additionalProperties) { + this.externalUserId = externalUserId; + this.ignoreHookErrors = ignoreHookErrors; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether to ignore errors during deactivation hook + */ + @JsonProperty("ignore_hook_errors") + public Optional getIgnoreHookErrors() { + return ignoreHookErrors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersDeleteRequest && equalTo((DeployedTriggersDeleteRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersDeleteRequest other) { + return externalUserId.equals(other.externalUserId) && ignoreHookErrors.equals(other.ignoreHookErrors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.ignoreHookErrors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersDeleteRequest other); + } + + public interface _FinalStage { + DeployedTriggersDeleteRequest build(); + + /** + *

    Whether to ignore errors during deactivation hook

    + */ + _FinalStage ignoreHookErrors(Optional ignoreHookErrors); + + _FinalStage ignoreHookErrors(Boolean ignoreHookErrors); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional ignoreHookErrors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersDeleteRequest other) { + externalUserId(other.getExternalUserId()); + ignoreHookErrors(other.getIgnoreHookErrors()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    Whether to ignore errors during deactivation hook

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage ignoreHookErrors(Boolean ignoreHookErrors) { + this.ignoreHookErrors = Optional.ofNullable(ignoreHookErrors); + return this; + } + + /** + *

    Whether to ignore errors during deactivation hook

    + */ + @java.lang.Override + @JsonSetter(value = "ignore_hook_errors", nulls = Nulls.SKIP) + public _FinalStage ignoreHookErrors(Optional ignoreHookErrors) { + this.ignoreHookErrors = ignoreHookErrors; + return this; + } + + @java.lang.Override + public DeployedTriggersDeleteRequest build() { + return new DeployedTriggersDeleteRequest(externalUserId, ignoreHookErrors, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java new file mode 100644 index 0000000..e3015b2 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListEventsRequest.Builder.class) +public final class DeployedTriggersListEventsRequest { + private final String externalUserId; + + private final Optional n; + + private final Map additionalProperties; + + private DeployedTriggersListEventsRequest( + String externalUserId, Optional n, Map additionalProperties) { + this.externalUserId = externalUserId; + this.n = n; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The number of events to retrieve (defaults to 20 if not provided) + */ + @JsonProperty("n") + public Optional getN() { + return n; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListEventsRequest && equalTo((DeployedTriggersListEventsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListEventsRequest other) { + return externalUserId.equals(other.externalUserId) && n.equals(other.n); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.n); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    Your end user ID, for whom you deployed the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListEventsRequest other); + } + + public interface _FinalStage { + DeployedTriggersListEventsRequest build(); + + /** + *

    The number of events to retrieve (defaults to 20 if not provided)

    + */ + _FinalStage n(Optional n); + + _FinalStage n(Integer n); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional n = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListEventsRequest other) { + externalUserId(other.getExternalUserId()); + n(other.getN()); + return this; + } + + /** + *

    Your end user ID, for whom you deployed the trigger

    + *

    Your end user ID, for whom you deployed the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The number of events to retrieve (defaults to 20 if not provided)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage n(Integer n) { + this.n = Optional.ofNullable(n); + return this; + } + + /** + *

    The number of events to retrieve (defaults to 20 if not provided)

    + */ + @java.lang.Override + @JsonSetter(value = "n", nulls = Nulls.SKIP) + public _FinalStage n(Optional n) { + this.n = n; + return this; + } + + @java.lang.Override + public DeployedTriggersListEventsRequest build() { + return new DeployedTriggersListEventsRequest(externalUserId, n, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java new file mode 100644 index 0000000..556c4f0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java @@ -0,0 +1,246 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListRequest.Builder.class) +public final class DeployedTriggersListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListRequest( + Optional after, + Optional before, + Optional limit, + String externalUserId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListRequest && equalTo((DeployedTriggersListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    Your end user ID, for whom you deployed the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListRequest other); + } + + public interface _FinalStage { + DeployedTriggersListRequest build(); + + /** + *

    The cursor to start from for pagination

    + */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

    The cursor to end before for pagination

    + */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

    The maximum number of results to return

    + */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Integer limit); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional limit = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

    Your end user ID, for whom you deployed the trigger

    + *

    Your end user ID, for whom you deployed the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The maximum number of results to return

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

    The cursor to end before for pagination

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

    The cursor to start from for pagination

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public DeployedTriggersListRequest build() { + return new DeployedTriggersListRequest(after, before, limit, externalUserId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java new file mode 100644 index 0000000..62cf4dd --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListWebhooksRequest.Builder.class) +public final class DeployedTriggersListWebhooksRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListWebhooksRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListWebhooksRequest + && equalTo((DeployedTriggersListWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListWebhooksRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListWebhooksRequest other); + } + + public interface _FinalStage { + DeployedTriggersListWebhooksRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListWebhooksRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersListWebhooksRequest build() { + return new DeployedTriggersListWebhooksRequest(externalUserId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java new file mode 100644 index 0000000..95979ed --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListWorkflowsRequest.Builder.class) +public final class DeployedTriggersListWorkflowsRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListWorkflowsRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListWorkflowsRequest + && equalTo((DeployedTriggersListWorkflowsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListWorkflowsRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListWorkflowsRequest other); + } + + public interface _FinalStage { + DeployedTriggersListWorkflowsRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListWorkflowsRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersListWorkflowsRequest build() { + return new DeployedTriggersListWorkflowsRequest(externalUserId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java new file mode 100644 index 0000000..4aab165 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersRetrieveRequest.Builder.class) +public final class DeployedTriggersRetrieveRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersRetrieveRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersRetrieveRequest && equalTo((DeployedTriggersRetrieveRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersRetrieveRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    Your end user ID, for whom you deployed the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersRetrieveRequest other); + } + + public interface _FinalStage { + DeployedTriggersRetrieveRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersRetrieveRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

    Your end user ID, for whom you deployed the trigger

    + *

    Your end user ID, for whom you deployed the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersRetrieveRequest build() { + return new DeployedTriggersRetrieveRequest(externalUserId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java new file mode 100644 index 0000000..735cf4a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java @@ -0,0 +1,246 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTriggerOpts.Builder.class) +public final class UpdateTriggerOpts { + private final String externalUserId; + + private final Optional active; + + private final Optional> configuredProps; + + private final Optional name; + + private final Map additionalProperties; + + private UpdateTriggerOpts( + String externalUserId, + Optional active, + Optional> configuredProps, + Optional name, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.active = active; + this.configuredProps = configuredProps; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether the trigger should be active + */ + @JsonProperty("active") + public Optional getActive() { + return active; + } + + /** + * @return The configured properties for the trigger + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The name of the trigger + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerOpts && equalTo((UpdateTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerOpts other) { + return externalUserId.equals(other.externalUserId) + && active.equals(other.active) + && configuredProps.equals(other.configuredProps) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.active, this.configuredProps, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(UpdateTriggerOpts other); + } + + public interface _FinalStage { + UpdateTriggerOpts build(); + + /** + *

    Whether the trigger should be active

    + */ + _FinalStage active(Optional active); + + _FinalStage active(Boolean active); + + /** + *

    The configured properties for the trigger

    + */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

    The name of the trigger

    + */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional name = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional active = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerOpts other) { + externalUserId(other.getExternalUserId()); + active(other.getActive()); + configuredProps(other.getConfiguredProps()); + name(other.getName()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The name of the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    The name of the trigger

    + */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

    The configured properties for the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps = Optional.ofNullable(configuredProps); + return this; + } + + /** + *

    The configured properties for the trigger

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + /** + *

    Whether the trigger should be active

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage active(Boolean active) { + this.active = Optional.ofNullable(active); + return this; + } + + /** + *

    Whether the trigger should be active

    + */ + @java.lang.Override + @JsonSetter(value = "active", nulls = Nulls.SKIP) + public _FinalStage active(Optional active) { + this.active = active; + return this; + } + + @java.lang.Override + public UpdateTriggerOpts build() { + return new UpdateTriggerOpts(externalUserId, active, configuredProps, name, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java new file mode 100644 index 0000000..d00d5fb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTriggerWebhooksOpts.Builder.class) +public final class UpdateTriggerWebhooksOpts { + private final String externalUserId; + + private final List webhookUrls; + + private final Map additionalProperties; + + private UpdateTriggerWebhooksOpts( + String externalUserId, List webhookUrls, Map additionalProperties) { + this.externalUserId = externalUserId; + this.webhookUrls = webhookUrls; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Array of webhook URLs to set + */ + @JsonProperty("webhook_urls") + public List getWebhookUrls() { + return webhookUrls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerWebhooksOpts && equalTo((UpdateTriggerWebhooksOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerWebhooksOpts other) { + return externalUserId.equals(other.externalUserId) && webhookUrls.equals(other.webhookUrls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.webhookUrls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(UpdateTriggerWebhooksOpts other); + } + + public interface _FinalStage { + UpdateTriggerWebhooksOpts build(); + + /** + *

    Array of webhook URLs to set

    + */ + _FinalStage webhookUrls(List webhookUrls); + + _FinalStage addWebhookUrls(String webhookUrls); + + _FinalStage addAllWebhookUrls(List webhookUrls); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private List webhookUrls = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerWebhooksOpts other) { + externalUserId(other.getExternalUserId()); + webhookUrls(other.getWebhookUrls()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    Array of webhook URLs to set

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllWebhookUrls(List webhookUrls) { + this.webhookUrls.addAll(webhookUrls); + return this; + } + + /** + *

    Array of webhook URLs to set

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addWebhookUrls(String webhookUrls) { + this.webhookUrls.add(webhookUrls); + return this; + } + + /** + *

    Array of webhook URLs to set

    + */ + @java.lang.Override + @JsonSetter(value = "webhook_urls", nulls = Nulls.SKIP) + public _FinalStage webhookUrls(List webhookUrls) { + this.webhookUrls.clear(); + this.webhookUrls.addAll(webhookUrls); + return this; + } + + @java.lang.Override + public UpdateTriggerWebhooksOpts build() { + return new UpdateTriggerWebhooksOpts(externalUserId, webhookUrls, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java new file mode 100644 index 0000000..7022dd6 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTriggerWorkflowsOpts.Builder.class) +public final class UpdateTriggerWorkflowsOpts { + private final String externalUserId; + + private final List workflowIds; + + private final Map additionalProperties; + + private UpdateTriggerWorkflowsOpts( + String externalUserId, List workflowIds, Map additionalProperties) { + this.externalUserId = externalUserId; + this.workflowIds = workflowIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Array of workflow IDs to set + */ + @JsonProperty("workflow_ids") + public List getWorkflowIds() { + return workflowIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerWorkflowsOpts && equalTo((UpdateTriggerWorkflowsOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerWorkflowsOpts other) { + return externalUserId.equals(other.externalUserId) && workflowIds.equals(other.workflowIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.workflowIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(UpdateTriggerWorkflowsOpts other); + } + + public interface _FinalStage { + UpdateTriggerWorkflowsOpts build(); + + /** + *

    Array of workflow IDs to set

    + */ + _FinalStage workflowIds(List workflowIds); + + _FinalStage addWorkflowIds(String workflowIds); + + _FinalStage addAllWorkflowIds(List workflowIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private List workflowIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerWorkflowsOpts other) { + externalUserId(other.getExternalUserId()); + workflowIds(other.getWorkflowIds()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    Array of workflow IDs to set

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllWorkflowIds(List workflowIds) { + this.workflowIds.addAll(workflowIds); + return this; + } + + /** + *

    Array of workflow IDs to set

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addWorkflowIds(String workflowIds) { + this.workflowIds.add(workflowIds); + return this; + } + + /** + *

    Array of workflow IDs to set

    + */ + @java.lang.Override + @JsonSetter(value = "workflow_ids", nulls = Nulls.SKIP) + public _FinalStage workflowIds(List workflowIds) { + this.workflowIds.clear(); + this.workflowIds.addAll(workflowIds); + return this; + } + + @java.lang.Override + public UpdateTriggerWorkflowsOpts build() { + return new UpdateTriggerWorkflowsOpts(externalUserId, workflowIds, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java new file mode 100644 index 0000000..87556e3 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncOauthTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawOauthTokensClient rawClient; + + public AsyncOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawOauthTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawOauthTokensClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture create(CreateOAuthTokenOpts request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java new file mode 100644 index 0000000..cc29bb8 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawOauthTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> create(CreateOAuthTokenOpts request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/oauth/token") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), CreateOAuthTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java new file mode 100644 index 0000000..1ae2bf1 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; + +public class OauthTokensClient { + protected final ClientOptions clientOptions; + + private final RawOauthTokensClient rawClient; + + public OauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawOauthTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawOauthTokensClient withRawResponse() { + return this.rawClient; + } + + public CreateOAuthTokenResponse create(CreateOAuthTokenOpts request) { + return this.rawClient.create(request).body(); + } + + public CreateOAuthTokenResponse create(CreateOAuthTokenOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java new file mode 100644 index 0000000..c7096b4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawOauthTokensClient { + protected final ClientOptions clientOptions; + + public RawOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse create(CreateOAuthTokenOpts request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/oauth/token") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateOAuthTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java new file mode 100644 index 0000000..50ab4b2 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOAuthTokenOpts.Builder.class) +public final class CreateOAuthTokenOpts { + private final String clientId; + + private final String clientSecret; + + private final Map additionalProperties; + + private CreateOAuthTokenOpts(String clientId, String clientSecret, Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("grant_type") + public String getGrantType() { + return "client_credentials"; + } + + @JsonProperty("client_id") + public String getClientId() { + return clientId; + } + + @JsonProperty("client_secret") + public String getClientSecret() { + return clientSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOAuthTokenOpts && equalTo((CreateOAuthTokenOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOAuthTokenOpts other) { + return clientId.equals(other.clientId) && clientSecret.equals(other.clientSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ClientIdStage builder() { + return new Builder(); + } + + public interface ClientIdStage { + ClientSecretStage clientId(@NotNull String clientId); + + Builder from(CreateOAuthTokenOpts other); + } + + public interface ClientSecretStage { + _FinalStage clientSecret(@NotNull String clientSecret); + } + + public interface _FinalStage { + CreateOAuthTokenOpts build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ClientIdStage, ClientSecretStage, _FinalStage { + private String clientId; + + private String clientSecret; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOAuthTokenOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + return this; + } + + @java.lang.Override + @JsonSetter("client_id") + public ClientSecretStage clientId(@NotNull String clientId) { + this.clientId = Objects.requireNonNull(clientId, "clientId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("client_secret") + public _FinalStage clientSecret(@NotNull String clientSecret) { + this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret must not be null"); + return this; + } + + @java.lang.Override + public CreateOAuthTokenOpts build() { + return new CreateOAuthTokenOpts(clientId, clientSecret, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java new file mode 100644 index 0000000..1d75dd6 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncProjectsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawProjectsClient rawClient; + + public AsyncProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawProjectsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawProjectsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture retrieveInfo() { + return this.rawClient.retrieveInfo().thenApply(response -> response.body()); + } + + public CompletableFuture retrieveInfo(RequestOptions requestOptions) { + return this.rawClient.retrieveInfo(requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java new file mode 100644 index 0000000..df37ce8 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawProjectsClient { + protected final ClientOptions clientOptions; + + public AsyncRawProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> retrieveInfo() { + return retrieveInfo(null); + } + + public CompletableFuture> retrieveInfo( + RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("projects/info") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java new file mode 100644 index 0000000..b09fc87 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; + +public class ProjectsClient { + protected final ClientOptions clientOptions; + + private final RawProjectsClient rawClient; + + public ProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawProjectsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawProjectsClient withRawResponse() { + return this.rawClient; + } + + public ProjectInfoResponse retrieveInfo() { + return this.rawClient.retrieveInfo().body(); + } + + public ProjectInfoResponse retrieveInfo(RequestOptions requestOptions) { + return this.rawClient.retrieveInfo(requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java new file mode 100644 index 0000000..d09dc32 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java @@ -0,0 +1,66 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawProjectsClient { + protected final ClientOptions clientOptions; + + public RawProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse retrieveInfo() { + return retrieveInfo(null); + } + + public PipedreamApiHttpResponse retrieveInfo(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("projects/info") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java new file mode 100644 index 0000000..61bcd21 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +public class AsyncProxyClient { + protected final ClientOptions clientOptions; + + private final AsyncRawProxyClient rawClient; + + public AsyncProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawProxyClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawProxyClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> get(String url64, ProxyGetRequest request) { + return this.rawClient.get(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> post(String url64, ProxyPostRequest request) { + return this.rawClient.post(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + return this.rawClient.post(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> put(String url64, ProxyPutRequest request) { + return this.rawClient.put(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + return this.rawClient.put(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> delete(String url64, ProxyDeleteRequest request) { + return this.rawClient.delete(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> patch(String url64, ProxyPatchRequest request) { + return this.rawClient.patch(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + return this.rawClient.patch(url64, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java new file mode 100644 index 0000000..d6737d6 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawProxyClient { + protected final ClientOptions clientOptions; + + public AsyncRawProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> get(String url64, ProxyGetRequest request) { + return get(url64, request, null); + } + + public CompletableFuture>> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> post( + String url64, ProxyPostRequest request) { + return post(url64, request, null); + } + + public CompletableFuture>> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> put(String url64, ProxyPutRequest request) { + return put(url64, request, null); + } + + public CompletableFuture>> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> delete( + String url64, ProxyDeleteRequest request) { + return delete(url64, request, null); + } + + public CompletableFuture>> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> patch( + String url64, ProxyPatchRequest request) { + return patch(url64, request, null); + } + + public CompletableFuture>> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java new file mode 100644 index 0000000..aa27dba --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.util.Map; + +public class ProxyClient { + protected final ClientOptions clientOptions; + + private final RawProxyClient rawClient; + + public ProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawProxyClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawProxyClient withRawResponse() { + return this.rawClient; + } + + public Map get(String url64, ProxyGetRequest request) { + return this.rawClient.get(url64, request).body(); + } + + public Map get(String url64, ProxyGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(url64, request, requestOptions).body(); + } + + public Map post(String url64, ProxyPostRequest request) { + return this.rawClient.post(url64, request).body(); + } + + public Map post(String url64, ProxyPostRequest request, RequestOptions requestOptions) { + return this.rawClient.post(url64, request, requestOptions).body(); + } + + public Map put(String url64, ProxyPutRequest request) { + return this.rawClient.put(url64, request).body(); + } + + public Map put(String url64, ProxyPutRequest request, RequestOptions requestOptions) { + return this.rawClient.put(url64, request, requestOptions).body(); + } + + public Map delete(String url64, ProxyDeleteRequest request) { + return this.rawClient.delete(url64, request).body(); + } + + public Map delete(String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(url64, request, requestOptions).body(); + } + + public Map patch(String url64, ProxyPatchRequest request) { + return this.rawClient.patch(url64, request).body(); + } + + public Map patch(String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + return this.rawClient.patch(url64, request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java new file mode 100644 index 0000000..9720f2b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.io.IOException; +import java.util.Map; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawProxyClient { + protected final ClientOptions clientOptions; + + public RawProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> get(String url64, ProxyGetRequest request) { + return get(url64, request, null); + } + + public PipedreamApiHttpResponse> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> post(String url64, ProxyPostRequest request) { + return post(url64, request, null); + } + + public PipedreamApiHttpResponse> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> put(String url64, ProxyPutRequest request) { + return put(url64, request, null); + } + + public PipedreamApiHttpResponse> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> delete(String url64, ProxyDeleteRequest request) { + return delete(url64, request, null); + } + + public PipedreamApiHttpResponse> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> patch(String url64, ProxyPatchRequest request) { + return patch(url64, request, null); + } + + public PipedreamApiHttpResponse> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java new file mode 100644 index 0000000..f956f17 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyDeleteRequest.Builder.class) +public final class ProxyDeleteRequest { + private final String externalUserId; + + private final String accountId; + + private final Map additionalProperties; + + private ProxyDeleteRequest(String externalUserId, String accountId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyDeleteRequest && equalTo((ProxyDeleteRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyDeleteRequest other) { + return externalUserId.equals(other.externalUserId) && accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID for the proxy request

    + */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyDeleteRequest other); + } + + public interface AccountIdStage { + /** + *

    The account ID to use for authentication

    + */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyDeleteRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyDeleteRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + return this; + } + + /** + *

    The external user ID for the proxy request

    + *

    The external user ID for the proxy request

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public AccountIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The account ID to use for authentication

    + *

    The account ID to use for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public ProxyDeleteRequest build() { + return new ProxyDeleteRequest(externalUserId, accountId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java new file mode 100644 index 0000000..bf09229 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyGetRequest.Builder.class) +public final class ProxyGetRequest { + private final String externalUserId; + + private final String accountId; + + private final Map additionalProperties; + + private ProxyGetRequest(String externalUserId, String accountId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyGetRequest && equalTo((ProxyGetRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyGetRequest other) { + return externalUserId.equals(other.externalUserId) && accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID for the proxy request

    + */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyGetRequest other); + } + + public interface AccountIdStage { + /** + *

    The account ID to use for authentication

    + */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyGetRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyGetRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + return this; + } + + /** + *

    The external user ID for the proxy request

    + *

    The external user ID for the proxy request

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public AccountIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The account ID to use for authentication

    + *

    The account ID to use for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public ProxyGetRequest build() { + return new ProxyGetRequest(externalUserId, accountId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java new file mode 100644 index 0000000..fe68355 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPatchRequest.Builder.class) +public final class ProxyPatchRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPatchRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPatchRequest && equalTo((ProxyPatchRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPatchRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID for the proxy request

    + */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPatchRequest other); + } + + public interface AccountIdStage { + /** + *

    The account ID to use for authentication

    + */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPatchRequest build(); + + /** + *

    Request body to forward to the target API

    + */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPatchRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

    The external user ID for the proxy request

    + *

    The external user ID for the proxy request

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public AccountIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The account ID to use for authentication

    + *

    The account ID to use for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

    Request body to forward to the target API

    + */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPatchRequest build() { + return new ProxyPatchRequest(externalUserId, accountId, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java new file mode 100644 index 0000000..d648ab4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPostRequest.Builder.class) +public final class ProxyPostRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPostRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPostRequest && equalTo((ProxyPostRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPostRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID for the proxy request

    + */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPostRequest other); + } + + public interface AccountIdStage { + /** + *

    The account ID to use for authentication

    + */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPostRequest build(); + + /** + *

    Request body to forward to the target API

    + */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPostRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

    The external user ID for the proxy request

    + *

    The external user ID for the proxy request

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public AccountIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The account ID to use for authentication

    + *

    The account ID to use for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

    Request body to forward to the target API

    + */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPostRequest build() { + return new ProxyPostRequest(externalUserId, accountId, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java new file mode 100644 index 0000000..d4aaeba --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPutRequest.Builder.class) +public final class ProxyPutRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPutRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPutRequest && equalTo((ProxyPutRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPutRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID for the proxy request

    + */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPutRequest other); + } + + public interface AccountIdStage { + /** + *

    The account ID to use for authentication

    + */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPutRequest build(); + + /** + *

    Request body to forward to the target API

    + */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPutRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

    The external user ID for the proxy request

    + *

    The external user ID for the proxy request

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public AccountIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The account ID to use for authentication

    + *

    The account ID to use for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

    Request body to forward to the target API

    + */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPutRequest build() { + return new ProxyPutRequest(externalUserId, accountId, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java new file mode 100644 index 0000000..9ddd525 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java @@ -0,0 +1,158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> create(CreateTokenRequest request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> validate(String ctok) { + return validate(ctok, TokensValidateRequest.builder().build()); + } + + public CompletableFuture> validate( + String ctok, TokensValidateRequest request) { + return validate(ctok, request, null); + } + + public CompletableFuture> validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .addPathSegment(ctok) + .addPathSegments("validate"); + if (request.getParams().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "params", request.getParams().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java new file mode 100644 index 0000000..eef98a0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTokensClient rawClient; + + public AsyncTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTokensClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture create(CreateTokenRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateTokenRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture validate(String ctok) { + return this.rawClient.validate(ctok).thenApply(response -> response.body()); + } + + public CompletableFuture validate(String ctok, TokensValidateRequest request) { + return this.rawClient.validate(ctok, request).thenApply(response -> response.body()); + } + + public CompletableFuture validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + return this.rawClient.validate(ctok, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java new file mode 100644 index 0000000..d20fbea --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTokensClient { + protected final ClientOptions clientOptions; + + public RawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse create(CreateTokenRequest request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create( + CreateTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse validate(String ctok) { + return validate(ctok, TokensValidateRequest.builder().build()); + } + + public PipedreamApiHttpResponse validate(String ctok, TokensValidateRequest request) { + return validate(ctok, request, null); + } + + public PipedreamApiHttpResponse validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .addPathSegment(ctok) + .addPathSegments("validate"); + if (request.getParams().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "params", request.getParams().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java new file mode 100644 index 0000000..98801f4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; + +public class TokensClient { + protected final ClientOptions clientOptions; + + private final RawTokensClient rawClient; + + public TokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTokensClient withRawResponse() { + return this.rawClient; + } + + public CreateTokenResponse create(CreateTokenRequest request) { + return this.rawClient.create(request).body(); + } + + public CreateTokenResponse create(CreateTokenRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + public ValidateTokenResponse validate(String ctok) { + return this.rawClient.validate(ctok).body(); + } + + public ValidateTokenResponse validate(String ctok, TokensValidateRequest request) { + return this.rawClient.validate(ctok, request).body(); + } + + public ValidateTokenResponse validate(String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + return this.rawClient.validate(ctok, request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java new file mode 100644 index 0000000..9ec9c19 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java @@ -0,0 +1,338 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTokenRequest.Builder.class) +public final class CreateTokenRequest { + private final Optional> allowedOrigins; + + private final Optional errorRedirectUri; + + private final String externalUserId; + + private final String projectId; + + private final Optional successRedirectUri; + + private final Optional webhookUri; + + private final Map additionalProperties; + + private CreateTokenRequest( + Optional> allowedOrigins, + Optional errorRedirectUri, + String externalUserId, + String projectId, + Optional successRedirectUri, + Optional webhookUri, + Map additionalProperties) { + this.allowedOrigins = allowedOrigins; + this.errorRedirectUri = errorRedirectUri; + this.externalUserId = externalUserId; + this.projectId = projectId; + this.successRedirectUri = successRedirectUri; + this.webhookUri = webhookUri; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of allowed origins for CORS + */ + @JsonProperty("allowed_origins") + public Optional> getAllowedOrigins() { + return allowedOrigins; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return Your end user ID, for whom you're creating the token + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The ID of the project + */ + @JsonProperty("project_id") + public String getProjectId() { + return projectId; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + /** + * @return Webhook URI for notifications + */ + @JsonProperty("webhook_uri") + public Optional getWebhookUri() { + return webhookUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenRequest && equalTo((CreateTokenRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenRequest other) { + return allowedOrigins.equals(other.allowedOrigins) + && errorRedirectUri.equals(other.errorRedirectUri) + && externalUserId.equals(other.externalUserId) + && projectId.equals(other.projectId) + && successRedirectUri.equals(other.successRedirectUri) + && webhookUri.equals(other.webhookUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.allowedOrigins, + this.errorRedirectUri, + this.externalUserId, + this.projectId, + this.successRedirectUri, + this.webhookUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    Your end user ID, for whom you're creating the token

    + */ + ProjectIdStage externalUserId(@NotNull String externalUserId); + + Builder from(CreateTokenRequest other); + } + + public interface ProjectIdStage { + /** + *

    The ID of the project

    + */ + _FinalStage projectId(@NotNull String projectId); + } + + public interface _FinalStage { + CreateTokenRequest build(); + + /** + *

    List of allowed origins for CORS

    + */ + _FinalStage allowedOrigins(Optional> allowedOrigins); + + _FinalStage allowedOrigins(List allowedOrigins); + + /** + *

    URI to redirect to on error

    + */ + _FinalStage errorRedirectUri(Optional errorRedirectUri); + + _FinalStage errorRedirectUri(String errorRedirectUri); + + /** + *

    URI to redirect to on success

    + */ + _FinalStage successRedirectUri(Optional successRedirectUri); + + _FinalStage successRedirectUri(String successRedirectUri); + + /** + *

    Webhook URI for notifications

    + */ + _FinalStage webhookUri(Optional webhookUri); + + _FinalStage webhookUri(String webhookUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, ProjectIdStage, _FinalStage { + private String externalUserId; + + private String projectId; + + private Optional webhookUri = Optional.empty(); + + private Optional successRedirectUri = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional> allowedOrigins = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTokenRequest other) { + allowedOrigins(other.getAllowedOrigins()); + errorRedirectUri(other.getErrorRedirectUri()); + externalUserId(other.getExternalUserId()); + projectId(other.getProjectId()); + successRedirectUri(other.getSuccessRedirectUri()); + webhookUri(other.getWebhookUri()); + return this; + } + + /** + *

    Your end user ID, for whom you're creating the token

    + *

    Your end user ID, for whom you're creating the token

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public ProjectIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The ID of the project

    + *

    The ID of the project

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("project_id") + public _FinalStage projectId(@NotNull String projectId) { + this.projectId = Objects.requireNonNull(projectId, "projectId must not be null"); + return this; + } + + /** + *

    Webhook URI for notifications

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage webhookUri(String webhookUri) { + this.webhookUri = Optional.ofNullable(webhookUri); + return this; + } + + /** + *

    Webhook URI for notifications

    + */ + @java.lang.Override + @JsonSetter(value = "webhook_uri", nulls = Nulls.SKIP) + public _FinalStage webhookUri(Optional webhookUri) { + this.webhookUri = webhookUri; + return this; + } + + /** + *

    URI to redirect to on success

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage successRedirectUri(String successRedirectUri) { + this.successRedirectUri = Optional.ofNullable(successRedirectUri); + return this; + } + + /** + *

    URI to redirect to on success

    + */ + @java.lang.Override + @JsonSetter(value = "success_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage successRedirectUri(Optional successRedirectUri) { + this.successRedirectUri = successRedirectUri; + return this; + } + + /** + *

    URI to redirect to on error

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorRedirectUri(String errorRedirectUri) { + this.errorRedirectUri = Optional.ofNullable(errorRedirectUri); + return this; + } + + /** + *

    URI to redirect to on error

    + */ + @java.lang.Override + @JsonSetter(value = "error_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage errorRedirectUri(Optional errorRedirectUri) { + this.errorRedirectUri = errorRedirectUri; + return this; + } + + /** + *

    List of allowed origins for CORS

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage allowedOrigins(List allowedOrigins) { + this.allowedOrigins = Optional.ofNullable(allowedOrigins); + return this; + } + + /** + *

    List of allowed origins for CORS

    + */ + @java.lang.Override + @JsonSetter(value = "allowed_origins", nulls = Nulls.SKIP) + public _FinalStage allowedOrigins(Optional> allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + @java.lang.Override + public CreateTokenRequest build() { + return new CreateTokenRequest( + allowedOrigins, + errorRedirectUri, + externalUserId, + projectId, + successRedirectUri, + webhookUri, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java new file mode 100644 index 0000000..1479f3c --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ValidateTokenParams; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokensValidateRequest.Builder.class) +public final class TokensValidateRequest { + private final Optional params; + + private final Map additionalProperties; + + private TokensValidateRequest(Optional params, Map additionalProperties) { + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("params") + public Optional getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokensValidateRequest && equalTo((TokensValidateRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokensValidateRequest other) { + return params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional params = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokensValidateRequest other) { + params(other.getParams()); + return this; + } + + @JsonSetter(value = "params", nulls = Nulls.SKIP) + public Builder params(Optional params) { + this.params = params; + return this; + } + + public Builder params(ValidateTokenParams params) { + this.params = Optional.ofNullable(params); + return this; + } + + public TokensValidateRequest build() { + return new TokensValidateRequest(params, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java new file mode 100644 index 0000000..8e4c08a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java @@ -0,0 +1,386 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployTriggerResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTriggersClient { + protected final ClientOptions clientOptions; + + public AsyncRawTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(TriggersListRequest.builder().build()); + } + + public CompletableFuture>> list( + TriggersListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + TriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + TriggersListRequest nextRequest = TriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + TriggersConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + TriggersReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> deploy(DeployTriggerOpts request) { + return deploy(request, null); + } + + public CompletableFuture> deploy( + DeployTriggerOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/deploy") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + DeployTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java new file mode 100644 index 0000000..2f3361f --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.ReloadPropsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncTriggersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTriggersClient rawClient; + + public AsyncTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTriggersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(TriggersListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + TriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(TriggersConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(TriggersReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture deploy(DeployTriggerOpts request) { + return this.rawClient.deploy(request).thenApply(response -> response.body()); + } + + public CompletableFuture deploy(DeployTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.deploy(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java new file mode 100644 index 0000000..83abd08 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployTriggerResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTriggersClient { + protected final ClientOptions clientOptions; + + public RawTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(TriggersListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(TriggersListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + TriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + TriggersListRequest nextRequest = TriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(TriggersConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(TriggersReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse deploy(DeployTriggerOpts request) { + return deploy(request, null); + } + + public PipedreamApiHttpResponse deploy( + DeployTriggerOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/deploy") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + DeployTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java new file mode 100644 index 0000000..d16a37b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.ReloadPropsResponse; + +public class TriggersClient { + protected final ClientOptions clientOptions; + + private final RawTriggersClient rawClient; + + public TriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTriggersClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(TriggersListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(TriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(TriggersConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(TriggersConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(TriggersReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(TriggersReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } + + public DeployedComponent deploy(DeployTriggerOpts request) { + return this.rawClient.deploy(request).body(); + } + + public DeployedComponent deploy(DeployTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.deploy(request, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java new file mode 100644 index 0000000..b45a651 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployTriggerOpts.Builder.class) +public final class DeployTriggerOpts { + private final String id; + + private final String externalUserId; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional webhookUrl; + + private final Map additionalProperties; + + private DeployTriggerOpts( + String id, + String externalUserId, + Optional> configuredProps, + Optional dynamicPropsId, + Optional webhookUrl, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.webhookUrl = webhookUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The trigger component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The configured properties for the trigger + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Optional webhook URL to receive trigger events + */ + @JsonProperty("webhook_url") + public Optional getWebhookUrl() { + return webhookUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployTriggerOpts && equalTo((DeployTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployTriggerOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && webhookUrl.equals(other.webhookUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.externalUserId, this.configuredProps, this.dynamicPropsId, this.webhookUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

    The trigger component ID

    + */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(DeployTriggerOpts other); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + DeployTriggerOpts build(); + + /** + *

    The configured properties for the trigger

    + */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

    The ID for dynamic props

    + */ + _FinalStage dynamicPropsId(Optional dynamicPropsId); + + _FinalStage dynamicPropsId(String dynamicPropsId); + + /** + *

    Optional webhook URL to receive trigger events

    + */ + _FinalStage webhookUrl(Optional webhookUrl); + + _FinalStage webhookUrl(String webhookUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional webhookUrl = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployTriggerOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + webhookUrl(other.getWebhookUrl()); + return this; + } + + /** + *

    The trigger component ID

    + *

    The trigger component ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ExternalUserIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The external user ID

    + *

    The external user ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    Optional webhook URL to receive trigger events

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage webhookUrl(String webhookUrl) { + this.webhookUrl = Optional.ofNullable(webhookUrl); + return this; + } + + /** + *

    Optional webhook URL to receive trigger events

    + */ + @java.lang.Override + @JsonSetter(value = "webhook_url", nulls = Nulls.SKIP) + public _FinalStage webhookUrl(Optional webhookUrl) { + this.webhookUrl = webhookUrl; + return this; + } + + /** + *

    The ID for dynamic props

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dynamicPropsId(String dynamicPropsId) { + this.dynamicPropsId = Optional.ofNullable(dynamicPropsId); + return this; + } + + /** + *

    The ID for dynamic props

    + */ + @java.lang.Override + @JsonSetter(value = "dynamic_props_id", nulls = Nulls.SKIP) + public _FinalStage dynamicPropsId(Optional dynamicPropsId) { + this.dynamicPropsId = dynamicPropsId; + return this; + } + + /** + *

    The configured properties for the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps = Optional.ofNullable(configuredProps); + return this; + } + + /** + *

    The configured properties for the trigger

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + @java.lang.Override + public DeployTriggerOpts build() { + return new DeployTriggerOpts( + id, externalUserId, configuredProps, dynamicPropsId, webhookUrl, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java new file mode 100644 index 0000000..dda960b --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ConfigurePropOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TriggersConfigurePropRequest.Builder.class) +public final class TriggersConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private TriggersConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersConfigurePropRequest && equalTo((TriggersConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(TriggersConfigurePropRequest other); + } + + public interface _FinalStage { + TriggersConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TriggersConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public TriggersConfigurePropRequest build() { + return new TriggersConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java new file mode 100644 index 0000000..833a738 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TriggersListRequest.Builder.class) +public final class TriggersListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private TriggersListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the triggers + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the triggers + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersListRequest && equalTo((TriggersListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TriggersListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    A search query to filter the triggers

    + */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

    The ID or name slug of the app to filter the triggers

    + */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public TriggersListRequest build() { + return new TriggersListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java new file mode 100644 index 0000000..b40b8ca --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ReloadPropsOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TriggersReloadPropsRequest.Builder.class) +public final class TriggersReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private TriggersReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersReloadPropsRequest && equalTo((TriggersReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(TriggersReloadPropsRequest other); + } + + public interface _FinalStage { + TriggersReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TriggersReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public TriggersReloadPropsRequest build() { + return new TriggersReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java new file mode 100644 index 0000000..5cb2cdb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawUsersClient { + protected final ClientOptions clientOptions; + + public AsyncRawUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> deleteExternalUser(String externalUserId) { + return deleteExternalUser(externalUserId, null); + } + + public CompletableFuture> deleteExternalUser( + String externalUserId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("users") + .addPathSegment(externalUserId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java new file mode 100644 index 0000000..97dafe2 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import java.util.concurrent.CompletableFuture; + +public class AsyncUsersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawUsersClient rawClient; + + public AsyncUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawUsersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawUsersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture deleteExternalUser(String externalUserId) { + return this.rawClient.deleteExternalUser(externalUserId).thenApply(response -> response.body()); + } + + public CompletableFuture deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + return this.rawClient.deleteExternalUser(externalUserId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java new file mode 100644 index 0000000..7fe69c9 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawUsersClient { + protected final ClientOptions clientOptions; + + public RawUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse deleteExternalUser(String externalUserId) { + return deleteExternalUser(externalUserId, null); + } + + public PipedreamApiHttpResponse deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("users") + .addPathSegment(externalUserId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/UsersClient.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/UsersClient.java new file mode 100644 index 0000000..a00362d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/resources/users/UsersClient.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; + +public class UsersClient { + protected final ClientOptions clientOptions; + + private final RawUsersClient rawClient; + + public UsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawUsersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawUsersClient withRawResponse() { + return this.rawClient; + } + + public void deleteExternalUser(String externalUserId) { + this.rawClient.deleteExternalUser(externalUserId).body(); + } + + public void deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + this.rawClient.deleteExternalUser(externalUserId, requestOptions).body(); + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Account.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Account.java new file mode 100644 index 0000000..30c5157 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Account.java @@ -0,0 +1,485 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Account.Builder.class) +public final class Account { + private final Optional id; + + private final Optional name; + + private final Optional externalId; + + private final Optional healthy; + + private final Optional dead; + + private final Optional app; + + private final Optional createdAt; + + private final Optional updatedAt; + + private final Optional> credentials; + + private final Optional expiresAt; + + private final Optional error; + + private final Optional lastRefreshedAt; + + private final Optional nextRefreshAt; + + private final Map additionalProperties; + + private Account( + Optional id, + Optional name, + Optional externalId, + Optional healthy, + Optional dead, + Optional app, + Optional createdAt, + Optional updatedAt, + Optional> credentials, + Optional expiresAt, + Optional error, + Optional lastRefreshedAt, + Optional nextRefreshAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.externalId = externalId; + this.healthy = healthy; + this.dead = dead; + this.app = app; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.credentials = credentials; + this.expiresAt = expiresAt; + this.error = error; + this.lastRefreshedAt = lastRefreshedAt; + this.nextRefreshAt = nextRefreshAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique ID of the account. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The custom name of the account if set. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return The external ID associated with the account. + */ + @JsonProperty("external_id") + public Optional getExternalId() { + return externalId; + } + + /** + * @return Indicates if the account is healthy. Pipedream will periodically retry token refresh and test requests for unhealthy accounts + */ + @JsonProperty("healthy") + public Optional getHealthy() { + return healthy; + } + + /** + * @return Indicates if the account is no longer active + */ + @JsonProperty("dead") + public Optional getDead() { + return dead; + } + + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return The date and time the account was created, an ISO 8601 formatted string + */ + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + /** + * @return The date and time the account was last updated, an ISO 8601 formatted string + */ + @JsonProperty("updated_at") + public Optional getUpdatedAt() { + return updatedAt; + } + + /** + * @return The credentials associated with the account, if the include_credentials parameter was set to true in the request + */ + @JsonProperty("credentials") + public Optional> getCredentials() { + return credentials; + } + + /** + * @return The date and time the account's credentials expiration, an ISO 8601 formatted string + */ + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + /** + * @return The error message if the account is unhealthy or dead, null otherwise + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return The date and time the account was last refreshed, an ISO 8601 formatted string + */ + @JsonProperty("last_refreshed_at") + public Optional getLastRefreshedAt() { + return lastRefreshedAt; + } + + /** + * @return The date and time the account will next be refreshed, an ISO 8601 formatted string + */ + @JsonProperty("next_refresh_at") + public Optional getNextRefreshAt() { + return nextRefreshAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Account && equalTo((Account) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Account other) { + return id.equals(other.id) + && name.equals(other.name) + && externalId.equals(other.externalId) + && healthy.equals(other.healthy) + && dead.equals(other.dead) + && app.equals(other.app) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && credentials.equals(other.credentials) + && expiresAt.equals(other.expiresAt) + && error.equals(other.error) + && lastRefreshedAt.equals(other.lastRefreshedAt) + && nextRefreshAt.equals(other.nextRefreshAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.externalId, + this.healthy, + this.dead, + this.app, + this.createdAt, + this.updatedAt, + this.credentials, + this.expiresAt, + this.error, + this.lastRefreshedAt, + this.nextRefreshAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional externalId = Optional.empty(); + + private Optional healthy = Optional.empty(); + + private Optional dead = Optional.empty(); + + private Optional app = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional updatedAt = Optional.empty(); + + private Optional> credentials = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional lastRefreshedAt = Optional.empty(); + + private Optional nextRefreshAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(Account other) { + id(other.getId()); + name(other.getName()); + externalId(other.getExternalId()); + healthy(other.getHealthy()); + dead(other.getDead()); + app(other.getApp()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + credentials(other.getCredentials()); + expiresAt(other.getExpiresAt()); + error(other.getError()); + lastRefreshedAt(other.getLastRefreshedAt()); + nextRefreshAt(other.getNextRefreshAt()); + return this; + } + + /** + *

    The unique ID of the account.

    + */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

    The custom name of the account if set.

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    The external ID associated with the account.

    + */ + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public Builder externalId(Optional externalId) { + this.externalId = externalId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = Optional.ofNullable(externalId); + return this; + } + + /** + *

    Indicates if the account is healthy. Pipedream will periodically retry token refresh and test requests for unhealthy accounts

    + */ + @JsonSetter(value = "healthy", nulls = Nulls.SKIP) + public Builder healthy(Optional healthy) { + this.healthy = healthy; + return this; + } + + public Builder healthy(Boolean healthy) { + this.healthy = Optional.ofNullable(healthy); + return this; + } + + /** + *

    Indicates if the account is no longer active

    + */ + @JsonSetter(value = "dead", nulls = Nulls.SKIP) + public Builder dead(Optional dead) { + this.dead = dead; + return this; + } + + public Builder dead(Boolean dead) { + this.dead = Optional.ofNullable(dead); + return this; + } + + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(App app) { + this.app = Optional.ofNullable(app); + return this; + } + + /** + *

    The date and time the account was created, an ISO 8601 formatted string

    + */ + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

    The date and time the account was last updated, an ISO 8601 formatted string

    + */ + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public Builder updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + /** + *

    The credentials associated with the account, if the include_credentials parameter was set to true in the request

    + */ + @JsonSetter(value = "credentials", nulls = Nulls.SKIP) + public Builder credentials(Optional> credentials) { + this.credentials = credentials; + return this; + } + + public Builder credentials(Map credentials) { + this.credentials = Optional.ofNullable(credentials); + return this; + } + + /** + *

    The date and time the account's credentials expiration, an ISO 8601 formatted string

    + */ + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

    The error message if the account is unhealthy or dead, null otherwise

    + */ + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

    The date and time the account was last refreshed, an ISO 8601 formatted string

    + */ + @JsonSetter(value = "last_refreshed_at", nulls = Nulls.SKIP) + public Builder lastRefreshedAt(Optional lastRefreshedAt) { + this.lastRefreshedAt = lastRefreshedAt; + return this; + } + + public Builder lastRefreshedAt(OffsetDateTime lastRefreshedAt) { + this.lastRefreshedAt = Optional.ofNullable(lastRefreshedAt); + return this; + } + + /** + *

    The date and time the account will next be refreshed, an ISO 8601 formatted string

    + */ + @JsonSetter(value = "next_refresh_at", nulls = Nulls.SKIP) + public Builder nextRefreshAt(Optional nextRefreshAt) { + this.nextRefreshAt = nextRefreshAt; + return this; + } + + public Builder nextRefreshAt(OffsetDateTime nextRefreshAt) { + this.nextRefreshAt = Optional.ofNullable(nextRefreshAt); + return this; + } + + public Account build() { + return new Account( + id, + name, + externalId, + healthy, + dead, + app, + createdAt, + updatedAt, + credentials, + expiresAt, + error, + lastRefreshedAt, + nextRefreshAt, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/App.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/App.java new file mode 100644 index 0000000..2983820 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/App.java @@ -0,0 +1,472 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = App.Builder.class) +public final class App { + private final Optional id; + + private final String nameSlug; + + private final String name; + + private final Optional authType; + + private final Optional description; + + private final String imgSrc; + + private final Optional customFieldsJson; + + private final List categories; + + private final double featuredWeight; + + private final Map additionalProperties; + + private App( + Optional id, + String nameSlug, + String name, + Optional authType, + Optional description, + String imgSrc, + Optional customFieldsJson, + List categories, + double featuredWeight, + Map additionalProperties) { + this.id = id; + this.nameSlug = nameSlug; + this.name = name; + this.authType = authType; + this.description = description; + this.imgSrc = imgSrc; + this.customFieldsJson = customFieldsJson; + this.categories = categories; + this.featuredWeight = featuredWeight; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app. Only applies for OAuth apps. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug) + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + /** + * @return The human-readable name of the app + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The authentication type used by the app + */ + @JsonProperty("auth_type") + public Optional getAuthType() { + return authType; + } + + /** + * @return A short description of the app + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The URL to the app's logo + */ + @JsonProperty("img_src") + public String getImgSrc() { + return imgSrc; + } + + /** + * @return A JSON string representing the custom fields for the app + */ + @JsonProperty("custom_fields_json") + public Optional getCustomFieldsJson() { + return customFieldsJson; + } + + /** + * @return Categories associated with the app + */ + @JsonProperty("categories") + public List getCategories() { + return categories; + } + + /** + * @return A rough directional ordering of app popularity, subject to changes by Pipedream + */ + @JsonProperty("featured_weight") + public double getFeaturedWeight() { + return featuredWeight; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof App && equalTo((App) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(App other) { + return id.equals(other.id) + && nameSlug.equals(other.nameSlug) + && name.equals(other.name) + && authType.equals(other.authType) + && description.equals(other.description) + && imgSrc.equals(other.imgSrc) + && customFieldsJson.equals(other.customFieldsJson) + && categories.equals(other.categories) + && featuredWeight == other.featuredWeight; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.nameSlug, + this.name, + this.authType, + this.description, + this.imgSrc, + this.customFieldsJson, + this.categories, + this.featuredWeight); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameSlugStage builder() { + return new Builder(); + } + + public interface NameSlugStage { + /** + *

    The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

    + */ + NameStage nameSlug(@NotNull String nameSlug); + + Builder from(App other); + } + + public interface NameStage { + /** + *

    The human-readable name of the app

    + */ + ImgSrcStage name(@NotNull String name); + } + + public interface ImgSrcStage { + /** + *

    The URL to the app's logo

    + */ + FeaturedWeightStage imgSrc(@NotNull String imgSrc); + } + + public interface FeaturedWeightStage { + /** + *

    A rough directional ordering of app popularity, subject to changes by Pipedream

    + */ + _FinalStage featuredWeight(double featuredWeight); + } + + public interface _FinalStage { + App build(); + + /** + *

    ID of the app. Only applies for OAuth apps.

    + */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + + /** + *

    The authentication type used by the app

    + */ + _FinalStage authType(Optional authType); + + _FinalStage authType(AppAuthType authType); + + /** + *

    A short description of the app

    + */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

    A JSON string representing the custom fields for the app

    + */ + _FinalStage customFieldsJson(Optional customFieldsJson); + + _FinalStage customFieldsJson(String customFieldsJson); + + /** + *

    Categories associated with the app

    + */ + _FinalStage categories(List categories); + + _FinalStage addCategories(String categories); + + _FinalStage addAllCategories(List categories); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements NameSlugStage, NameStage, ImgSrcStage, FeaturedWeightStage, _FinalStage { + private String nameSlug; + + private String name; + + private String imgSrc; + + private double featuredWeight; + + private List categories = new ArrayList<>(); + + private Optional customFieldsJson = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional authType = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(App other) { + id(other.getId()); + nameSlug(other.getNameSlug()); + name(other.getName()); + authType(other.getAuthType()); + description(other.getDescription()); + imgSrc(other.getImgSrc()); + customFieldsJson(other.getCustomFieldsJson()); + categories(other.getCategories()); + featuredWeight(other.getFeaturedWeight()); + return this; + } + + /** + *

    The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

    + *

    The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name_slug") + public NameStage nameSlug(@NotNull String nameSlug) { + this.nameSlug = Objects.requireNonNull(nameSlug, "nameSlug must not be null"); + return this; + } + + /** + *

    The human-readable name of the app

    + *

    The human-readable name of the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public ImgSrcStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

    The URL to the app's logo

    + *

    The URL to the app's logo

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("img_src") + public FeaturedWeightStage imgSrc(@NotNull String imgSrc) { + this.imgSrc = Objects.requireNonNull(imgSrc, "imgSrc must not be null"); + return this; + } + + /** + *

    A rough directional ordering of app popularity, subject to changes by Pipedream

    + *

    A rough directional ordering of app popularity, subject to changes by Pipedream

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("featured_weight") + public _FinalStage featuredWeight(double featuredWeight) { + this.featuredWeight = featuredWeight; + return this; + } + + /** + *

    Categories associated with the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllCategories(List categories) { + this.categories.addAll(categories); + return this; + } + + /** + *

    Categories associated with the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addCategories(String categories) { + this.categories.add(categories); + return this; + } + + /** + *

    Categories associated with the app

    + */ + @java.lang.Override + @JsonSetter(value = "categories", nulls = Nulls.SKIP) + public _FinalStage categories(List categories) { + this.categories.clear(); + this.categories.addAll(categories); + return this; + } + + /** + *

    A JSON string representing the custom fields for the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customFieldsJson(String customFieldsJson) { + this.customFieldsJson = Optional.ofNullable(customFieldsJson); + return this; + } + + /** + *

    A JSON string representing the custom fields for the app

    + */ + @java.lang.Override + @JsonSetter(value = "custom_fields_json", nulls = Nulls.SKIP) + public _FinalStage customFieldsJson(Optional customFieldsJson) { + this.customFieldsJson = customFieldsJson; + return this; + } + + /** + *

    A short description of the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    A short description of the app

    + */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

    The authentication type used by the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage authType(AppAuthType authType) { + this.authType = Optional.ofNullable(authType); + return this; + } + + /** + *

    The authentication type used by the app

    + */ + @java.lang.Override + @JsonSetter(value = "auth_type", nulls = Nulls.SKIP) + public _FinalStage authType(Optional authType) { + this.authType = authType; + return this; + } + + /** + *

    ID of the app. Only applies for OAuth apps.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

    ID of the app. Only applies for OAuth apps.

    + */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public App build() { + return new App( + id, + nameSlug, + name, + authType, + description, + imgSrc, + customFieldsJson, + categories, + featuredWeight, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppAuthType.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppAuthType.java new file mode 100644 index 0000000..e795709 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppAuthType.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppAuthType { + KEYS("keys"), + + OAUTH("oauth"), + + NONE("none"); + + private final String value; + + AppAuthType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppCategory.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppCategory.java new file mode 100644 index 0000000..12799ff --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/AppCategory.java @@ -0,0 +1,161 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppCategory.Builder.class) +public final class AppCategory { + private final Optional id; + + private final Optional name; + + private final Optional description; + + private final Map additionalProperties; + + private AppCategory( + Optional id, + Optional name, + Optional description, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app category + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The human-readable name of the app category + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return A short description of the app category + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppCategory && equalTo((AppCategory) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppCategory other) { + return id.equals(other.id) && name.equals(other.name) && description.equals(other.description); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.description); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppCategory other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + return this; + } + + /** + *

    ID of the app category

    + */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

    The human-readable name of the app category

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    A short description of the app category

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public AppCategory build() { + return new AppCategory(id, name, description, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/BackendClientOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/BackendClientOpts.java new file mode 100644 index 0000000..cdf9287 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/BackendClientOpts.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BackendClientOpts.Builder.class) +public final class BackendClientOpts { + private final Optional clientId; + + private final Optional clientSecret; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private BackendClientOpts( + Optional clientId, + Optional clientSecret, + Optional apiUrl, + Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The client ID for authentication + */ + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + /** + * @return The client secret for authentication + */ + @JsonProperty("client_secret") + public Optional getClientSecret() { + return clientSecret; + } + + /** + * @return The API URL to use + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BackendClientOpts && equalTo((BackendClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BackendClientOpts other) { + return clientId.equals(other.clientId) + && clientSecret.equals(other.clientSecret) + && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional clientId = Optional.empty(); + + private Optional clientSecret = Optional.empty(); + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BackendClientOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

    The client ID for authentication

    + */ + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(String clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + /** + *

    The client secret for authentication

    + */ + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public Builder clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public Builder clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

    The API URL to use

    + */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public BackendClientOpts build() { + return new BackendClientOpts(clientId, clientSecret, apiUrl, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ClientOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ClientOpts.java new file mode 100644 index 0000000..70aa6e6 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ClientOpts.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientOpts.Builder.class) +public final class ClientOpts { + private final Optional clientId; + + private final Optional clientSecret; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private ClientOpts( + Optional clientId, + Optional clientSecret, + Optional apiUrl, + Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The client ID for authentication + */ + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + /** + * @return The client secret for authentication + */ + @JsonProperty("client_secret") + public Optional getClientSecret() { + return clientSecret; + } + + /** + * @return The API URL to use (defaults to https://api.pipedream.com/) + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientOpts && equalTo((ClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientOpts other) { + return clientId.equals(other.clientId) + && clientSecret.equals(other.clientSecret) + && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional clientId = Optional.empty(); + + private Optional clientSecret = Optional.empty(); + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

    The client ID for authentication

    + */ + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(String clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + /** + *

    The client secret for authentication

    + */ + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public Builder clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public Builder clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

    The API URL to use (defaults to https://api.pipedream.com/)

    + */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public ClientOpts build() { + return new ClientOpts(clientId, clientSecret, apiUrl, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Component.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Component.java new file mode 100644 index 0000000..95cbe86 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/Component.java @@ -0,0 +1,365 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Component.Builder.class) +public final class Component { + private final String key; + + private final String name; + + private final String version; + + private final List configurableProps; + + private final Optional description; + + private final Optional componentType; + + private final Optional stash; + + private final Map additionalProperties; + + private Component( + String key, + String name, + String version, + List configurableProps, + Optional description, + Optional componentType, + Optional stash, + Map additionalProperties) { + this.key = key; + this.name = name; + this.version = version; + this.configurableProps = configurableProps; + this.description = description; + this.componentType = componentType; + this.stash = stash; + this.additionalProperties = additionalProperties; + } + + /** + * @return The key that uniquely identifies the component. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return The human-readable name of the component, e.g. 'GitLab: List Commits' + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The latest version of the component, in SemVer format. + */ + @JsonProperty("version") + public String getVersion() { + return version; + } + + @JsonProperty("configurable_props") + public List getConfigurableProps() { + return configurableProps; + } + + /** + * @return A description of the component + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The type of component (trigger or action) + */ + @JsonProperty("component_type") + public Optional getComponentType() { + return componentType; + } + + /** + * @return Indicates if a File Stash ID is optional or required to run the component + */ + @JsonProperty("stash") + public Optional getStash() { + return stash; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Component && equalTo((Component) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Component other) { + return key.equals(other.key) + && name.equals(other.name) + && version.equals(other.version) + && configurableProps.equals(other.configurableProps) + && description.equals(other.description) + && componentType.equals(other.componentType) + && stash.equals(other.stash); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.key, + this.name, + this.version, + this.configurableProps, + this.description, + this.componentType, + this.stash); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

    The key that uniquely identifies the component.

    + */ + NameStage key(@NotNull String key); + + Builder from(Component other); + } + + public interface NameStage { + /** + *

    The human-readable name of the component, e.g. 'GitLab: List Commits'

    + */ + VersionStage name(@NotNull String name); + } + + public interface VersionStage { + /** + *

    The latest version of the component, in SemVer format.

    + */ + _FinalStage version(@NotNull String version); + } + + public interface _FinalStage { + Component build(); + + _FinalStage configurableProps(List configurableProps); + + _FinalStage addConfigurableProps(ConfigurableProp configurableProps); + + _FinalStage addAllConfigurableProps(List configurableProps); + + /** + *

    A description of the component

    + */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

    The type of component (trigger or action)

    + */ + _FinalStage componentType(Optional componentType); + + _FinalStage componentType(String componentType); + + /** + *

    Indicates if a File Stash ID is optional or required to run the component

    + */ + _FinalStage stash(Optional stash); + + _FinalStage stash(ComponentStash stash); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, NameStage, VersionStage, _FinalStage { + private String key; + + private String name; + + private String version; + + private Optional stash = Optional.empty(); + + private Optional componentType = Optional.empty(); + + private Optional description = Optional.empty(); + + private List configurableProps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Component other) { + key(other.getKey()); + name(other.getName()); + version(other.getVersion()); + configurableProps(other.getConfigurableProps()); + description(other.getDescription()); + componentType(other.getComponentType()); + stash(other.getStash()); + return this; + } + + /** + *

    The key that uniquely identifies the component.

    + *

    The key that uniquely identifies the component.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("key") + public NameStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + /** + *

    The human-readable name of the component, e.g. 'GitLab: List Commits'

    + *

    The human-readable name of the component, e.g. 'GitLab: List Commits'

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public VersionStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

    The latest version of the component, in SemVer format.

    + *

    The latest version of the component, in SemVer format.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("version") + public _FinalStage version(@NotNull String version) { + this.version = Objects.requireNonNull(version, "version must not be null"); + return this; + } + + /** + *

    Indicates if a File Stash ID is optional or required to run the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stash(ComponentStash stash) { + this.stash = Optional.ofNullable(stash); + return this; + } + + /** + *

    Indicates if a File Stash ID is optional or required to run the component

    + */ + @java.lang.Override + @JsonSetter(value = "stash", nulls = Nulls.SKIP) + public _FinalStage stash(Optional stash) { + this.stash = stash; + return this; + } + + /** + *

    The type of component (trigger or action)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage componentType(String componentType) { + this.componentType = Optional.ofNullable(componentType); + return this; + } + + /** + *

    The type of component (trigger or action)

    + */ + @java.lang.Override + @JsonSetter(value = "component_type", nulls = Nulls.SKIP) + public _FinalStage componentType(Optional componentType) { + this.componentType = componentType; + return this; + } + + /** + *

    A description of the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    A description of the component

    + */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public _FinalStage addAllConfigurableProps(List configurableProps) { + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public _FinalStage addConfigurableProps(ConfigurableProp configurableProps) { + this.configurableProps.add(configurableProps); + return this; + } + + @java.lang.Override + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public _FinalStage configurableProps(List configurableProps) { + this.configurableProps.clear(); + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public Component build() { + return new Component( + key, name, version, configurableProps, description, componentType, stash, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ComponentStash.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ComponentStash.java new file mode 100644 index 0000000..ffbda73 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ComponentStash.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ComponentStash { + OPTIONAL("optional"), + + REQUIRED("required"); + + private final String value; + + ComponentStash(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurableProp.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurableProp.java new file mode 100644 index 0000000..9b27278 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurableProp.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurableProp.Builder.class) +public final class ConfigurableProp { + private final Optional name; + + private final Optional type; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurableProp( + Optional name, + Optional type, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.name = name; + this.type = type; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurableProp && equalTo((ConfigurableProp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurableProp other) { + return name.equals(other.name) + && type.equals(other.type) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.type, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurableProp other) { + name(other.getName()); + type(other.getType()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurableProp build() { + return new ConfigurableProp( + name, + type, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java new file mode 100644 index 0000000..782303c --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java @@ -0,0 +1,484 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropAlert.Builder.class) +public final class ConfigurablePropAlert { + private final Optional type; + + private final Optional alertType; + + private final Optional content; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropAlert( + Optional type, + Optional alertType, + Optional content, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.alertType = alertType; + this.content = content; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return The severity level of the alert. + */ + @JsonProperty("alertType") + public Optional getAlertType() { + return alertType; + } + + /** + * @return The content of the alert, which can include HTML or plain text. + */ + @JsonProperty("content") + public Optional getContent() { + return content; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropAlert && equalTo((ConfigurablePropAlert) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropAlert other) { + return type.equals(other.type) + && alertType.equals(other.alertType) + && content.equals(other.content) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.alertType, + this.content, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional alertType = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropAlert other) { + type(other.getType()); + alertType(other.getAlertType()); + content(other.getContent()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    The severity level of the alert.

    + */ + @JsonSetter(value = "alertType", nulls = Nulls.SKIP) + public Builder alertType(Optional alertType) { + this.alertType = alertType; + return this; + } + + public Builder alertType(ConfigurablePropAlertAlertType alertType) { + this.alertType = Optional.ofNullable(alertType); + return this; + } + + /** + *

    The content of the alert, which can include HTML or plain text.

    + */ + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public Builder content(Optional content) { + this.content = content; + return this; + } + + public Builder content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropAlert build() { + return new ConfigurablePropAlert( + type, + alertType, + content, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java new file mode 100644 index 0000000..539ca52 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ConfigurablePropAlertAlertType { + INFO("info"), + + NEUTRAL("neutral"), + + WARNING("warning"), + + ERROR("error"); + + private final String value; + + ConfigurablePropAlertAlertType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java new file mode 100644 index 0000000..87824c9 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropAny.Builder.class) +public final class ConfigurablePropAny { + private final Optional type; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropAny( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropAny && equalTo((ConfigurablePropAny) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropAny other) { + return type.equals(other.type) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropAny other) { + type(other.getType()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropAny build() { + return new ConfigurablePropAny( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java new file mode 100644 index 0000000..f6e4246 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropApp.Builder.class) +public final class ConfigurablePropApp { + private final Optional type; + + private final Optional app; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropApp( + Optional type, + Optional app, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.app = app; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured. + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropApp && equalTo((ConfigurablePropApp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropApp other) { + return type.equals(other.type) + && app.equals(other.app) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.app, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional app = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropApp other) { + type(other.getType()); + app(other.getApp()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured.

    + */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropApp build() { + return new ConfigurablePropApp( + type, + app, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java new file mode 100644 index 0000000..ad596d0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropBoolean.Builder.class) +public final class ConfigurablePropBoolean { + private final Optional type; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropBoolean( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropBoolean && equalTo((ConfigurablePropBoolean) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropBoolean other) { + return type.equals(other.type) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropBoolean other) { + type(other.getType()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropBoolean build() { + return new ConfigurablePropBoolean( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java new file mode 100644 index 0000000..91fffbf --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropDiscord.Builder.class) +public final class ConfigurablePropDiscord { + private final Optional type; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropDiscord( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropDiscord && equalTo((ConfigurablePropDiscord) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropDiscord other) { + return type.equals(other.type) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropDiscord other) { + type(other.getType()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropDiscord build() { + return new ConfigurablePropDiscord( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java new file mode 100644 index 0000000..ddbdf76 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java @@ -0,0 +1,484 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropInteger.Builder.class) +public final class ConfigurablePropInteger { + private final Optional type; + + private final Optional min; + + private final Optional max; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropInteger( + Optional type, + Optional min, + Optional max, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.min = min; + this.max = max; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return The minimum value for this integer prop. + */ + @JsonProperty("min") + public Optional getMin() { + return min; + } + + /** + * @return The maximum value for this integer prop. + */ + @JsonProperty("max") + public Optional getMax() { + return max; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropInteger && equalTo((ConfigurablePropInteger) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropInteger other) { + return type.equals(other.type) + && min.equals(other.min) + && max.equals(other.max) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.min, + this.max, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional min = Optional.empty(); + + private Optional max = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropInteger other) { + type(other.getType()); + min(other.getMin()); + max(other.getMax()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    The minimum value for this integer prop.

    + */ + @JsonSetter(value = "min", nulls = Nulls.SKIP) + public Builder min(Optional min) { + this.min = min; + return this; + } + + public Builder min(Integer min) { + this.min = Optional.ofNullable(min); + return this; + } + + /** + *

    The maximum value for this integer prop.

    + */ + @JsonSetter(value = "max", nulls = Nulls.SKIP) + public Builder max(Optional max) { + this.max = max; + return this; + } + + public Builder max(Integer max) { + this.max = Optional.ofNullable(max); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropInteger build() { + return new ConfigurablePropInteger( + type, + min, + max, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java new file mode 100644 index 0000000..0cd6fa0 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropObject.Builder.class) +public final class ConfigurablePropObject { + private final Optional type; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropObject( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropObject && equalTo((ConfigurablePropObject) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropObject other) { + return type.equals(other.type) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropObject other) { + type(other.getType()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropObject build() { + return new ConfigurablePropObject( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropString.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropString.java new file mode 100644 index 0000000..c85dcf4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropString.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropString.Builder.class) +public final class ConfigurablePropString { + private final Optional type; + + private final Optional secret; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropString( + Optional type, + Optional secret, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.secret = secret; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return If true, this prop is a secret and should not be displayed in plain text. + */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropString && equalTo((ConfigurablePropString) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropString other) { + return type.equals(other.type) + && secret.equals(other.secret) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.secret, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional secret = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropString other) { + type(other.getType()); + secret(other.getSecret()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    If true, this prop is a secret and should not be displayed in plain text.

    + */ + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public Builder secret(Optional secret) { + this.secret = secret; + return this; + } + + public Builder secret(Boolean secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropString build() { + return new ConfigurablePropString( + type, + secret, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java new file mode 100644 index 0000000..664fc6a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropStringArray.Builder.class) +public final class ConfigurablePropStringArray { + private final Optional type; + + private final Optional secret; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropStringArray( + Optional type, + Optional secret, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.secret = secret; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return If true, this prop is a secret and should not be displayed in plain text. + */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropStringArray && equalTo((ConfigurablePropStringArray) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropStringArray other) { + return type.equals(other.type) + && secret.equals(other.secret) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.secret, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional secret = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropStringArray other) { + type(other.getType()); + secret(other.getSecret()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    If true, this prop is a secret and should not be displayed in plain text.

    + */ + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public Builder secret(Optional secret) { + this.secret = secret; + return this; + } + + public Builder secret(Boolean secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropStringArray build() { + return new ConfigurablePropStringArray( + type, + secret, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java new file mode 100644 index 0000000..86455a5 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java @@ -0,0 +1,509 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurePropOpts.Builder.class) +public final class ConfigurePropOpts { + private final String id; + + private final String externalUserId; + + private final String propName; + + private final Optional blocking; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional asyncHandle; + + private final Optional page; + + private final Optional> prevContext; + + private final Optional query; + + private final Map additionalProperties; + + private ConfigurePropOpts( + String id, + String externalUserId, + String propName, + Optional blocking, + Optional> configuredProps, + Optional dynamicPropsId, + Optional asyncHandle, + Optional page, + Optional> prevContext, + Optional query, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.propName = propName; + this.blocking = blocking; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.asyncHandle = asyncHandle; + this.page = page; + this.prevContext = prevContext; + this.query = query; + this.additionalProperties = additionalProperties; + } + + /** + * @return The component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The name of the prop to configure + */ + @JsonProperty("prop_name") + public String getPropName() { + return propName; + } + + /** + * @return Whether this operation should block until completion + */ + @JsonProperty("blocking") + public Optional getBlocking() { + return blocking; + } + + /** + * @return The configured properties for the component + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Handle for async operations + */ + @JsonProperty("async_handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + /** + * @return Page number for paginated results + */ + @JsonProperty("page") + public Optional getPage() { + return page; + } + + /** + * @return Previous context for pagination + */ + @JsonProperty("prev_context") + public Optional> getPrevContext() { + return prevContext; + } + + /** + * @return Search query for filtering options + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurePropOpts && equalTo((ConfigurePropOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurePropOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && propName.equals(other.propName) + && blocking.equals(other.blocking) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && asyncHandle.equals(other.asyncHandle) + && page.equals(other.page) + && prevContext.equals(other.prevContext) + && query.equals(other.query); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.externalUserId, + this.propName, + this.blocking, + this.configuredProps, + this.dynamicPropsId, + this.asyncHandle, + this.page, + this.prevContext, + this.query); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

    The component ID

    + */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(ConfigurePropOpts other); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID

    + */ + PropNameStage externalUserId(@NotNull String externalUserId); + } + + public interface PropNameStage { + /** + *

    The name of the prop to configure

    + */ + _FinalStage propName(@NotNull String propName); + } + + public interface _FinalStage { + ConfigurePropOpts build(); + + /** + *

    Whether this operation should block until completion

    + */ + _FinalStage blocking(Optional blocking); + + _FinalStage blocking(Boolean blocking); + + /** + *

    The configured properties for the component

    + */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

    The ID for dynamic props

    + */ + _FinalStage dynamicPropsId(Optional dynamicPropsId); + + _FinalStage dynamicPropsId(String dynamicPropsId); + + /** + *

    Handle for async operations

    + */ + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + + /** + *

    Page number for paginated results

    + */ + _FinalStage page(Optional page); + + _FinalStage page(Double page); + + /** + *

    Previous context for pagination

    + */ + _FinalStage prevContext(Optional> prevContext); + + _FinalStage prevContext(Map prevContext); + + /** + *

    Search query for filtering options

    + */ + _FinalStage query(Optional query); + + _FinalStage query(String query); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, PropNameStage, _FinalStage { + private String id; + + private String externalUserId; + + private String propName; + + private Optional query = Optional.empty(); + + private Optional> prevContext = Optional.empty(); + + private Optional page = Optional.empty(); + + private Optional asyncHandle = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional blocking = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConfigurePropOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + propName(other.getPropName()); + blocking(other.getBlocking()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + asyncHandle(other.getAsyncHandle()); + page(other.getPage()); + prevContext(other.getPrevContext()); + query(other.getQuery()); + return this; + } + + /** + *

    The component ID

    + *

    The component ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ExternalUserIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The external user ID

    + *

    The external user ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public PropNameStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The name of the prop to configure

    + *

    The name of the prop to configure

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("prop_name") + public _FinalStage propName(@NotNull String propName) { + this.propName = Objects.requireNonNull(propName, "propName must not be null"); + return this; + } + + /** + *

    Search query for filtering options

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

    Search query for filtering options

    + */ + @java.lang.Override + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public _FinalStage query(Optional query) { + this.query = query; + return this; + } + + /** + *

    Previous context for pagination

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage prevContext(Map prevContext) { + this.prevContext = Optional.ofNullable(prevContext); + return this; + } + + /** + *

    Previous context for pagination

    + */ + @java.lang.Override + @JsonSetter(value = "prev_context", nulls = Nulls.SKIP) + public _FinalStage prevContext(Optional> prevContext) { + this.prevContext = prevContext; + return this; + } + + /** + *

    Page number for paginated results

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage page(Double page) { + this.page = Optional.ofNullable(page); + return this; + } + + /** + *

    Page number for paginated results

    + */ + @java.lang.Override + @JsonSetter(value = "page", nulls = Nulls.SKIP) + public _FinalStage page(Optional page) { + this.page = page; + return this; + } + + /** + *

    Handle for async operations

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + /** + *

    Handle for async operations

    + */ + @java.lang.Override + @JsonSetter(value = "async_handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + /** + *

    The ID for dynamic props

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dynamicPropsId(String dynamicPropsId) { + this.dynamicPropsId = Optional.ofNullable(dynamicPropsId); + return this; + } + + /** + *

    The ID for dynamic props

    + */ + @java.lang.Override + @JsonSetter(value = "dynamic_props_id", nulls = Nulls.SKIP) + public _FinalStage dynamicPropsId(Optional dynamicPropsId) { + this.dynamicPropsId = dynamicPropsId; + return this; + } + + /** + *

    The configured properties for the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps = Optional.ofNullable(configuredProps); + return this; + } + + /** + *

    The configured properties for the component

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + /** + *

    Whether this operation should block until completion

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage blocking(Boolean blocking) { + this.blocking = Optional.ofNullable(blocking); + return this; + } + + /** + *

    Whether this operation should block until completion

    + */ + @java.lang.Override + @JsonSetter(value = "blocking", nulls = Nulls.SKIP) + public _FinalStage blocking(Optional blocking) { + this.blocking = blocking; + return this; + } + + @java.lang.Override + public ConfigurePropOpts build() { + return new ConfigurePropOpts( + id, + externalUserId, + propName, + blocking, + configuredProps, + dynamicPropsId, + asyncHandle, + page, + prevContext, + query, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java new file mode 100644 index 0000000..6c1a6af --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java @@ -0,0 +1,133 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurePropResponse.Builder.class) +public final class ConfigurePropResponse { + private final Optional> options; + + private final Optional> errors; + + private final Map additionalProperties; + + private ConfigurePropResponse( + Optional> options, + Optional> errors, + Map additionalProperties) { + this.options = options; + this.errors = errors; + this.additionalProperties = additionalProperties; + } + + /** + * @return Available options for the configured prop + */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + /** + * @return Any errors that occurred during configuration + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurePropResponse && equalTo((ConfigurePropResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurePropResponse other) { + return options.equals(other.options) && errors.equals(other.errors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.options, this.errors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> options = Optional.empty(); + + private Optional> errors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurePropResponse other) { + options(other.getOptions()); + errors(other.getErrors()); + return this; + } + + /** + *

    Available options for the configured prop

    + */ + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional> options) { + this.options = options; + return this; + } + + public Builder options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

    Any errors that occurred during configuration

    + */ + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(Optional> errors) { + this.errors = errors; + return this; + } + + public Builder errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + + public ConfigurePropResponse build() { + return new ConfigurePropResponse(options, errors, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java new file mode 100644 index 0000000..212cb99 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java @@ -0,0 +1,338 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConnectTokenCreateOpts.Builder.class) +public final class ConnectTokenCreateOpts { + private final String externalUserId; + + private final String projectId; + + private final Optional> allowedOrigins; + + private final Optional errorRedirectUri; + + private final Optional successRedirectUri; + + private final Optional webhookUri; + + private final Map additionalProperties; + + private ConnectTokenCreateOpts( + String externalUserId, + String projectId, + Optional> allowedOrigins, + Optional errorRedirectUri, + Optional successRedirectUri, + Optional webhookUri, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.projectId = projectId; + this.allowedOrigins = allowedOrigins; + this.errorRedirectUri = errorRedirectUri; + this.successRedirectUri = successRedirectUri; + this.webhookUri = webhookUri; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you're creating the token + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The ID of the project + */ + @JsonProperty("project_id") + public String getProjectId() { + return projectId; + } + + /** + * @return List of allowed origins for CORS + */ + @JsonProperty("allowed_origins") + public Optional> getAllowedOrigins() { + return allowedOrigins; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + /** + * @return Webhook URI for notifications + */ + @JsonProperty("webhook_uri") + public Optional getWebhookUri() { + return webhookUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConnectTokenCreateOpts && equalTo((ConnectTokenCreateOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConnectTokenCreateOpts other) { + return externalUserId.equals(other.externalUserId) + && projectId.equals(other.projectId) + && allowedOrigins.equals(other.allowedOrigins) + && errorRedirectUri.equals(other.errorRedirectUri) + && successRedirectUri.equals(other.successRedirectUri) + && webhookUri.equals(other.webhookUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.externalUserId, + this.projectId, + this.allowedOrigins, + this.errorRedirectUri, + this.successRedirectUri, + this.webhookUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    Your end user ID, for whom you're creating the token

    + */ + ProjectIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ConnectTokenCreateOpts other); + } + + public interface ProjectIdStage { + /** + *

    The ID of the project

    + */ + _FinalStage projectId(@NotNull String projectId); + } + + public interface _FinalStage { + ConnectTokenCreateOpts build(); + + /** + *

    List of allowed origins for CORS

    + */ + _FinalStage allowedOrigins(Optional> allowedOrigins); + + _FinalStage allowedOrigins(List allowedOrigins); + + /** + *

    URI to redirect to on error

    + */ + _FinalStage errorRedirectUri(Optional errorRedirectUri); + + _FinalStage errorRedirectUri(String errorRedirectUri); + + /** + *

    URI to redirect to on success

    + */ + _FinalStage successRedirectUri(Optional successRedirectUri); + + _FinalStage successRedirectUri(String successRedirectUri); + + /** + *

    Webhook URI for notifications

    + */ + _FinalStage webhookUri(Optional webhookUri); + + _FinalStage webhookUri(String webhookUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, ProjectIdStage, _FinalStage { + private String externalUserId; + + private String projectId; + + private Optional webhookUri = Optional.empty(); + + private Optional successRedirectUri = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional> allowedOrigins = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConnectTokenCreateOpts other) { + externalUserId(other.getExternalUserId()); + projectId(other.getProjectId()); + allowedOrigins(other.getAllowedOrigins()); + errorRedirectUri(other.getErrorRedirectUri()); + successRedirectUri(other.getSuccessRedirectUri()); + webhookUri(other.getWebhookUri()); + return this; + } + + /** + *

    Your end user ID, for whom you're creating the token

    + *

    Your end user ID, for whom you're creating the token

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public ProjectIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The ID of the project

    + *

    The ID of the project

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("project_id") + public _FinalStage projectId(@NotNull String projectId) { + this.projectId = Objects.requireNonNull(projectId, "projectId must not be null"); + return this; + } + + /** + *

    Webhook URI for notifications

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage webhookUri(String webhookUri) { + this.webhookUri = Optional.ofNullable(webhookUri); + return this; + } + + /** + *

    Webhook URI for notifications

    + */ + @java.lang.Override + @JsonSetter(value = "webhook_uri", nulls = Nulls.SKIP) + public _FinalStage webhookUri(Optional webhookUri) { + this.webhookUri = webhookUri; + return this; + } + + /** + *

    URI to redirect to on success

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage successRedirectUri(String successRedirectUri) { + this.successRedirectUri = Optional.ofNullable(successRedirectUri); + return this; + } + + /** + *

    URI to redirect to on success

    + */ + @java.lang.Override + @JsonSetter(value = "success_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage successRedirectUri(Optional successRedirectUri) { + this.successRedirectUri = successRedirectUri; + return this; + } + + /** + *

    URI to redirect to on error

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorRedirectUri(String errorRedirectUri) { + this.errorRedirectUri = Optional.ofNullable(errorRedirectUri); + return this; + } + + /** + *

    URI to redirect to on error

    + */ + @java.lang.Override + @JsonSetter(value = "error_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage errorRedirectUri(Optional errorRedirectUri) { + this.errorRedirectUri = errorRedirectUri; + return this; + } + + /** + *

    List of allowed origins for CORS

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage allowedOrigins(List allowedOrigins) { + this.allowedOrigins = Optional.ofNullable(allowedOrigins); + return this; + } + + /** + *

    List of allowed origins for CORS

    + */ + @java.lang.Override + @JsonSetter(value = "allowed_origins", nulls = Nulls.SKIP) + public _FinalStage allowedOrigins(Optional> allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + @java.lang.Override + public ConnectTokenCreateOpts build() { + return new ConnectTokenCreateOpts( + externalUserId, + projectId, + allowedOrigins, + errorRedirectUri, + successRedirectUri, + webhookUri, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java new file mode 100644 index 0000000..76aac12 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConnectTokenResponse.Builder.class) +public final class ConnectTokenResponse { + private final String connectLinkUrl; + + private final OffsetDateTime expiresAt; + + private final String token; + + private final Map additionalProperties; + + private ConnectTokenResponse( + String connectLinkUrl, OffsetDateTime expiresAt, String token, Map additionalProperties) { + this.connectLinkUrl = connectLinkUrl; + this.expiresAt = expiresAt; + this.token = token; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Connect Link URL + */ + @JsonProperty("connect_link_url") + public String getConnectLinkUrl() { + return connectLinkUrl; + } + + /** + * @return The expiration time of the token in ISO 8601 format + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The generated token + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConnectTokenResponse && equalTo((ConnectTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConnectTokenResponse other) { + return connectLinkUrl.equals(other.connectLinkUrl) + && expiresAt.equals(other.expiresAt) + && token.equals(other.token); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.connectLinkUrl, this.expiresAt, this.token); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ConnectLinkUrlStage builder() { + return new Builder(); + } + + public interface ConnectLinkUrlStage { + /** + *

    The Connect Link URL

    + */ + ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl); + + Builder from(ConnectTokenResponse other); + } + + public interface ExpiresAtStage { + /** + *

    The expiration time of the token in ISO 8601 format

    + */ + TokenStage expiresAt(@NotNull OffsetDateTime expiresAt); + } + + public interface TokenStage { + /** + *

    The generated token

    + */ + _FinalStage token(@NotNull String token); + } + + public interface _FinalStage { + ConnectTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ConnectLinkUrlStage, ExpiresAtStage, TokenStage, _FinalStage { + private String connectLinkUrl; + + private OffsetDateTime expiresAt; + + private String token; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConnectTokenResponse other) { + connectLinkUrl(other.getConnectLinkUrl()); + expiresAt(other.getExpiresAt()); + token(other.getToken()); + return this; + } + + /** + *

    The Connect Link URL

    + *

    The Connect Link URL

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("connect_link_url") + public ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl) { + this.connectLinkUrl = Objects.requireNonNull(connectLinkUrl, "connectLinkUrl must not be null"); + return this; + } + + /** + *

    The expiration time of the token in ISO 8601 format

    + *

    The expiration time of the token in ISO 8601 format

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expires_at") + public TokenStage expiresAt(@NotNull OffsetDateTime expiresAt) { + this.expiresAt = Objects.requireNonNull(expiresAt, "expiresAt must not be null"); + return this; + } + + /** + *

    The generated token

    + *

    The generated token

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("token") + public _FinalStage token(@NotNull String token) { + this.token = Objects.requireNonNull(token, "token must not be null"); + return this; + } + + @java.lang.Override + public ConnectTokenResponse build() { + return new ConnectTokenResponse(connectLinkUrl, expiresAt, token, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java new file mode 100644 index 0000000..96af1a4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBrowserClientOpts.Builder.class) +public final class CreateBrowserClientOpts { + private final Optional apiUrl; + + private final Map additionalProperties; + + private CreateBrowserClientOpts(Optional apiUrl, Map additionalProperties) { + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The API URL to use + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBrowserClientOpts && equalTo((CreateBrowserClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBrowserClientOpts other) { + return apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateBrowserClientOpts other) { + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

    The API URL to use

    + */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public CreateBrowserClientOpts build() { + return new CreateBrowserClientOpts(apiUrl, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java new file mode 100644 index 0000000..3f50fd1 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOAuthTokenResponse.Builder.class) +public final class CreateOAuthTokenResponse { + private final String accessToken; + + private final String tokenType; + + private final int expiresIn; + + private final Map additionalProperties; + + private CreateOAuthTokenResponse( + String accessToken, String tokenType, int expiresIn, Map additionalProperties) { + this.accessToken = accessToken; + this.tokenType = tokenType; + this.expiresIn = expiresIn; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("access_token") + public String getAccessToken() { + return accessToken; + } + + @JsonProperty("token_type") + public String getTokenType() { + return tokenType; + } + + @JsonProperty("expires_in") + public int getExpiresIn() { + return expiresIn; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOAuthTokenResponse && equalTo((CreateOAuthTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOAuthTokenResponse other) { + return accessToken.equals(other.accessToken) + && tokenType.equals(other.tokenType) + && expiresIn == other.expiresIn; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accessToken, this.tokenType, this.expiresIn); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccessTokenStage builder() { + return new Builder(); + } + + public interface AccessTokenStage { + TokenTypeStage accessToken(@NotNull String accessToken); + + Builder from(CreateOAuthTokenResponse other); + } + + public interface TokenTypeStage { + ExpiresInStage tokenType(@NotNull String tokenType); + } + + public interface ExpiresInStage { + _FinalStage expiresIn(int expiresIn); + } + + public interface _FinalStage { + CreateOAuthTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccessTokenStage, TokenTypeStage, ExpiresInStage, _FinalStage { + private String accessToken; + + private String tokenType; + + private int expiresIn; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOAuthTokenResponse other) { + accessToken(other.getAccessToken()); + tokenType(other.getTokenType()); + expiresIn(other.getExpiresIn()); + return this; + } + + @java.lang.Override + @JsonSetter("access_token") + public TokenTypeStage accessToken(@NotNull String accessToken) { + this.accessToken = Objects.requireNonNull(accessToken, "accessToken must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("token_type") + public ExpiresInStage tokenType(@NotNull String tokenType) { + this.tokenType = Objects.requireNonNull(tokenType, "tokenType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("expires_in") + public _FinalStage expiresIn(int expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + @java.lang.Override + public CreateOAuthTokenResponse build() { + return new CreateOAuthTokenResponse(accessToken, tokenType, expiresIn, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateTokenResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateTokenResponse.java new file mode 100644 index 0000000..4ce6161 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/CreateTokenResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTokenResponse.Builder.class) +public final class CreateTokenResponse { + private final String connectLinkUrl; + + private final OffsetDateTime expiresAt; + + private final String token; + + private final Map additionalProperties; + + private CreateTokenResponse( + String connectLinkUrl, OffsetDateTime expiresAt, String token, Map additionalProperties) { + this.connectLinkUrl = connectLinkUrl; + this.expiresAt = expiresAt; + this.token = token; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Connect Link URL + */ + @JsonProperty("connect_link_url") + public String getConnectLinkUrl() { + return connectLinkUrl; + } + + /** + * @return The expiration time of the token in ISO 8601 format + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The generated token + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenResponse && equalTo((CreateTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenResponse other) { + return connectLinkUrl.equals(other.connectLinkUrl) + && expiresAt.equals(other.expiresAt) + && token.equals(other.token); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.connectLinkUrl, this.expiresAt, this.token); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ConnectLinkUrlStage builder() { + return new Builder(); + } + + public interface ConnectLinkUrlStage { + /** + *

    The Connect Link URL

    + */ + ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl); + + Builder from(CreateTokenResponse other); + } + + public interface ExpiresAtStage { + /** + *

    The expiration time of the token in ISO 8601 format

    + */ + TokenStage expiresAt(@NotNull OffsetDateTime expiresAt); + } + + public interface TokenStage { + /** + *

    The generated token

    + */ + _FinalStage token(@NotNull String token); + } + + public interface _FinalStage { + CreateTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ConnectLinkUrlStage, ExpiresAtStage, TokenStage, _FinalStage { + private String connectLinkUrl; + + private OffsetDateTime expiresAt; + + private String token; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTokenResponse other) { + connectLinkUrl(other.getConnectLinkUrl()); + expiresAt(other.getExpiresAt()); + token(other.getToken()); + return this; + } + + /** + *

    The Connect Link URL

    + *

    The Connect Link URL

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("connect_link_url") + public ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl) { + this.connectLinkUrl = Objects.requireNonNull(connectLinkUrl, "connectLinkUrl must not be null"); + return this; + } + + /** + *

    The expiration time of the token in ISO 8601 format

    + *

    The expiration time of the token in ISO 8601 format

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expires_at") + public TokenStage expiresAt(@NotNull OffsetDateTime expiresAt) { + this.expiresAt = Objects.requireNonNull(expiresAt, "expiresAt must not be null"); + return this; + } + + /** + *

    The generated token

    + *

    The generated token

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("token") + public _FinalStage token(@NotNull String token) { + this.token = Objects.requireNonNull(token, "token must not be null"); + return this; + } + + @java.lang.Override + public CreateTokenResponse build() { + return new CreateTokenResponse(connectLinkUrl, expiresAt, token, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java new file mode 100644 index 0000000..70b04b4 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteTriggerOpts.Builder.class) +public final class DeleteTriggerOpts { + private final Optional ignoreHookErrors; + + private final Map additionalProperties; + + private DeleteTriggerOpts(Optional ignoreHookErrors, Map additionalProperties) { + this.ignoreHookErrors = ignoreHookErrors; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether to ignore errors during deactivation hook + */ + @JsonProperty("ignore_hook_errors") + public Optional getIgnoreHookErrors() { + return ignoreHookErrors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteTriggerOpts && equalTo((DeleteTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteTriggerOpts other) { + return ignoreHookErrors.equals(other.ignoreHookErrors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ignoreHookErrors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional ignoreHookErrors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteTriggerOpts other) { + ignoreHookErrors(other.getIgnoreHookErrors()); + return this; + } + + /** + *

    Whether to ignore errors during deactivation hook

    + */ + @JsonSetter(value = "ignore_hook_errors", nulls = Nulls.SKIP) + public Builder ignoreHookErrors(Optional ignoreHookErrors) { + this.ignoreHookErrors = ignoreHookErrors; + return this; + } + + public Builder ignoreHookErrors(Boolean ignoreHookErrors) { + this.ignoreHookErrors = Optional.ofNullable(ignoreHookErrors); + return this; + } + + public DeleteTriggerOpts build() { + return new DeleteTriggerOpts(ignoreHookErrors, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java new file mode 100644 index 0000000..09aac9d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployTriggerResponse.Builder.class) +public final class DeployTriggerResponse { + private final DeployedComponent data; + + private final Map additionalProperties; + + private DeployTriggerResponse(DeployedComponent data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DeployedComponent getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployTriggerResponse && equalTo((DeployTriggerResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployTriggerResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull DeployedComponent data); + + Builder from(DeployTriggerResponse other); + } + + public interface _FinalStage { + DeployTriggerResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private DeployedComponent data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployTriggerResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DeployedComponent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public DeployTriggerResponse build() { + return new DeployTriggerResponse(data, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployedComponent.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployedComponent.java new file mode 100644 index 0000000..8a6e6b9 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/DeployedComponent.java @@ -0,0 +1,539 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedComponent.Builder.class) +public final class DeployedComponent { + private final String id; + + private final String ownerId; + + private final String componentId; + + private final List configurableProps; + + private final Map configuredProps; + + private final boolean active; + + private final int createdAt; + + private final int updatedAt; + + private final String name; + + private final String nameSlug; + + private final Optional callbackObservations; + + private final Map additionalProperties; + + private DeployedComponent( + String id, + String ownerId, + String componentId, + List configurableProps, + Map configuredProps, + boolean active, + int createdAt, + int updatedAt, + String name, + String nameSlug, + Optional callbackObservations, + Map additionalProperties) { + this.id = id; + this.ownerId = ownerId; + this.componentId = componentId; + this.configurableProps = configurableProps; + this.configuredProps = configuredProps; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.nameSlug = nameSlug; + this.callbackObservations = callbackObservations; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique ID of the deployed component + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The ID of the owner + */ + @JsonProperty("owner_id") + public String getOwnerId() { + return ownerId; + } + + /** + * @return The ID of the component that was deployed + */ + @JsonProperty("component_id") + public String getComponentId() { + return componentId; + } + + /** + * @return The configurable properties of the component + */ + @JsonProperty("configurable_props") + public List getConfigurableProps() { + return configurableProps; + } + + /** + * @return The configured properties of the component + */ + @JsonProperty("configured_props") + public Map getConfiguredProps() { + return configuredProps; + } + + /** + * @return Whether the deployed component is active + */ + @JsonProperty("active") + public boolean getActive() { + return active; + } + + /** + * @return The timestamp when the component was deployed (epoch milliseconds) + */ + @JsonProperty("created_at") + public int getCreatedAt() { + return createdAt; + } + + /** + * @return The timestamp when the component was last updated (epoch milliseconds) + */ + @JsonProperty("updated_at") + public int getUpdatedAt() { + return updatedAt; + } + + /** + * @return The name of the deployed component + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The name slug of the deployed component + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + @JsonProperty("callback_observations") + public Optional getCallbackObservations() { + return callbackObservations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedComponent && equalTo((DeployedComponent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedComponent other) { + return id.equals(other.id) + && ownerId.equals(other.ownerId) + && componentId.equals(other.componentId) + && configurableProps.equals(other.configurableProps) + && configuredProps.equals(other.configuredProps) + && active == other.active + && createdAt == other.createdAt + && updatedAt == other.updatedAt + && name.equals(other.name) + && nameSlug.equals(other.nameSlug) + && callbackObservations.equals(other.callbackObservations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.ownerId, + this.componentId, + this.configurableProps, + this.configuredProps, + this.active, + this.createdAt, + this.updatedAt, + this.name, + this.nameSlug, + this.callbackObservations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

    The unique ID of the deployed component

    + */ + OwnerIdStage id(@NotNull String id); + + Builder from(DeployedComponent other); + } + + public interface OwnerIdStage { + /** + *

    The ID of the owner

    + */ + ComponentIdStage ownerId(@NotNull String ownerId); + } + + public interface ComponentIdStage { + /** + *

    The ID of the component that was deployed

    + */ + ActiveStage componentId(@NotNull String componentId); + } + + public interface ActiveStage { + /** + *

    Whether the deployed component is active

    + */ + CreatedAtStage active(boolean active); + } + + public interface CreatedAtStage { + /** + *

    The timestamp when the component was deployed (epoch milliseconds)

    + */ + UpdatedAtStage createdAt(int createdAt); + } + + public interface UpdatedAtStage { + /** + *

    The timestamp when the component was last updated (epoch milliseconds)

    + */ + NameStage updatedAt(int updatedAt); + } + + public interface NameStage { + /** + *

    The name of the deployed component

    + */ + NameSlugStage name(@NotNull String name); + } + + public interface NameSlugStage { + /** + *

    The name slug of the deployed component

    + */ + _FinalStage nameSlug(@NotNull String nameSlug); + } + + public interface _FinalStage { + DeployedComponent build(); + + /** + *

    The configurable properties of the component

    + */ + _FinalStage configurableProps(List configurableProps); + + _FinalStage addConfigurableProps(ConfigurableProp configurableProps); + + _FinalStage addAllConfigurableProps(List configurableProps); + + /** + *

    The configured properties of the component

    + */ + _FinalStage configuredProps(Map configuredProps); + + _FinalStage putAllConfiguredProps(Map configuredProps); + + _FinalStage configuredProps(String key, Object value); + + _FinalStage callbackObservations(Optional callbackObservations); + + _FinalStage callbackObservations(Object callbackObservations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + OwnerIdStage, + ComponentIdStage, + ActiveStage, + CreatedAtStage, + UpdatedAtStage, + NameStage, + NameSlugStage, + _FinalStage { + private String id; + + private String ownerId; + + private String componentId; + + private boolean active; + + private int createdAt; + + private int updatedAt; + + private String name; + + private String nameSlug; + + private Optional callbackObservations = Optional.empty(); + + private Map configuredProps = new LinkedHashMap<>(); + + private List configurableProps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedComponent other) { + id(other.getId()); + ownerId(other.getOwnerId()); + componentId(other.getComponentId()); + configurableProps(other.getConfigurableProps()); + configuredProps(other.getConfiguredProps()); + active(other.getActive()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + nameSlug(other.getNameSlug()); + callbackObservations(other.getCallbackObservations()); + return this; + } + + /** + *

    The unique ID of the deployed component

    + *

    The unique ID of the deployed component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OwnerIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The ID of the owner

    + *

    The ID of the owner

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("owner_id") + public ComponentIdStage ownerId(@NotNull String ownerId) { + this.ownerId = Objects.requireNonNull(ownerId, "ownerId must not be null"); + return this; + } + + /** + *

    The ID of the component that was deployed

    + *

    The ID of the component that was deployed

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("component_id") + public ActiveStage componentId(@NotNull String componentId) { + this.componentId = Objects.requireNonNull(componentId, "componentId must not be null"); + return this; + } + + /** + *

    Whether the deployed component is active

    + *

    Whether the deployed component is active

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("active") + public CreatedAtStage active(boolean active) { + this.active = active; + return this; + } + + /** + *

    The timestamp when the component was deployed (epoch milliseconds)

    + *

    The timestamp when the component was deployed (epoch milliseconds)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(int createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

    The timestamp when the component was last updated (epoch milliseconds)

    + *

    The timestamp when the component was last updated (epoch milliseconds)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public NameStage updatedAt(int updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + *

    The name of the deployed component

    + *

    The name of the deployed component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public NameSlugStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

    The name slug of the deployed component

    + *

    The name slug of the deployed component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name_slug") + public _FinalStage nameSlug(@NotNull String nameSlug) { + this.nameSlug = Objects.requireNonNull(nameSlug, "nameSlug must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage callbackObservations(Object callbackObservations) { + this.callbackObservations = Optional.ofNullable(callbackObservations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callback_observations", nulls = Nulls.SKIP) + public _FinalStage callbackObservations(Optional callbackObservations) { + this.callbackObservations = callbackObservations; + return this; + } + + /** + *

    The configured properties of the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(String key, Object value) { + this.configuredProps.put(key, value); + return this; + } + + /** + *

    The configured properties of the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllConfiguredProps(Map configuredProps) { + this.configuredProps.putAll(configuredProps); + return this; + } + + /** + *

    The configured properties of the component

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps.clear(); + this.configuredProps.putAll(configuredProps); + return this; + } + + /** + *

    The configurable properties of the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllConfigurableProps(List configurableProps) { + this.configurableProps.addAll(configurableProps); + return this; + } + + /** + *

    The configurable properties of the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addConfigurableProps(ConfigurableProp configurableProps) { + this.configurableProps.add(configurableProps); + return this; + } + + /** + *

    The configurable properties of the component

    + */ + @java.lang.Override + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public _FinalStage configurableProps(List configurableProps) { + this.configurableProps.clear(); + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public DeployedComponent build() { + return new DeployedComponent( + id, + ownerId, + componentId, + configurableProps, + configuredProps, + active, + createdAt, + updatedAt, + name, + nameSlug, + callbackObservations, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/EmittedEvent.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/EmittedEvent.java new file mode 100644 index 0000000..21eebab --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/EmittedEvent.java @@ -0,0 +1,235 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EmittedEvent.Builder.class) +public final class EmittedEvent { + private final Map e; + + private final String k; + + private final int ts; + + private final String id; + + private final Map additionalProperties; + + private EmittedEvent(Map e, String k, int ts, String id, Map additionalProperties) { + this.e = e; + this.k = k; + this.ts = ts; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The event's payload + */ + @JsonProperty("e") + public Map getE() { + return e; + } + + /** + * @return The event's type (set to 'emit' currently) + */ + @JsonProperty("k") + public String getK() { + return k; + } + + /** + * @return The event's timestamp in epoch milliseconds + */ + @JsonProperty("ts") + public int getTs() { + return ts; + } + + /** + * @return The event's unique ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EmittedEvent && equalTo((EmittedEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EmittedEvent other) { + return e.equals(other.e) && k.equals(other.k) && ts == other.ts && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.e, this.k, this.ts, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KStage builder() { + return new Builder(); + } + + public interface KStage { + /** + *

    The event's type (set to 'emit' currently)

    + */ + TsStage k(@NotNull String k); + + Builder from(EmittedEvent other); + } + + public interface TsStage { + /** + *

    The event's timestamp in epoch milliseconds

    + */ + IdStage ts(int ts); + } + + public interface IdStage { + /** + *

    The event's unique ID

    + */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + EmittedEvent build(); + + /** + *

    The event's payload

    + */ + _FinalStage e(Map e); + + _FinalStage putAllE(Map e); + + _FinalStage e(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KStage, TsStage, IdStage, _FinalStage { + private String k; + + private int ts; + + private String id; + + private Map e = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EmittedEvent other) { + e(other.getE()); + k(other.getK()); + ts(other.getTs()); + id(other.getId()); + return this; + } + + /** + *

    The event's type (set to 'emit' currently)

    + *

    The event's type (set to 'emit' currently)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("k") + public TsStage k(@NotNull String k) { + this.k = Objects.requireNonNull(k, "k must not be null"); + return this; + } + + /** + *

    The event's timestamp in epoch milliseconds

    + *

    The event's timestamp in epoch milliseconds

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ts") + public IdStage ts(int ts) { + this.ts = ts; + return this; + } + + /** + *

    The event's unique ID

    + *

    The event's unique ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The event's payload

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage e(String key, Object value) { + this.e.put(key, value); + return this; + } + + /** + *

    The event's payload

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllE(Map e) { + this.e.putAll(e); + return this; + } + + /** + *

    The event's payload

    + */ + @java.lang.Override + @JsonSetter(value = "e", nulls = Nulls.SKIP) + public _FinalStage e(Map e) { + this.e.clear(); + this.e.putAll(e); + return this; + } + + @java.lang.Override + public EmittedEvent build() { + return new EmittedEvent(e, k, ts, id, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ErrorResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ErrorResponse.java new file mode 100644 index 0000000..38b2481 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ErrorResponse.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ErrorResponse.Builder.class) +public final class ErrorResponse { + private final String error; + + private final Optional code; + + private final Optional> details; + + private final Map additionalProperties; + + private ErrorResponse( + String error, + Optional code, + Optional> details, + Map additionalProperties) { + this.error = error; + this.code = code; + this.details = details; + this.additionalProperties = additionalProperties; + } + + /** + * @return The error message + */ + @JsonProperty("error") + public String getError() { + return error; + } + + /** + * @return The error code + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return Additional error details + */ + @JsonProperty("details") + public Optional> getDetails() { + return details; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ErrorResponse && equalTo((ErrorResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ErrorResponse other) { + return error.equals(other.error) && code.equals(other.code) && details.equals(other.details); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error, this.code, this.details); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + /** + *

    The error message

    + */ + _FinalStage error(@NotNull String error); + + Builder from(ErrorResponse other); + } + + public interface _FinalStage { + ErrorResponse build(); + + /** + *

    The error code

    + */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + /** + *

    Additional error details

    + */ + _FinalStage details(Optional> details); + + _FinalStage details(Map details); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private String error; + + private Optional> details = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ErrorResponse other) { + error(other.getError()); + code(other.getCode()); + details(other.getDetails()); + return this; + } + + /** + *

    The error message

    + *

    The error message

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull String error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + /** + *

    Additional error details

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage details(Map details) { + this.details = Optional.ofNullable(details); + return this; + } + + /** + *

    Additional error details

    + */ + @java.lang.Override + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public _FinalStage details(Optional> details) { + this.details = details; + return this; + } + + /** + *

    The error code

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

    The error code

    + */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public ErrorResponse build() { + return new ErrorResponse(error, code, details, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAccountsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAccountsResponse.java new file mode 100644 index 0000000..27141c1 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAccountsResponse.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAccountsResponse.Builder.class) +public final class GetAccountsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetAccountsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAccountsResponse && equalTo((GetAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetAccountsResponse other); + } + + public interface _FinalStage { + GetAccountsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Account data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Account data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetAccountsResponse build() { + return new GetAccountsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppResponse.java new file mode 100644 index 0000000..b8d680d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAppResponse.Builder.class) +public final class GetAppResponse { + private final App data; + + private final Map additionalProperties; + + private GetAppResponse(App data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public App getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAppResponse && equalTo((GetAppResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAppResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull App data); + + Builder from(GetAppResponse other); + } + + public interface _FinalStage { + GetAppResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private App data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAppResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull App data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetAppResponse build() { + return new GetAppResponse(data, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppsResponse.java new file mode 100644 index 0000000..9f69b14 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetAppsResponse.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAppsResponse.Builder.class) +public final class GetAppsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetAppsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAppsResponse && equalTo((GetAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetAppsResponse other); + } + + public interface _FinalStage { + GetAppsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(App data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(App data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetAppsResponse build() { + return new GetAppsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentResponse.java new file mode 100644 index 0000000..f2a0631 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetComponentResponse.Builder.class) +public final class GetComponentResponse { + private final Component data; + + private final Map additionalProperties; + + private GetComponentResponse(Component data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public Component getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetComponentResponse && equalTo((GetComponentResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetComponentResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull Component data); + + Builder from(GetComponentResponse other); + } + + public interface _FinalStage { + GetComponentResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private Component data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetComponentResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull Component data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetComponentResponse build() { + return new GetComponentResponse(data, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentsResponse.java new file mode 100644 index 0000000..9768dbf --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetComponentsResponse.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetComponentsResponse.Builder.class) +public final class GetComponentsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetComponentsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetComponentsResponse && equalTo((GetComponentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetComponentsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetComponentsResponse other); + } + + public interface _FinalStage { + GetComponentsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Component data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetComponentsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Component data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetComponentsResponse build() { + return new GetComponentsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java new file mode 100644 index 0000000..87d47ab --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerEventsResponse.Builder.class) +public final class GetTriggerEventsResponse { + private final List data; + + private final Map additionalProperties; + + private GetTriggerEventsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerEventsResponse && equalTo((GetTriggerEventsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerEventsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerEventsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + public Builder addData(EmittedEvent data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + this.data.addAll(data); + return this; + } + + public GetTriggerEventsResponse build() { + return new GetTriggerEventsResponse(data, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerResponse.java new file mode 100644 index 0000000..697147e --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerResponse.Builder.class) +public final class GetTriggerResponse { + private final DeployedComponent data; + + private final Map additionalProperties; + + private GetTriggerResponse(DeployedComponent data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DeployedComponent getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerResponse && equalTo((GetTriggerResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull DeployedComponent data); + + Builder from(GetTriggerResponse other); + } + + public interface _FinalStage { + GetTriggerResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private DeployedComponent data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetTriggerResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DeployedComponent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetTriggerResponse build() { + return new GetTriggerResponse(data, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java new file mode 100644 index 0000000..1d86176 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerWebhooksResponse.Builder.class) +public final class GetTriggerWebhooksResponse { + private final List webhookUrls; + + private final Map additionalProperties; + + private GetTriggerWebhooksResponse(List webhookUrls, Map additionalProperties) { + this.webhookUrls = webhookUrls; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("webhook_urls") + public List getWebhookUrls() { + return webhookUrls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerWebhooksResponse && equalTo((GetTriggerWebhooksResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerWebhooksResponse other) { + return webhookUrls.equals(other.webhookUrls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.webhookUrls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List webhookUrls = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerWebhooksResponse other) { + webhookUrls(other.getWebhookUrls()); + return this; + } + + @JsonSetter(value = "webhook_urls", nulls = Nulls.SKIP) + public Builder webhookUrls(List webhookUrls) { + this.webhookUrls.clear(); + this.webhookUrls.addAll(webhookUrls); + return this; + } + + public Builder addWebhookUrls(String webhookUrls) { + this.webhookUrls.add(webhookUrls); + return this; + } + + public Builder addAllWebhookUrls(List webhookUrls) { + this.webhookUrls.addAll(webhookUrls); + return this; + } + + public GetTriggerWebhooksResponse build() { + return new GetTriggerWebhooksResponse(webhookUrls, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java new file mode 100644 index 0000000..e14ed35 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerWorkflowsResponse.Builder.class) +public final class GetTriggerWorkflowsResponse { + private final List workflowIds; + + private final Map additionalProperties; + + private GetTriggerWorkflowsResponse(List workflowIds, Map additionalProperties) { + this.workflowIds = workflowIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("workflow_ids") + public List getWorkflowIds() { + return workflowIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerWorkflowsResponse && equalTo((GetTriggerWorkflowsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerWorkflowsResponse other) { + return workflowIds.equals(other.workflowIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.workflowIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List workflowIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerWorkflowsResponse other) { + workflowIds(other.getWorkflowIds()); + return this; + } + + @JsonSetter(value = "workflow_ids", nulls = Nulls.SKIP) + public Builder workflowIds(List workflowIds) { + this.workflowIds.clear(); + this.workflowIds.addAll(workflowIds); + return this; + } + + public Builder addWorkflowIds(String workflowIds) { + this.workflowIds.add(workflowIds); + return this; + } + + public Builder addAllWorkflowIds(List workflowIds) { + this.workflowIds.addAll(workflowIds); + return this; + } + + public GetTriggerWorkflowsResponse build() { + return new GetTriggerWorkflowsResponse(workflowIds, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggersResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggersResponse.java new file mode 100644 index 0000000..0c6a070 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/GetTriggersResponse.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggersResponse.Builder.class) +public final class GetTriggersResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetTriggersResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggersResponse && equalTo((GetTriggersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetTriggersResponse other); + } + + public interface _FinalStage { + GetTriggersResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(DeployedComponent data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetTriggersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(DeployedComponent data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetTriggersResponse build() { + return new GetTriggersResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAccountsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAccountsResponse.java new file mode 100644 index 0000000..f474727 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAccountsResponse.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAccountsResponse.Builder.class) +public final class ListAccountsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAccountsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAccountsResponse && equalTo((ListAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAccountsResponse other); + } + + public interface _FinalStage { + ListAccountsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Account data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Account data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public ListAccountsResponse build() { + return new ListAccountsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAppsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAppsResponse.java new file mode 100644 index 0000000..85fab80 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ListAppsResponse.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppsResponse.Builder.class) +public final class ListAppsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAppsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppsResponse && equalTo((ListAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAppsResponse other); + } + + public interface _FinalStage { + ListAppsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(App data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(App data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public ListAppsResponse build() { + return new ListAppsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PageInfo.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PageInfo.java new file mode 100644 index 0000000..8fbda9e --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PageInfo.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PageInfo.Builder.class) +public final class PageInfo { + private final Optional count; + + private final Optional totalCount; + + private final Optional startCursor; + + private final Optional endCursor; + + private final Map additionalProperties; + + private PageInfo( + Optional count, + Optional totalCount, + Optional startCursor, + Optional endCursor, + Map additionalProperties) { + this.count = count; + this.totalCount = totalCount; + this.startCursor = startCursor; + this.endCursor = endCursor; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("count") + public Optional getCount() { + return count; + } + + @JsonProperty("total_count") + public Optional getTotalCount() { + return totalCount; + } + + @JsonProperty("start_cursor") + public Optional getStartCursor() { + return startCursor; + } + + @JsonProperty("end_cursor") + public Optional getEndCursor() { + return endCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PageInfo && equalTo((PageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PageInfo other) { + return count.equals(other.count) + && totalCount.equals(other.totalCount) + && startCursor.equals(other.startCursor) + && endCursor.equals(other.endCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.totalCount, this.startCursor, this.endCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional count = Optional.empty(); + + private Optional totalCount = Optional.empty(); + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PageInfo other) { + count(other.getCount()); + totalCount(other.getTotalCount()); + startCursor(other.getStartCursor()); + endCursor(other.getEndCursor()); + return this; + } + + @JsonSetter(value = "count", nulls = Nulls.SKIP) + public Builder count(Optional count) { + this.count = count; + return this; + } + + public Builder count(Integer count) { + this.count = Optional.ofNullable(count); + return this; + } + + @JsonSetter(value = "total_count", nulls = Nulls.SKIP) + public Builder totalCount(Optional totalCount) { + this.totalCount = totalCount; + return this; + } + + public Builder totalCount(Integer totalCount) { + this.totalCount = Optional.ofNullable(totalCount); + return this; + } + + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public Builder startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + public Builder startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public Builder endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + public Builder endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + public PageInfo build() { + return new PageInfo(count, totalCount, startCursor, endCursor, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectEnvironment.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectEnvironment.java new file mode 100644 index 0000000..aceb02c --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectEnvironment.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ProjectEnvironment { + DEVELOPMENT("development"), + + PRODUCTION("production"); + + private final String value; + + ProjectEnvironment(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java new file mode 100644 index 0000000..c3f66ca --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProjectInfoResponse.Builder.class) +public final class ProjectInfoResponse { + private final List apps; + + private final Map additionalProperties; + + private ProjectInfoResponse(List apps, Map additionalProperties) { + this.apps = apps; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("apps") + public List getApps() { + return apps; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProjectInfoResponse && equalTo((ProjectInfoResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProjectInfoResponse other) { + return apps.equals(other.apps); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apps); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List apps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProjectInfoResponse other) { + apps(other.getApps()); + return this; + } + + @JsonSetter(value = "apps", nulls = Nulls.SKIP) + public Builder apps(List apps) { + this.apps.clear(); + this.apps.addAll(apps); + return this; + } + + public Builder addApps(ProjectInfoResponseAppsItem apps) { + this.apps.add(apps); + return this; + } + + public Builder addAllApps(List apps) { + this.apps.addAll(apps); + return this; + } + + public ProjectInfoResponse build() { + return new ProjectInfoResponse(apps, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java new file mode 100644 index 0000000..1b6412a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProjectInfoResponseAppsItem.Builder.class) +public final class ProjectInfoResponseAppsItem { + private final Optional id; + + private final String nameSlug; + + private final Map additionalProperties; + + private ProjectInfoResponseAppsItem( + Optional id, String nameSlug, Map additionalProperties) { + this.id = id; + this.nameSlug = nameSlug; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app. Only applies for OAuth apps. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name slug of the target app + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProjectInfoResponseAppsItem && equalTo((ProjectInfoResponseAppsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProjectInfoResponseAppsItem other) { + return id.equals(other.id) && nameSlug.equals(other.nameSlug); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.nameSlug); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameSlugStage builder() { + return new Builder(); + } + + public interface NameSlugStage { + /** + *

    The name slug of the target app

    + */ + _FinalStage nameSlug(@NotNull String nameSlug); + + Builder from(ProjectInfoResponseAppsItem other); + } + + public interface _FinalStage { + ProjectInfoResponseAppsItem build(); + + /** + *

    ID of the app. Only applies for OAuth apps.

    + */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameSlugStage, _FinalStage { + private String nameSlug; + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProjectInfoResponseAppsItem other) { + id(other.getId()); + nameSlug(other.getNameSlug()); + return this; + } + + /** + *

    The name slug of the target app

    + *

    The name slug of the target app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name_slug") + public _FinalStage nameSlug(@NotNull String nameSlug) { + this.nameSlug = Objects.requireNonNull(nameSlug, "nameSlug must not be null"); + return this; + } + + /** + *

    ID of the app. Only applies for OAuth apps.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

    ID of the app. Only applies for OAuth apps.

    + */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public ProjectInfoResponseAppsItem build() { + return new ProjectInfoResponseAppsItem(id, nameSlug, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PropOption.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PropOption.java new file mode 100644 index 0000000..f3fd389 --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/PropOption.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PropOption.Builder.class) +public final class PropOption { + private final String label; + + private final Object value; + + private final Map additionalProperties; + + private PropOption(String label, Object value, Map additionalProperties) { + this.label = label; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return The human-readable label for the option + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + @JsonProperty("value") + public Object getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PropOption && equalTo((PropOption) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PropOption other) { + return label.equals(other.label) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LabelStage builder() { + return new Builder(); + } + + public interface LabelStage { + /** + *

    The human-readable label for the option

    + */ + ValueStage label(@NotNull String label); + + Builder from(PropOption other); + } + + public interface ValueStage { + _FinalStage value(Object value); + } + + public interface _FinalStage { + PropOption build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LabelStage, ValueStage, _FinalStage { + private String label; + + private Object value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PropOption other) { + label(other.getLabel()); + value(other.getValue()); + return this; + } + + /** + *

    The human-readable label for the option

    + *

    The human-readable label for the option

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public ValueStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(Object value) { + this.value = value; + return this; + } + + @java.lang.Override + public PropOption build() { + return new PropOption(label, value, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProxyResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProxyResponse.java new file mode 100644 index 0000000..60a46ab --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ProxyResponse.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyResponse.Builder.class) +public final class ProxyResponse { + private final Optional status; + + private final Optional> headers; + + private final Optional body; + + private final Map additionalProperties; + + private ProxyResponse( + Optional status, + Optional> headers, + Optional body, + Map additionalProperties) { + this.status = status; + this.headers = headers; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return HTTP status code + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Response headers + */ + @JsonProperty("headers") + public Optional> getHeaders() { + return headers; + } + + @JsonProperty("body") + public Optional getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyResponse && equalTo((ProxyResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyResponse other) { + return status.equals(other.status) && headers.equals(other.headers) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.status, this.headers, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional status = Optional.empty(); + + private Optional> headers = Optional.empty(); + + private Optional body = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProxyResponse other) { + status(other.getStatus()); + headers(other.getHeaders()); + body(other.getBody()); + return this; + } + + /** + *

    HTTP status code

    + */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(Integer status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

    Response headers

    + */ + @JsonSetter(value = "headers", nulls = Nulls.SKIP) + public Builder headers(Optional> headers) { + this.headers = headers; + return this; + } + + public Builder headers(Map headers) { + this.headers = Optional.ofNullable(headers); + return this; + } + + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public Builder body(Optional body) { + this.body = body; + return this; + } + + public Builder body(Object body) { + this.body = Optional.ofNullable(body); + return this; + } + + public ProxyResponse build() { + return new ProxyResponse(status, headers, body, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java new file mode 100644 index 0000000..c10ebce --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java @@ -0,0 +1,331 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReloadPropsOpts.Builder.class) +public final class ReloadPropsOpts { + private final String id; + + private final String externalUserId; + + private final Optional blocking; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional asyncHandle; + + private final Map additionalProperties; + + private ReloadPropsOpts( + String id, + String externalUserId, + Optional blocking, + Optional> configuredProps, + Optional dynamicPropsId, + Optional asyncHandle, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.blocking = blocking; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.asyncHandle = asyncHandle; + this.additionalProperties = additionalProperties; + } + + /** + * @return The component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether this operation should block until completion + */ + @JsonProperty("blocking") + public Optional getBlocking() { + return blocking; + } + + /** + * @return The configured properties for the component + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Handle for async operations + */ + @JsonProperty("async_handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReloadPropsOpts && equalTo((ReloadPropsOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReloadPropsOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && blocking.equals(other.blocking) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && asyncHandle.equals(other.asyncHandle); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.externalUserId, + this.blocking, + this.configuredProps, + this.dynamicPropsId, + this.asyncHandle); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

    The component ID

    + */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(ReloadPropsOpts other); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + ReloadPropsOpts build(); + + /** + *

    Whether this operation should block until completion

    + */ + _FinalStage blocking(Optional blocking); + + _FinalStage blocking(Boolean blocking); + + /** + *

    The configured properties for the component

    + */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

    The ID for dynamic props

    + */ + _FinalStage dynamicPropsId(Optional dynamicPropsId); + + _FinalStage dynamicPropsId(String dynamicPropsId); + + /** + *

    Handle for async operations

    + */ + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional asyncHandle = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional blocking = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReloadPropsOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + blocking(other.getBlocking()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + asyncHandle(other.getAsyncHandle()); + return this; + } + + /** + *

    The component ID

    + *

    The component ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ExternalUserIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The external user ID

    + *

    The external user ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    Handle for async operations

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + /** + *

    Handle for async operations

    + */ + @java.lang.Override + @JsonSetter(value = "async_handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + /** + *

    The ID for dynamic props

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dynamicPropsId(String dynamicPropsId) { + this.dynamicPropsId = Optional.ofNullable(dynamicPropsId); + return this; + } + + /** + *

    The ID for dynamic props

    + */ + @java.lang.Override + @JsonSetter(value = "dynamic_props_id", nulls = Nulls.SKIP) + public _FinalStage dynamicPropsId(Optional dynamicPropsId) { + this.dynamicPropsId = dynamicPropsId; + return this; + } + + /** + *

    The configured properties for the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps = Optional.ofNullable(configuredProps); + return this; + } + + /** + *

    The configured properties for the component

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + /** + *

    Whether this operation should block until completion

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage blocking(Boolean blocking) { + this.blocking = Optional.ofNullable(blocking); + return this; + } + + /** + *

    Whether this operation should block until completion

    + */ + @java.lang.Override + @JsonSetter(value = "blocking", nulls = Nulls.SKIP) + public _FinalStage blocking(Optional blocking) { + this.blocking = blocking; + return this; + } + + @java.lang.Override + public ReloadPropsOpts build() { + return new ReloadPropsOpts( + id, externalUserId, blocking, configuredProps, dynamicPropsId, asyncHandle, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java new file mode 100644 index 0000000..56e3dae --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReloadPropsResponse.Builder.class) +public final class ReloadPropsResponse { + private final Optional> configurableProps; + + private final Map additionalProperties; + + private ReloadPropsResponse( + Optional> configurableProps, Map additionalProperties) { + this.configurableProps = configurableProps; + this.additionalProperties = additionalProperties; + } + + /** + * @return The updated configurable properties + */ + @JsonProperty("configurable_props") + public Optional> getConfigurableProps() { + return configurableProps; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReloadPropsResponse && equalTo((ReloadPropsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReloadPropsResponse other) { + return configurableProps.equals(other.configurableProps); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.configurableProps); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> configurableProps = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReloadPropsResponse other) { + configurableProps(other.getConfigurableProps()); + return this; + } + + /** + *

    The updated configurable properties

    + */ + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public Builder configurableProps(Optional> configurableProps) { + this.configurableProps = configurableProps; + return this; + } + + public Builder configurableProps(List configurableProps) { + this.configurableProps = Optional.ofNullable(configurableProps); + return this; + } + + public ReloadPropsResponse build() { + return new ReloadPropsResponse(configurableProps, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/RunActionResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/RunActionResponse.java new file mode 100644 index 0000000..585a35a --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/RunActionResponse.java @@ -0,0 +1,175 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RunActionResponse.Builder.class) +public final class RunActionResponse { + private final Optional exports; + + private final Optional os; + + private final Optional ret; + + private final Optional stashId; + + private final Map additionalProperties; + + private RunActionResponse( + Optional exports, + Optional os, + Optional ret, + Optional stashId, + Map additionalProperties) { + this.exports = exports; + this.os = os; + this.ret = ret; + this.stashId = stashId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("exports") + public Optional getExports() { + return exports; + } + + @JsonProperty("os") + public Optional getOs() { + return os; + } + + @JsonProperty("ret") + public Optional getRet() { + return ret; + } + + /** + * @return The ID of the File Stash that was used to sync the action's /tmp directory + */ + @JsonProperty("stash_id") + public Optional getStashId() { + return stashId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunActionResponse && equalTo((RunActionResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunActionResponse other) { + return exports.equals(other.exports) + && os.equals(other.os) + && ret.equals(other.ret) + && stashId.equals(other.stashId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exports, this.os, this.ret, this.stashId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional exports = Optional.empty(); + + private Optional os = Optional.empty(); + + private Optional ret = Optional.empty(); + + private Optional stashId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RunActionResponse other) { + exports(other.getExports()); + os(other.getOs()); + ret(other.getRet()); + stashId(other.getStashId()); + return this; + } + + @JsonSetter(value = "exports", nulls = Nulls.SKIP) + public Builder exports(Optional exports) { + this.exports = exports; + return this; + } + + public Builder exports(Object exports) { + this.exports = Optional.ofNullable(exports); + return this; + } + + @JsonSetter(value = "os", nulls = Nulls.SKIP) + public Builder os(Optional os) { + this.os = os; + return this; + } + + public Builder os(Object os) { + this.os = Optional.ofNullable(os); + return this; + } + + @JsonSetter(value = "ret", nulls = Nulls.SKIP) + public Builder ret(Optional ret) { + this.ret = ret; + return this; + } + + public Builder ret(Object ret) { + this.ret = Optional.ofNullable(ret); + return this; + } + + /** + *

    The ID of the File Stash that was used to sync the action's /tmp directory

    + */ + @JsonSetter(value = "stash_id", nulls = Nulls.SKIP) + public Builder stashId(Optional stashId) { + this.stashId = stashId; + return this; + } + + public Builder stashId(String stashId) { + this.stashId = Optional.ofNullable(stashId); + return this; + } + + public RunActionResponse build() { + return new RunActionResponse(exports, os, ret, stashId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/StartConnectOpts.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/StartConnectOpts.java new file mode 100644 index 0000000..74e494d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/StartConnectOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StartConnectOpts.Builder.class) +public final class StartConnectOpts { + private final Optional iframe; + + private final Map additionalProperties; + + private StartConnectOpts(Optional iframe, Map additionalProperties) { + this.iframe = iframe; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the iframe element to use + */ + @JsonProperty("iframe") + public Optional getIframe() { + return iframe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StartConnectOpts && equalTo((StartConnectOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StartConnectOpts other) { + return iframe.equals(other.iframe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.iframe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional iframe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(StartConnectOpts other) { + iframe(other.getIframe()); + return this; + } + + /** + *

    ID of the iframe element to use

    + */ + @JsonSetter(value = "iframe", nulls = Nulls.SKIP) + public Builder iframe(Optional iframe) { + this.iframe = iframe; + return this; + } + + public Builder iframe(String iframe) { + this.iframe = Optional.ofNullable(iframe); + return this; + } + + public StartConnectOpts build() { + return new StartConnectOpts(iframe, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenParams.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenParams.java new file mode 100644 index 0000000..26f43cb --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenParams.java @@ -0,0 +1,156 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ValidateTokenParams.Builder.class) +public final class ValidateTokenParams { + private final String appId; + + private final Optional oauthAppId; + + private final Map additionalProperties; + + private ValidateTokenParams(String appId, Optional oauthAppId, Map additionalProperties) { + this.appId = appId; + this.oauthAppId = oauthAppId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app ID to validate against + */ + @JsonProperty("app_id") + public String getAppId() { + return appId; + } + + /** + * @return The OAuth app ID + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidateTokenParams && equalTo((ValidateTokenParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidateTokenParams other) { + return appId.equals(other.appId) && oauthAppId.equals(other.oauthAppId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.appId, this.oauthAppId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppIdStage builder() { + return new Builder(); + } + + public interface AppIdStage { + /** + *

    The app ID to validate against

    + */ + _FinalStage appId(@NotNull String appId); + + Builder from(ValidateTokenParams other); + } + + public interface _FinalStage { + ValidateTokenParams build(); + + /** + *

    The OAuth app ID

    + */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppIdStage, _FinalStage { + private String appId; + + private Optional oauthAppId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ValidateTokenParams other) { + appId(other.getAppId()); + oauthAppId(other.getOauthAppId()); + return this; + } + + /** + *

    The app ID to validate against

    + *

    The app ID to validate against

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app_id") + public _FinalStage appId(@NotNull String appId) { + this.appId = Objects.requireNonNull(appId, "appId must not be null"); + return this; + } + + /** + *

    The OAuth app ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

    The OAuth app ID

    + */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + @java.lang.Override + public ValidateTokenParams build() { + return new ValidateTokenParams(appId, oauthAppId, additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java new file mode 100644 index 0000000..5691d9d --- /dev/null +++ b/build/spotless/spotlessJava/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java @@ -0,0 +1,511 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ValidateTokenResponse.Builder.class) +public final class ValidateTokenResponse { + private final Optional app; + + private final Optional error; + + private final Optional errorRedirectUri; + + private final Optional oauthAppId; + + private final Optional projectAppName; + + private final Optional projectEnvironment; + + private final Optional projectId; + + private final Optional projectSupportEmail; + + private final boolean success; + + private final Optional successRedirectUri; + + private final Map additionalProperties; + + private ValidateTokenResponse( + Optional app, + Optional error, + Optional errorRedirectUri, + Optional oauthAppId, + Optional projectAppName, + Optional projectEnvironment, + Optional projectId, + Optional projectSupportEmail, + boolean success, + Optional successRedirectUri, + Map additionalProperties) { + this.app = app; + this.error = error; + this.errorRedirectUri = errorRedirectUri; + this.oauthAppId = oauthAppId; + this.projectAppName = projectAppName; + this.projectEnvironment = projectEnvironment; + this.projectId = projectId; + this.projectSupportEmail = projectSupportEmail; + this.success = success; + this.successRedirectUri = successRedirectUri; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return Error message if validation failed + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return OAuth app ID if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return Name of the project app + */ + @JsonProperty("project_app_name") + public Optional getProjectAppName() { + return projectAppName; + } + + /** + * @return Environment of the project + */ + @JsonProperty("project_environment") + public Optional getProjectEnvironment() { + return projectEnvironment; + } + + /** + * @return ID of the project + */ + @JsonProperty("project_id") + public Optional getProjectId() { + return projectId; + } + + /** + * @return Support email for the project + */ + @JsonProperty("project_support_email") + public Optional getProjectSupportEmail() { + return projectSupportEmail; + } + + /** + * @return Whether the token validation was successful + */ + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidateTokenResponse && equalTo((ValidateTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidateTokenResponse other) { + return app.equals(other.app) + && error.equals(other.error) + && errorRedirectUri.equals(other.errorRedirectUri) + && oauthAppId.equals(other.oauthAppId) + && projectAppName.equals(other.projectAppName) + && projectEnvironment.equals(other.projectEnvironment) + && projectId.equals(other.projectId) + && projectSupportEmail.equals(other.projectSupportEmail) + && success == other.success + && successRedirectUri.equals(other.successRedirectUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.app, + this.error, + this.errorRedirectUri, + this.oauthAppId, + this.projectAppName, + this.projectEnvironment, + this.projectId, + this.projectSupportEmail, + this.success, + this.successRedirectUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SuccessStage builder() { + return new Builder(); + } + + public interface SuccessStage { + /** + *

    Whether the token validation was successful

    + */ + _FinalStage success(boolean success); + + Builder from(ValidateTokenResponse other); + } + + public interface _FinalStage { + ValidateTokenResponse build(); + + _FinalStage app(Optional app); + + _FinalStage app(App app); + + /** + *

    Error message if validation failed

    + */ + _FinalStage error(Optional error); + + _FinalStage error(String error); + + /** + *

    URI to redirect to on error

    + */ + _FinalStage errorRedirectUri(Optional errorRedirectUri); + + _FinalStage errorRedirectUri(String errorRedirectUri); + + /** + *

    OAuth app ID if applicable

    + */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); + + /** + *

    Name of the project app

    + */ + _FinalStage projectAppName(Optional projectAppName); + + _FinalStage projectAppName(String projectAppName); + + /** + *

    Environment of the project

    + */ + _FinalStage projectEnvironment(Optional projectEnvironment); + + _FinalStage projectEnvironment(String projectEnvironment); + + /** + *

    ID of the project

    + */ + _FinalStage projectId(Optional projectId); + + _FinalStage projectId(String projectId); + + /** + *

    Support email for the project

    + */ + _FinalStage projectSupportEmail(Optional projectSupportEmail); + + _FinalStage projectSupportEmail(String projectSupportEmail); + + /** + *

    URI to redirect to on success

    + */ + _FinalStage successRedirectUri(Optional successRedirectUri); + + _FinalStage successRedirectUri(String successRedirectUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SuccessStage, _FinalStage { + private boolean success; + + private Optional successRedirectUri = Optional.empty(); + + private Optional projectSupportEmail = Optional.empty(); + + private Optional projectId = Optional.empty(); + + private Optional projectEnvironment = Optional.empty(); + + private Optional projectAppName = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ValidateTokenResponse other) { + app(other.getApp()); + error(other.getError()); + errorRedirectUri(other.getErrorRedirectUri()); + oauthAppId(other.getOauthAppId()); + projectAppName(other.getProjectAppName()); + projectEnvironment(other.getProjectEnvironment()); + projectId(other.getProjectId()); + projectSupportEmail(other.getProjectSupportEmail()); + success(other.getSuccess()); + successRedirectUri(other.getSuccessRedirectUri()); + return this; + } + + /** + *

    Whether the token validation was successful

    + *

    Whether the token validation was successful

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("success") + public _FinalStage success(boolean success) { + this.success = success; + return this; + } + + /** + *

    URI to redirect to on success

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage successRedirectUri(String successRedirectUri) { + this.successRedirectUri = Optional.ofNullable(successRedirectUri); + return this; + } + + /** + *

    URI to redirect to on success

    + */ + @java.lang.Override + @JsonSetter(value = "success_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage successRedirectUri(Optional successRedirectUri) { + this.successRedirectUri = successRedirectUri; + return this; + } + + /** + *

    Support email for the project

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage projectSupportEmail(String projectSupportEmail) { + this.projectSupportEmail = Optional.ofNullable(projectSupportEmail); + return this; + } + + /** + *

    Support email for the project

    + */ + @java.lang.Override + @JsonSetter(value = "project_support_email", nulls = Nulls.SKIP) + public _FinalStage projectSupportEmail(Optional projectSupportEmail) { + this.projectSupportEmail = projectSupportEmail; + return this; + } + + /** + *

    ID of the project

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage projectId(String projectId) { + this.projectId = Optional.ofNullable(projectId); + return this; + } + + /** + *

    ID of the project

    + */ + @java.lang.Override + @JsonSetter(value = "project_id", nulls = Nulls.SKIP) + public _FinalStage projectId(Optional projectId) { + this.projectId = projectId; + return this; + } + + /** + *

    Environment of the project

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage projectEnvironment(String projectEnvironment) { + this.projectEnvironment = Optional.ofNullable(projectEnvironment); + return this; + } + + /** + *

    Environment of the project

    + */ + @java.lang.Override + @JsonSetter(value = "project_environment", nulls = Nulls.SKIP) + public _FinalStage projectEnvironment(Optional projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + /** + *

    Name of the project app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage projectAppName(String projectAppName) { + this.projectAppName = Optional.ofNullable(projectAppName); + return this; + } + + /** + *

    Name of the project app

    + */ + @java.lang.Override + @JsonSetter(value = "project_app_name", nulls = Nulls.SKIP) + public _FinalStage projectAppName(Optional projectAppName) { + this.projectAppName = projectAppName; + return this; + } + + /** + *

    OAuth app ID if applicable

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

    OAuth app ID if applicable

    + */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + /** + *

    URI to redirect to on error

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorRedirectUri(String errorRedirectUri) { + this.errorRedirectUri = Optional.ofNullable(errorRedirectUri); + return this; + } + + /** + *

    URI to redirect to on error

    + */ + @java.lang.Override + @JsonSetter(value = "error_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage errorRedirectUri(Optional errorRedirectUri) { + this.errorRedirectUri = errorRedirectUri; + return this; + } + + /** + *

    Error message if validation failed

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

    Error message if validation failed

    + */ + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + @java.lang.Override + public _FinalStage app(App app) { + this.app = Optional.ofNullable(app); + return this; + } + + @java.lang.Override + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public _FinalStage app(Optional app) { + this.app = app; + return this; + } + + @java.lang.Override + public ValidateTokenResponse build() { + return new ValidateTokenResponse( + app, + error, + errorRedirectUri, + oauthAppId, + projectAppName, + projectEnvironment, + projectId, + projectSupportEmail, + success, + successRedirectUri, + additionalProperties); + } + } +} diff --git a/build/spotless/spotlessJava/src/test/java/com/pipedream/api/StreamTest.java b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/StreamTest.java new file mode 100644 index 0000000..a0f9ca9 --- /dev/null +++ b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/StreamTest.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import static org.junit.jupiter.api.Assertions.*; + +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.Stream; +import java.io.IOException; +import java.io.StringReader; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; + +public final class StreamTest { + @Test + public void testJsonStream() { + List messages = List.of(Map.of("message", "hello"), Map.of("message", "world")); + List jsonStrings = messages.stream().map(StreamTest::mapToJson).toList(); + String input = String.join("\n", jsonStrings); + StringReader jsonInput = new StringReader(input); + Stream jsonStream = Stream.fromJson(Map.class, jsonInput); + int expectedMessages = 2; + int actualMessages = 0; + for (Map jsonObject : jsonStream) { + actualMessages++; + assertTrue(jsonObject.containsKey("message")); + } + assertEquals(expectedMessages, actualMessages); + } + + @Test + public void testSseStream() { + List events = List.of(Map.of("event", "start"), Map.of("event", "end")); + List sseStrings = events.stream().map(StreamTest::mapToSse).toList(); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSse(Map.class, sseInput); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + assertTrue(eventData.containsKey("event")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testSseStreamWithTerminator() { + List events = List.of(Map.of("message", "first"), Map.of("message", "second")); + List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); + sseStrings.add("data: [DONE]"); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSse(Map.class, sseInput, "[DONE]"); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + assertTrue(eventData.containsKey("message")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testStreamResourceManagement() throws IOException { + StringReader testInput = new StringReader("{\"test\":\"data\"}"); + Stream testStream = Stream.fromJson(Map.class, testInput); + testStream.close(); + assertFalse(testStream.iterator().hasNext()); + } + + private static String mapToJson(Map map) { + try { + return ObjectMappers.JSON_MAPPER.writeValueAsString(map); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static String mapToSse(Map map) { + return "data: " + mapToJson(map); + } +} diff --git a/build/spotless/spotlessJava/src/test/java/com/pipedream/api/TestClient.java b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/TestClient.java new file mode 100644 index 0000000..157ade0 --- /dev/null +++ b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/TestClient.java @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +public final class TestClient { + public void test() { + // Add tests here and mark this file in .fernignore + assert true; + } +} diff --git a/build/spotless/spotlessJava/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java new file mode 100644 index 0000000..d8eac81 --- /dev/null +++ b/build/spotless/spotlessJava/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class QueryStringMapperTest { + @Test + public void testObjectWithQuotedString_indexedArrays() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithQuotedString_arraysAsRepeats() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_indexedArrays() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_arraysAsRepeats() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_indexedArrays() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_arraysAsRepeats() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_indexedArrays() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_arraysAsRepeats() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_indexedArrays() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = "objects%5B0%5D%5Bvalue%5D=world&objects%5B0%5D%5Bkey%5D=hello&objects%5B1%5D" + + "%5Bvalue%5D=bar&objects%5B1%5D%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_arraysAsRepeats() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = + "objects%5Bvalue%5D=world&objects%5Bkey%5D=hello&objects%5Bvalue" + "%5D=bar&objects%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_indexedArrays() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = + "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds%5D%5B0%5D=id1&objectwitharray" + + "%5BcontactIds%5D%5B1%5D=id2&objectwitharray%5BcontactIds%5D%5B2%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_arraysAsRepeats() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds" + + "%5D=id1&objectwitharray%5BcontactIds%5D=id2&objectwitharray%5BcontactIds%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + private static String queryString(Map params, boolean arraysAsRepeats) { + HttpUrl.Builder httpUrl = HttpUrl.parse("http://www.fakewebsite.com/").newBuilder(); + params.forEach((paramName, paramValue) -> + QueryStringMapper.addQueryParameter(httpUrl, paramName, paramValue, arraysAsRepeats)); + return httpUrl.build().encodedQuery(); + } +} diff --git a/build/tmp/spotless-register-dependencies b/build/tmp/spotless-register-dependencies new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/build/tmp/spotless-register-dependencies @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..e69de29 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..d4081da --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..23d15a9 --- /dev/null +++ b/gradlew @@ -0,0 +1,251 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH="\\\"\\\"" + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..5eed7ee --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/sample-app/build.gradle b/sample-app/build.gradle new file mode 100644 index 0000000..4ee8f22 --- /dev/null +++ b/sample-app/build.gradle @@ -0,0 +1,19 @@ +plugins { + id 'java-library' +} + +repositories { + mavenCentral() + maven { + url 'https://s01.oss.sonatype.org/content/repositories/releases/' + } +} + +dependencies { + implementation rootProject +} + + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + diff --git a/sample-app/src/main/java/sample/App.java b/sample-app/src/main/java/sample/App.java new file mode 100644 index 0000000..7587480 --- /dev/null +++ b/sample-app/src/main/java/sample/App.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +package sample; + +import java.lang.String; + +public final class App { + public static void main(String[] args) { + // import com.pipedream.api.AsyncPipedreamApiClient + } +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..db2eef5 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,3 @@ +rootProject.name = 'pipedream' + +include 'sample-app' \ No newline at end of file diff --git a/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java b/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java new file mode 100644 index 0000000..ee61fa8 --- /dev/null +++ b/src/main/java/com/pipedream/api/AsyncPipedreamApiClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Suppliers; +import com.pipedream.api.resources.accounts.AsyncAccountsClient; +import com.pipedream.api.resources.actions.AsyncActionsClient; +import com.pipedream.api.resources.appcategories.AsyncAppCategoriesClient; +import com.pipedream.api.resources.apps.AsyncAppsClient; +import com.pipedream.api.resources.components.AsyncComponentsClient; +import com.pipedream.api.resources.deployedtriggers.AsyncDeployedTriggersClient; +import com.pipedream.api.resources.oauthtokens.AsyncOauthTokensClient; +import com.pipedream.api.resources.projects.AsyncProjectsClient; +import com.pipedream.api.resources.proxy.AsyncProxyClient; +import com.pipedream.api.resources.tokens.AsyncTokensClient; +import com.pipedream.api.resources.triggers.AsyncTriggersClient; +import com.pipedream.api.resources.users.AsyncUsersClient; +import java.util.function.Supplier; + +public class AsyncPipedreamApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier appCategoriesClient; + + protected final Supplier appsClient; + + protected final Supplier accountsClient; + + protected final Supplier usersClient; + + protected final Supplier componentsClient; + + protected final Supplier actionsClient; + + protected final Supplier triggersClient; + + protected final Supplier deployedTriggersClient; + + protected final Supplier projectsClient; + + protected final Supplier proxyClient; + + protected final Supplier tokensClient; + + protected final Supplier oauthTokensClient; + + public AsyncPipedreamApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.appCategoriesClient = Suppliers.memoize(() -> new AsyncAppCategoriesClient(clientOptions)); + this.appsClient = Suppliers.memoize(() -> new AsyncAppsClient(clientOptions)); + this.accountsClient = Suppliers.memoize(() -> new AsyncAccountsClient(clientOptions)); + this.usersClient = Suppliers.memoize(() -> new AsyncUsersClient(clientOptions)); + this.componentsClient = Suppliers.memoize(() -> new AsyncComponentsClient(clientOptions)); + this.actionsClient = Suppliers.memoize(() -> new AsyncActionsClient(clientOptions)); + this.triggersClient = Suppliers.memoize(() -> new AsyncTriggersClient(clientOptions)); + this.deployedTriggersClient = Suppliers.memoize(() -> new AsyncDeployedTriggersClient(clientOptions)); + this.projectsClient = Suppliers.memoize(() -> new AsyncProjectsClient(clientOptions)); + this.proxyClient = Suppliers.memoize(() -> new AsyncProxyClient(clientOptions)); + this.tokensClient = Suppliers.memoize(() -> new AsyncTokensClient(clientOptions)); + this.oauthTokensClient = Suppliers.memoize(() -> new AsyncOauthTokensClient(clientOptions)); + } + + public AsyncAppCategoriesClient appCategories() { + return this.appCategoriesClient.get(); + } + + public AsyncAppsClient apps() { + return this.appsClient.get(); + } + + public AsyncAccountsClient accounts() { + return this.accountsClient.get(); + } + + public AsyncUsersClient users() { + return this.usersClient.get(); + } + + public AsyncComponentsClient components() { + return this.componentsClient.get(); + } + + public AsyncActionsClient actions() { + return this.actionsClient.get(); + } + + public AsyncTriggersClient triggers() { + return this.triggersClient.get(); + } + + public AsyncDeployedTriggersClient deployedTriggers() { + return this.deployedTriggersClient.get(); + } + + public AsyncProjectsClient projects() { + return this.projectsClient.get(); + } + + public AsyncProxyClient proxy() { + return this.proxyClient.get(); + } + + public AsyncTokensClient tokens() { + return this.tokensClient.get(); + } + + public AsyncOauthTokensClient oauthTokens() { + return this.oauthTokensClient.get(); + } + + public static AsyncPipedreamApiClientBuilder builder() { + return new AsyncPipedreamApiClientBuilder(); + } +} diff --git a/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java b/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java new file mode 100644 index 0000000..0ebee7b --- /dev/null +++ b/src/main/java/com/pipedream/api/AsyncPipedreamApiClientBuilder.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Environment; +import com.pipedream.api.core.OAuthTokenSupplier; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import okhttp3.OkHttpClient; + +public final class AsyncPipedreamApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); + + private String clientSecret = System.getenv("PIPEDREAM_CLIENT_SECRET"); + + private String projectEnvironment = null; + + private Environment environment = Environment.PROD; + + /** + * Sets clientId. + * Defaults to the PIPEDREAM_CLIENT_ID environment variable. + */ + public AsyncPipedreamApiClientBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets clientSecret. + * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. + */ + public AsyncPipedreamApiClientBuilder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Sets projectEnvironment + */ + public AsyncPipedreamApiClientBuilder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public AsyncPipedreamApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public AsyncPipedreamApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public AsyncPipedreamApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public AsyncPipedreamApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public AsyncPipedreamApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public AsyncPipedreamApiClientBuilder projectId(String projectId) { + clientOptionsBuilder.projectId(projectId); + return this; + } + + public AsyncPipedreamApiClient build() { + OauthTokensClient authClient = new OauthTokensClient( + ClientOptions.builder().environment(this.environment).build()); + OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); + this.clientOptionsBuilder.addHeader("Authorization", oAuthTokenSupplier); + if (projectEnvironment != null) { + this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); + } + clientOptionsBuilder.environment(this.environment); + return new AsyncPipedreamApiClient(clientOptionsBuilder.build()); + } +} diff --git a/src/main/java/com/pipedream/api/PipedreamApiClient.java b/src/main/java/com/pipedream/api/PipedreamApiClient.java new file mode 100644 index 0000000..fbe892b --- /dev/null +++ b/src/main/java/com/pipedream/api/PipedreamApiClient.java @@ -0,0 +1,116 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Suppliers; +import com.pipedream.api.resources.accounts.AccountsClient; +import com.pipedream.api.resources.actions.ActionsClient; +import com.pipedream.api.resources.appcategories.AppCategoriesClient; +import com.pipedream.api.resources.apps.AppsClient; +import com.pipedream.api.resources.components.ComponentsClient; +import com.pipedream.api.resources.deployedtriggers.DeployedTriggersClient; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import com.pipedream.api.resources.projects.ProjectsClient; +import com.pipedream.api.resources.proxy.ProxyClient; +import com.pipedream.api.resources.tokens.TokensClient; +import com.pipedream.api.resources.triggers.TriggersClient; +import com.pipedream.api.resources.users.UsersClient; +import java.util.function.Supplier; + +public class PipedreamApiClient { + protected final ClientOptions clientOptions; + + protected final Supplier appCategoriesClient; + + protected final Supplier appsClient; + + protected final Supplier accountsClient; + + protected final Supplier usersClient; + + protected final Supplier componentsClient; + + protected final Supplier actionsClient; + + protected final Supplier triggersClient; + + protected final Supplier deployedTriggersClient; + + protected final Supplier projectsClient; + + protected final Supplier proxyClient; + + protected final Supplier tokensClient; + + protected final Supplier oauthTokensClient; + + public PipedreamApiClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.appCategoriesClient = Suppliers.memoize(() -> new AppCategoriesClient(clientOptions)); + this.appsClient = Suppliers.memoize(() -> new AppsClient(clientOptions)); + this.accountsClient = Suppliers.memoize(() -> new AccountsClient(clientOptions)); + this.usersClient = Suppliers.memoize(() -> new UsersClient(clientOptions)); + this.componentsClient = Suppliers.memoize(() -> new ComponentsClient(clientOptions)); + this.actionsClient = Suppliers.memoize(() -> new ActionsClient(clientOptions)); + this.triggersClient = Suppliers.memoize(() -> new TriggersClient(clientOptions)); + this.deployedTriggersClient = Suppliers.memoize(() -> new DeployedTriggersClient(clientOptions)); + this.projectsClient = Suppliers.memoize(() -> new ProjectsClient(clientOptions)); + this.proxyClient = Suppliers.memoize(() -> new ProxyClient(clientOptions)); + this.tokensClient = Suppliers.memoize(() -> new TokensClient(clientOptions)); + this.oauthTokensClient = Suppliers.memoize(() -> new OauthTokensClient(clientOptions)); + } + + public AppCategoriesClient appCategories() { + return this.appCategoriesClient.get(); + } + + public AppsClient apps() { + return this.appsClient.get(); + } + + public AccountsClient accounts() { + return this.accountsClient.get(); + } + + public UsersClient users() { + return this.usersClient.get(); + } + + public ComponentsClient components() { + return this.componentsClient.get(); + } + + public ActionsClient actions() { + return this.actionsClient.get(); + } + + public TriggersClient triggers() { + return this.triggersClient.get(); + } + + public DeployedTriggersClient deployedTriggers() { + return this.deployedTriggersClient.get(); + } + + public ProjectsClient projects() { + return this.projectsClient.get(); + } + + public ProxyClient proxy() { + return this.proxyClient.get(); + } + + public TokensClient tokens() { + return this.tokensClient.get(); + } + + public OauthTokensClient oauthTokens() { + return this.oauthTokensClient.get(); + } + + public static PipedreamApiClientBuilder builder() { + return new PipedreamApiClientBuilder(); + } +} diff --git a/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java b/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java new file mode 100644 index 0000000..9983f98 --- /dev/null +++ b/src/main/java/com/pipedream/api/PipedreamApiClientBuilder.java @@ -0,0 +1,99 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.Environment; +import com.pipedream.api.core.OAuthTokenSupplier; +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import okhttp3.OkHttpClient; + +public final class PipedreamApiClientBuilder { + private ClientOptions.Builder clientOptionsBuilder = ClientOptions.builder(); + + private String clientId = System.getenv("PIPEDREAM_CLIENT_ID"); + + private String clientSecret = System.getenv("PIPEDREAM_CLIENT_SECRET"); + + private String projectEnvironment = null; + + private Environment environment = Environment.PROD; + + /** + * Sets clientId. + * Defaults to the PIPEDREAM_CLIENT_ID environment variable. + */ + public PipedreamApiClientBuilder clientId(String clientId) { + this.clientId = clientId; + return this; + } + + /** + * Sets clientSecret. + * Defaults to the PIPEDREAM_CLIENT_SECRET environment variable. + */ + public PipedreamApiClientBuilder clientSecret(String clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + /** + * Sets projectEnvironment + */ + public PipedreamApiClientBuilder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public PipedreamApiClientBuilder environment(Environment environment) { + this.environment = environment; + return this; + } + + public PipedreamApiClientBuilder url(String url) { + this.environment = Environment.custom(url); + return this; + } + + /** + * Sets the timeout (in seconds) for the client. Defaults to 60 seconds. + */ + public PipedreamApiClientBuilder timeout(int timeout) { + this.clientOptionsBuilder.timeout(timeout); + return this; + } + + /** + * Sets the maximum number of retries for the client. Defaults to 2 retries. + */ + public PipedreamApiClientBuilder maxRetries(int maxRetries) { + this.clientOptionsBuilder.maxRetries(maxRetries); + return this; + } + + /** + * Sets the underlying OkHttp client + */ + public PipedreamApiClientBuilder httpClient(OkHttpClient httpClient) { + this.clientOptionsBuilder.httpClient(httpClient); + return this; + } + + public PipedreamApiClientBuilder projectId(String projectId) { + clientOptionsBuilder.projectId(projectId); + return this; + } + + public PipedreamApiClient build() { + OauthTokensClient authClient = new OauthTokensClient( + ClientOptions.builder().environment(this.environment).build()); + OAuthTokenSupplier oAuthTokenSupplier = new OAuthTokenSupplier(clientId, clientSecret, authClient); + this.clientOptionsBuilder.addHeader("Authorization", oAuthTokenSupplier); + if (projectEnvironment != null) { + this.clientOptionsBuilder.addHeader("x-pd-environment", this.projectEnvironment); + } + clientOptionsBuilder.environment(this.environment); + return new PipedreamApiClient(clientOptionsBuilder.build()); + } +} diff --git a/src/main/java/com/pipedream/api/core/ClientOptions.java b/src/main/java/com/pipedream/api/core/ClientOptions.java new file mode 100644 index 0000000..71e9632 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/ClientOptions.java @@ -0,0 +1,186 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; +import okhttp3.OkHttpClient; + +public final class ClientOptions { + private final Environment environment; + + private final Map headers; + + private final Map> headerSuppliers; + + private final OkHttpClient httpClient; + + private final int timeout; + + private String projectId; + + private ClientOptions( + Environment environment, + Map headers, + Map> headerSuppliers, + OkHttpClient httpClient, + int timeout, + String projectId) { + this.environment = environment; + this.headers = new HashMap<>(); + this.headers.putAll(headers); + this.headers.putAll(new HashMap() { + { + put("X-Fern-Language", "JAVA"); + put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk"); + put("X-Fern-SDK-Version", "0.0.190"); + } + }); + this.headerSuppliers = headerSuppliers; + this.httpClient = httpClient; + this.timeout = timeout; + this.projectId = projectId; + } + + public Environment environment() { + return this.environment; + } + + public Map headers(RequestOptions requestOptions) { + Map values = new HashMap<>(this.headers); + headerSuppliers.forEach((key, supplier) -> { + values.put(key, supplier.get()); + }); + if (requestOptions != null) { + values.putAll(requestOptions.getHeaders()); + } + return values; + } + + public int timeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.timeout; + } + return requestOptions.getTimeout().orElse(this.timeout); + } + + public OkHttpClient httpClient() { + return this.httpClient; + } + + public OkHttpClient httpClientWithTimeout(RequestOptions requestOptions) { + if (requestOptions == null) { + return this.httpClient; + } + return this.httpClient + .newBuilder() + .callTimeout(requestOptions.getTimeout().get(), requestOptions.getTimeoutTimeUnit()) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .build(); + } + + public String projectId() { + return this.projectId; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private Environment environment; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + private int maxRetries = 2; + + private Optional timeout = Optional.empty(); + + private OkHttpClient httpClient = null; + + private String projectId; + + public Builder environment(Environment environment) { + this.environment = environment; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(int timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + /** + * Override the timeout in seconds. Defaults to 60 seconds. + */ + public Builder timeout(Optional timeout) { + this.timeout = timeout; + return this; + } + + /** + * Override the maximum number of retries. Defaults to 2 retries. + */ + public Builder maxRetries(int maxRetries) { + this.maxRetries = maxRetries; + return this; + } + + public Builder httpClient(OkHttpClient httpClient) { + this.httpClient = httpClient; + return this; + } + + public Builder projectId(String projectId) { + this.projectId = projectId; + return this; + } + + public ClientOptions build() { + OkHttpClient.Builder httpClientBuilder = + this.httpClient != null ? this.httpClient.newBuilder() : new OkHttpClient.Builder(); + + if (this.httpClient != null) { + timeout.ifPresent(timeout -> httpClientBuilder + .callTimeout(timeout, TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS)); + } else { + httpClientBuilder + .callTimeout(this.timeout.orElse(60), TimeUnit.SECONDS) + .connectTimeout(0, TimeUnit.SECONDS) + .writeTimeout(0, TimeUnit.SECONDS) + .readTimeout(0, TimeUnit.SECONDS) + .addInterceptor(new RetryInterceptor(this.maxRetries)); + } + + this.httpClient = httpClientBuilder.build(); + this.timeout = Optional.of(httpClient.callTimeoutMillis() / 1000); + + return new ClientOptions( + environment, headers, headerSuppliers, httpClient, this.timeout.get(), this.projectId); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java b/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java new file mode 100644 index 0000000..e9083a3 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/DateTimeDeserializer.java @@ -0,0 +1,55 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonToken; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.module.SimpleModule; +import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalQueries; + +/** + * Custom deserializer that handles converting ISO8601 dates into {@link OffsetDateTime} objects. + */ +class DateTimeDeserializer extends JsonDeserializer { + private static final SimpleModule MODULE; + + static { + MODULE = new SimpleModule().addDeserializer(OffsetDateTime.class, new DateTimeDeserializer()); + } + + /** + * Gets a module wrapping this deserializer as an adapter for the Jackson ObjectMapper. + * + * @return A {@link SimpleModule} to be plugged onto Jackson ObjectMapper. + */ + public static SimpleModule getModule() { + return MODULE; + } + + @Override + public OffsetDateTime deserialize(JsonParser parser, DeserializationContext context) throws IOException { + JsonToken token = parser.currentToken(); + if (token == JsonToken.VALUE_NUMBER_INT) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(parser.getValueAsLong()), ZoneOffset.UTC); + } else { + TemporalAccessor temporal = DateTimeFormatter.ISO_DATE_TIME.parseBest( + parser.getValueAsString(), OffsetDateTime::from, LocalDateTime::from); + + if (temporal.query(TemporalQueries.offset()) == null) { + return LocalDateTime.from(temporal).atOffset(ZoneOffset.UTC); + } else { + return OffsetDateTime.from(temporal); + } + } + } +} diff --git a/src/main/java/com/pipedream/api/core/Environment.java b/src/main/java/com/pipedream/api/core/Environment.java new file mode 100644 index 0000000..def399b --- /dev/null +++ b/src/main/java/com/pipedream/api/core/Environment.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +public final class Environment { + public static final Environment CANARY = new Environment("https://api2.pipedream.com"); + + public static final Environment DEV = new Environment("https://api.${DEV_NAMESPACE}.gkes.pipedream.net"); + + public static final Environment PROD = new Environment("https://api.pipedream.com"); + + private final String url; + + private Environment(String url) { + this.url = url; + } + + public String getUrl() { + return this.url; + } + + public static Environment custom(String url) { + return new Environment(url); + } +} diff --git a/src/main/java/com/pipedream/api/core/FileStream.java b/src/main/java/com/pipedream/api/core/FileStream.java new file mode 100644 index 0000000..d5500e2 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/FileStream.java @@ -0,0 +1,60 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a file stream with associated metadata for file uploads. + */ +public class FileStream { + private final InputStream inputStream; + private final String fileName; + private final MediaType contentType; + + /** + * Constructs a FileStream with the given input stream and optional metadata. + * + * @param inputStream The input stream of the file content. Must not be null. + * @param fileName The name of the file, or null if unknown. + * @param contentType The MIME type of the file content, or null if unknown. + * @throws NullPointerException if inputStream is null + */ + public FileStream(InputStream inputStream, @Nullable String fileName, @Nullable MediaType contentType) { + this.inputStream = Objects.requireNonNull(inputStream, "Input stream cannot be null"); + this.fileName = fileName; + this.contentType = contentType; + } + + public FileStream(InputStream inputStream) { + this(inputStream, null, null); + } + + public InputStream getInputStream() { + return inputStream; + } + + @Nullable + public String getFileName() { + return fileName; + } + + @Nullable + public MediaType getContentType() { + return contentType; + } + + /** + * Creates a RequestBody suitable for use with OkHttp client. + * + * @return A RequestBody instance representing this file stream. + */ + public RequestBody toRequestBody() { + return new InputStreamRequestBody(contentType, inputStream); + } +} diff --git a/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java b/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java new file mode 100644 index 0000000..a91bea5 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/InputStreamRequestBody.java @@ -0,0 +1,79 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Objects; +import okhttp3.MediaType; +import okhttp3.RequestBody; +import okhttp3.internal.Util; +import okio.BufferedSink; +import okio.Okio; +import okio.Source; +import org.jetbrains.annotations.Nullable; + +/** + * A custom implementation of OkHttp's RequestBody that wraps an InputStream. + * This class allows streaming of data from an InputStream directly to an HTTP request body, + * which is useful for file uploads or sending large amounts of data without loading it all into memory. + */ +public class InputStreamRequestBody extends RequestBody { + private final InputStream inputStream; + private final MediaType contentType; + + /** + * Constructs an InputStreamRequestBody with the specified content type and input stream. + * + * @param contentType the MediaType of the content, or null if not known + * @param inputStream the InputStream containing the data to be sent + * @throws NullPointerException if inputStream is null + */ + public InputStreamRequestBody(@Nullable MediaType contentType, InputStream inputStream) { + this.contentType = contentType; + this.inputStream = Objects.requireNonNull(inputStream, "inputStream == null"); + } + + /** + * Returns the content type of this request body. + * + * @return the MediaType of the content, or null if not specified + */ + @Nullable + @Override + public MediaType contentType() { + return contentType; + } + + /** + * Returns the content length of this request body, if known. + * This method attempts to determine the length using the InputStream's available() method, + * which may not always accurately reflect the total length of the stream. + * + * @return the content length, or -1 if the length is unknown + * @throws IOException if an I/O error occurs + */ + @Override + public long contentLength() throws IOException { + return inputStream.available() == 0 ? -1 : inputStream.available(); + } + + /** + * Writes the content of the InputStream to the given BufferedSink. + * This method is responsible for transferring the data from the InputStream to the network request. + * + * @param sink the BufferedSink to write the content to + * @throws IOException if an I/O error occurs during writing + */ + @Override + public void writeTo(BufferedSink sink) throws IOException { + Source source = null; + try { + source = Okio.source(inputStream); + sink.writeAll(source); + } finally { + Util.closeQuietly(Objects.requireNonNull(source)); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/MediaTypes.java b/src/main/java/com/pipedream/api/core/MediaTypes.java new file mode 100644 index 0000000..6b6288f --- /dev/null +++ b/src/main/java/com/pipedream/api/core/MediaTypes.java @@ -0,0 +1,13 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import okhttp3.MediaType; + +public final class MediaTypes { + + public static final MediaType APPLICATION_JSON = MediaType.parse("application/json"); + + private MediaTypes() {} +} diff --git a/src/main/java/com/pipedream/api/core/Nullable.java b/src/main/java/com/pipedream/api/core/Nullable.java new file mode 100644 index 0000000..2b6af74 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/Nullable.java @@ -0,0 +1,140 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Optional; +import java.util.function.Function; + +public final class Nullable { + + private final Either, Null> value; + + private Nullable() { + this.value = Either.left(Optional.empty()); + } + + private Nullable(T value) { + if (value == null) { + this.value = Either.right(Null.INSTANCE); + } else { + this.value = Either.left(Optional.of(value)); + } + } + + public static Nullable ofNull() { + return new Nullable<>(null); + } + + public static Nullable of(T value) { + return new Nullable<>(value); + } + + public static Nullable empty() { + return new Nullable<>(); + } + + public static Nullable ofOptional(Optional value) { + if (value.isPresent()) { + return of(value.get()); + } else { + return empty(); + } + } + + public boolean isNull() { + return this.value.isRight(); + } + + public boolean isEmpty() { + return this.value.isLeft() && !this.value.getLeft().isPresent(); + } + + public T get() { + if (this.isNull()) { + return null; + } + + return this.value.getLeft().get(); + } + + public Nullable map(Function mapper) { + if (this.isNull()) { + return Nullable.ofNull(); + } + + return Nullable.ofOptional(this.value.getLeft().map(mapper)); + } + + @Override + public boolean equals(Object other) { + if (!(other instanceof Nullable)) { + return false; + } + + if (((Nullable) other).isNull() && this.isNull()) { + return true; + } + + return this.value.getLeft().equals(((Nullable) other).value.getLeft()); + } + + private static final class Either { + private L left = null; + private R right = null; + + private Either(L left, R right) { + if (left != null && right != null) { + throw new IllegalArgumentException("Left and right argument cannot both be non-null."); + } + + if (left == null && right == null) { + throw new IllegalArgumentException("Left and right argument cannot both be null."); + } + + if (left != null) { + this.left = left; + } + + if (right != null) { + this.right = right; + } + } + + public static Either left(L left) { + return new Either<>(left, null); + } + + public static Either right(R right) { + return new Either<>(null, right); + } + + public boolean isLeft() { + return this.left != null; + } + + public boolean isRight() { + return this.right != null; + } + + public L getLeft() { + if (!this.isLeft()) { + throw new IllegalArgumentException("Cannot get left from right Either."); + } + return this.left; + } + + public R getRight() { + if (!this.isRight()) { + throw new IllegalArgumentException("Cannot get right from left Either."); + } + return this.right; + } + } + + private static final class Null { + private static final Null INSTANCE = new Null(); + + private Null() {} + } +} diff --git a/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java b/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java new file mode 100644 index 0000000..afad6eb --- /dev/null +++ b/src/main/java/com/pipedream/api/core/NullableNonemptyFilter.java @@ -0,0 +1,19 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Optional; + +public final class NullableNonemptyFilter { + @Override + public boolean equals(Object o) { + boolean isOptionalEmpty = isOptionalEmpty(o); + + return isOptionalEmpty; + } + + private boolean isOptionalEmpty(Object o) { + return o instanceof Optional && !((Optional) o).isPresent(); + } +} diff --git a/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java b/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java new file mode 100644 index 0000000..ddbde79 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/OAuthTokenSupplier.java @@ -0,0 +1,54 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.pipedream.api.resources.oauthtokens.OauthTokensClient; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.function.Supplier; + +public final class OAuthTokenSupplier implements Supplier { + private static final long BUFFER_IN_MINUTES = 2; + + private final String clientId; + + private final String clientSecret; + + private final OauthTokensClient authClient; + + private String accessToken; + + private Instant expiresAt; + + public OAuthTokenSupplier(String clientId, String clientSecret, OauthTokensClient authClient) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.authClient = authClient; + this.expiresAt = Instant.now(); + } + + public CreateOAuthTokenResponse fetchToken() { + CreateOAuthTokenOpts getTokenRequest = CreateOAuthTokenOpts.builder() + .clientId(clientId) + .clientSecret(clientSecret) + .build(); + return authClient.create(getTokenRequest); + } + + @java.lang.Override + public String get() { + if (accessToken == null || expiresAt.isBefore(Instant.now())) { + CreateOAuthTokenResponse authResponse = fetchToken(); + this.accessToken = authResponse.getAccessToken(); + this.expiresAt = getExpiresAt(authResponse.getExpiresIn()); + } + return "Bearer " + accessToken; + } + + private Instant getExpiresAt(long expiresInSeconds) { + return Instant.now().plus(expiresInSeconds, ChronoUnit.SECONDS).minus(BUFFER_IN_MINUTES, ChronoUnit.MINUTES); + } +} diff --git a/src/main/java/com/pipedream/api/core/ObjectMappers.java b/src/main/java/com/pipedream/api/core/ObjectMappers.java new file mode 100644 index 0000000..6dd6c3c --- /dev/null +++ b/src/main/java/com/pipedream/api/core/ObjectMappers.java @@ -0,0 +1,36 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.databind.json.JsonMapper; +import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import java.io.IOException; + +public final class ObjectMappers { + public static final ObjectMapper JSON_MAPPER = JsonMapper.builder() + .addModule(new Jdk8Module()) + .addModule(new JavaTimeModule()) + .addModule(DateTimeDeserializer.getModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS) + .build(); + + private ObjectMappers() {} + + public static String stringify(Object o) { + try { + return JSON_MAPPER + .setSerializationInclusion(JsonInclude.Include.ALWAYS) + .writerWithDefaultPrettyPrinter() + .writeValueAsString(o); + } catch (IOException e) { + return o.getClass().getName() + "@" + Integer.toHexString(o.hashCode()); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java b/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java new file mode 100644 index 0000000..d4d2e56 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/PipedreamApiApiException.java @@ -0,0 +1,73 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +/** + * This exception type will be thrown for any non-2XX API responses. + */ +public class PipedreamApiApiException extends PipedreamApiException { + /** + * The error code of the response that triggered the exception. + */ + private final int statusCode; + + /** + * The body of the response that triggered the exception. + */ + private final Object body; + + private final Map> headers; + + public PipedreamApiApiException(String message, int statusCode, Object body) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + } + + public PipedreamApiApiException(String message, int statusCode, Object body, Response rawResponse) { + super(message); + this.statusCode = statusCode; + this.body = body; + this.headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + this.headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + } + + /** + * @return the statusCode + */ + public int statusCode() { + return this.statusCode; + } + + /** + * @return the body + */ + public Object body() { + return this.body; + } + + /** + * @return the headers + */ + public Map> headers() { + return this.headers; + } + + @java.lang.Override + public String toString() { + return "PipedreamApiApiException{" + "message: " + getMessage() + ", statusCode: " + statusCode + ", body: " + + body + "}"; + } +} diff --git a/src/main/java/com/pipedream/api/core/PipedreamApiException.java b/src/main/java/com/pipedream/api/core/PipedreamApiException.java new file mode 100644 index 0000000..866b47e --- /dev/null +++ b/src/main/java/com/pipedream/api/core/PipedreamApiException.java @@ -0,0 +1,17 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +/** + * This class serves as the base exception for all errors in the SDK. + */ +public class PipedreamApiException extends RuntimeException { + public PipedreamApiException(String message) { + super(message); + } + + public PipedreamApiException(String message, Exception e) { + super(message, e); + } +} diff --git a/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java b/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java new file mode 100644 index 0000000..59f2804 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/PipedreamApiHttpResponse.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.Response; + +public final class PipedreamApiHttpResponse { + + private final T body; + + private final Map> headers; + + public PipedreamApiHttpResponse(T body, Response rawResponse) { + this.body = body; + + Map> headers = new HashMap<>(); + rawResponse.headers().forEach(header -> { + String key = header.component1(); + String value = header.component2(); + headers.computeIfAbsent(key, _str -> new ArrayList<>()).add(value); + }); + this.headers = headers; + } + + public T body() { + return this.body; + } + + public Map> headers() { + return headers; + } +} diff --git a/src/main/java/com/pipedream/api/core/QueryStringMapper.java b/src/main/java/com/pipedream/api/core/QueryStringMapper.java new file mode 100644 index 0000000..70723d0 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/QueryStringMapper.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ArrayNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import java.util.AbstractMap; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import okhttp3.MultipartBody; + +public class QueryStringMapper { + + private static final ObjectMapper MAPPER = ObjectMappers.JSON_MAPPER; + + public static void addQueryParameter(HttpUrl.Builder httpUrl, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + httpUrl.addQueryParameter(key, valueNode.textValue()); + } else { + httpUrl.addQueryParameter(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().textValue()); + } else { + httpUrl.addQueryParameter(key + field.getKey(), field.getValue().toString()); + } + } + } + + public static void addFormDataPart( + MultipartBody.Builder multipartBody, String key, Object value, boolean arraysAsRepeats) { + JsonNode valueNode = MAPPER.valueToTree(value); + + List> flat; + if (valueNode.isObject()) { + flat = flattenObject((ObjectNode) valueNode, arraysAsRepeats); + } else if (valueNode.isArray()) { + flat = flattenArray((ArrayNode) valueNode, "", arraysAsRepeats); + } else { + if (valueNode.isTextual()) { + multipartBody.addFormDataPart(key, valueNode.textValue()); + } else { + multipartBody.addFormDataPart(key, valueNode.toString()); + } + return; + } + + for (Map.Entry field : flat) { + if (field.getValue().isTextual()) { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().textValue()); + } else { + multipartBody.addFormDataPart( + key + field.getKey(), field.getValue().toString()); + } + } + } + + public static List> flattenObject(ObjectNode object, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator> fields = object.fields(); + while (fields.hasNext()) { + Map.Entry field = fields.next(); + + String key = "[" + field.getKey() + "]"; + + if (field.getValue().isObject()) { + List> flatField = + flattenObject((ObjectNode) field.getValue(), arraysAsRepeats); + addAll(flat, flatField, key); + } else if (field.getValue().isArray()) { + List> flatField = + flattenArray((ArrayNode) field.getValue(), key, arraysAsRepeats); + addAll(flat, flatField, ""); + } else { + flat.add(new AbstractMap.SimpleEntry<>(key, field.getValue())); + } + } + + return flat; + } + + private static List> flattenArray( + ArrayNode array, String key, boolean arraysAsRepeats) { + List> flat = new ArrayList<>(); + + Iterator elements = array.elements(); + + int index = 0; + while (elements.hasNext()) { + JsonNode element = elements.next(); + + String indexKey = key + "[" + index + "]"; + + if (arraysAsRepeats) { + indexKey = key; + } + + if (element.isObject()) { + List> flatField = flattenObject((ObjectNode) element, arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else if (element.isArray()) { + List> flatField = flattenArray((ArrayNode) element, "", arraysAsRepeats); + addAll(flat, flatField, indexKey); + } else { + flat.add(new AbstractMap.SimpleEntry<>(indexKey, element)); + } + + index++; + } + + return flat; + } + + private static void addAll( + List> target, List> source, String prefix) { + for (Map.Entry entry : source) { + Map.Entry entryToAdd = + new AbstractMap.SimpleEntry<>(prefix + entry.getKey(), entry.getValue()); + target.add(entryToAdd); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/RequestOptions.java b/src/main/java/com/pipedream/api/core/RequestOptions.java new file mode 100644 index 0000000..559f48d --- /dev/null +++ b/src/main/java/com/pipedream/api/core/RequestOptions.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.TimeUnit; +import java.util.function.Supplier; + +public final class RequestOptions { + private final String projectEnvironment; + + private final Optional timeout; + + private final TimeUnit timeoutTimeUnit; + + private final Map headers; + + private final Map> headerSuppliers; + + private RequestOptions( + String projectEnvironment, + Optional timeout, + TimeUnit timeoutTimeUnit, + Map headers, + Map> headerSuppliers) { + this.projectEnvironment = projectEnvironment; + this.timeout = timeout; + this.timeoutTimeUnit = timeoutTimeUnit; + this.headers = headers; + this.headerSuppliers = headerSuppliers; + } + + public Optional getTimeout() { + return timeout; + } + + public TimeUnit getTimeoutTimeUnit() { + return timeoutTimeUnit; + } + + public Map getHeaders() { + Map headers = new HashMap<>(); + if (this.projectEnvironment != null) { + headers.put("x-pd-environment", this.projectEnvironment); + } + headers.putAll(this.headers); + this.headerSuppliers.forEach((key, supplier) -> { + headers.put(key, supplier.get()); + }); + return headers; + } + + public static Builder builder() { + return new Builder(); + } + + public static final class Builder { + private String projectEnvironment = null; + + private Optional timeout = Optional.empty(); + + private TimeUnit timeoutTimeUnit = TimeUnit.SECONDS; + + private final Map headers = new HashMap<>(); + + private final Map> headerSuppliers = new HashMap<>(); + + public Builder projectEnvironment(String projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + public Builder timeout(Integer timeout) { + this.timeout = Optional.of(timeout); + return this; + } + + public Builder timeout(Integer timeout, TimeUnit timeoutTimeUnit) { + this.timeout = Optional.of(timeout); + this.timeoutTimeUnit = timeoutTimeUnit; + return this; + } + + public Builder addHeader(String key, String value) { + this.headers.put(key, value); + return this; + } + + public Builder addHeader(String key, Supplier value) { + this.headerSuppliers.put(key, value); + return this; + } + + public RequestOptions build() { + return new RequestOptions(projectEnvironment, timeout, timeoutTimeUnit, headers, headerSuppliers); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java b/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java new file mode 100644 index 0000000..56b0fb5 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/ResponseBodyInputStream.java @@ -0,0 +1,45 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.FilterInputStream; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom InputStream that wraps the InputStream from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the stream is closed. + * + * This class extends FilterInputStream and takes an OkHttp Response object as a parameter. + * It retrieves the InputStream from the Response and overrides the close method to close + * both the InputStream and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyInputStream extends FilterInputStream { + private final Response response; + + /** + * Constructs a ResponseBodyInputStream that wraps the InputStream from the given OkHttp + * Response object. + * + * @param response the OkHttp Response object from which the InputStream is retrieved + * @throws IOException if an I/O error occurs while retrieving the InputStream + */ + public ResponseBodyInputStream(Response response) throws IOException { + super(response.body().byteStream()); + this.response = response; + } + + /** + * Closes the InputStream and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the stream is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the stream is closed + } +} diff --git a/src/main/java/com/pipedream/api/core/ResponseBodyReader.java b/src/main/java/com/pipedream/api/core/ResponseBodyReader.java new file mode 100644 index 0000000..54dff9f --- /dev/null +++ b/src/main/java/com/pipedream/api/core/ResponseBodyReader.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.FilterReader; +import java.io.IOException; +import okhttp3.Response; + +/** + * A custom Reader that wraps the Reader from the OkHttp Response and ensures that the + * OkHttp Response object is properly closed when the reader is closed. + * + * This class extends FilterReader and takes an OkHttp Response object as a parameter. + * It retrieves the Reader from the Response and overrides the close method to close + * both the Reader and the Response object, ensuring proper resource management and preventing + * premature closure of the underlying HTTP connection. + */ +public class ResponseBodyReader extends FilterReader { + private final Response response; + + /** + * Constructs a ResponseBodyReader that wraps the Reader from the given OkHttp Response object. + * + * @param response the OkHttp Response object from which the Reader is retrieved + * @throws IOException if an I/O error occurs while retrieving the Reader + */ + public ResponseBodyReader(Response response) throws IOException { + super(response.body().charStream()); + this.response = response; + } + + /** + * Closes the Reader and the associated OkHttp Response object. This ensures that the + * underlying HTTP connection is properly closed after the reader is no longer needed. + * + * @throws IOException if an I/O error occurs + */ + @Override + public void close() throws IOException { + super.close(); + response.close(); // Ensure the response is closed when the reader is closed + } +} diff --git a/src/main/java/com/pipedream/api/core/RetryInterceptor.java b/src/main/java/com/pipedream/api/core/RetryInterceptor.java new file mode 100644 index 0000000..66b6be4 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/RetryInterceptor.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.IOException; +import java.time.Duration; +import java.util.Optional; +import java.util.Random; +import okhttp3.Interceptor; +import okhttp3.Response; + +public class RetryInterceptor implements Interceptor { + + private static final Duration ONE_SECOND = Duration.ofSeconds(1); + private final ExponentialBackoff backoff; + private final Random random = new Random(); + + public RetryInterceptor(int maxRetries) { + this.backoff = new ExponentialBackoff(maxRetries); + } + + @Override + public Response intercept(Chain chain) throws IOException { + Response response = chain.proceed(chain.request()); + + if (shouldRetry(response.code())) { + return retryChain(response, chain); + } + + return response; + } + + private Response retryChain(Response response, Chain chain) throws IOException { + Optional nextBackoff = this.backoff.nextBackoff(); + while (nextBackoff.isPresent()) { + try { + Thread.sleep(nextBackoff.get().toMillis()); + } catch (InterruptedException e) { + throw new IOException("Interrupted while trying request", e); + } + response.close(); + response = chain.proceed(chain.request()); + if (shouldRetry(response.code())) { + nextBackoff = this.backoff.nextBackoff(); + } else { + return response; + } + } + + return response; + } + + private static boolean shouldRetry(int statusCode) { + return statusCode == 408 || statusCode == 429 || statusCode >= 500; + } + + private final class ExponentialBackoff { + + private final int maxNumRetries; + + private int retryNumber = 0; + + ExponentialBackoff(int maxNumRetries) { + this.maxNumRetries = maxNumRetries; + } + + public Optional nextBackoff() { + retryNumber += 1; + if (retryNumber > maxNumRetries) { + return Optional.empty(); + } + + int upperBound = (int) Math.pow(2, retryNumber); + return Optional.of(ONE_SECOND.multipliedBy(random.nextInt(upperBound))); + } + } +} diff --git a/src/main/java/com/pipedream/api/core/Stream.java b/src/main/java/com/pipedream/api/core/Stream.java new file mode 100644 index 0000000..3781dcc --- /dev/null +++ b/src/main/java/com/pipedream/api/core/Stream.java @@ -0,0 +1,272 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.io.Closeable; +import java.io.IOException; +import java.io.Reader; +import java.util.Iterator; +import java.util.NoSuchElementException; +import java.util.Scanner; + +/** + * The {@code Stream} class implements {@link Iterable} to provide a simple mechanism for reading and parsing + * objects of a given type from data streamed via a {@link Reader} using a specified delimiter. + *

    + * {@code Stream} assumes that data is being pushed to the provided {@link Reader} asynchronously and utilizes a + * {@code Scanner} to block during iteration if the next object is not available. + * Iterable stream for parsing JSON and Server-Sent Events (SSE) data. + * Supports both newline-delimited JSON and SSE with optional stream termination. + * + * @param The type of objects in the stream. + */ +public final class Stream implements Iterable, Closeable { + + private static final String NEWLINE = "\n"; + private static final String DATA_PREFIX = "data:"; + + public enum StreamType { + JSON, + SSE + } + + private final Class valueType; + private final Scanner scanner; + private final StreamType streamType; + private final String messageTerminator; + private final String streamTerminator; + private final Reader sseReader; + private boolean isClosed = false; + + /** + * Constructs a new {@code Stream} with the specified value type, reader, and delimiter. + * + * @param valueType The class of the objects in the stream. + * @param reader The reader that provides the streamed data. + * @param delimiter The delimiter used to separate elements in the stream. + */ + public Stream(Class valueType, Reader reader, String delimiter) { + this.valueType = valueType; + this.scanner = new Scanner(reader).useDelimiter(delimiter); + this.streamType = StreamType.JSON; + this.messageTerminator = delimiter; + this.streamTerminator = null; + this.sseReader = null; + } + + private Stream(Class valueType, StreamType type, Reader reader, String terminator) { + this.valueType = valueType; + this.streamType = type; + if (type == StreamType.JSON) { + this.scanner = new Scanner(reader).useDelimiter(terminator); + this.messageTerminator = terminator; + this.streamTerminator = null; + this.sseReader = null; + } else { + this.scanner = null; + this.messageTerminator = NEWLINE; + this.streamTerminator = terminator; + this.sseReader = reader; + } + } + + public static Stream fromJson(Class valueType, Reader reader, String delimiter) { + return new Stream<>(valueType, reader, delimiter); + } + + public static Stream fromJson(Class valueType, Reader reader) { + return new Stream<>(valueType, reader, NEWLINE); + } + + public static Stream fromSse(Class valueType, Reader sseReader) { + return new Stream<>(valueType, StreamType.SSE, sseReader, null); + } + + public static Stream fromSse(Class valueType, Reader sseReader, String streamTerminator) { + return new Stream<>(valueType, StreamType.SSE, sseReader, streamTerminator); + } + + @Override + public void close() throws IOException { + if (!isClosed) { + isClosed = true; + if (scanner != null) { + scanner.close(); + } + if (sseReader != null) { + sseReader.close(); + } + } + } + + private boolean isStreamClosed() { + return isClosed; + } + + /** + * Returns an iterator over the elements in this stream that blocks during iteration when the next object is + * not yet available. + * + * @return An iterator that can be used to traverse the elements in the stream. + */ + @Override + public Iterator iterator() { + if (streamType == StreamType.SSE) { + return new SSEIterator(); + } else { + return new JsonIterator(); + } + } + + private final class JsonIterator implements Iterator { + + /** + * Returns {@code true} if there are more elements in the stream. + *

    + * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return {@code true} if there are more elements, {@code false} otherwise. + */ + @Override + public boolean hasNext() { + if (isStreamClosed()) { + return false; + } + return scanner.hasNext(); + } + + /** + * Returns the next element in the stream. + *

    + * Will block and wait for input if the stream has not ended and the next object is not yet available. + * + * @return The next element in the stream. + * @throws NoSuchElementException If there are no more elements in the stream. + */ + @Override + public T next() { + if (isStreamClosed()) { + throw new NoSuchElementException("Stream is closed"); + } + + if (!scanner.hasNext()) { + throw new NoSuchElementException(); + } else { + try { + T parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(scanner.next().trim(), valueType); + return parsedResponse; + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + } + + private final class SSEIterator implements Iterator { + private Scanner sseScanner; + private T nextItem; + private boolean hasNextItem = false; + private boolean endOfStream = false; + private StringBuilder buffer = new StringBuilder(); + private boolean prefixSeen = false; + + private SSEIterator() { + if (sseReader != null && !isStreamClosed()) { + this.sseScanner = new Scanner(sseReader); + } else { + this.endOfStream = true; + } + } + + @Override + public boolean hasNext() { + if (isStreamClosed() || endOfStream) { + return false; + } + + if (hasNextItem) { + return true; + } + + return readNextMessage(); + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException("No more elements in stream"); + } + + T result = nextItem; + nextItem = null; + hasNextItem = false; + return result; + } + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + private boolean readNextMessage() { + if (sseScanner == null || isStreamClosed()) { + endOfStream = true; + return false; + } + + try { + while (sseScanner.hasNextLine()) { + String chunk = sseScanner.nextLine(); + buffer.append(chunk).append(NEWLINE); + + int terminatorIndex; + while ((terminatorIndex = buffer.indexOf(messageTerminator)) >= 0) { + String line = buffer.substring(0, terminatorIndex + messageTerminator.length()); + buffer.delete(0, terminatorIndex + messageTerminator.length()); + + line = line.trim(); + if (line.isEmpty()) { + continue; + } + + if (!prefixSeen && line.startsWith(DATA_PREFIX)) { + prefixSeen = true; + line = line.substring(DATA_PREFIX.length()).trim(); + } else if (!prefixSeen) { + continue; + } + + if (streamTerminator != null && line.contains(streamTerminator)) { + endOfStream = true; + return false; + } + + try { + nextItem = ObjectMappers.JSON_MAPPER.readValue(line, valueType); + hasNextItem = true; + prefixSeen = false; + return true; + } catch (Exception parseEx) { + continue; + } + } + } + + endOfStream = true; + return false; + + } catch (Exception e) { + System.err.println("Failed to parse SSE stream: " + e.getMessage()); + endOfStream = true; + return false; + } + } + } +} diff --git a/src/main/java/com/pipedream/api/core/Suppliers.java b/src/main/java/com/pipedream/api/core/Suppliers.java new file mode 100644 index 0000000..b907552 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/Suppliers.java @@ -0,0 +1,23 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.util.Objects; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Supplier; + +public final class Suppliers { + private Suppliers() {} + + public static Supplier memoize(Supplier delegate) { + AtomicReference value = new AtomicReference<>(); + return () -> { + T val = value.get(); + if (val == null) { + val = value.updateAndGet(cur -> cur == null ? Objects.requireNonNull(delegate.get()) : cur); + } + return val; + }; + } +} diff --git a/src/main/java/com/pipedream/api/core/pagination/BasePage.java b/src/main/java/com/pipedream/api/core/pagination/BasePage.java new file mode 100644 index 0000000..ca83fe4 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/pagination/BasePage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.List; + +public abstract class BasePage { + private final boolean hasNext; + private final List items; + + public BasePage(boolean hasNext, List items) { + this.hasNext = hasNext; + this.items = items; + } + + public boolean hasNext() { + return !items.isEmpty() && hasNext; + } + + public List getItems() { + return items; + } +} diff --git a/src/main/java/com/pipedream/api/core/pagination/SyncPage.java b/src/main/java/com/pipedream/api/core/pagination/SyncPage.java new file mode 100644 index 0000000..86fc5b7 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/pagination/SyncPage.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.List; +import java.util.NoSuchElementException; +import java.util.function.Supplier; + +public class SyncPage extends BasePage { + protected final Supplier> nextSupplier; + + public SyncPage(boolean hasNext, List items, Supplier> nextSupplier) { + super(hasNext, items); + this.nextSupplier = nextSupplier; + } + + public SyncPage nextPage() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return nextSupplier.get(); + } +} diff --git a/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java b/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java new file mode 100644 index 0000000..fd5fca3 --- /dev/null +++ b/src/main/java/com/pipedream/api/core/pagination/SyncPagingIterable.java @@ -0,0 +1,61 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core.pagination; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.NoSuchElementException; +import java.util.Optional; +import java.util.function.Supplier; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + +public class SyncPagingIterable extends SyncPage implements Iterable { + + public SyncPagingIterable(boolean hasNext, List items, Supplier> getNext) { + super(hasNext, items, getNext); + } + + public SyncPagingIterable(boolean hasNext, Optional> items, Supplier> getNext) { + super(hasNext, items.orElse(new ArrayList<>()), getNext); + } + + public Stream streamItems() { + return StreamSupport.stream(this.spliterator(), false); + } + + @Override + public Iterator iterator() { + return new Iterator() { + private Iterator itemsIterator = getItems().iterator(); + private SyncPage currentPage = SyncPagingIterable.this; + + @Override + public boolean hasNext() { + if (itemsIterator.hasNext()) { + return true; + } + if (currentPage.hasNext()) { + advancePage(); + return itemsIterator.hasNext(); + } + return false; + } + + @Override + public T next() { + if (!hasNext()) { + throw new NoSuchElementException(); + } + return itemsIterator.next(); + } + + private void advancePage() { + currentPage = currentPage.nextPage(); + itemsIterator = currentPage.getItems().iterator(); + } + }; + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java new file mode 100644 index 0000000..81f9441 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/AccountsClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; + +public class AccountsClient { + protected final ClientOptions clientOptions; + + private final RawAccountsClient rawClient; + + public AccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAccountsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(AccountsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(AccountsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Account create(CreateAccountRequest request) { + return this.rawClient.create(request).body(); + } + + public Account create(CreateAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + public Account retrieve(String accountId) { + return this.rawClient.retrieve(accountId).body(); + } + + public Account retrieve(String accountId, AccountsRetrieveRequest request) { + return this.rawClient.retrieve(accountId, request).body(); + } + + public Account retrieve(String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, request, requestOptions).body(); + } + + public void delete(String accountId) { + this.rawClient.delete(accountId).body(); + } + + public void delete(String accountId, RequestOptions requestOptions) { + this.rawClient.delete(accountId, requestOptions).body(); + } + + public void deleteByApp(String appId) { + this.rawClient.deleteByApp(appId).body(); + } + + public void deleteByApp(String appId, RequestOptions requestOptions) { + this.rawClient.deleteByApp(appId, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java new file mode 100644 index 0000000..761a206 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/AsyncAccountsClient.java @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import java.util.concurrent.CompletableFuture; + +public class AsyncAccountsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAccountsClient rawClient; + + public AsyncAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAccountsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAccountsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(AccountsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + AccountsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateAccountRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateAccountRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String accountId) { + return this.rawClient.retrieve(accountId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String accountId, AccountsRetrieveRequest request) { + return this.rawClient.retrieve(accountId, request).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(accountId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String accountId) { + return this.rawClient.delete(accountId).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String accountId, RequestOptions requestOptions) { + return this.rawClient.delete(accountId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture deleteByApp(String appId) { + return this.rawClient.deleteByApp(appId).thenApply(response -> response.body()); + } + + public CompletableFuture deleteByApp(String appId, RequestOptions requestOptions) { + return this.rawClient.deleteByApp(appId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java new file mode 100644 index 0000000..1c4a9bb --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/AsyncRawAccountsClient.java @@ -0,0 +1,391 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import com.pipedream.api.types.ListAccountsResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAccountsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(AccountsListRequest.builder().build()); + } + + public CompletableFuture>> list(AccountsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + AccountsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + ListAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAccountsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + AccountsListRequest nextRequest = AccountsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> create(CreateAccountRequest request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateAccountRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + Map properties = new HashMap<>(); + properties.put("app_slug", request.getAppSlug()); + properties.put("cfmap_json", request.getCfmapJson()); + properties.put("connect_token", request.getConnectToken()); + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String accountId) { + return retrieve(accountId, AccountsRetrieveRequest.builder().build()); + } + + public CompletableFuture> retrieve( + String accountId, AccountsRetrieveRequest request) { + return retrieve(accountId, request, null); + } + + public CompletableFuture> retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId); + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> delete(String accountId) { + return delete(accountId, null); + } + + public CompletableFuture> delete(String accountId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> deleteByApp(String appId) { + return deleteByApp(appId, null); + } + + public CompletableFuture> deleteByApp(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("apps") + .addPathSegment(appId) + .addPathSegments("accounts") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java new file mode 100644 index 0000000..114533c --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/RawAccountsClient.java @@ -0,0 +1,312 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.accounts.requests.AccountsListRequest; +import com.pipedream.api.resources.accounts.requests.AccountsRetrieveRequest; +import com.pipedream.api.resources.accounts.requests.CreateAccountRequest; +import com.pipedream.api.types.Account; +import com.pipedream.api.types.ListAccountsResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAccountsClient { + protected final ClientOptions clientOptions; + + public RawAccountsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(AccountsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(AccountsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + AccountsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + ListAccountsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAccountsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + AccountsListRequest nextRequest = AccountsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse create(CreateAccountRequest request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create(CreateAccountRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts"); + if (request.getAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "app_id", request.getAppId().get(), false); + } + if (request.getExternalUserId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "external_user_id", request.getExternalUserId().get(), false); + } + if (request.getOauthAppId().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "oauth_app_id", request.getOauthAppId().get(), false); + } + Map properties = new HashMap<>(); + properties.put("app_slug", request.getAppSlug()); + properties.put("cfmap_json", request.getCfmapJson()); + properties.put("connect_token", request.getConnectToken()); + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String accountId) { + return retrieve(accountId, AccountsRetrieveRequest.builder().build()); + } + + public PipedreamApiHttpResponse retrieve(String accountId, AccountsRetrieveRequest request) { + return retrieve(accountId, request, null); + } + + public PipedreamApiHttpResponse retrieve( + String accountId, AccountsRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId); + if (request.getIncludeCredentials().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, + "include_credentials", + request.getIncludeCredentials().get(), + false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), Account.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse delete(String accountId) { + return delete(accountId, null); + } + + public PipedreamApiHttpResponse delete(String accountId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("accounts") + .addPathSegment(accountId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse deleteByApp(String appId) { + return deleteByApp(appId, null); + } + + public PipedreamApiHttpResponse deleteByApp(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("apps") + .addPathSegment(appId) + .addPathSegments("accounts") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java b/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java new file mode 100644 index 0000000..2d67f6d --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsListRequest.java @@ -0,0 +1,285 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountsListRequest.Builder.class) +public final class AccountsListRequest { + private final Optional appId; + + private final Optional externalUserId; + + private final Optional oauthAppId; + + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional includeCredentials; + + private final Map additionalProperties; + + private AccountsListRequest( + Optional appId, + Optional externalUserId, + Optional oauthAppId, + Optional after, + Optional before, + Optional limit, + Optional includeCredentials, + Map additionalProperties) { + this.appId = appId; + this.externalUserId = externalUserId; + this.oauthAppId = oauthAppId; + this.after = after; + this.before = before; + this.limit = limit; + this.includeCredentials = includeCredentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app slug or ID to filter accounts by. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + @JsonProperty("external_user_id") + public Optional getExternalUserId() { + return externalUserId; + } + + /** + * @return The OAuth app ID to filter by, if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Whether to retrieve the account's credentials or not + */ + @JsonProperty("include_credentials") + public Optional getIncludeCredentials() { + return includeCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountsListRequest && equalTo((AccountsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountsListRequest other) { + return appId.equals(other.appId) + && externalUserId.equals(other.externalUserId) + && oauthAppId.equals(other.oauthAppId) + && after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && includeCredentials.equals(other.includeCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.externalUserId, + this.oauthAppId, + this.after, + this.before, + this.limit, + this.includeCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional appId = Optional.empty(); + + private Optional externalUserId = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional includeCredentials = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AccountsListRequest other) { + appId(other.getAppId()); + externalUserId(other.getExternalUserId()); + oauthAppId(other.getOauthAppId()); + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + includeCredentials(other.getIncludeCredentials()); + return this; + } + + /** + *

    The app slug or ID to filter accounts by.

    + */ + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public Builder appId(Optional appId) { + this.appId = appId; + return this; + } + + public Builder appId(String appId) { + this.appId = Optional.ofNullable(appId); + return this; + } + + @JsonSetter(value = "external_user_id", nulls = Nulls.SKIP) + public Builder externalUserId(Optional externalUserId) { + this.externalUserId = externalUserId; + return this; + } + + public Builder externalUserId(String externalUserId) { + this.externalUserId = Optional.ofNullable(externalUserId); + return this; + } + + /** + *

    The OAuth app ID to filter by, if applicable

    + */ + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public Builder oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + public Builder oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    Whether to retrieve the account's credentials or not

    + */ + @JsonSetter(value = "include_credentials", nulls = Nulls.SKIP) + public Builder includeCredentials(Optional includeCredentials) { + this.includeCredentials = includeCredentials; + return this; + } + + public Builder includeCredentials(Boolean includeCredentials) { + this.includeCredentials = Optional.ofNullable(includeCredentials); + return this; + } + + public AccountsListRequest build() { + return new AccountsListRequest( + appId, externalUserId, oauthAppId, after, before, limit, includeCredentials, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java b/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java new file mode 100644 index 0000000..3844f9d --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/requests/AccountsRetrieveRequest.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AccountsRetrieveRequest.Builder.class) +public final class AccountsRetrieveRequest { + private final Optional includeCredentials; + + private final Map additionalProperties; + + private AccountsRetrieveRequest(Optional includeCredentials, Map additionalProperties) { + this.includeCredentials = includeCredentials; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether to retrieve the account's credentials or not + */ + @JsonProperty("include_credentials") + public Optional getIncludeCredentials() { + return includeCredentials; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AccountsRetrieveRequest && equalTo((AccountsRetrieveRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AccountsRetrieveRequest other) { + return includeCredentials.equals(other.includeCredentials); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.includeCredentials); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional includeCredentials = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AccountsRetrieveRequest other) { + includeCredentials(other.getIncludeCredentials()); + return this; + } + + /** + *

    Whether to retrieve the account's credentials or not

    + */ + @JsonSetter(value = "include_credentials", nulls = Nulls.SKIP) + public Builder includeCredentials(Optional includeCredentials) { + this.includeCredentials = includeCredentials; + return this; + } + + public Builder includeCredentials(Boolean includeCredentials) { + this.includeCredentials = Optional.ofNullable(includeCredentials); + return this; + } + + public AccountsRetrieveRequest build() { + return new AccountsRetrieveRequest(includeCredentials, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java b/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java new file mode 100644 index 0000000..aeec52a --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/accounts/requests/CreateAccountRequest.java @@ -0,0 +1,354 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.accounts.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateAccountRequest.Builder.class) +public final class CreateAccountRequest { + private final Optional appId; + + private final Optional externalUserId; + + private final Optional oauthAppId; + + private final String appSlug; + + private final String cfmapJson; + + private final String connectToken; + + private final Optional name; + + private final Map additionalProperties; + + private CreateAccountRequest( + Optional appId, + Optional externalUserId, + Optional oauthAppId, + String appSlug, + String cfmapJson, + String connectToken, + Optional name, + Map additionalProperties) { + this.appId = appId; + this.externalUserId = externalUserId; + this.oauthAppId = oauthAppId; + this.appSlug = appSlug; + this.cfmapJson = cfmapJson; + this.connectToken = connectToken; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app slug or ID to filter accounts by. + */ + @JsonProperty("app_id") + public Optional getAppId() { + return appId; + } + + @JsonProperty("external_user_id") + public Optional getExternalUserId() { + return externalUserId; + } + + /** + * @return The OAuth app ID to filter by, if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return The app slug for the account + */ + @JsonProperty("app_slug") + public String getAppSlug() { + return appSlug; + } + + /** + * @return JSON string containing the custom fields mapping + */ + @JsonProperty("cfmap_json") + public String getCfmapJson() { + return cfmapJson; + } + + /** + * @return The connect token for authentication + */ + @JsonProperty("connect_token") + public String getConnectToken() { + return connectToken; + } + + /** + * @return Optional name for the account + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateAccountRequest && equalTo((CreateAccountRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateAccountRequest other) { + return appId.equals(other.appId) + && externalUserId.equals(other.externalUserId) + && oauthAppId.equals(other.oauthAppId) + && appSlug.equals(other.appSlug) + && cfmapJson.equals(other.cfmapJson) + && connectToken.equals(other.connectToken) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.appId, + this.externalUserId, + this.oauthAppId, + this.appSlug, + this.cfmapJson, + this.connectToken, + this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppSlugStage builder() { + return new Builder(); + } + + public interface AppSlugStage { + /** + *

    The app slug for the account

    + */ + CfmapJsonStage appSlug(@NotNull String appSlug); + + Builder from(CreateAccountRequest other); + } + + public interface CfmapJsonStage { + /** + *

    JSON string containing the custom fields mapping

    + */ + ConnectTokenStage cfmapJson(@NotNull String cfmapJson); + } + + public interface ConnectTokenStage { + /** + *

    The connect token for authentication

    + */ + _FinalStage connectToken(@NotNull String connectToken); + } + + public interface _FinalStage { + CreateAccountRequest build(); + + /** + *

    The app slug or ID to filter accounts by.

    + */ + _FinalStage appId(Optional appId); + + _FinalStage appId(String appId); + + _FinalStage externalUserId(Optional externalUserId); + + _FinalStage externalUserId(String externalUserId); + + /** + *

    The OAuth app ID to filter by, if applicable

    + */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); + + /** + *

    Optional name for the account

    + */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppSlugStage, CfmapJsonStage, ConnectTokenStage, _FinalStage { + private String appSlug; + + private String cfmapJson; + + private String connectToken; + + private Optional name = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional externalUserId = Optional.empty(); + + private Optional appId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateAccountRequest other) { + appId(other.getAppId()); + externalUserId(other.getExternalUserId()); + oauthAppId(other.getOauthAppId()); + appSlug(other.getAppSlug()); + cfmapJson(other.getCfmapJson()); + connectToken(other.getConnectToken()); + name(other.getName()); + return this; + } + + /** + *

    The app slug for the account

    + *

    The app slug for the account

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app_slug") + public CfmapJsonStage appSlug(@NotNull String appSlug) { + this.appSlug = Objects.requireNonNull(appSlug, "appSlug must not be null"); + return this; + } + + /** + *

    JSON string containing the custom fields mapping

    + *

    JSON string containing the custom fields mapping

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("cfmap_json") + public ConnectTokenStage cfmapJson(@NotNull String cfmapJson) { + this.cfmapJson = Objects.requireNonNull(cfmapJson, "cfmapJson must not be null"); + return this; + } + + /** + *

    The connect token for authentication

    + *

    The connect token for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("connect_token") + public _FinalStage connectToken(@NotNull String connectToken) { + this.connectToken = Objects.requireNonNull(connectToken, "connectToken must not be null"); + return this; + } + + /** + *

    Optional name for the account

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Optional name for the account

    + */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

    The OAuth app ID to filter by, if applicable

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

    The OAuth app ID to filter by, if applicable

    + */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + @java.lang.Override + public _FinalStage externalUserId(String externalUserId) { + this.externalUserId = Optional.ofNullable(externalUserId); + return this; + } + + @java.lang.Override + @JsonSetter(value = "external_user_id", nulls = Nulls.SKIP) + public _FinalStage externalUserId(Optional externalUserId) { + this.externalUserId = externalUserId; + return this; + } + + /** + *

    The app slug or ID to filter accounts by.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appId(String appId) { + this.appId = Optional.ofNullable(appId); + return this; + } + + /** + *

    The app slug or ID to filter accounts by.

    + */ + @java.lang.Override + @JsonSetter(value = "app_id", nulls = Nulls.SKIP) + public _FinalStage appId(Optional appId) { + this.appId = appId; + return this; + } + + @java.lang.Override + public CreateAccountRequest build() { + return new CreateAccountRequest( + appId, externalUserId, oauthAppId, appSlug, cfmapJson, connectToken, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java new file mode 100644 index 0000000..52efedb --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/ActionsClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; + +public class ActionsClient { + protected final ClientOptions clientOptions; + + private final RawActionsClient rawClient; + + public ActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawActionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawActionsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(ActionsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(ActionsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(ActionsConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(ActionsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(ActionsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(ActionsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } + + public RunActionResponse run(RunActionOpts request) { + return this.rawClient.run(request).body(); + } + + public RunActionResponse run(RunActionOpts request, RequestOptions requestOptions) { + return this.rawClient.run(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java new file mode 100644 index 0000000..19ff8e7 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/AsyncActionsClient.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncActionsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawActionsClient rawClient; + + public AsyncActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawActionsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawActionsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(ActionsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + ActionsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(ActionsConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(ActionsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture run(RunActionOpts request) { + return this.rawClient.run(request).thenApply(response -> response.body()); + } + + public CompletableFuture run(RunActionOpts request, RequestOptions requestOptions) { + return this.rawClient.run(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java new file mode 100644 index 0000000..9686990 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java @@ -0,0 +1,397 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawActionsClient { + protected final ClientOptions clientOptions; + + public AsyncRawActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(ActionsListRequest.builder().build()); + } + + public CompletableFuture>> list(ActionsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + ActionsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ActionsListRequest nextRequest = ActionsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + ActionsConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + ActionsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> run(RunActionOpts request) { + return run(request, null); + } + + public CompletableFuture> run( + RunActionOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/run") + .build(); + Map properties = new HashMap<>(); + properties.put("id", request.getId()); + properties.put("external_user_id", request.getExternalUserId()); + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getDynamicPropsId().isPresent()) { + properties.put("dynamic_props_id", request.getDynamicPropsId()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java new file mode 100644 index 0000000..eee1aa6 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java @@ -0,0 +1,315 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.actions.requests.ActionsConfigurePropRequest; +import com.pipedream.api.resources.actions.requests.ActionsListRequest; +import com.pipedream.api.resources.actions.requests.ActionsReloadPropsRequest; +import com.pipedream.api.resources.actions.requests.RunActionOpts; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import com.pipedream.api.types.RunActionResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawActionsClient { + protected final ClientOptions clientOptions; + + public RawActionsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(ActionsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(ActionsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + ActionsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ActionsListRequest nextRequest = ActionsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(ActionsConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + ActionsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(ActionsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + ActionsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse run(RunActionOpts request) { + return run(request, null); + } + + public PipedreamApiHttpResponse run(RunActionOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("actions/run") + .build(); + Map properties = new HashMap<>(); + properties.put("id", request.getId()); + properties.put("external_user_id", request.getExternalUserId()); + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getDynamicPropsId().isPresent()) { + properties.put("dynamic_props_id", request.getDynamicPropsId()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), RunActionResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java new file mode 100644 index 0000000..5da951b --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ConfigurePropOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ActionsConfigurePropRequest.Builder.class) +public final class ActionsConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private ActionsConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsConfigurePropRequest && equalTo((ActionsConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(ActionsConfigurePropRequest other); + } + + public interface _FinalStage { + ActionsConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ActionsConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ActionsConfigurePropRequest build() { + return new ActionsConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java new file mode 100644 index 0000000..60f1e37 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ActionsListRequest.Builder.class) +public final class ActionsListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private ActionsListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the actions + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the actions + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsListRequest && equalTo((ActionsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ActionsListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    A search query to filter the actions

    + */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

    The ID or name slug of the app to filter the actions

    + */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public ActionsListRequest build() { + return new ActionsListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java new file mode 100644 index 0000000..afefa8a --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/requests/ActionsReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ReloadPropsOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ActionsReloadPropsRequest.Builder.class) +public final class ActionsReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private ActionsReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ActionsReloadPropsRequest && equalTo((ActionsReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ActionsReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(ActionsReloadPropsRequest other); + } + + public interface _FinalStage { + ActionsReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ActionsReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ActionsReloadPropsRequest build() { + return new ActionsReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java b/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java new file mode 100644 index 0000000..6a16af8 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java @@ -0,0 +1,269 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.actions.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RunActionOpts.Builder.class) +public final class RunActionOpts { + private final Optional asyncHandle; + + private final String id; + + private final String externalUserId; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Map additionalProperties; + + private RunActionOpts( + Optional asyncHandle, + String id, + String externalUserId, + Optional> configuredProps, + Optional dynamicPropsId, + Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.id = id; + this.externalUserId = externalUserId; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + /** + * @return The action component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The configured properties for the action + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunActionOpts && equalTo((RunActionOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunActionOpts other) { + return asyncHandle.equals(other.asyncHandle) + && id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.id, this.externalUserId, this.configuredProps, this.dynamicPropsId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

    The action component ID

    + */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(RunActionOpts other); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + RunActionOpts build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + + /** + *

    The configured properties for the action

    + */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

    The ID for dynamic props

    + */ + _FinalStage dynamicPropsId(Optional dynamicPropsId); + + _FinalStage dynamicPropsId(String dynamicPropsId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(RunActionOpts other) { + asyncHandle(other.getAsyncHandle()); + id(other.getId()); + externalUserId(other.getExternalUserId()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + return this; + } + + /** + *

    The action component ID

    + *

    The action component ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ExternalUserIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The external user ID

    + *

    The external user ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The ID for dynamic props

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dynamicPropsId(String dynamicPropsId) { + this.dynamicPropsId = Optional.ofNullable(dynamicPropsId); + return this; + } + + /** + *

    The ID for dynamic props

    + */ + @java.lang.Override + @JsonSetter(value = "dynamic_props_id", nulls = Nulls.SKIP) + public _FinalStage dynamicPropsId(Optional dynamicPropsId) { + this.dynamicPropsId = dynamicPropsId; + return this; + } + + /** + *

    The configured properties for the action

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps = Optional.ofNullable(configuredProps); + return this; + } + + /** + *

    The configured properties for the action

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public RunActionOpts build() { + return new RunActionOpts( + asyncHandle, id, externalUserId, configuredProps, dynamicPropsId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java new file mode 100644 index 0000000..357d245 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appcategories/AppCategoriesClient.java @@ -0,0 +1,43 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.util.List; + +public class AppCategoriesClient { + protected final ClientOptions clientOptions; + + private final RawAppCategoriesClient rawClient; + + public AppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppCategoriesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppCategoriesClient withRawResponse() { + return this.rawClient; + } + + public List list() { + return this.rawClient.list().body(); + } + + public List list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).body(); + } + + public AppCategory retrieve(String id) { + return this.rawClient.retrieve(id).body(); + } + + public AppCategory retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java new file mode 100644 index 0000000..d374614 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appcategories/AsyncAppCategoriesClient.java @@ -0,0 +1,44 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppCategoriesClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppCategoriesClient rawClient; + + public AsyncAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppCategoriesClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppCategoriesClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(RequestOptions requestOptions) { + return this.rawClient.list(requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String id) { + return this.rawClient.retrieve(id).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String id, RequestOptions requestOptions) { + return this.rawClient.retrieve(id, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java new file mode 100644 index 0000000..c7a7bf5 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appcategories/AsyncRawAppCategoriesClient.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.io.IOException; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppCategoriesClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(null); + } + + public CompletableFuture>> list(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String id) { + return retrieve(id, null); + } + + public CompletableFuture> retrieve(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java b/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java new file mode 100644 index 0000000..497bd77 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/appcategories/RawAppCategoriesClient.java @@ -0,0 +1,104 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.appcategories; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.AppCategory; +import java.io.IOException; +import java.util.List; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppCategoriesClient { + protected final ClientOptions clientOptions; + + public RawAppCategoriesClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(null); + } + + public PipedreamApiHttpResponse> list(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String id) { + return retrieve(id, null); + } + + public PipedreamApiHttpResponse retrieve(String id, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/app_categories") + .addPathSegment(id) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), AppCategory.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/AppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AppsClient.java new file mode 100644 index 0000000..39bcb35 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/AppsClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; + +public class AppsClient { + protected final ClientOptions clientOptions; + + private final RawAppsClient rawClient; + + public AppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawAppsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(AppsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(AppsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public GetAppResponse retrieve(String appId) { + return this.rawClient.retrieve(appId).body(); + } + + public GetAppResponse retrieve(String appId, RequestOptions requestOptions) { + return this.rawClient.retrieve(appId, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java new file mode 100644 index 0000000..fbe87f5 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/AsyncAppsClient.java @@ -0,0 +1,50 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncAppsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawAppsClient rawClient; + + public AsyncAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawAppsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawAppsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(AppsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list(AppsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String appId) { + return this.rawClient.retrieve(appId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String appId, RequestOptions requestOptions) { + return this.rawClient.retrieve(appId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java new file mode 100644 index 0000000..42967c0 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/AsyncRawAppsClient.java @@ -0,0 +1,189 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import com.pipedream.api.types.ListAppsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawAppsClient { + protected final ClientOptions clientOptions; + + public AsyncRawAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(AppsListRequest.builder().build()); + } + + public CompletableFuture>> list(AppsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + AppsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getSortKey().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_key", request.getSortKey().get(), false); + } + if (request.getSortDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_direction", request.getSortDirection().get(), false); + } + if (request.getCategoryIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "category_ids", request.getCategoryIds().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + ListAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + AppsListRequest nextRequest = AppsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String appId) { + return retrieve(appId, null); + } + + public CompletableFuture> retrieve( + String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps") + .addPathSegment(appId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java new file mode 100644 index 0000000..37619d9 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/RawAppsClient.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.apps.requests.AppsListRequest; +import com.pipedream.api.types.App; +import com.pipedream.api.types.GetAppResponse; +import com.pipedream.api.types.ListAppsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawAppsClient { + protected final ClientOptions clientOptions; + + public RawAppsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(AppsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(AppsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + AppsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getSortKey().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_key", request.getSortKey().get(), false); + } + if (request.getSortDirection().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "sort_direction", request.getSortDirection().get(), false); + } + if (request.getCategoryIds().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "category_ids", request.getCategoryIds().get(), true); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + ListAppsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ListAppsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + AppsListRequest nextRequest = AppsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String appId) { + return retrieve(appId, null); + } + + public PipedreamApiHttpResponse retrieve(String appId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/apps") + .addPathSegment(appId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetAppResponse.class), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java b/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java new file mode 100644 index 0000000..5e13f36 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/requests/AppsListRequest.java @@ -0,0 +1,294 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.resources.apps.types.AppsListRequestSortDirection; +import com.pipedream.api.resources.apps.types.AppsListRequestSortKey; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppsListRequest.Builder.class) +public final class AppsListRequest { + private final Optional> categoryIds; + + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional sortKey; + + private final Optional sortDirection; + + private final Map additionalProperties; + + private AppsListRequest( + Optional> categoryIds, + Optional after, + Optional before, + Optional limit, + Optional q, + Optional sortKey, + Optional sortDirection, + Map additionalProperties) { + this.categoryIds = categoryIds; + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.sortKey = sortKey; + this.sortDirection = sortDirection; + this.additionalProperties = additionalProperties; + } + + /** + * @return Only return apps in these categories + */ + @JsonProperty("category_ids") + public Optional> getCategoryIds() { + return categoryIds; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the apps + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The key to sort the apps by + */ + @JsonProperty("sort_key") + public Optional getSortKey() { + return sortKey; + } + + /** + * @return The direction to sort the apps + */ + @JsonProperty("sort_direction") + public Optional getSortDirection() { + return sortDirection; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppsListRequest && equalTo((AppsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppsListRequest other) { + return categoryIds.equals(other.categoryIds) + && after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && sortKey.equals(other.sortKey) + && sortDirection.equals(other.sortDirection); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.categoryIds, this.after, this.before, this.limit, this.q, this.sortKey, this.sortDirection); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> categoryIds = Optional.empty(); + + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional sortKey = Optional.empty(); + + private Optional sortDirection = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppsListRequest other) { + categoryIds(other.getCategoryIds()); + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + sortKey(other.getSortKey()); + sortDirection(other.getSortDirection()); + return this; + } + + /** + *

    Only return apps in these categories

    + */ + @JsonSetter(value = "category_ids", nulls = Nulls.SKIP) + public Builder categoryIds(Optional> categoryIds) { + this.categoryIds = categoryIds; + return this; + } + + public Builder categoryIds(List categoryIds) { + this.categoryIds = Optional.ofNullable(categoryIds); + return this; + } + + public Builder categoryIds(String categoryIds) { + this.categoryIds = Optional.of(Collections.singletonList(categoryIds)); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    A search query to filter the apps

    + */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

    The key to sort the apps by

    + */ + @JsonSetter(value = "sort_key", nulls = Nulls.SKIP) + public Builder sortKey(Optional sortKey) { + this.sortKey = sortKey; + return this; + } + + public Builder sortKey(AppsListRequestSortKey sortKey) { + this.sortKey = Optional.ofNullable(sortKey); + return this; + } + + /** + *

    The direction to sort the apps

    + */ + @JsonSetter(value = "sort_direction", nulls = Nulls.SKIP) + public Builder sortDirection(Optional sortDirection) { + this.sortDirection = sortDirection; + return this; + } + + public Builder sortDirection(AppsListRequestSortDirection sortDirection) { + this.sortDirection = Optional.ofNullable(sortDirection); + return this; + } + + public AppsListRequest build() { + return new AppsListRequest( + categoryIds, after, before, limit, q, sortKey, sortDirection, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java new file mode 100644 index 0000000..18cc793 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortDirection.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppsListRequestSortDirection { + ASC("asc"), + + DESC("desc"); + + private final String value; + + AppsListRequestSortDirection(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java new file mode 100644 index 0000000..7260231 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/apps/types/AppsListRequestSortKey.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.apps.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppsListRequestSortKey { + NAME("name"), + + NAME_SLUG("name_slug"), + + FEATURED_WEIGHT("featured_weight"); + + private final String value; + + AppsListRequestSortKey(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java new file mode 100644 index 0000000..c5934f3 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/AsyncComponentsClient.java @@ -0,0 +1,72 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncComponentsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawComponentsClient rawClient; + + public AsyncComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawComponentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawComponentsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(ComponentsListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + ComponentsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(ComponentsConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(ComponentsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java new file mode 100644 index 0000000..43e8178 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java @@ -0,0 +1,321 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawComponentsClient { + protected final ClientOptions clientOptions; + + public AsyncRawComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(ComponentsListRequest.builder().build()); + } + + public CompletableFuture>> list( + ComponentsListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + ComponentsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + ComponentsListRequest nextRequest = ComponentsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + ComponentsConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + ComponentsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java new file mode 100644 index 0000000..f273dcb --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/ComponentsClient.java @@ -0,0 +1,68 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.ReloadPropsResponse; + +public class ComponentsClient { + protected final ClientOptions clientOptions; + + private final RawComponentsClient rawClient; + + public ComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawComponentsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawComponentsClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(ComponentsListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(ComponentsListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(ComponentsConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(ComponentsReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java new file mode 100644 index 0000000..cd8521d --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java @@ -0,0 +1,253 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.components.requests.ComponentsConfigurePropRequest; +import com.pipedream.api.resources.components.requests.ComponentsListRequest; +import com.pipedream.api.resources.components.requests.ComponentsReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawComponentsClient { + protected final ClientOptions clientOptions; + + public RawComponentsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(ComponentsListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(ComponentsListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + ComponentsListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + ComponentsListRequest nextRequest = ComponentsListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(ComponentsConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + ComponentsConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(ComponentsReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + ComponentsReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("components/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java new file mode 100644 index 0000000..541a93e --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ConfigurePropOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ComponentsConfigurePropRequest.Builder.class) +public final class ComponentsConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private ComponentsConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsConfigurePropRequest && equalTo((ComponentsConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(ComponentsConfigurePropRequest other); + } + + public interface _FinalStage { + ComponentsConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ComponentsConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ComponentsConfigurePropRequest build() { + return new ComponentsConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java new file mode 100644 index 0000000..8d5b23b --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ComponentsListRequest.Builder.class) +public final class ComponentsListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private ComponentsListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the components + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the components + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsListRequest && equalTo((ComponentsListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ComponentsListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    A search query to filter the components

    + */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

    The ID or name slug of the app to filter the components

    + */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public ComponentsListRequest build() { + return new ComponentsListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java new file mode 100644 index 0000000..960dc66 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/components/requests/ComponentsReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.components.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ReloadPropsOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ComponentsReloadPropsRequest.Builder.class) +public final class ComponentsReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private ComponentsReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ComponentsReloadPropsRequest && equalTo((ComponentsReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ComponentsReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(ComponentsReloadPropsRequest other); + } + + public interface _FinalStage { + ComponentsReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ComponentsReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public ComponentsReloadPropsRequest build() { + return new ComponentsReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java new file mode 100644 index 0000000..bc6b458 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncDeployedTriggersClient.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import java.util.List; +import java.util.concurrent.CompletableFuture; + +public class AsyncDeployedTriggersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawDeployedTriggersClient rawClient; + + public AsyncDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawDeployedTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawDeployedTriggersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list(DeployedTriggersListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String triggerId, DeployedTriggersRetrieveRequest request) { + return this.rawClient.retrieve(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture update(String triggerId, UpdateTriggerOpts request) { + return this.rawClient.update(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.update(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture delete(String triggerId, DeployedTriggersDeleteRequest request) { + return this.rawClient.delete(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return this.rawClient.listEvents(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.listEvents(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return this.rawClient.listWorkflows(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + return this.rawClient.listWorkflows(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return this.rawClient.updateWorkflows(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + return this.rawClient + .updateWorkflows(triggerId, request, requestOptions) + .thenApply(response -> response.body()); + } + + public CompletableFuture listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return this.rawClient.listWebhooks(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.listWebhooks(triggerId, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return this.rawClient.updateWebhooks(triggerId, request).thenApply(response -> response.body()); + } + + public CompletableFuture updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + return this.rawClient.updateWebhooks(triggerId, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java new file mode 100644 index 0000000..cbee597 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/AsyncRawDeployedTriggersClient.java @@ -0,0 +1,630 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerEventsResponse; +import com.pipedream.api.types.GetTriggerResponse; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import com.pipedream.api.types.GetTriggersResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawDeployedTriggersClient { + protected final ClientOptions clientOptions; + + public AsyncRawDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list( + DeployedTriggersListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = + new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve( + String triggerId, DeployedTriggersRetrieveRequest request) { + return retrieve(triggerId, request, null); + } + + public CompletableFuture> retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> update( + String triggerId, UpdateTriggerOpts request) { + return update(triggerId, request, null); + } + + public CompletableFuture> update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + if (request.getActive().isPresent()) { + properties.put("active", request.getActive()); + } + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> delete( + String triggerId, DeployedTriggersDeleteRequest request) { + return delete(triggerId, request, null); + } + + public CompletableFuture> delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getIgnoreHookErrors().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ignore_hook_errors", request.getIgnoreHookErrors().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return listEvents(triggerId, request, null); + } + + public CompletableFuture>> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("events"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getN().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "n", request.getN().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetTriggerEventsResponse parsedResponse = ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerEventsResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return listWorkflows(triggerId, request, null); + } + + public CompletableFuture> listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWorkflowsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return updateWorkflows(triggerId, request, null); + } + + public CompletableFuture> updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("workflow_ids", request.getWorkflowIds()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWorkflowsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return listWebhooks(triggerId, request, null); + } + + public CompletableFuture> listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWebhooksResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return updateWebhooks(triggerId, request, null); + } + + public CompletableFuture> updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("webhook_urls", request.getWebhookUrls()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), GetTriggerWebhooksResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java new file mode 100644 index 0000000..891ce12 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/DeployedTriggersClient.java @@ -0,0 +1,121 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import java.util.List; + +public class DeployedTriggersClient { + protected final ClientOptions clientOptions; + + private final RawDeployedTriggersClient rawClient; + + public DeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawDeployedTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawDeployedTriggersClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list(DeployedTriggersListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public DeployedComponent retrieve(String triggerId, DeployedTriggersRetrieveRequest request) { + return this.rawClient.retrieve(triggerId, request).body(); + } + + public DeployedComponent retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + return this.rawClient.retrieve(triggerId, request, requestOptions).body(); + } + + public DeployedComponent update(String triggerId, UpdateTriggerOpts request) { + return this.rawClient.update(triggerId, request).body(); + } + + public DeployedComponent update(String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.update(triggerId, request, requestOptions).body(); + } + + public void delete(String triggerId, DeployedTriggersDeleteRequest request) { + this.rawClient.delete(triggerId, request).body(); + } + + public void delete(String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + this.rawClient.delete(triggerId, request, requestOptions).body(); + } + + public List listEvents(String triggerId, DeployedTriggersListEventsRequest request) { + return this.rawClient.listEvents(triggerId, request).body(); + } + + public List listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + return this.rawClient.listEvents(triggerId, request, requestOptions).body(); + } + + public GetTriggerWorkflowsResponse listWorkflows(String triggerId, DeployedTriggersListWorkflowsRequest request) { + return this.rawClient.listWorkflows(triggerId, request).body(); + } + + public GetTriggerWorkflowsResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + return this.rawClient.listWorkflows(triggerId, request, requestOptions).body(); + } + + public GetTriggerWorkflowsResponse updateWorkflows(String triggerId, UpdateTriggerWorkflowsOpts request) { + return this.rawClient.updateWorkflows(triggerId, request).body(); + } + + public GetTriggerWorkflowsResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + return this.rawClient + .updateWorkflows(triggerId, request, requestOptions) + .body(); + } + + public GetTriggerWebhooksResponse listWebhooks(String triggerId, DeployedTriggersListWebhooksRequest request) { + return this.rawClient.listWebhooks(triggerId, request).body(); + } + + public GetTriggerWebhooksResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + return this.rawClient.listWebhooks(triggerId, request, requestOptions).body(); + } + + public GetTriggerWebhooksResponse updateWebhooks(String triggerId, UpdateTriggerWebhooksOpts request) { + return this.rawClient.updateWebhooks(triggerId, request).body(); + } + + public GetTriggerWebhooksResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + return this.rawClient.updateWebhooks(triggerId, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java new file mode 100644 index 0000000..0e1e09f --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/RawDeployedTriggersClient.java @@ -0,0 +1,493 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersDeleteRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListEventsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWebhooksRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersListWorkflowsRequest; +import com.pipedream.api.resources.deployedtriggers.requests.DeployedTriggersRetrieveRequest; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWebhooksOpts; +import com.pipedream.api.resources.deployedtriggers.requests.UpdateTriggerWorkflowsOpts; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.EmittedEvent; +import com.pipedream.api.types.GetTriggerEventsResponse; +import com.pipedream.api.types.GetTriggerResponse; +import com.pipedream.api.types.GetTriggerWebhooksResponse; +import com.pipedream.api.types.GetTriggerWorkflowsResponse; +import com.pipedream.api.types.GetTriggersResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawDeployedTriggersClient { + protected final ClientOptions clientOptions; + + public RawDeployedTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list(DeployedTriggersListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + DeployedTriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggersResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggersResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + DeployedTriggersListRequest nextRequest = DeployedTriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve( + String triggerId, DeployedTriggersRetrieveRequest request) { + return retrieve(triggerId, request, null); + } + + public PipedreamApiHttpResponse retrieve( + String triggerId, DeployedTriggersRetrieveRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse update(String triggerId, UpdateTriggerOpts request) { + return update(triggerId, request, null); + } + + public PipedreamApiHttpResponse update( + String triggerId, UpdateTriggerOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + if (request.getActive().isPresent()) { + properties.put("active", request.getActive()); + } + if (request.getConfiguredProps().isPresent()) { + properties.put("configured_props", request.getConfiguredProps()); + } + if (request.getName().isPresent()) { + properties.put("name", request.getName()); + } + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse delete(String triggerId, DeployedTriggersDeleteRequest request) { + return delete(triggerId, request, null); + } + + public PipedreamApiHttpResponse delete( + String triggerId, DeployedTriggersDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getIgnoreHookErrors().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "ignore_hook_errors", request.getIgnoreHookErrors().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> listEvents( + String triggerId, DeployedTriggersListEventsRequest request) { + return listEvents(triggerId, request, null); + } + + public PipedreamApiHttpResponse> listEvents( + String triggerId, DeployedTriggersListEventsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("events"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + if (request.getN().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "n", request.getN().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetTriggerEventsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerEventsResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request) { + return listWorkflows(triggerId, request, null); + } + + public PipedreamApiHttpResponse listWorkflows( + String triggerId, DeployedTriggersListWorkflowsRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request) { + return updateWorkflows(triggerId, request, null); + } + + public PipedreamApiHttpResponse updateWorkflows( + String triggerId, UpdateTriggerWorkflowsOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("pipelines"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("workflow_ids", request.getWorkflowIds()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWorkflowsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request) { + return listWebhooks(triggerId, request, null); + } + + public PipedreamApiHttpResponse listWebhooks( + String triggerId, DeployedTriggersListWebhooksRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request) { + return updateWebhooks(triggerId, request, null); + } + + public PipedreamApiHttpResponse updateWebhooks( + String triggerId, UpdateTriggerWebhooksOpts request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("deployed-triggers") + .addPathSegment(triggerId) + .addPathSegments("webhooks"); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + Map properties = new HashMap<>(); + properties.put("webhook_urls", request.getWebhookUrls()); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(properties), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetTriggerWebhooksResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java new file mode 100644 index 0000000..3989d6e --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersDeleteRequest.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersDeleteRequest.Builder.class) +public final class DeployedTriggersDeleteRequest { + private final String externalUserId; + + private final Optional ignoreHookErrors; + + private final Map additionalProperties; + + private DeployedTriggersDeleteRequest( + String externalUserId, Optional ignoreHookErrors, Map additionalProperties) { + this.externalUserId = externalUserId; + this.ignoreHookErrors = ignoreHookErrors; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether to ignore errors during deactivation hook + */ + @JsonProperty("ignore_hook_errors") + public Optional getIgnoreHookErrors() { + return ignoreHookErrors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersDeleteRequest && equalTo((DeployedTriggersDeleteRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersDeleteRequest other) { + return externalUserId.equals(other.externalUserId) && ignoreHookErrors.equals(other.ignoreHookErrors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.ignoreHookErrors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersDeleteRequest other); + } + + public interface _FinalStage { + DeployedTriggersDeleteRequest build(); + + /** + *

    Whether to ignore errors during deactivation hook

    + */ + _FinalStage ignoreHookErrors(Optional ignoreHookErrors); + + _FinalStage ignoreHookErrors(Boolean ignoreHookErrors); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional ignoreHookErrors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersDeleteRequest other) { + externalUserId(other.getExternalUserId()); + ignoreHookErrors(other.getIgnoreHookErrors()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    Whether to ignore errors during deactivation hook

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage ignoreHookErrors(Boolean ignoreHookErrors) { + this.ignoreHookErrors = Optional.ofNullable(ignoreHookErrors); + return this; + } + + /** + *

    Whether to ignore errors during deactivation hook

    + */ + @java.lang.Override + @JsonSetter(value = "ignore_hook_errors", nulls = Nulls.SKIP) + public _FinalStage ignoreHookErrors(Optional ignoreHookErrors) { + this.ignoreHookErrors = ignoreHookErrors; + return this; + } + + @java.lang.Override + public DeployedTriggersDeleteRequest build() { + return new DeployedTriggersDeleteRequest(externalUserId, ignoreHookErrors, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java new file mode 100644 index 0000000..e3015b2 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListEventsRequest.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListEventsRequest.Builder.class) +public final class DeployedTriggersListEventsRequest { + private final String externalUserId; + + private final Optional n; + + private final Map additionalProperties; + + private DeployedTriggersListEventsRequest( + String externalUserId, Optional n, Map additionalProperties) { + this.externalUserId = externalUserId; + this.n = n; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The number of events to retrieve (defaults to 20 if not provided) + */ + @JsonProperty("n") + public Optional getN() { + return n; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListEventsRequest && equalTo((DeployedTriggersListEventsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListEventsRequest other) { + return externalUserId.equals(other.externalUserId) && n.equals(other.n); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.n); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    Your end user ID, for whom you deployed the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListEventsRequest other); + } + + public interface _FinalStage { + DeployedTriggersListEventsRequest build(); + + /** + *

    The number of events to retrieve (defaults to 20 if not provided)

    + */ + _FinalStage n(Optional n); + + _FinalStage n(Integer n); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional n = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListEventsRequest other) { + externalUserId(other.getExternalUserId()); + n(other.getN()); + return this; + } + + /** + *

    Your end user ID, for whom you deployed the trigger

    + *

    Your end user ID, for whom you deployed the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The number of events to retrieve (defaults to 20 if not provided)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage n(Integer n) { + this.n = Optional.ofNullable(n); + return this; + } + + /** + *

    The number of events to retrieve (defaults to 20 if not provided)

    + */ + @java.lang.Override + @JsonSetter(value = "n", nulls = Nulls.SKIP) + public _FinalStage n(Optional n) { + this.n = n; + return this; + } + + @java.lang.Override + public DeployedTriggersListEventsRequest build() { + return new DeployedTriggersListEventsRequest(externalUserId, n, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java new file mode 100644 index 0000000..556c4f0 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListRequest.java @@ -0,0 +1,246 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListRequest.Builder.class) +public final class DeployedTriggersListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListRequest( + Optional after, + Optional before, + Optional limit, + String externalUserId, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListRequest && equalTo((DeployedTriggersListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    Your end user ID, for whom you deployed the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListRequest other); + } + + public interface _FinalStage { + DeployedTriggersListRequest build(); + + /** + *

    The cursor to start from for pagination

    + */ + _FinalStage after(Optional after); + + _FinalStage after(String after); + + /** + *

    The cursor to end before for pagination

    + */ + _FinalStage before(Optional before); + + _FinalStage before(String before); + + /** + *

    The maximum number of results to return

    + */ + _FinalStage limit(Optional limit); + + _FinalStage limit(Integer limit); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional limit = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional after = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

    Your end user ID, for whom you deployed the trigger

    + *

    Your end user ID, for whom you deployed the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The maximum number of results to return

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @java.lang.Override + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public _FinalStage limit(Optional limit) { + this.limit = limit; + return this; + } + + /** + *

    The cursor to end before for pagination

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @java.lang.Override + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public _FinalStage before(Optional before) { + this.before = before; + return this; + } + + /** + *

    The cursor to start from for pagination

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @java.lang.Override + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public _FinalStage after(Optional after) { + this.after = after; + return this; + } + + @java.lang.Override + public DeployedTriggersListRequest build() { + return new DeployedTriggersListRequest(after, before, limit, externalUserId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java new file mode 100644 index 0000000..62cf4dd --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWebhooksRequest.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListWebhooksRequest.Builder.class) +public final class DeployedTriggersListWebhooksRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListWebhooksRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListWebhooksRequest + && equalTo((DeployedTriggersListWebhooksRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListWebhooksRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListWebhooksRequest other); + } + + public interface _FinalStage { + DeployedTriggersListWebhooksRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListWebhooksRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersListWebhooksRequest build() { + return new DeployedTriggersListWebhooksRequest(externalUserId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java new file mode 100644 index 0000000..95979ed --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersListWorkflowsRequest.java @@ -0,0 +1,114 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersListWorkflowsRequest.Builder.class) +public final class DeployedTriggersListWorkflowsRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersListWorkflowsRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersListWorkflowsRequest + && equalTo((DeployedTriggersListWorkflowsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersListWorkflowsRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersListWorkflowsRequest other); + } + + public interface _FinalStage { + DeployedTriggersListWorkflowsRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersListWorkflowsRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersListWorkflowsRequest build() { + return new DeployedTriggersListWorkflowsRequest(externalUserId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java new file mode 100644 index 0000000..4aab165 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/DeployedTriggersRetrieveRequest.java @@ -0,0 +1,113 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedTriggersRetrieveRequest.Builder.class) +public final class DeployedTriggersRetrieveRequest { + private final String externalUserId; + + private final Map additionalProperties; + + private DeployedTriggersRetrieveRequest(String externalUserId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you deployed the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedTriggersRetrieveRequest && equalTo((DeployedTriggersRetrieveRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedTriggersRetrieveRequest other) { + return externalUserId.equals(other.externalUserId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    Your end user ID, for whom you deployed the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(DeployedTriggersRetrieveRequest other); + } + + public interface _FinalStage { + DeployedTriggersRetrieveRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedTriggersRetrieveRequest other) { + externalUserId(other.getExternalUserId()); + return this; + } + + /** + *

    Your end user ID, for whom you deployed the trigger

    + *

    Your end user ID, for whom you deployed the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + @java.lang.Override + public DeployedTriggersRetrieveRequest build() { + return new DeployedTriggersRetrieveRequest(externalUserId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java new file mode 100644 index 0000000..735cf4a --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerOpts.java @@ -0,0 +1,246 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTriggerOpts.Builder.class) +public final class UpdateTriggerOpts { + private final String externalUserId; + + private final Optional active; + + private final Optional> configuredProps; + + private final Optional name; + + private final Map additionalProperties; + + private UpdateTriggerOpts( + String externalUserId, + Optional active, + Optional> configuredProps, + Optional name, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.active = active; + this.configuredProps = configuredProps; + this.name = name; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether the trigger should be active + */ + @JsonProperty("active") + public Optional getActive() { + return active; + } + + /** + * @return The configured properties for the trigger + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The name of the trigger + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerOpts && equalTo((UpdateTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerOpts other) { + return externalUserId.equals(other.externalUserId) + && active.equals(other.active) + && configuredProps.equals(other.configuredProps) + && name.equals(other.name); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.active, this.configuredProps, this.name); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(UpdateTriggerOpts other); + } + + public interface _FinalStage { + UpdateTriggerOpts build(); + + /** + *

    Whether the trigger should be active

    + */ + _FinalStage active(Optional active); + + _FinalStage active(Boolean active); + + /** + *

    The configured properties for the trigger

    + */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

    The name of the trigger

    + */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private Optional name = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional active = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerOpts other) { + externalUserId(other.getExternalUserId()); + active(other.getActive()); + configuredProps(other.getConfiguredProps()); + name(other.getName()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The name of the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    The name of the trigger

    + */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; + return this; + } + + /** + *

    The configured properties for the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps = Optional.ofNullable(configuredProps); + return this; + } + + /** + *

    The configured properties for the trigger

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + /** + *

    Whether the trigger should be active

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage active(Boolean active) { + this.active = Optional.ofNullable(active); + return this; + } + + /** + *

    Whether the trigger should be active

    + */ + @java.lang.Override + @JsonSetter(value = "active", nulls = Nulls.SKIP) + public _FinalStage active(Optional active) { + this.active = active; + return this; + } + + @java.lang.Override + public UpdateTriggerOpts build() { + return new UpdateTriggerOpts(externalUserId, active, configuredProps, name, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java new file mode 100644 index 0000000..d00d5fb --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWebhooksOpts.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTriggerWebhooksOpts.Builder.class) +public final class UpdateTriggerWebhooksOpts { + private final String externalUserId; + + private final List webhookUrls; + + private final Map additionalProperties; + + private UpdateTriggerWebhooksOpts( + String externalUserId, List webhookUrls, Map additionalProperties) { + this.externalUserId = externalUserId; + this.webhookUrls = webhookUrls; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Array of webhook URLs to set + */ + @JsonProperty("webhook_urls") + public List getWebhookUrls() { + return webhookUrls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerWebhooksOpts && equalTo((UpdateTriggerWebhooksOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerWebhooksOpts other) { + return externalUserId.equals(other.externalUserId) && webhookUrls.equals(other.webhookUrls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.webhookUrls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(UpdateTriggerWebhooksOpts other); + } + + public interface _FinalStage { + UpdateTriggerWebhooksOpts build(); + + /** + *

    Array of webhook URLs to set

    + */ + _FinalStage webhookUrls(List webhookUrls); + + _FinalStage addWebhookUrls(String webhookUrls); + + _FinalStage addAllWebhookUrls(List webhookUrls); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private List webhookUrls = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerWebhooksOpts other) { + externalUserId(other.getExternalUserId()); + webhookUrls(other.getWebhookUrls()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    Array of webhook URLs to set

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllWebhookUrls(List webhookUrls) { + this.webhookUrls.addAll(webhookUrls); + return this; + } + + /** + *

    Array of webhook URLs to set

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addWebhookUrls(String webhookUrls) { + this.webhookUrls.add(webhookUrls); + return this; + } + + /** + *

    Array of webhook URLs to set

    + */ + @java.lang.Override + @JsonSetter(value = "webhook_urls", nulls = Nulls.SKIP) + public _FinalStage webhookUrls(List webhookUrls) { + this.webhookUrls.clear(); + this.webhookUrls.addAll(webhookUrls); + return this; + } + + @java.lang.Override + public UpdateTriggerWebhooksOpts build() { + return new UpdateTriggerWebhooksOpts(externalUserId, webhookUrls, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java new file mode 100644 index 0000000..7022dd6 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/deployedtriggers/requests/UpdateTriggerWorkflowsOpts.java @@ -0,0 +1,171 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.deployedtriggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = UpdateTriggerWorkflowsOpts.Builder.class) +public final class UpdateTriggerWorkflowsOpts { + private final String externalUserId; + + private final List workflowIds; + + private final Map additionalProperties; + + private UpdateTriggerWorkflowsOpts( + String externalUserId, List workflowIds, Map additionalProperties) { + this.externalUserId = externalUserId; + this.workflowIds = workflowIds; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID who owns the trigger + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Array of workflow IDs to set + */ + @JsonProperty("workflow_ids") + public List getWorkflowIds() { + return workflowIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof UpdateTriggerWorkflowsOpts && equalTo((UpdateTriggerWorkflowsOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(UpdateTriggerWorkflowsOpts other) { + return externalUserId.equals(other.externalUserId) && workflowIds.equals(other.workflowIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.workflowIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID who owns the trigger

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + + Builder from(UpdateTriggerWorkflowsOpts other); + } + + public interface _FinalStage { + UpdateTriggerWorkflowsOpts build(); + + /** + *

    Array of workflow IDs to set

    + */ + _FinalStage workflowIds(List workflowIds); + + _FinalStage addWorkflowIds(String workflowIds); + + _FinalStage addAllWorkflowIds(List workflowIds); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, _FinalStage { + private String externalUserId; + + private List workflowIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(UpdateTriggerWorkflowsOpts other) { + externalUserId(other.getExternalUserId()); + workflowIds(other.getWorkflowIds()); + return this; + } + + /** + *

    The external user ID who owns the trigger

    + *

    The external user ID who owns the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    Array of workflow IDs to set

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllWorkflowIds(List workflowIds) { + this.workflowIds.addAll(workflowIds); + return this; + } + + /** + *

    Array of workflow IDs to set

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addWorkflowIds(String workflowIds) { + this.workflowIds.add(workflowIds); + return this; + } + + /** + *

    Array of workflow IDs to set

    + */ + @java.lang.Override + @JsonSetter(value = "workflow_ids", nulls = Nulls.SKIP) + public _FinalStage workflowIds(List workflowIds) { + this.workflowIds.clear(); + this.workflowIds.addAll(workflowIds); + return this; + } + + @java.lang.Override + public UpdateTriggerWorkflowsOpts build() { + return new UpdateTriggerWorkflowsOpts(externalUserId, workflowIds, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java new file mode 100644 index 0000000..87556e3 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncOauthTokensClient.java @@ -0,0 +1,37 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncOauthTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawOauthTokensClient rawClient; + + public AsyncOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawOauthTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawOauthTokensClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture create(CreateOAuthTokenOpts request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java new file mode 100644 index 0000000..cc29bb8 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/AsyncRawOauthTokensClient.java @@ -0,0 +1,95 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawOauthTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> create(CreateOAuthTokenOpts request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/oauth/token") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), CreateOAuthTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java new file mode 100644 index 0000000..1ae2bf1 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/OauthTokensClient.java @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; + +public class OauthTokensClient { + protected final ClientOptions clientOptions; + + private final RawOauthTokensClient rawClient; + + public OauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawOauthTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawOauthTokensClient withRawResponse() { + return this.rawClient; + } + + public CreateOAuthTokenResponse create(CreateOAuthTokenOpts request) { + return this.rawClient.create(request).body(); + } + + public CreateOAuthTokenResponse create(CreateOAuthTokenOpts request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java b/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java new file mode 100644 index 0000000..c7096b4 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/RawOauthTokensClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.oauthtokens.requests.CreateOAuthTokenOpts; +import com.pipedream.api.types.CreateOAuthTokenResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawOauthTokensClient { + protected final ClientOptions clientOptions; + + public RawOauthTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse create(CreateOAuthTokenOpts request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create( + CreateOAuthTokenOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/oauth/token") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateOAuthTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java b/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java new file mode 100644 index 0000000..50ab4b2 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/oauthtokens/requests/CreateOAuthTokenOpts.java @@ -0,0 +1,129 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.oauthtokens.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOAuthTokenOpts.Builder.class) +public final class CreateOAuthTokenOpts { + private final String clientId; + + private final String clientSecret; + + private final Map additionalProperties; + + private CreateOAuthTokenOpts(String clientId, String clientSecret, Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("grant_type") + public String getGrantType() { + return "client_credentials"; + } + + @JsonProperty("client_id") + public String getClientId() { + return clientId; + } + + @JsonProperty("client_secret") + public String getClientSecret() { + return clientSecret; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOAuthTokenOpts && equalTo((CreateOAuthTokenOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOAuthTokenOpts other) { + return clientId.equals(other.clientId) && clientSecret.equals(other.clientSecret); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ClientIdStage builder() { + return new Builder(); + } + + public interface ClientIdStage { + ClientSecretStage clientId(@NotNull String clientId); + + Builder from(CreateOAuthTokenOpts other); + } + + public interface ClientSecretStage { + _FinalStage clientSecret(@NotNull String clientSecret); + } + + public interface _FinalStage { + CreateOAuthTokenOpts build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ClientIdStage, ClientSecretStage, _FinalStage { + private String clientId; + + private String clientSecret; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOAuthTokenOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + return this; + } + + @java.lang.Override + @JsonSetter("client_id") + public ClientSecretStage clientId(@NotNull String clientId) { + this.clientId = Objects.requireNonNull(clientId, "clientId must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("client_secret") + public _FinalStage clientSecret(@NotNull String clientSecret) { + this.clientSecret = Objects.requireNonNull(clientSecret, "clientSecret must not be null"); + return this; + } + + @java.lang.Override + public CreateOAuthTokenOpts build() { + return new CreateOAuthTokenOpts(clientId, clientSecret, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java new file mode 100644 index 0000000..1d75dd6 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/projects/AsyncProjectsClient.java @@ -0,0 +1,35 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncProjectsClient { + protected final ClientOptions clientOptions; + + private final AsyncRawProjectsClient rawClient; + + public AsyncProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawProjectsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawProjectsClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture retrieveInfo() { + return this.rawClient.retrieveInfo().thenApply(response -> response.body()); + } + + public CompletableFuture retrieveInfo(RequestOptions requestOptions) { + return this.rawClient.retrieveInfo(requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java new file mode 100644 index 0000000..df37ce8 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/projects/AsyncRawProjectsClient.java @@ -0,0 +1,84 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawProjectsClient { + protected final ClientOptions clientOptions; + + public AsyncRawProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> retrieveInfo() { + return retrieveInfo(null); + } + + public CompletableFuture> retrieveInfo( + RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("projects/info") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java new file mode 100644 index 0000000..b09fc87 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/projects/ProjectsClient.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; + +public class ProjectsClient { + protected final ClientOptions clientOptions; + + private final RawProjectsClient rawClient; + + public ProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawProjectsClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawProjectsClient withRawResponse() { + return this.rawClient; + } + + public ProjectInfoResponse retrieveInfo() { + return this.rawClient.retrieveInfo().body(); + } + + public ProjectInfoResponse retrieveInfo(RequestOptions requestOptions) { + return this.rawClient.retrieveInfo(requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java b/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java new file mode 100644 index 0000000..d09dc32 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/projects/RawProjectsClient.java @@ -0,0 +1,66 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.projects; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.types.ProjectInfoResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawProjectsClient { + protected final ClientOptions clientOptions; + + public RawProjectsClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse retrieveInfo() { + return retrieveInfo(null); + } + + public PipedreamApiHttpResponse retrieveInfo(RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("projects/info") + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ProjectInfoResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java new file mode 100644 index 0000000..61bcd21 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/AsyncProxyClient.java @@ -0,0 +1,77 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +public class AsyncProxyClient { + protected final ClientOptions clientOptions; + + private final AsyncRawProxyClient rawClient; + + public AsyncProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawProxyClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawProxyClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> get(String url64, ProxyGetRequest request) { + return this.rawClient.get(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> post(String url64, ProxyPostRequest request) { + return this.rawClient.post(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + return this.rawClient.post(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> put(String url64, ProxyPutRequest request) { + return this.rawClient.put(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + return this.rawClient.put(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> delete(String url64, ProxyDeleteRequest request) { + return this.rawClient.delete(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(url64, request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture> patch(String url64, ProxyPatchRequest request) { + return this.rawClient.patch(url64, request).thenApply(response -> response.body()); + } + + public CompletableFuture> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + return this.rawClient.patch(url64, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java new file mode 100644 index 0000000..d6737d6 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/AsyncRawProxyClient.java @@ -0,0 +1,347 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawProxyClient { + protected final ClientOptions clientOptions; + + public AsyncRawProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> get(String url64, ProxyGetRequest request) { + return get(url64, request, null); + } + + public CompletableFuture>> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> post( + String url64, ProxyPostRequest request) { + return post(url64, request, null); + } + + public CompletableFuture>> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> put(String url64, ProxyPutRequest request) { + return put(url64, request, null); + } + + public CompletableFuture>> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> delete( + String url64, ProxyDeleteRequest request) { + return delete(url64, request, null); + } + + public CompletableFuture>> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture>> patch( + String url64, ProxyPatchRequest request) { + return patch(url64, request, null); + } + + public CompletableFuture>> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java new file mode 100644 index 0000000..aa27dba --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/ProxyClient.java @@ -0,0 +1,71 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.util.Map; + +public class ProxyClient { + protected final ClientOptions clientOptions; + + private final RawProxyClient rawClient; + + public ProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawProxyClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawProxyClient withRawResponse() { + return this.rawClient; + } + + public Map get(String url64, ProxyGetRequest request) { + return this.rawClient.get(url64, request).body(); + } + + public Map get(String url64, ProxyGetRequest request, RequestOptions requestOptions) { + return this.rawClient.get(url64, request, requestOptions).body(); + } + + public Map post(String url64, ProxyPostRequest request) { + return this.rawClient.post(url64, request).body(); + } + + public Map post(String url64, ProxyPostRequest request, RequestOptions requestOptions) { + return this.rawClient.post(url64, request, requestOptions).body(); + } + + public Map put(String url64, ProxyPutRequest request) { + return this.rawClient.put(url64, request).body(); + } + + public Map put(String url64, ProxyPutRequest request, RequestOptions requestOptions) { + return this.rawClient.put(url64, request, requestOptions).body(); + } + + public Map delete(String url64, ProxyDeleteRequest request) { + return this.rawClient.delete(url64, request).body(); + } + + public Map delete(String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + return this.rawClient.delete(url64, request, requestOptions).body(); + } + + public Map patch(String url64, ProxyPatchRequest request) { + return this.rawClient.patch(url64, request).body(); + } + + public Map patch(String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + return this.rawClient.patch(url64, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java b/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java new file mode 100644 index 0000000..9720f2b --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/RawProxyClient.java @@ -0,0 +1,275 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy; + +import com.fasterxml.jackson.core.type.TypeReference; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.proxy.requests.ProxyDeleteRequest; +import com.pipedream.api.resources.proxy.requests.ProxyGetRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPatchRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPostRequest; +import com.pipedream.api.resources.proxy.requests.ProxyPutRequest; +import java.io.IOException; +import java.util.Map; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawProxyClient { + protected final ClientOptions clientOptions; + + public RawProxyClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> get(String url64, ProxyGetRequest request) { + return get(url64, request, null); + } + + public PipedreamApiHttpResponse> get( + String url64, ProxyGetRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> post(String url64, ProxyPostRequest request) { + return post(url64, request, null); + } + + public PipedreamApiHttpResponse> post( + String url64, ProxyPostRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> put(String url64, ProxyPutRequest request) { + return put(url64, request, null); + } + + public PipedreamApiHttpResponse> put( + String url64, ProxyPutRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PUT", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> delete(String url64, ProxyDeleteRequest request) { + return delete(url64, request, null); + } + + public PipedreamApiHttpResponse> delete( + String url64, ProxyDeleteRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse> patch(String url64, ProxyPatchRequest request) { + return patch(url64, request, null); + } + + public PipedreamApiHttpResponse> patch( + String url64, ProxyPatchRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("proxy") + .addPathSegment(url64); + QueryStringMapper.addQueryParameter(httpUrl, "external_user_id", request.getExternalUserId(), false); + QueryStringMapper.addQueryParameter(httpUrl, "account_id", request.getAccountId(), false); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("PATCH", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue( + responseBody.string(), new TypeReference>() {}), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} 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 new file mode 100644 index 0000000..f956f17 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyDeleteRequest.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyDeleteRequest.Builder.class) +public final class ProxyDeleteRequest { + private final String externalUserId; + + private final String accountId; + + private final Map additionalProperties; + + private ProxyDeleteRequest(String externalUserId, String accountId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyDeleteRequest && equalTo((ProxyDeleteRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyDeleteRequest other) { + return externalUserId.equals(other.externalUserId) && accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID for the proxy request

    + */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyDeleteRequest other); + } + + public interface AccountIdStage { + /** + *

    The account ID to use for authentication

    + */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyDeleteRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyDeleteRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + return this; + } + + /** + *

    The external user ID for the proxy request

    + *

    The external user ID for the proxy request

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public AccountIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The account ID to use for authentication

    + *

    The account ID to use for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public ProxyDeleteRequest build() { + return new ProxyDeleteRequest(externalUserId, accountId, additionalProperties); + } + } +} 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 new file mode 100644 index 0000000..bf09229 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyGetRequest.java @@ -0,0 +1,146 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyGetRequest.Builder.class) +public final class ProxyGetRequest { + private final String externalUserId; + + private final String accountId; + + private final Map additionalProperties; + + private ProxyGetRequest(String externalUserId, String accountId, Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyGetRequest && equalTo((ProxyGetRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyGetRequest other) { + return externalUserId.equals(other.externalUserId) && accountId.equals(other.accountId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID for the proxy request

    + */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyGetRequest other); + } + + public interface AccountIdStage { + /** + *

    The account ID to use for authentication

    + */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyGetRequest build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyGetRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + return this; + } + + /** + *

    The external user ID for the proxy request

    + *

    The external user ID for the proxy request

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public AccountIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The account ID to use for authentication

    + *

    The account ID to use for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + @java.lang.Override + public ProxyGetRequest build() { + return new ProxyGetRequest(externalUserId, accountId, additionalProperties); + } + } +} 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 new file mode 100644 index 0000000..fe68355 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPatchRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPatchRequest.Builder.class) +public final class ProxyPatchRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPatchRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPatchRequest && equalTo((ProxyPatchRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPatchRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID for the proxy request

    + */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPatchRequest other); + } + + public interface AccountIdStage { + /** + *

    The account ID to use for authentication

    + */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPatchRequest build(); + + /** + *

    Request body to forward to the target API

    + */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPatchRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

    The external user ID for the proxy request

    + *

    The external user ID for the proxy request

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public AccountIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The account ID to use for authentication

    + *

    The account ID to use for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

    Request body to forward to the target API

    + */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPatchRequest build() { + return new ProxyPatchRequest(externalUserId, accountId, body, additionalProperties); + } + } +} 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 new file mode 100644 index 0000000..d648ab4 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPostRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPostRequest.Builder.class) +public final class ProxyPostRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPostRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPostRequest && equalTo((ProxyPostRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPostRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID for the proxy request

    + */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPostRequest other); + } + + public interface AccountIdStage { + /** + *

    The account ID to use for authentication

    + */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPostRequest build(); + + /** + *

    Request body to forward to the target API

    + */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPostRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

    The external user ID for the proxy request

    + *

    The external user ID for the proxy request

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public AccountIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The account ID to use for authentication

    + *

    The account ID to use for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

    Request body to forward to the target API

    + */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPostRequest build() { + return new ProxyPostRequest(externalUserId, accountId, body, additionalProperties); + } + } +} 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 new file mode 100644 index 0000000..d4aaeba --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/proxy/requests/ProxyPutRequest.java @@ -0,0 +1,208 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.proxy.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyPutRequest.Builder.class) +public final class ProxyPutRequest { + private final String externalUserId; + + private final String accountId; + + private final Map body; + + private final Map additionalProperties; + + private ProxyPutRequest( + String externalUserId, + String accountId, + Map body, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.accountId = accountId; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return The external user ID for the proxy request + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The account ID to use for authentication + */ + @JsonProperty("account_id") + public String getAccountId() { + return accountId; + } + + /** + * @return Request body to forward to the target API + */ + @JsonProperty("body") + public Map getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyPutRequest && equalTo((ProxyPutRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyPutRequest other) { + return externalUserId.equals(other.externalUserId) + && accountId.equals(other.accountId) + && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.externalUserId, this.accountId, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID for the proxy request

    + */ + AccountIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ProxyPutRequest other); + } + + public interface AccountIdStage { + /** + *

    The account ID to use for authentication

    + */ + _FinalStage accountId(@NotNull String accountId); + } + + public interface _FinalStage { + ProxyPutRequest build(); + + /** + *

    Request body to forward to the target API

    + */ + _FinalStage body(Map body); + + _FinalStage putAllBody(Map body); + + _FinalStage body(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, AccountIdStage, _FinalStage { + private String externalUserId; + + private String accountId; + + private Map body = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProxyPutRequest other) { + externalUserId(other.getExternalUserId()); + accountId(other.getAccountId()); + body(other.getBody()); + return this; + } + + /** + *

    The external user ID for the proxy request

    + *

    The external user ID for the proxy request

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public AccountIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The account ID to use for authentication

    + *

    The account ID to use for authentication

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("account_id") + public _FinalStage accountId(@NotNull String accountId) { + this.accountId = Objects.requireNonNull(accountId, "accountId must not be null"); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage body(String key, Object value) { + this.body.put(key, value); + return this; + } + + /** + *

    Request body to forward to the target API

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllBody(Map body) { + this.body.putAll(body); + return this; + } + + /** + *

    Request body to forward to the target API

    + */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Map body) { + this.body.clear(); + this.body.putAll(body); + return this; + } + + @java.lang.Override + public ProxyPutRequest build() { + return new ProxyPutRequest(externalUserId, accountId, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java new file mode 100644 index 0000000..9ddd525 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/AsyncRawTokensClient.java @@ -0,0 +1,158 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTokensClient { + protected final ClientOptions clientOptions; + + public AsyncRawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> create(CreateTokenRequest request) { + return create(request, null); + } + + public CompletableFuture> create( + CreateTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> validate(String ctok) { + return validate(ctok, TokensValidateRequest.builder().build()); + } + + public CompletableFuture> validate( + String ctok, TokensValidateRequest request) { + return validate(ctok, request, null); + } + + public CompletableFuture> validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .addPathSegment(ctok) + .addPathSegments("validate"); + if (request.getParams().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "params", request.getParams().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java new file mode 100644 index 0000000..eef98a0 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/AsyncTokensClient.java @@ -0,0 +1,51 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncTokensClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTokensClient rawClient; + + public AsyncTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTokensClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture create(CreateTokenRequest request) { + return this.rawClient.create(request).thenApply(response -> response.body()); + } + + public CompletableFuture create(CreateTokenRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture validate(String ctok) { + return this.rawClient.validate(ctok).thenApply(response -> response.body()); + } + + public CompletableFuture validate(String ctok, TokensValidateRequest request) { + return this.rawClient.validate(ctok, request).thenApply(response -> response.body()); + } + + public CompletableFuture validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + return this.rawClient.validate(ctok, request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java new file mode 100644 index 0000000..d20fbea --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/RawTokensClient.java @@ -0,0 +1,127 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTokensClient { + protected final ClientOptions clientOptions; + + public RawTokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse create(CreateTokenRequest request) { + return create(request, null); + } + + public PipedreamApiHttpResponse create( + CreateTokenRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), CreateTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse validate(String ctok) { + return validate(ctok, TokensValidateRequest.builder().build()); + } + + public PipedreamApiHttpResponse validate(String ctok, TokensValidateRequest request) { + return validate(ctok, request, null); + } + + public PipedreamApiHttpResponse validate( + String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect/tokens") + .addPathSegment(ctok) + .addPathSegments("validate"); + if (request.getParams().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "params", request.getParams().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ValidateTokenResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java b/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java new file mode 100644 index 0000000..98801f4 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/TokensClient.java @@ -0,0 +1,49 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.resources.tokens.requests.CreateTokenRequest; +import com.pipedream.api.resources.tokens.requests.TokensValidateRequest; +import com.pipedream.api.types.CreateTokenResponse; +import com.pipedream.api.types.ValidateTokenResponse; + +public class TokensClient { + protected final ClientOptions clientOptions; + + private final RawTokensClient rawClient; + + public TokensClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTokensClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTokensClient withRawResponse() { + return this.rawClient; + } + + public CreateTokenResponse create(CreateTokenRequest request) { + return this.rawClient.create(request).body(); + } + + public CreateTokenResponse create(CreateTokenRequest request, RequestOptions requestOptions) { + return this.rawClient.create(request, requestOptions).body(); + } + + public ValidateTokenResponse validate(String ctok) { + return this.rawClient.validate(ctok).body(); + } + + public ValidateTokenResponse validate(String ctok, TokensValidateRequest request) { + return this.rawClient.validate(ctok, request).body(); + } + + public ValidateTokenResponse validate(String ctok, TokensValidateRequest request, RequestOptions requestOptions) { + return this.rawClient.validate(ctok, request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java b/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java new file mode 100644 index 0000000..9ec9c19 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/requests/CreateTokenRequest.java @@ -0,0 +1,338 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTokenRequest.Builder.class) +public final class CreateTokenRequest { + private final Optional> allowedOrigins; + + private final Optional errorRedirectUri; + + private final String externalUserId; + + private final String projectId; + + private final Optional successRedirectUri; + + private final Optional webhookUri; + + private final Map additionalProperties; + + private CreateTokenRequest( + Optional> allowedOrigins, + Optional errorRedirectUri, + String externalUserId, + String projectId, + Optional successRedirectUri, + Optional webhookUri, + Map additionalProperties) { + this.allowedOrigins = allowedOrigins; + this.errorRedirectUri = errorRedirectUri; + this.externalUserId = externalUserId; + this.projectId = projectId; + this.successRedirectUri = successRedirectUri; + this.webhookUri = webhookUri; + this.additionalProperties = additionalProperties; + } + + /** + * @return List of allowed origins for CORS + */ + @JsonProperty("allowed_origins") + public Optional> getAllowedOrigins() { + return allowedOrigins; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return Your end user ID, for whom you're creating the token + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The ID of the project + */ + @JsonProperty("project_id") + public String getProjectId() { + return projectId; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + /** + * @return Webhook URI for notifications + */ + @JsonProperty("webhook_uri") + public Optional getWebhookUri() { + return webhookUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenRequest && equalTo((CreateTokenRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenRequest other) { + return allowedOrigins.equals(other.allowedOrigins) + && errorRedirectUri.equals(other.errorRedirectUri) + && externalUserId.equals(other.externalUserId) + && projectId.equals(other.projectId) + && successRedirectUri.equals(other.successRedirectUri) + && webhookUri.equals(other.webhookUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.allowedOrigins, + this.errorRedirectUri, + this.externalUserId, + this.projectId, + this.successRedirectUri, + this.webhookUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    Your end user ID, for whom you're creating the token

    + */ + ProjectIdStage externalUserId(@NotNull String externalUserId); + + Builder from(CreateTokenRequest other); + } + + public interface ProjectIdStage { + /** + *

    The ID of the project

    + */ + _FinalStage projectId(@NotNull String projectId); + } + + public interface _FinalStage { + CreateTokenRequest build(); + + /** + *

    List of allowed origins for CORS

    + */ + _FinalStage allowedOrigins(Optional> allowedOrigins); + + _FinalStage allowedOrigins(List allowedOrigins); + + /** + *

    URI to redirect to on error

    + */ + _FinalStage errorRedirectUri(Optional errorRedirectUri); + + _FinalStage errorRedirectUri(String errorRedirectUri); + + /** + *

    URI to redirect to on success

    + */ + _FinalStage successRedirectUri(Optional successRedirectUri); + + _FinalStage successRedirectUri(String successRedirectUri); + + /** + *

    Webhook URI for notifications

    + */ + _FinalStage webhookUri(Optional webhookUri); + + _FinalStage webhookUri(String webhookUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, ProjectIdStage, _FinalStage { + private String externalUserId; + + private String projectId; + + private Optional webhookUri = Optional.empty(); + + private Optional successRedirectUri = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional> allowedOrigins = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTokenRequest other) { + allowedOrigins(other.getAllowedOrigins()); + errorRedirectUri(other.getErrorRedirectUri()); + externalUserId(other.getExternalUserId()); + projectId(other.getProjectId()); + successRedirectUri(other.getSuccessRedirectUri()); + webhookUri(other.getWebhookUri()); + return this; + } + + /** + *

    Your end user ID, for whom you're creating the token

    + *

    Your end user ID, for whom you're creating the token

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public ProjectIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The ID of the project

    + *

    The ID of the project

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("project_id") + public _FinalStage projectId(@NotNull String projectId) { + this.projectId = Objects.requireNonNull(projectId, "projectId must not be null"); + return this; + } + + /** + *

    Webhook URI for notifications

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage webhookUri(String webhookUri) { + this.webhookUri = Optional.ofNullable(webhookUri); + return this; + } + + /** + *

    Webhook URI for notifications

    + */ + @java.lang.Override + @JsonSetter(value = "webhook_uri", nulls = Nulls.SKIP) + public _FinalStage webhookUri(Optional webhookUri) { + this.webhookUri = webhookUri; + return this; + } + + /** + *

    URI to redirect to on success

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage successRedirectUri(String successRedirectUri) { + this.successRedirectUri = Optional.ofNullable(successRedirectUri); + return this; + } + + /** + *

    URI to redirect to on success

    + */ + @java.lang.Override + @JsonSetter(value = "success_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage successRedirectUri(Optional successRedirectUri) { + this.successRedirectUri = successRedirectUri; + return this; + } + + /** + *

    URI to redirect to on error

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorRedirectUri(String errorRedirectUri) { + this.errorRedirectUri = Optional.ofNullable(errorRedirectUri); + return this; + } + + /** + *

    URI to redirect to on error

    + */ + @java.lang.Override + @JsonSetter(value = "error_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage errorRedirectUri(Optional errorRedirectUri) { + this.errorRedirectUri = errorRedirectUri; + return this; + } + + /** + *

    List of allowed origins for CORS

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage allowedOrigins(List allowedOrigins) { + this.allowedOrigins = Optional.ofNullable(allowedOrigins); + return this; + } + + /** + *

    List of allowed origins for CORS

    + */ + @java.lang.Override + @JsonSetter(value = "allowed_origins", nulls = Nulls.SKIP) + public _FinalStage allowedOrigins(Optional> allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + @java.lang.Override + public CreateTokenRequest build() { + return new CreateTokenRequest( + allowedOrigins, + errorRedirectUri, + externalUserId, + projectId, + successRedirectUri, + webhookUri, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java b/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java new file mode 100644 index 0000000..1479f3c --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/tokens/requests/TokensValidateRequest.java @@ -0,0 +1,96 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.tokens.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ValidateTokenParams; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TokensValidateRequest.Builder.class) +public final class TokensValidateRequest { + private final Optional params; + + private final Map additionalProperties; + + private TokensValidateRequest(Optional params, Map additionalProperties) { + this.params = params; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("params") + public Optional getParams() { + return params; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TokensValidateRequest && equalTo((TokensValidateRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TokensValidateRequest other) { + return params.equals(other.params); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.params); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional params = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TokensValidateRequest other) { + params(other.getParams()); + return this; + } + + @JsonSetter(value = "params", nulls = Nulls.SKIP) + public Builder params(Optional params) { + this.params = params; + return this; + } + + public Builder params(ValidateTokenParams params) { + this.params = Optional.ofNullable(params); + return this; + } + + public TokensValidateRequest build() { + return new TokensValidateRequest(params, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java new file mode 100644 index 0000000..8e4c08a --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/AsyncRawTriggersClient.java @@ -0,0 +1,386 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployTriggerResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawTriggersClient { + protected final ClientOptions clientOptions; + + public AsyncRawTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture>> list() { + return list(TriggersListRequest.builder().build()); + } + + public CompletableFuture>> list( + TriggersListRequest request) { + return list(request, null); + } + + public CompletableFuture>> list( + TriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture>> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = + parsedResponse.getPageInfo().getEndCursor(); + TriggersListRequest nextRequest = TriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + future.complete(new PipedreamApiHttpResponse<>( + new SyncPagingIterable(startingAfter.isPresent(), result, () -> { + try { + return list(nextRequest, requestOptions) + .get() + .body(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> retrieve(String componentId) { + return retrieve(componentId, null); + } + + public CompletableFuture> retrieve( + String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> configureProp( + TriggersConfigurePropRequest request) { + return configureProp(request, null); + } + + public CompletableFuture> configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> reloadProps( + TriggersReloadPropsRequest request) { + return reloadProps(request, null); + } + + public CompletableFuture> reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } + + public CompletableFuture> deploy(DeployTriggerOpts request) { + return deploy(request, null); + } + + public CompletableFuture> deploy( + DeployTriggerOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/deploy") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + DeployTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); + future.complete(new PipedreamApiHttpResponse<>(parsedResponse.getData(), response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java new file mode 100644 index 0000000..2f3361f --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/AsyncTriggersClient.java @@ -0,0 +1,82 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.ReloadPropsResponse; +import java.util.concurrent.CompletableFuture; + +public class AsyncTriggersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawTriggersClient rawClient; + + public AsyncTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawTriggersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture> list() { + return this.rawClient.list().thenApply(response -> response.body()); + } + + public CompletableFuture> list(TriggersListRequest request) { + return this.rawClient.list(request).thenApply(response -> response.body()); + } + + public CompletableFuture> list( + TriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId) { + return this.rawClient.retrieve(componentId).thenApply(response -> response.body()); + } + + public CompletableFuture retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp(TriggersConfigurePropRequest request) { + return this.rawClient.configureProp(request).thenApply(response -> response.body()); + } + + public CompletableFuture configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps(TriggersReloadPropsRequest request) { + return this.rawClient.reloadProps(request).thenApply(response -> response.body()); + } + + public CompletableFuture reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).thenApply(response -> response.body()); + } + + public CompletableFuture deploy(DeployTriggerOpts request) { + return this.rawClient.deploy(request).thenApply(response -> response.body()); + } + + public CompletableFuture deploy(DeployTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.deploy(request, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java new file mode 100644 index 0000000..83abd08 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/RawTriggersClient.java @@ -0,0 +1,305 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.MediaTypes; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.QueryStringMapper; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployTriggerResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.GetComponentResponse; +import com.pipedream.api.types.GetComponentsResponse; +import com.pipedream.api.types.ReloadPropsResponse; +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.RequestBody; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawTriggersClient { + protected final ClientOptions clientOptions; + + public RawTriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse> list() { + return list(TriggersListRequest.builder().build()); + } + + public PipedreamApiHttpResponse> list(TriggersListRequest request) { + return list(request, null); + } + + public PipedreamApiHttpResponse> list( + TriggersListRequest request, RequestOptions requestOptions) { + HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers"); + if (request.getAfter().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "after", request.getAfter().get(), false); + } + if (request.getBefore().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "before", request.getBefore().get(), false); + } + if (request.getLimit().isPresent()) { + QueryStringMapper.addQueryParameter( + httpUrl, "limit", request.getLimit().get(), false); + } + if (request.getQ().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "q", request.getQ().get(), false); + } + if (request.getApp().isPresent()) { + QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl.build()) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json"); + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentsResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentsResponse.class); + Optional startingAfter = parsedResponse.getPageInfo().getEndCursor(); + TriggersListRequest nextRequest = TriggersListRequest.builder() + .from(request) + .after(startingAfter) + .build(); + List result = parsedResponse.getData(); + return new PipedreamApiHttpResponse<>( + new SyncPagingIterable( + startingAfter.isPresent(), result, () -> list(nextRequest, requestOptions) + .body()), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse retrieve(String componentId) { + return retrieve(componentId, null); + } + + public PipedreamApiHttpResponse retrieve(String componentId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers") + .addPathSegment(componentId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("GET", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + GetComponentResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), GetComponentResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse configureProp(TriggersConfigurePropRequest request) { + return configureProp(request, null); + } + + public PipedreamApiHttpResponse configureProp( + TriggersConfigurePropRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/configure") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ConfigurePropResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse reloadProps(TriggersReloadPropsRequest request) { + return reloadProps(request, null); + } + + public PipedreamApiHttpResponse reloadProps( + TriggersReloadPropsRequest request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/props") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request.getBody()), MediaTypes.APPLICATION_JSON); + } catch (Exception e) { + throw new RuntimeException(e); + } + Request.Builder _requestBuilder = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json"); + if (request.getAsyncHandle().isPresent()) { + _requestBuilder.addHeader("x-async-handle", request.getAsyncHandle().get()); + } + Request okhttpRequest = _requestBuilder.build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>( + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), ReloadPropsResponse.class), + response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } + + public PipedreamApiHttpResponse deploy(DeployTriggerOpts request) { + return deploy(request, null); + } + + public PipedreamApiHttpResponse deploy( + DeployTriggerOpts request, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("triggers/deploy") + .build(); + RequestBody body; + try { + body = RequestBody.create( + ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } catch (JsonProcessingException e) { + throw new PipedreamApiException("Failed to serialize request", e); + } + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("POST", body) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") + .addHeader("Accept", "application/json") + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + DeployTriggerResponse parsedResponse = + ObjectMappers.JSON_MAPPER.readValue(responseBody.string(), DeployTriggerResponse.class); + return new PipedreamApiHttpResponse<>(parsedResponse.getData(), response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java b/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java new file mode 100644 index 0000000..d16a37b --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/TriggersClient.java @@ -0,0 +1,78 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import com.pipedream.api.core.pagination.SyncPagingIterable; +import com.pipedream.api.resources.triggers.requests.DeployTriggerOpts; +import com.pipedream.api.resources.triggers.requests.TriggersConfigurePropRequest; +import com.pipedream.api.resources.triggers.requests.TriggersListRequest; +import com.pipedream.api.resources.triggers.requests.TriggersReloadPropsRequest; +import com.pipedream.api.types.Component; +import com.pipedream.api.types.ConfigurePropResponse; +import com.pipedream.api.types.DeployedComponent; +import com.pipedream.api.types.ReloadPropsResponse; + +public class TriggersClient { + protected final ClientOptions clientOptions; + + private final RawTriggersClient rawClient; + + public TriggersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawTriggersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawTriggersClient withRawResponse() { + return this.rawClient; + } + + public SyncPagingIterable list() { + return this.rawClient.list().body(); + } + + public SyncPagingIterable list(TriggersListRequest request) { + return this.rawClient.list(request).body(); + } + + public SyncPagingIterable list(TriggersListRequest request, RequestOptions requestOptions) { + return this.rawClient.list(request, requestOptions).body(); + } + + public Component retrieve(String componentId) { + return this.rawClient.retrieve(componentId).body(); + } + + public Component retrieve(String componentId, RequestOptions requestOptions) { + return this.rawClient.retrieve(componentId, requestOptions).body(); + } + + public ConfigurePropResponse configureProp(TriggersConfigurePropRequest request) { + return this.rawClient.configureProp(request).body(); + } + + public ConfigurePropResponse configureProp(TriggersConfigurePropRequest request, RequestOptions requestOptions) { + return this.rawClient.configureProp(request, requestOptions).body(); + } + + public ReloadPropsResponse reloadProps(TriggersReloadPropsRequest request) { + return this.rawClient.reloadProps(request).body(); + } + + public ReloadPropsResponse reloadProps(TriggersReloadPropsRequest request, RequestOptions requestOptions) { + return this.rawClient.reloadProps(request, requestOptions).body(); + } + + public DeployedComponent deploy(DeployTriggerOpts request) { + return this.rawClient.deploy(request).body(); + } + + public DeployedComponent deploy(DeployTriggerOpts request, RequestOptions requestOptions) { + return this.rawClient.deploy(request, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java b/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java new file mode 100644 index 0000000..b45a651 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/requests/DeployTriggerOpts.java @@ -0,0 +1,282 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployTriggerOpts.Builder.class) +public final class DeployTriggerOpts { + private final String id; + + private final String externalUserId; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional webhookUrl; + + private final Map additionalProperties; + + private DeployTriggerOpts( + String id, + String externalUserId, + Optional> configuredProps, + Optional dynamicPropsId, + Optional webhookUrl, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.webhookUrl = webhookUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The trigger component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The configured properties for the trigger + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Optional webhook URL to receive trigger events + */ + @JsonProperty("webhook_url") + public Optional getWebhookUrl() { + return webhookUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployTriggerOpts && equalTo((DeployTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployTriggerOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && webhookUrl.equals(other.webhookUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.externalUserId, this.configuredProps, this.dynamicPropsId, this.webhookUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

    The trigger component ID

    + */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(DeployTriggerOpts other); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + DeployTriggerOpts build(); + + /** + *

    The configured properties for the trigger

    + */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

    The ID for dynamic props

    + */ + _FinalStage dynamicPropsId(Optional dynamicPropsId); + + _FinalStage dynamicPropsId(String dynamicPropsId); + + /** + *

    Optional webhook URL to receive trigger events

    + */ + _FinalStage webhookUrl(Optional webhookUrl); + + _FinalStage webhookUrl(String webhookUrl); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional webhookUrl = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployTriggerOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + webhookUrl(other.getWebhookUrl()); + return this; + } + + /** + *

    The trigger component ID

    + *

    The trigger component ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ExternalUserIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The external user ID

    + *

    The external user ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    Optional webhook URL to receive trigger events

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage webhookUrl(String webhookUrl) { + this.webhookUrl = Optional.ofNullable(webhookUrl); + return this; + } + + /** + *

    Optional webhook URL to receive trigger events

    + */ + @java.lang.Override + @JsonSetter(value = "webhook_url", nulls = Nulls.SKIP) + public _FinalStage webhookUrl(Optional webhookUrl) { + this.webhookUrl = webhookUrl; + return this; + } + + /** + *

    The ID for dynamic props

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dynamicPropsId(String dynamicPropsId) { + this.dynamicPropsId = Optional.ofNullable(dynamicPropsId); + return this; + } + + /** + *

    The ID for dynamic props

    + */ + @java.lang.Override + @JsonSetter(value = "dynamic_props_id", nulls = Nulls.SKIP) + public _FinalStage dynamicPropsId(Optional dynamicPropsId) { + this.dynamicPropsId = dynamicPropsId; + return this; + } + + /** + *

    The configured properties for the trigger

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps = Optional.ofNullable(configuredProps); + return this; + } + + /** + *

    The configured properties for the trigger

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + @java.lang.Override + public DeployTriggerOpts build() { + return new DeployTriggerOpts( + id, externalUserId, configuredProps, dynamicPropsId, webhookUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java new file mode 100644 index 0000000..dda960b --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersConfigurePropRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ConfigurePropOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TriggersConfigurePropRequest.Builder.class) +public final class TriggersConfigurePropRequest { + private final Optional asyncHandle; + + private final ConfigurePropOpts body; + + private final Map additionalProperties; + + private TriggersConfigurePropRequest( + Optional asyncHandle, ConfigurePropOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ConfigurePropOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersConfigurePropRequest && equalTo((TriggersConfigurePropRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersConfigurePropRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ConfigurePropOpts body); + + Builder from(TriggersConfigurePropRequest other); + } + + public interface _FinalStage { + TriggersConfigurePropRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ConfigurePropOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TriggersConfigurePropRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ConfigurePropOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public TriggersConfigurePropRequest build() { + return new TriggersConfigurePropRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java new file mode 100644 index 0000000..833a738 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersListRequest.java @@ -0,0 +1,223 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TriggersListRequest.Builder.class) +public final class TriggersListRequest { + private final Optional after; + + private final Optional before; + + private final Optional limit; + + private final Optional q; + + private final Optional app; + + private final Map additionalProperties; + + private TriggersListRequest( + Optional after, + Optional before, + Optional limit, + Optional q, + Optional app, + Map additionalProperties) { + this.after = after; + this.before = before; + this.limit = limit; + this.q = q; + this.app = app; + this.additionalProperties = additionalProperties; + } + + /** + * @return The cursor to start from for pagination + */ + @JsonProperty("after") + public Optional getAfter() { + return after; + } + + /** + * @return The cursor to end before for pagination + */ + @JsonProperty("before") + public Optional getBefore() { + return before; + } + + /** + * @return The maximum number of results to return + */ + @JsonProperty("limit") + public Optional getLimit() { + return limit; + } + + /** + * @return A search query to filter the triggers + */ + @JsonProperty("q") + public Optional getQ() { + return q; + } + + /** + * @return The ID or name slug of the app to filter the triggers + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersListRequest && equalTo((TriggersListRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersListRequest other) { + return after.equals(other.after) + && before.equals(other.before) + && limit.equals(other.limit) + && q.equals(other.q) + && app.equals(other.app); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.after, this.before, this.limit, this.q, this.app); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional after = Optional.empty(); + + private Optional before = Optional.empty(); + + private Optional limit = Optional.empty(); + + private Optional q = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(TriggersListRequest other) { + after(other.getAfter()); + before(other.getBefore()); + limit(other.getLimit()); + q(other.getQ()); + app(other.getApp()); + return this; + } + + /** + *

    The cursor to start from for pagination

    + */ + @JsonSetter(value = "after", nulls = Nulls.SKIP) + public Builder after(Optional after) { + this.after = after; + return this; + } + + public Builder after(String after) { + this.after = Optional.ofNullable(after); + return this; + } + + /** + *

    The cursor to end before for pagination

    + */ + @JsonSetter(value = "before", nulls = Nulls.SKIP) + public Builder before(Optional before) { + this.before = before; + return this; + } + + public Builder before(String before) { + this.before = Optional.ofNullable(before); + return this; + } + + /** + *

    The maximum number of results to return

    + */ + @JsonSetter(value = "limit", nulls = Nulls.SKIP) + public Builder limit(Optional limit) { + this.limit = limit; + return this; + } + + public Builder limit(Integer limit) { + this.limit = Optional.ofNullable(limit); + return this; + } + + /** + *

    A search query to filter the triggers

    + */ + @JsonSetter(value = "q", nulls = Nulls.SKIP) + public Builder q(Optional q) { + this.q = q; + return this; + } + + public Builder q(String q) { + this.q = Optional.ofNullable(q); + return this; + } + + /** + *

    The ID or name slug of the app to filter the triggers

    + */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + public TriggersListRequest build() { + return new TriggersListRequest(after, before, limit, q, app, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java new file mode 100644 index 0000000..b40b8ca --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/triggers/requests/TriggersReloadPropsRequest.java @@ -0,0 +1,134 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.triggers.requests; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.types.ReloadPropsOpts; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = TriggersReloadPropsRequest.Builder.class) +public final class TriggersReloadPropsRequest { + private final Optional asyncHandle; + + private final ReloadPropsOpts body; + + private final Map additionalProperties; + + private TriggersReloadPropsRequest( + Optional asyncHandle, ReloadPropsOpts body, Map additionalProperties) { + this.asyncHandle = asyncHandle; + this.body = body; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("x-async-handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @JsonProperty("body") + public ReloadPropsOpts getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof TriggersReloadPropsRequest && equalTo((TriggersReloadPropsRequest) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(TriggersReloadPropsRequest other) { + return asyncHandle.equals(other.asyncHandle) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.asyncHandle, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static BodyStage builder() { + return new Builder(); + } + + public interface BodyStage { + _FinalStage body(@NotNull ReloadPropsOpts body); + + Builder from(TriggersReloadPropsRequest other); + } + + public interface _FinalStage { + TriggersReloadPropsRequest build(); + + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements BodyStage, _FinalStage { + private ReloadPropsOpts body; + + private Optional asyncHandle = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(TriggersReloadPropsRequest other) { + asyncHandle(other.getAsyncHandle()); + body(other.getBody()); + return this; + } + + @java.lang.Override + @JsonSetter("body") + public _FinalStage body(@NotNull ReloadPropsOpts body) { + this.body = Objects.requireNonNull(body, "body must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + @java.lang.Override + @JsonSetter(value = "x-async-handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + @java.lang.Override + public TriggersReloadPropsRequest build() { + return new TriggersReloadPropsRequest(asyncHandle, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java b/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java new file mode 100644 index 0000000..5cb2cdb --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/users/AsyncRawUsersClient.java @@ -0,0 +1,81 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import java.io.IOException; +import java.util.concurrent.CompletableFuture; +import okhttp3.Call; +import okhttp3.Callback; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; +import org.jetbrains.annotations.NotNull; + +public class AsyncRawUsersClient { + protected final ClientOptions clientOptions; + + public AsyncRawUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public CompletableFuture> deleteExternalUser(String externalUserId) { + return deleteExternalUser(externalUserId, null); + } + + public CompletableFuture> deleteExternalUser( + String externalUserId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("users") + .addPathSegment(externalUserId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + CompletableFuture> future = new CompletableFuture<>(); + client.newCall(okhttpRequest).enqueue(new Callback() { + @Override + public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { + try (ResponseBody responseBody = response.body()) { + if (response.isSuccessful()) { + future.complete(new PipedreamApiHttpResponse<>(null, response)); + return; + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + future.completeExceptionally(new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response)); + return; + } catch (IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + } + + @Override + public void onFailure(@NotNull Call call, @NotNull IOException e) { + future.completeExceptionally(new PipedreamApiException("Network error executing HTTP request", e)); + } + }); + return future; + } +} diff --git a/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java b/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java new file mode 100644 index 0000000..97dafe2 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/users/AsyncUsersClient.java @@ -0,0 +1,34 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; +import java.util.concurrent.CompletableFuture; + +public class AsyncUsersClient { + protected final ClientOptions clientOptions; + + private final AsyncRawUsersClient rawClient; + + public AsyncUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new AsyncRawUsersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public AsyncRawUsersClient withRawResponse() { + return this.rawClient; + } + + public CompletableFuture deleteExternalUser(String externalUserId) { + return this.rawClient.deleteExternalUser(externalUserId).thenApply(response -> response.body()); + } + + public CompletableFuture deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + return this.rawClient.deleteExternalUser(externalUserId, requestOptions).thenApply(response -> response.body()); + } +} diff --git a/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java b/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java new file mode 100644 index 0000000..7fe69c9 --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/users/RawUsersClient.java @@ -0,0 +1,63 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.PipedreamApiApiException; +import com.pipedream.api.core.PipedreamApiException; +import com.pipedream.api.core.PipedreamApiHttpResponse; +import com.pipedream.api.core.RequestOptions; +import java.io.IOException; +import okhttp3.Headers; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; +import okhttp3.ResponseBody; + +public class RawUsersClient { + protected final ClientOptions clientOptions; + + public RawUsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + } + + public PipedreamApiHttpResponse deleteExternalUser(String externalUserId) { + return deleteExternalUser(externalUserId, null); + } + + public PipedreamApiHttpResponse deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + HttpUrl httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()) + .newBuilder() + .addPathSegments("v1/connect") + .addPathSegment(clientOptions.projectId()) + .addPathSegments("users") + .addPathSegment(externalUserId) + .build(); + Request okhttpRequest = new Request.Builder() + .url(httpUrl) + .method("DELETE", null) + .headers(Headers.of(clientOptions.headers(requestOptions))) + .build(); + OkHttpClient client = clientOptions.httpClient(); + if (requestOptions != null && requestOptions.getTimeout().isPresent()) { + client = clientOptions.httpClientWithTimeout(requestOptions); + } + try (Response response = client.newCall(okhttpRequest).execute()) { + ResponseBody responseBody = response.body(); + if (response.isSuccessful()) { + return new PipedreamApiHttpResponse<>(null, response); + } + String responseBodyString = responseBody != null ? responseBody.string() : "{}"; + throw new PipedreamApiApiException( + "Error with status code " + response.code(), + response.code(), + ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), + response); + } catch (IOException e) { + throw new PipedreamApiException("Network error executing HTTP request", e); + } + } +} diff --git a/src/main/java/com/pipedream/api/resources/users/UsersClient.java b/src/main/java/com/pipedream/api/resources/users/UsersClient.java new file mode 100644 index 0000000..a00362d --- /dev/null +++ b/src/main/java/com/pipedream/api/resources/users/UsersClient.java @@ -0,0 +1,33 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.resources.users; + +import com.pipedream.api.core.ClientOptions; +import com.pipedream.api.core.RequestOptions; + +public class UsersClient { + protected final ClientOptions clientOptions; + + private final RawUsersClient rawClient; + + public UsersClient(ClientOptions clientOptions) { + this.clientOptions = clientOptions; + this.rawClient = new RawUsersClient(clientOptions); + } + + /** + * Get responses with HTTP metadata like headers + */ + public RawUsersClient withRawResponse() { + return this.rawClient; + } + + public void deleteExternalUser(String externalUserId) { + this.rawClient.deleteExternalUser(externalUserId).body(); + } + + public void deleteExternalUser(String externalUserId, RequestOptions requestOptions) { + this.rawClient.deleteExternalUser(externalUserId, requestOptions).body(); + } +} diff --git a/src/main/java/com/pipedream/api/types/Account.java b/src/main/java/com/pipedream/api/types/Account.java new file mode 100644 index 0000000..30c5157 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/Account.java @@ -0,0 +1,485 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Account.Builder.class) +public final class Account { + private final Optional id; + + private final Optional name; + + private final Optional externalId; + + private final Optional healthy; + + private final Optional dead; + + private final Optional app; + + private final Optional createdAt; + + private final Optional updatedAt; + + private final Optional> credentials; + + private final Optional expiresAt; + + private final Optional error; + + private final Optional lastRefreshedAt; + + private final Optional nextRefreshAt; + + private final Map additionalProperties; + + private Account( + Optional id, + Optional name, + Optional externalId, + Optional healthy, + Optional dead, + Optional app, + Optional createdAt, + Optional updatedAt, + Optional> credentials, + Optional expiresAt, + Optional error, + Optional lastRefreshedAt, + Optional nextRefreshAt, + Map additionalProperties) { + this.id = id; + this.name = name; + this.externalId = externalId; + this.healthy = healthy; + this.dead = dead; + this.app = app; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.credentials = credentials; + this.expiresAt = expiresAt; + this.error = error; + this.lastRefreshedAt = lastRefreshedAt; + this.nextRefreshAt = nextRefreshAt; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique ID of the account. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The custom name of the account if set. + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return The external ID associated with the account. + */ + @JsonProperty("external_id") + public Optional getExternalId() { + return externalId; + } + + /** + * @return Indicates if the account is healthy. Pipedream will periodically retry token refresh and test requests for unhealthy accounts + */ + @JsonProperty("healthy") + public Optional getHealthy() { + return healthy; + } + + /** + * @return Indicates if the account is no longer active + */ + @JsonProperty("dead") + public Optional getDead() { + return dead; + } + + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return The date and time the account was created, an ISO 8601 formatted string + */ + @JsonProperty("created_at") + public Optional getCreatedAt() { + return createdAt; + } + + /** + * @return The date and time the account was last updated, an ISO 8601 formatted string + */ + @JsonProperty("updated_at") + public Optional getUpdatedAt() { + return updatedAt; + } + + /** + * @return The credentials associated with the account, if the include_credentials parameter was set to true in the request + */ + @JsonProperty("credentials") + public Optional> getCredentials() { + return credentials; + } + + /** + * @return The date and time the account's credentials expiration, an ISO 8601 formatted string + */ + @JsonProperty("expires_at") + public Optional getExpiresAt() { + return expiresAt; + } + + /** + * @return The error message if the account is unhealthy or dead, null otherwise + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return The date and time the account was last refreshed, an ISO 8601 formatted string + */ + @JsonProperty("last_refreshed_at") + public Optional getLastRefreshedAt() { + return lastRefreshedAt; + } + + /** + * @return The date and time the account will next be refreshed, an ISO 8601 formatted string + */ + @JsonProperty("next_refresh_at") + public Optional getNextRefreshAt() { + return nextRefreshAt; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Account && equalTo((Account) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Account other) { + return id.equals(other.id) + && name.equals(other.name) + && externalId.equals(other.externalId) + && healthy.equals(other.healthy) + && dead.equals(other.dead) + && app.equals(other.app) + && createdAt.equals(other.createdAt) + && updatedAt.equals(other.updatedAt) + && credentials.equals(other.credentials) + && expiresAt.equals(other.expiresAt) + && error.equals(other.error) + && lastRefreshedAt.equals(other.lastRefreshedAt) + && nextRefreshAt.equals(other.nextRefreshAt); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.name, + this.externalId, + this.healthy, + this.dead, + this.app, + this.createdAt, + this.updatedAt, + this.credentials, + this.expiresAt, + this.error, + this.lastRefreshedAt, + this.nextRefreshAt); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional externalId = Optional.empty(); + + private Optional healthy = Optional.empty(); + + private Optional dead = Optional.empty(); + + private Optional app = Optional.empty(); + + private Optional createdAt = Optional.empty(); + + private Optional updatedAt = Optional.empty(); + + private Optional> credentials = Optional.empty(); + + private Optional expiresAt = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional lastRefreshedAt = Optional.empty(); + + private Optional nextRefreshAt = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(Account other) { + id(other.getId()); + name(other.getName()); + externalId(other.getExternalId()); + healthy(other.getHealthy()); + dead(other.getDead()); + app(other.getApp()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + credentials(other.getCredentials()); + expiresAt(other.getExpiresAt()); + error(other.getError()); + lastRefreshedAt(other.getLastRefreshedAt()); + nextRefreshAt(other.getNextRefreshAt()); + return this; + } + + /** + *

    The unique ID of the account.

    + */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

    The custom name of the account if set.

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    The external ID associated with the account.

    + */ + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public Builder externalId(Optional externalId) { + this.externalId = externalId; + return this; + } + + public Builder externalId(String externalId) { + this.externalId = Optional.ofNullable(externalId); + return this; + } + + /** + *

    Indicates if the account is healthy. Pipedream will periodically retry token refresh and test requests for unhealthy accounts

    + */ + @JsonSetter(value = "healthy", nulls = Nulls.SKIP) + public Builder healthy(Optional healthy) { + this.healthy = healthy; + return this; + } + + public Builder healthy(Boolean healthy) { + this.healthy = Optional.ofNullable(healthy); + return this; + } + + /** + *

    Indicates if the account is no longer active

    + */ + @JsonSetter(value = "dead", nulls = Nulls.SKIP) + public Builder dead(Optional dead) { + this.dead = dead; + return this; + } + + public Builder dead(Boolean dead) { + this.dead = Optional.ofNullable(dead); + return this; + } + + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(App app) { + this.app = Optional.ofNullable(app); + return this; + } + + /** + *

    The date and time the account was created, an ISO 8601 formatted string

    + */ + @JsonSetter(value = "created_at", nulls = Nulls.SKIP) + public Builder createdAt(Optional createdAt) { + this.createdAt = createdAt; + return this; + } + + public Builder createdAt(OffsetDateTime createdAt) { + this.createdAt = Optional.ofNullable(createdAt); + return this; + } + + /** + *

    The date and time the account was last updated, an ISO 8601 formatted string

    + */ + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public Builder updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public Builder updatedAt(OffsetDateTime updatedAt) { + this.updatedAt = Optional.ofNullable(updatedAt); + return this; + } + + /** + *

    The credentials associated with the account, if the include_credentials parameter was set to true in the request

    + */ + @JsonSetter(value = "credentials", nulls = Nulls.SKIP) + public Builder credentials(Optional> credentials) { + this.credentials = credentials; + return this; + } + + public Builder credentials(Map credentials) { + this.credentials = Optional.ofNullable(credentials); + return this; + } + + /** + *

    The date and time the account's credentials expiration, an ISO 8601 formatted string

    + */ + @JsonSetter(value = "expires_at", nulls = Nulls.SKIP) + public Builder expiresAt(Optional expiresAt) { + this.expiresAt = expiresAt; + return this; + } + + public Builder expiresAt(OffsetDateTime expiresAt) { + this.expiresAt = Optional.ofNullable(expiresAt); + return this; + } + + /** + *

    The error message if the account is unhealthy or dead, null otherwise

    + */ + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public Builder error(Optional error) { + this.error = error; + return this; + } + + public Builder error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

    The date and time the account was last refreshed, an ISO 8601 formatted string

    + */ + @JsonSetter(value = "last_refreshed_at", nulls = Nulls.SKIP) + public Builder lastRefreshedAt(Optional lastRefreshedAt) { + this.lastRefreshedAt = lastRefreshedAt; + return this; + } + + public Builder lastRefreshedAt(OffsetDateTime lastRefreshedAt) { + this.lastRefreshedAt = Optional.ofNullable(lastRefreshedAt); + return this; + } + + /** + *

    The date and time the account will next be refreshed, an ISO 8601 formatted string

    + */ + @JsonSetter(value = "next_refresh_at", nulls = Nulls.SKIP) + public Builder nextRefreshAt(Optional nextRefreshAt) { + this.nextRefreshAt = nextRefreshAt; + return this; + } + + public Builder nextRefreshAt(OffsetDateTime nextRefreshAt) { + this.nextRefreshAt = Optional.ofNullable(nextRefreshAt); + return this; + } + + public Account build() { + return new Account( + id, + name, + externalId, + healthy, + dead, + app, + createdAt, + updatedAt, + credentials, + expiresAt, + error, + lastRefreshedAt, + nextRefreshAt, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/App.java b/src/main/java/com/pipedream/api/types/App.java new file mode 100644 index 0000000..2983820 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/App.java @@ -0,0 +1,472 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = App.Builder.class) +public final class App { + private final Optional id; + + private final String nameSlug; + + private final String name; + + private final Optional authType; + + private final Optional description; + + private final String imgSrc; + + private final Optional customFieldsJson; + + private final List categories; + + private final double featuredWeight; + + private final Map additionalProperties; + + private App( + Optional id, + String nameSlug, + String name, + Optional authType, + Optional description, + String imgSrc, + Optional customFieldsJson, + List categories, + double featuredWeight, + Map additionalProperties) { + this.id = id; + this.nameSlug = nameSlug; + this.name = name; + this.authType = authType; + this.description = description; + this.imgSrc = imgSrc; + this.customFieldsJson = customFieldsJson; + this.categories = categories; + this.featuredWeight = featuredWeight; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app. Only applies for OAuth apps. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug) + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + /** + * @return The human-readable name of the app + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The authentication type used by the app + */ + @JsonProperty("auth_type") + public Optional getAuthType() { + return authType; + } + + /** + * @return A short description of the app + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The URL to the app's logo + */ + @JsonProperty("img_src") + public String getImgSrc() { + return imgSrc; + } + + /** + * @return A JSON string representing the custom fields for the app + */ + @JsonProperty("custom_fields_json") + public Optional getCustomFieldsJson() { + return customFieldsJson; + } + + /** + * @return Categories associated with the app + */ + @JsonProperty("categories") + public List getCategories() { + return categories; + } + + /** + * @return A rough directional ordering of app popularity, subject to changes by Pipedream + */ + @JsonProperty("featured_weight") + public double getFeaturedWeight() { + return featuredWeight; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof App && equalTo((App) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(App other) { + return id.equals(other.id) + && nameSlug.equals(other.nameSlug) + && name.equals(other.name) + && authType.equals(other.authType) + && description.equals(other.description) + && imgSrc.equals(other.imgSrc) + && customFieldsJson.equals(other.customFieldsJson) + && categories.equals(other.categories) + && featuredWeight == other.featuredWeight; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.nameSlug, + this.name, + this.authType, + this.description, + this.imgSrc, + this.customFieldsJson, + this.categories, + this.featuredWeight); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameSlugStage builder() { + return new Builder(); + } + + public interface NameSlugStage { + /** + *

    The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

    + */ + NameStage nameSlug(@NotNull String nameSlug); + + Builder from(App other); + } + + public interface NameStage { + /** + *

    The human-readable name of the app

    + */ + ImgSrcStage name(@NotNull String name); + } + + public interface ImgSrcStage { + /** + *

    The URL to the app's logo

    + */ + FeaturedWeightStage imgSrc(@NotNull String imgSrc); + } + + public interface FeaturedWeightStage { + /** + *

    A rough directional ordering of app popularity, subject to changes by Pipedream

    + */ + _FinalStage featuredWeight(double featuredWeight); + } + + public interface _FinalStage { + App build(); + + /** + *

    ID of the app. Only applies for OAuth apps.

    + */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + + /** + *

    The authentication type used by the app

    + */ + _FinalStage authType(Optional authType); + + _FinalStage authType(AppAuthType authType); + + /** + *

    A short description of the app

    + */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

    A JSON string representing the custom fields for the app

    + */ + _FinalStage customFieldsJson(Optional customFieldsJson); + + _FinalStage customFieldsJson(String customFieldsJson); + + /** + *

    Categories associated with the app

    + */ + _FinalStage categories(List categories); + + _FinalStage addCategories(String categories); + + _FinalStage addAllCategories(List categories); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements NameSlugStage, NameStage, ImgSrcStage, FeaturedWeightStage, _FinalStage { + private String nameSlug; + + private String name; + + private String imgSrc; + + private double featuredWeight; + + private List categories = new ArrayList<>(); + + private Optional customFieldsJson = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional authType = Optional.empty(); + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(App other) { + id(other.getId()); + nameSlug(other.getNameSlug()); + name(other.getName()); + authType(other.getAuthType()); + description(other.getDescription()); + imgSrc(other.getImgSrc()); + customFieldsJson(other.getCustomFieldsJson()); + categories(other.getCategories()); + featuredWeight(other.getFeaturedWeight()); + return this; + } + + /** + *

    The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

    + *

    The name slug of the target app (see https://pipedream.com/docs/connect/quickstart#find-your-apps-name-slug)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name_slug") + public NameStage nameSlug(@NotNull String nameSlug) { + this.nameSlug = Objects.requireNonNull(nameSlug, "nameSlug must not be null"); + return this; + } + + /** + *

    The human-readable name of the app

    + *

    The human-readable name of the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public ImgSrcStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

    The URL to the app's logo

    + *

    The URL to the app's logo

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("img_src") + public FeaturedWeightStage imgSrc(@NotNull String imgSrc) { + this.imgSrc = Objects.requireNonNull(imgSrc, "imgSrc must not be null"); + return this; + } + + /** + *

    A rough directional ordering of app popularity, subject to changes by Pipedream

    + *

    A rough directional ordering of app popularity, subject to changes by Pipedream

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("featured_weight") + public _FinalStage featuredWeight(double featuredWeight) { + this.featuredWeight = featuredWeight; + return this; + } + + /** + *

    Categories associated with the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllCategories(List categories) { + this.categories.addAll(categories); + return this; + } + + /** + *

    Categories associated with the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addCategories(String categories) { + this.categories.add(categories); + return this; + } + + /** + *

    Categories associated with the app

    + */ + @java.lang.Override + @JsonSetter(value = "categories", nulls = Nulls.SKIP) + public _FinalStage categories(List categories) { + this.categories.clear(); + this.categories.addAll(categories); + return this; + } + + /** + *

    A JSON string representing the custom fields for the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customFieldsJson(String customFieldsJson) { + this.customFieldsJson = Optional.ofNullable(customFieldsJson); + return this; + } + + /** + *

    A JSON string representing the custom fields for the app

    + */ + @java.lang.Override + @JsonSetter(value = "custom_fields_json", nulls = Nulls.SKIP) + public _FinalStage customFieldsJson(Optional customFieldsJson) { + this.customFieldsJson = customFieldsJson; + return this; + } + + /** + *

    A short description of the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    A short description of the app

    + */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + /** + *

    The authentication type used by the app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage authType(AppAuthType authType) { + this.authType = Optional.ofNullable(authType); + return this; + } + + /** + *

    The authentication type used by the app

    + */ + @java.lang.Override + @JsonSetter(value = "auth_type", nulls = Nulls.SKIP) + public _FinalStage authType(Optional authType) { + this.authType = authType; + return this; + } + + /** + *

    ID of the app. Only applies for OAuth apps.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

    ID of the app. Only applies for OAuth apps.

    + */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public App build() { + return new App( + id, + nameSlug, + name, + authType, + description, + imgSrc, + customFieldsJson, + categories, + featuredWeight, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/AppAuthType.java b/src/main/java/com/pipedream/api/types/AppAuthType.java new file mode 100644 index 0000000..e795709 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/AppAuthType.java @@ -0,0 +1,26 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum AppAuthType { + KEYS("keys"), + + OAUTH("oauth"), + + NONE("none"); + + private final String value; + + AppAuthType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/types/AppCategory.java b/src/main/java/com/pipedream/api/types/AppCategory.java new file mode 100644 index 0000000..12799ff --- /dev/null +++ b/src/main/java/com/pipedream/api/types/AppCategory.java @@ -0,0 +1,161 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = AppCategory.Builder.class) +public final class AppCategory { + private final Optional id; + + private final Optional name; + + private final Optional description; + + private final Map additionalProperties; + + private AppCategory( + Optional id, + Optional name, + Optional description, + Map additionalProperties) { + this.id = id; + this.name = name; + this.description = description; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app category + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The human-readable name of the app category + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return A short description of the app category + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof AppCategory && equalTo((AppCategory) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(AppCategory other) { + return id.equals(other.id) && name.equals(other.name) && description.equals(other.description); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.name, this.description); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional id = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional description = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(AppCategory other) { + id(other.getId()); + name(other.getName()); + description(other.getDescription()); + return this; + } + + /** + *

    ID of the app category

    + */ + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public Builder id(Optional id) { + this.id = id; + return this; + } + + public Builder id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

    The human-readable name of the app category

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    A short description of the app category

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + public AppCategory build() { + return new AppCategory(id, name, description, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/BackendClientOpts.java b/src/main/java/com/pipedream/api/types/BackendClientOpts.java new file mode 100644 index 0000000..cdf9287 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/BackendClientOpts.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = BackendClientOpts.Builder.class) +public final class BackendClientOpts { + private final Optional clientId; + + private final Optional clientSecret; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private BackendClientOpts( + Optional clientId, + Optional clientSecret, + Optional apiUrl, + Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The client ID for authentication + */ + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + /** + * @return The client secret for authentication + */ + @JsonProperty("client_secret") + public Optional getClientSecret() { + return clientSecret; + } + + /** + * @return The API URL to use + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof BackendClientOpts && equalTo((BackendClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(BackendClientOpts other) { + return clientId.equals(other.clientId) + && clientSecret.equals(other.clientSecret) + && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional clientId = Optional.empty(); + + private Optional clientSecret = Optional.empty(); + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(BackendClientOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

    The client ID for authentication

    + */ + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(String clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + /** + *

    The client secret for authentication

    + */ + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public Builder clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public Builder clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

    The API URL to use

    + */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public BackendClientOpts build() { + return new BackendClientOpts(clientId, clientSecret, apiUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ClientOpts.java b/src/main/java/com/pipedream/api/types/ClientOpts.java new file mode 100644 index 0000000..70aa6e6 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ClientOpts.java @@ -0,0 +1,163 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ClientOpts.Builder.class) +public final class ClientOpts { + private final Optional clientId; + + private final Optional clientSecret; + + private final Optional apiUrl; + + private final Map additionalProperties; + + private ClientOpts( + Optional clientId, + Optional clientSecret, + Optional apiUrl, + Map additionalProperties) { + this.clientId = clientId; + this.clientSecret = clientSecret; + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The client ID for authentication + */ + @JsonProperty("client_id") + public Optional getClientId() { + return clientId; + } + + /** + * @return The client secret for authentication + */ + @JsonProperty("client_secret") + public Optional getClientSecret() { + return clientSecret; + } + + /** + * @return The API URL to use (defaults to https://api.pipedream.com/) + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ClientOpts && equalTo((ClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ClientOpts other) { + return clientId.equals(other.clientId) + && clientSecret.equals(other.clientSecret) + && apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.clientId, this.clientSecret, this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional clientId = Optional.empty(); + + private Optional clientSecret = Optional.empty(); + + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ClientOpts other) { + clientId(other.getClientId()); + clientSecret(other.getClientSecret()); + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

    The client ID for authentication

    + */ + @JsonSetter(value = "client_id", nulls = Nulls.SKIP) + public Builder clientId(Optional clientId) { + this.clientId = clientId; + return this; + } + + public Builder clientId(String clientId) { + this.clientId = Optional.ofNullable(clientId); + return this; + } + + /** + *

    The client secret for authentication

    + */ + @JsonSetter(value = "client_secret", nulls = Nulls.SKIP) + public Builder clientSecret(Optional clientSecret) { + this.clientSecret = clientSecret; + return this; + } + + public Builder clientSecret(String clientSecret) { + this.clientSecret = Optional.ofNullable(clientSecret); + return this; + } + + /** + *

    The API URL to use (defaults to https://api.pipedream.com/)

    + */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public ClientOpts build() { + return new ClientOpts(clientId, clientSecret, apiUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/Component.java b/src/main/java/com/pipedream/api/types/Component.java new file mode 100644 index 0000000..95cbe86 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/Component.java @@ -0,0 +1,365 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = Component.Builder.class) +public final class Component { + private final String key; + + private final String name; + + private final String version; + + private final List configurableProps; + + private final Optional description; + + private final Optional componentType; + + private final Optional stash; + + private final Map additionalProperties; + + private Component( + String key, + String name, + String version, + List configurableProps, + Optional description, + Optional componentType, + Optional stash, + Map additionalProperties) { + this.key = key; + this.name = name; + this.version = version; + this.configurableProps = configurableProps; + this.description = description; + this.componentType = componentType; + this.stash = stash; + this.additionalProperties = additionalProperties; + } + + /** + * @return The key that uniquely identifies the component. + */ + @JsonProperty("key") + public String getKey() { + return key; + } + + /** + * @return The human-readable name of the component, e.g. 'GitLab: List Commits' + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The latest version of the component, in SemVer format. + */ + @JsonProperty("version") + public String getVersion() { + return version; + } + + @JsonProperty("configurable_props") + public List getConfigurableProps() { + return configurableProps; + } + + /** + * @return A description of the component + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return The type of component (trigger or action) + */ + @JsonProperty("component_type") + public Optional getComponentType() { + return componentType; + } + + /** + * @return Indicates if a File Stash ID is optional or required to run the component + */ + @JsonProperty("stash") + public Optional getStash() { + return stash; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof Component && equalTo((Component) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(Component other) { + return key.equals(other.key) + && name.equals(other.name) + && version.equals(other.version) + && configurableProps.equals(other.configurableProps) + && description.equals(other.description) + && componentType.equals(other.componentType) + && stash.equals(other.stash); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.key, + this.name, + this.version, + this.configurableProps, + this.description, + this.componentType, + this.stash); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KeyStage builder() { + return new Builder(); + } + + public interface KeyStage { + /** + *

    The key that uniquely identifies the component.

    + */ + NameStage key(@NotNull String key); + + Builder from(Component other); + } + + public interface NameStage { + /** + *

    The human-readable name of the component, e.g. 'GitLab: List Commits'

    + */ + VersionStage name(@NotNull String name); + } + + public interface VersionStage { + /** + *

    The latest version of the component, in SemVer format.

    + */ + _FinalStage version(@NotNull String version); + } + + public interface _FinalStage { + Component build(); + + _FinalStage configurableProps(List configurableProps); + + _FinalStage addConfigurableProps(ConfigurableProp configurableProps); + + _FinalStage addAllConfigurableProps(List configurableProps); + + /** + *

    A description of the component

    + */ + _FinalStage description(Optional description); + + _FinalStage description(String description); + + /** + *

    The type of component (trigger or action)

    + */ + _FinalStage componentType(Optional componentType); + + _FinalStage componentType(String componentType); + + /** + *

    Indicates if a File Stash ID is optional or required to run the component

    + */ + _FinalStage stash(Optional stash); + + _FinalStage stash(ComponentStash stash); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KeyStage, NameStage, VersionStage, _FinalStage { + private String key; + + private String name; + + private String version; + + private Optional stash = Optional.empty(); + + private Optional componentType = Optional.empty(); + + private Optional description = Optional.empty(); + + private List configurableProps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(Component other) { + key(other.getKey()); + name(other.getName()); + version(other.getVersion()); + configurableProps(other.getConfigurableProps()); + description(other.getDescription()); + componentType(other.getComponentType()); + stash(other.getStash()); + return this; + } + + /** + *

    The key that uniquely identifies the component.

    + *

    The key that uniquely identifies the component.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("key") + public NameStage key(@NotNull String key) { + this.key = Objects.requireNonNull(key, "key must not be null"); + return this; + } + + /** + *

    The human-readable name of the component, e.g. 'GitLab: List Commits'

    + *

    The human-readable name of the component, e.g. 'GitLab: List Commits'

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public VersionStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

    The latest version of the component, in SemVer format.

    + *

    The latest version of the component, in SemVer format.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("version") + public _FinalStage version(@NotNull String version) { + this.version = Objects.requireNonNull(version, "version must not be null"); + return this; + } + + /** + *

    Indicates if a File Stash ID is optional or required to run the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage stash(ComponentStash stash) { + this.stash = Optional.ofNullable(stash); + return this; + } + + /** + *

    Indicates if a File Stash ID is optional or required to run the component

    + */ + @java.lang.Override + @JsonSetter(value = "stash", nulls = Nulls.SKIP) + public _FinalStage stash(Optional stash) { + this.stash = stash; + return this; + } + + /** + *

    The type of component (trigger or action)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage componentType(String componentType) { + this.componentType = Optional.ofNullable(componentType); + return this; + } + + /** + *

    The type of component (trigger or action)

    + */ + @java.lang.Override + @JsonSetter(value = "component_type", nulls = Nulls.SKIP) + public _FinalStage componentType(Optional componentType) { + this.componentType = componentType; + return this; + } + + /** + *

    A description of the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    A description of the component

    + */ + @java.lang.Override + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public _FinalStage description(Optional description) { + this.description = description; + return this; + } + + @java.lang.Override + public _FinalStage addAllConfigurableProps(List configurableProps) { + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public _FinalStage addConfigurableProps(ConfigurableProp configurableProps) { + this.configurableProps.add(configurableProps); + return this; + } + + @java.lang.Override + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public _FinalStage configurableProps(List configurableProps) { + this.configurableProps.clear(); + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public Component build() { + return new Component( + key, name, version, configurableProps, description, componentType, stash, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ComponentStash.java b/src/main/java/com/pipedream/api/types/ComponentStash.java new file mode 100644 index 0000000..ffbda73 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ComponentStash.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ComponentStash { + OPTIONAL("optional"), + + REQUIRED("required"); + + private final String value; + + ComponentStash(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurableProp.java b/src/main/java/com/pipedream/api/types/ConfigurableProp.java new file mode 100644 index 0000000..9b27278 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurableProp.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurableProp.Builder.class) +public final class ConfigurableProp { + private final Optional name; + + private final Optional type; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurableProp( + Optional name, + Optional type, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.name = name; + this.type = type; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurableProp && equalTo((ConfigurableProp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurableProp other) { + return name.equals(other.name) + && type.equals(other.type) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.name, + this.type, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional name = Optional.empty(); + + private Optional type = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurableProp other) { + name(other.getName()); + type(other.getType()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurableProp build() { + return new ConfigurableProp( + name, + type, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java new file mode 100644 index 0000000..782303c --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAlert.java @@ -0,0 +1,484 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropAlert.Builder.class) +public final class ConfigurablePropAlert { + private final Optional type; + + private final Optional alertType; + + private final Optional content; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropAlert( + Optional type, + Optional alertType, + Optional content, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.alertType = alertType; + this.content = content; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return The severity level of the alert. + */ + @JsonProperty("alertType") + public Optional getAlertType() { + return alertType; + } + + /** + * @return The content of the alert, which can include HTML or plain text. + */ + @JsonProperty("content") + public Optional getContent() { + return content; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropAlert && equalTo((ConfigurablePropAlert) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropAlert other) { + return type.equals(other.type) + && alertType.equals(other.alertType) + && content.equals(other.content) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.alertType, + this.content, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional alertType = Optional.empty(); + + private Optional content = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropAlert other) { + type(other.getType()); + alertType(other.getAlertType()); + content(other.getContent()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    The severity level of the alert.

    + */ + @JsonSetter(value = "alertType", nulls = Nulls.SKIP) + public Builder alertType(Optional alertType) { + this.alertType = alertType; + return this; + } + + public Builder alertType(ConfigurablePropAlertAlertType alertType) { + this.alertType = Optional.ofNullable(alertType); + return this; + } + + /** + *

    The content of the alert, which can include HTML or plain text.

    + */ + @JsonSetter(value = "content", nulls = Nulls.SKIP) + public Builder content(Optional content) { + this.content = content; + return this; + } + + public Builder content(String content) { + this.content = Optional.ofNullable(content); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropAlert build() { + return new ConfigurablePropAlert( + type, + alertType, + content, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java new file mode 100644 index 0000000..539ca52 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAlertAlertType.java @@ -0,0 +1,28 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ConfigurablePropAlertAlertType { + INFO("info"), + + NEUTRAL("neutral"), + + WARNING("warning"), + + ERROR("error"); + + private final String value; + + ConfigurablePropAlertAlertType(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java b/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java new file mode 100644 index 0000000..87824c9 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropAny.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropAny.Builder.class) +public final class ConfigurablePropAny { + private final Optional type; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropAny( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropAny && equalTo((ConfigurablePropAny) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropAny other) { + return type.equals(other.type) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropAny other) { + type(other.getType()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropAny build() { + return new ConfigurablePropAny( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java b/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java new file mode 100644 index 0000000..f6e4246 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropApp.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropApp.Builder.class) +public final class ConfigurablePropApp { + private final Optional type; + + private final Optional app; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropApp( + Optional type, + Optional app, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.app = app; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured. + */ + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropApp && equalTo((ConfigurablePropApp) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropApp other) { + return type.equals(other.type) + && app.equals(other.app) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.app, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional app = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropApp other) { + type(other.getType()); + app(other.getApp()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    The name slug of the app, e.g. 'github', 'slack', etc. This is used to identify the app for which the account is being configured.

    + */ + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public Builder app(Optional app) { + this.app = app; + return this; + } + + public Builder app(String app) { + this.app = Optional.ofNullable(app); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropApp build() { + return new ConfigurablePropApp( + type, + app, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java b/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java new file mode 100644 index 0000000..ad596d0 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropBoolean.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropBoolean.Builder.class) +public final class ConfigurablePropBoolean { + private final Optional type; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropBoolean( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropBoolean && equalTo((ConfigurablePropBoolean) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropBoolean other) { + return type.equals(other.type) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropBoolean other) { + type(other.getType()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropBoolean build() { + return new ConfigurablePropBoolean( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java b/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java new file mode 100644 index 0000000..91fffbf --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropDiscord.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropDiscord.Builder.class) +public final class ConfigurablePropDiscord { + private final Optional type; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropDiscord( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropDiscord && equalTo((ConfigurablePropDiscord) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropDiscord other) { + return type.equals(other.type) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropDiscord other) { + type(other.getType()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropDiscord build() { + return new ConfigurablePropDiscord( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java b/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java new file mode 100644 index 0000000..ddbdf76 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropInteger.java @@ -0,0 +1,484 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropInteger.Builder.class) +public final class ConfigurablePropInteger { + private final Optional type; + + private final Optional min; + + private final Optional max; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropInteger( + Optional type, + Optional min, + Optional max, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.min = min; + this.max = max; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return The minimum value for this integer prop. + */ + @JsonProperty("min") + public Optional getMin() { + return min; + } + + /** + * @return The maximum value for this integer prop. + */ + @JsonProperty("max") + public Optional getMax() { + return max; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropInteger && equalTo((ConfigurablePropInteger) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropInteger other) { + return type.equals(other.type) + && min.equals(other.min) + && max.equals(other.max) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.min, + this.max, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional min = Optional.empty(); + + private Optional max = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropInteger other) { + type(other.getType()); + min(other.getMin()); + max(other.getMax()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    The minimum value for this integer prop.

    + */ + @JsonSetter(value = "min", nulls = Nulls.SKIP) + public Builder min(Optional min) { + this.min = min; + return this; + } + + public Builder min(Integer min) { + this.min = Optional.ofNullable(min); + return this; + } + + /** + *

    The maximum value for this integer prop.

    + */ + @JsonSetter(value = "max", nulls = Nulls.SKIP) + public Builder max(Optional max) { + this.max = max; + return this; + } + + public Builder max(Integer max) { + this.max = Optional.ofNullable(max); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropInteger build() { + return new ConfigurablePropInteger( + type, + min, + max, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java b/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java new file mode 100644 index 0000000..0cd6fa0 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropObject.java @@ -0,0 +1,420 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropObject.Builder.class) +public final class ConfigurablePropObject { + private final Optional type; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropObject( + Optional type, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropObject && equalTo((ConfigurablePropObject) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropObject other) { + return type.equals(other.type) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropObject other) { + type(other.getType()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropObject build() { + return new ConfigurablePropObject( + type, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropString.java b/src/main/java/com/pipedream/api/types/ConfigurablePropString.java new file mode 100644 index 0000000..c85dcf4 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropString.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropString.Builder.class) +public final class ConfigurablePropString { + private final Optional type; + + private final Optional secret; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropString( + Optional type, + Optional secret, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.secret = secret; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return If true, this prop is a secret and should not be displayed in plain text. + */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropString && equalTo((ConfigurablePropString) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropString other) { + return type.equals(other.type) + && secret.equals(other.secret) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.secret, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional secret = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropString other) { + type(other.getType()); + secret(other.getSecret()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    If true, this prop is a secret and should not be displayed in plain text.

    + */ + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public Builder secret(Optional secret) { + this.secret = secret; + return this; + } + + public Builder secret(Boolean secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropString build() { + return new ConfigurablePropString( + type, + secret, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java b/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java new file mode 100644 index 0000000..664fc6a --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurablePropStringArray.java @@ -0,0 +1,452 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurablePropStringArray.Builder.class) +public final class ConfigurablePropStringArray { + private final Optional type; + + private final Optional secret; + + private final Optional name; + + private final Optional label; + + private final Optional description; + + private final Optional optional; + + private final Optional disabled; + + private final Optional hidden; + + private final Optional remoteOptions; + + private final Optional useQuery; + + private final Optional reloadProps; + + private final Optional withLabel; + + private final Map additionalProperties; + + private ConfigurablePropStringArray( + Optional type, + Optional secret, + Optional name, + Optional label, + Optional description, + Optional optional, + Optional disabled, + Optional hidden, + Optional remoteOptions, + Optional useQuery, + Optional reloadProps, + Optional withLabel, + Map additionalProperties) { + this.type = type; + this.secret = secret; + this.name = name; + this.label = label; + this.description = description; + this.optional = optional; + this.disabled = disabled; + this.hidden = hidden; + this.remoteOptions = remoteOptions; + this.useQuery = useQuery; + this.reloadProps = reloadProps; + this.withLabel = withLabel; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("type") + public Optional getType() { + return type; + } + + /** + * @return If true, this prop is a secret and should not be displayed in plain text. + */ + @JsonProperty("secret") + public Optional getSecret() { + return secret; + } + + /** + * @return When building configuredProps, make sure to use this field as the key when setting the prop value + */ + @JsonProperty("name") + public Optional getName() { + return name; + } + + /** + * @return Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead. + */ + @JsonProperty("label") + public Optional getLabel() { + return label; + } + + /** + * @return A description of the prop, shown to the user when configuring the component. + */ + @JsonProperty("description") + public Optional getDescription() { + return description; + } + + /** + * @return If true, this prop does not need to be specified. + */ + @JsonProperty("optional") + public Optional getOptional() { + return optional; + } + + /** + * @return If true, this prop will be ignored. + */ + @JsonProperty("disabled") + public Optional getDisabled() { + return disabled; + } + + /** + * @return If true, should not expose this prop to the user + */ + @JsonProperty("hidden") + public Optional getHidden() { + return hidden; + } + + /** + * @return If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options + */ + @JsonProperty("remoteOptions") + public Optional getRemoteOptions() { + return remoteOptions; + } + + /** + * @return If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options + */ + @JsonProperty("useQuery") + public Optional getUseQuery() { + return useQuery; + } + + /** + * @return If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one + */ + @JsonProperty("reloadProps") + public Optional getReloadProps() { + return reloadProps; + } + + /** + * @return If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label + */ + @JsonProperty("withLabel") + public Optional getWithLabel() { + return withLabel; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurablePropStringArray && equalTo((ConfigurablePropStringArray) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurablePropStringArray other) { + return type.equals(other.type) + && secret.equals(other.secret) + && name.equals(other.name) + && label.equals(other.label) + && description.equals(other.description) + && optional.equals(other.optional) + && disabled.equals(other.disabled) + && hidden.equals(other.hidden) + && remoteOptions.equals(other.remoteOptions) + && useQuery.equals(other.useQuery) + && reloadProps.equals(other.reloadProps) + && withLabel.equals(other.withLabel); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.type, + this.secret, + this.name, + this.label, + this.description, + this.optional, + this.disabled, + this.hidden, + this.remoteOptions, + this.useQuery, + this.reloadProps, + this.withLabel); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional type = Optional.empty(); + + private Optional secret = Optional.empty(); + + private Optional name = Optional.empty(); + + private Optional label = Optional.empty(); + + private Optional description = Optional.empty(); + + private Optional optional = Optional.empty(); + + private Optional disabled = Optional.empty(); + + private Optional hidden = Optional.empty(); + + private Optional remoteOptions = Optional.empty(); + + private Optional useQuery = Optional.empty(); + + private Optional reloadProps = Optional.empty(); + + private Optional withLabel = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurablePropStringArray other) { + type(other.getType()); + secret(other.getSecret()); + name(other.getName()); + label(other.getLabel()); + description(other.getDescription()); + optional(other.getOptional()); + disabled(other.getDisabled()); + hidden(other.getHidden()); + remoteOptions(other.getRemoteOptions()); + useQuery(other.getUseQuery()); + reloadProps(other.getReloadProps()); + withLabel(other.getWithLabel()); + return this; + } + + @JsonSetter(value = "type", nulls = Nulls.SKIP) + public Builder type(Optional type) { + this.type = type; + return this; + } + + public Builder type(String type) { + this.type = Optional.ofNullable(type); + return this; + } + + /** + *

    If true, this prop is a secret and should not be displayed in plain text.

    + */ + @JsonSetter(value = "secret", nulls = Nulls.SKIP) + public Builder secret(Optional secret) { + this.secret = secret; + return this; + } + + public Builder secret(Boolean secret) { + this.secret = Optional.ofNullable(secret); + return this; + } + + /** + *

    When building configuredProps, make sure to use this field as the key when setting the prop value

    + */ + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public Builder name(Optional name) { + this.name = name; + return this; + } + + public Builder name(String name) { + this.name = Optional.ofNullable(name); + return this; + } + + /** + *

    Value to use as an input label. In cases where type is "app", should load the app via getApp, etc. and show app.name instead.

    + */ + @JsonSetter(value = "label", nulls = Nulls.SKIP) + public Builder label(Optional label) { + this.label = label; + return this; + } + + public Builder label(String label) { + this.label = Optional.ofNullable(label); + return this; + } + + /** + *

    A description of the prop, shown to the user when configuring the component.

    + */ + @JsonSetter(value = "description", nulls = Nulls.SKIP) + public Builder description(Optional description) { + this.description = description; + return this; + } + + public Builder description(String description) { + this.description = Optional.ofNullable(description); + return this; + } + + /** + *

    If true, this prop does not need to be specified.

    + */ + @JsonSetter(value = "optional", nulls = Nulls.SKIP) + public Builder optional(Optional optional) { + this.optional = optional; + return this; + } + + public Builder optional(Boolean optional) { + this.optional = Optional.ofNullable(optional); + return this; + } + + /** + *

    If true, this prop will be ignored.

    + */ + @JsonSetter(value = "disabled", nulls = Nulls.SKIP) + public Builder disabled(Optional disabled) { + this.disabled = disabled; + return this; + } + + public Builder disabled(Boolean disabled) { + this.disabled = Optional.ofNullable(disabled); + return this; + } + + /** + *

    If true, should not expose this prop to the user

    + */ + @JsonSetter(value = "hidden", nulls = Nulls.SKIP) + public Builder hidden(Optional hidden) { + this.hidden = hidden; + return this; + } + + public Builder hidden(Boolean hidden) { + this.hidden = Optional.ofNullable(hidden); + return this; + } + + /** + *

    If true, call configureComponent for this prop to load remote options. It is safe, and preferred, given a returned list of { label: string; value: any } objects to set the prop value to { __lv: { label: string; value: any } }. This way, on load, you can access label for the value without necessarily reloading these options

    + */ + @JsonSetter(value = "remoteOptions", nulls = Nulls.SKIP) + public Builder remoteOptions(Optional remoteOptions) { + this.remoteOptions = remoteOptions; + return this; + } + + public Builder remoteOptions(Boolean remoteOptions) { + this.remoteOptions = Optional.ofNullable(remoteOptions); + return this; + } + + /** + *

    If true, calls to configureComponent for this prop support receiving a query parameter to filter remote options

    + */ + @JsonSetter(value = "useQuery", nulls = Nulls.SKIP) + public Builder useQuery(Optional useQuery) { + this.useQuery = useQuery; + return this; + } + + public Builder useQuery(Boolean useQuery) { + this.useQuery = Optional.ofNullable(useQuery); + return this; + } + + /** + *

    If true, after setting a value for this prop, a call to reloadComponentProps is required as the component has dynamic configurable props dependent on this one

    + */ + @JsonSetter(value = "reloadProps", nulls = Nulls.SKIP) + public Builder reloadProps(Optional reloadProps) { + this.reloadProps = reloadProps; + return this; + } + + public Builder reloadProps(Boolean reloadProps) { + this.reloadProps = Optional.ofNullable(reloadProps); + return this; + } + + /** + *

    If true, you must save the configured prop value as a "label-value" object which should look like: { __lv: { label: string; value: any } } because the execution needs to access the label

    + */ + @JsonSetter(value = "withLabel", nulls = Nulls.SKIP) + public Builder withLabel(Optional withLabel) { + this.withLabel = withLabel; + return this; + } + + public Builder withLabel(Boolean withLabel) { + this.withLabel = Optional.ofNullable(withLabel); + return this; + } + + public ConfigurablePropStringArray build() { + return new ConfigurablePropStringArray( + type, + secret, + name, + label, + description, + optional, + disabled, + hidden, + remoteOptions, + useQuery, + reloadProps, + withLabel, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java b/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java new file mode 100644 index 0000000..86455a5 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurePropOpts.java @@ -0,0 +1,509 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurePropOpts.Builder.class) +public final class ConfigurePropOpts { + private final String id; + + private final String externalUserId; + + private final String propName; + + private final Optional blocking; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional asyncHandle; + + private final Optional page; + + private final Optional> prevContext; + + private final Optional query; + + private final Map additionalProperties; + + private ConfigurePropOpts( + String id, + String externalUserId, + String propName, + Optional blocking, + Optional> configuredProps, + Optional dynamicPropsId, + Optional asyncHandle, + Optional page, + Optional> prevContext, + Optional query, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.propName = propName; + this.blocking = blocking; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.asyncHandle = asyncHandle; + this.page = page; + this.prevContext = prevContext; + this.query = query; + this.additionalProperties = additionalProperties; + } + + /** + * @return The component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The name of the prop to configure + */ + @JsonProperty("prop_name") + public String getPropName() { + return propName; + } + + /** + * @return Whether this operation should block until completion + */ + @JsonProperty("blocking") + public Optional getBlocking() { + return blocking; + } + + /** + * @return The configured properties for the component + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Handle for async operations + */ + @JsonProperty("async_handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + /** + * @return Page number for paginated results + */ + @JsonProperty("page") + public Optional getPage() { + return page; + } + + /** + * @return Previous context for pagination + */ + @JsonProperty("prev_context") + public Optional> getPrevContext() { + return prevContext; + } + + /** + * @return Search query for filtering options + */ + @JsonProperty("query") + public Optional getQuery() { + return query; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurePropOpts && equalTo((ConfigurePropOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurePropOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && propName.equals(other.propName) + && blocking.equals(other.blocking) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && asyncHandle.equals(other.asyncHandle) + && page.equals(other.page) + && prevContext.equals(other.prevContext) + && query.equals(other.query); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.externalUserId, + this.propName, + this.blocking, + this.configuredProps, + this.dynamicPropsId, + this.asyncHandle, + this.page, + this.prevContext, + this.query); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

    The component ID

    + */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(ConfigurePropOpts other); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID

    + */ + PropNameStage externalUserId(@NotNull String externalUserId); + } + + public interface PropNameStage { + /** + *

    The name of the prop to configure

    + */ + _FinalStage propName(@NotNull String propName); + } + + public interface _FinalStage { + ConfigurePropOpts build(); + + /** + *

    Whether this operation should block until completion

    + */ + _FinalStage blocking(Optional blocking); + + _FinalStage blocking(Boolean blocking); + + /** + *

    The configured properties for the component

    + */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

    The ID for dynamic props

    + */ + _FinalStage dynamicPropsId(Optional dynamicPropsId); + + _FinalStage dynamicPropsId(String dynamicPropsId); + + /** + *

    Handle for async operations

    + */ + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + + /** + *

    Page number for paginated results

    + */ + _FinalStage page(Optional page); + + _FinalStage page(Double page); + + /** + *

    Previous context for pagination

    + */ + _FinalStage prevContext(Optional> prevContext); + + _FinalStage prevContext(Map prevContext); + + /** + *

    Search query for filtering options

    + */ + _FinalStage query(Optional query); + + _FinalStage query(String query); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, PropNameStage, _FinalStage { + private String id; + + private String externalUserId; + + private String propName; + + private Optional query = Optional.empty(); + + private Optional> prevContext = Optional.empty(); + + private Optional page = Optional.empty(); + + private Optional asyncHandle = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional blocking = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConfigurePropOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + propName(other.getPropName()); + blocking(other.getBlocking()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + asyncHandle(other.getAsyncHandle()); + page(other.getPage()); + prevContext(other.getPrevContext()); + query(other.getQuery()); + return this; + } + + /** + *

    The component ID

    + *

    The component ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ExternalUserIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The external user ID

    + *

    The external user ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public PropNameStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The name of the prop to configure

    + *

    The name of the prop to configure

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("prop_name") + public _FinalStage propName(@NotNull String propName) { + this.propName = Objects.requireNonNull(propName, "propName must not be null"); + return this; + } + + /** + *

    Search query for filtering options

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage query(String query) { + this.query = Optional.ofNullable(query); + return this; + } + + /** + *

    Search query for filtering options

    + */ + @java.lang.Override + @JsonSetter(value = "query", nulls = Nulls.SKIP) + public _FinalStage query(Optional query) { + this.query = query; + return this; + } + + /** + *

    Previous context for pagination

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage prevContext(Map prevContext) { + this.prevContext = Optional.ofNullable(prevContext); + return this; + } + + /** + *

    Previous context for pagination

    + */ + @java.lang.Override + @JsonSetter(value = "prev_context", nulls = Nulls.SKIP) + public _FinalStage prevContext(Optional> prevContext) { + this.prevContext = prevContext; + return this; + } + + /** + *

    Page number for paginated results

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage page(Double page) { + this.page = Optional.ofNullable(page); + return this; + } + + /** + *

    Page number for paginated results

    + */ + @java.lang.Override + @JsonSetter(value = "page", nulls = Nulls.SKIP) + public _FinalStage page(Optional page) { + this.page = page; + return this; + } + + /** + *

    Handle for async operations

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + /** + *

    Handle for async operations

    + */ + @java.lang.Override + @JsonSetter(value = "async_handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + /** + *

    The ID for dynamic props

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dynamicPropsId(String dynamicPropsId) { + this.dynamicPropsId = Optional.ofNullable(dynamicPropsId); + return this; + } + + /** + *

    The ID for dynamic props

    + */ + @java.lang.Override + @JsonSetter(value = "dynamic_props_id", nulls = Nulls.SKIP) + public _FinalStage dynamicPropsId(Optional dynamicPropsId) { + this.dynamicPropsId = dynamicPropsId; + return this; + } + + /** + *

    The configured properties for the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps = Optional.ofNullable(configuredProps); + return this; + } + + /** + *

    The configured properties for the component

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + /** + *

    Whether this operation should block until completion

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage blocking(Boolean blocking) { + this.blocking = Optional.ofNullable(blocking); + return this; + } + + /** + *

    Whether this operation should block until completion

    + */ + @java.lang.Override + @JsonSetter(value = "blocking", nulls = Nulls.SKIP) + public _FinalStage blocking(Optional blocking) { + this.blocking = blocking; + return this; + } + + @java.lang.Override + public ConfigurePropOpts build() { + return new ConfigurePropOpts( + id, + externalUserId, + propName, + blocking, + configuredProps, + dynamicPropsId, + asyncHandle, + page, + prevContext, + query, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java b/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java new file mode 100644 index 0000000..6c1a6af --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConfigurePropResponse.java @@ -0,0 +1,133 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConfigurePropResponse.Builder.class) +public final class ConfigurePropResponse { + private final Optional> options; + + private final Optional> errors; + + private final Map additionalProperties; + + private ConfigurePropResponse( + Optional> options, + Optional> errors, + Map additionalProperties) { + this.options = options; + this.errors = errors; + this.additionalProperties = additionalProperties; + } + + /** + * @return Available options for the configured prop + */ + @JsonProperty("options") + public Optional> getOptions() { + return options; + } + + /** + * @return Any errors that occurred during configuration + */ + @JsonProperty("errors") + public Optional> getErrors() { + return errors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConfigurePropResponse && equalTo((ConfigurePropResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConfigurePropResponse other) { + return options.equals(other.options) && errors.equals(other.errors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.options, this.errors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> options = Optional.empty(); + + private Optional> errors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ConfigurePropResponse other) { + options(other.getOptions()); + errors(other.getErrors()); + return this; + } + + /** + *

    Available options for the configured prop

    + */ + @JsonSetter(value = "options", nulls = Nulls.SKIP) + public Builder options(Optional> options) { + this.options = options; + return this; + } + + public Builder options(List options) { + this.options = Optional.ofNullable(options); + return this; + } + + /** + *

    Any errors that occurred during configuration

    + */ + @JsonSetter(value = "errors", nulls = Nulls.SKIP) + public Builder errors(Optional> errors) { + this.errors = errors; + return this; + } + + public Builder errors(List errors) { + this.errors = Optional.ofNullable(errors); + return this; + } + + public ConfigurePropResponse build() { + return new ConfigurePropResponse(options, errors, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java b/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java new file mode 100644 index 0000000..212cb99 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConnectTokenCreateOpts.java @@ -0,0 +1,338 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConnectTokenCreateOpts.Builder.class) +public final class ConnectTokenCreateOpts { + private final String externalUserId; + + private final String projectId; + + private final Optional> allowedOrigins; + + private final Optional errorRedirectUri; + + private final Optional successRedirectUri; + + private final Optional webhookUri; + + private final Map additionalProperties; + + private ConnectTokenCreateOpts( + String externalUserId, + String projectId, + Optional> allowedOrigins, + Optional errorRedirectUri, + Optional successRedirectUri, + Optional webhookUri, + Map additionalProperties) { + this.externalUserId = externalUserId; + this.projectId = projectId; + this.allowedOrigins = allowedOrigins; + this.errorRedirectUri = errorRedirectUri; + this.successRedirectUri = successRedirectUri; + this.webhookUri = webhookUri; + this.additionalProperties = additionalProperties; + } + + /** + * @return Your end user ID, for whom you're creating the token + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return The ID of the project + */ + @JsonProperty("project_id") + public String getProjectId() { + return projectId; + } + + /** + * @return List of allowed origins for CORS + */ + @JsonProperty("allowed_origins") + public Optional> getAllowedOrigins() { + return allowedOrigins; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + /** + * @return Webhook URI for notifications + */ + @JsonProperty("webhook_uri") + public Optional getWebhookUri() { + return webhookUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConnectTokenCreateOpts && equalTo((ConnectTokenCreateOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConnectTokenCreateOpts other) { + return externalUserId.equals(other.externalUserId) + && projectId.equals(other.projectId) + && allowedOrigins.equals(other.allowedOrigins) + && errorRedirectUri.equals(other.errorRedirectUri) + && successRedirectUri.equals(other.successRedirectUri) + && webhookUri.equals(other.webhookUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.externalUserId, + this.projectId, + this.allowedOrigins, + this.errorRedirectUri, + this.successRedirectUri, + this.webhookUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ExternalUserIdStage builder() { + return new Builder(); + } + + public interface ExternalUserIdStage { + /** + *

    Your end user ID, for whom you're creating the token

    + */ + ProjectIdStage externalUserId(@NotNull String externalUserId); + + Builder from(ConnectTokenCreateOpts other); + } + + public interface ProjectIdStage { + /** + *

    The ID of the project

    + */ + _FinalStage projectId(@NotNull String projectId); + } + + public interface _FinalStage { + ConnectTokenCreateOpts build(); + + /** + *

    List of allowed origins for CORS

    + */ + _FinalStage allowedOrigins(Optional> allowedOrigins); + + _FinalStage allowedOrigins(List allowedOrigins); + + /** + *

    URI to redirect to on error

    + */ + _FinalStage errorRedirectUri(Optional errorRedirectUri); + + _FinalStage errorRedirectUri(String errorRedirectUri); + + /** + *

    URI to redirect to on success

    + */ + _FinalStage successRedirectUri(Optional successRedirectUri); + + _FinalStage successRedirectUri(String successRedirectUri); + + /** + *

    Webhook URI for notifications

    + */ + _FinalStage webhookUri(Optional webhookUri); + + _FinalStage webhookUri(String webhookUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ExternalUserIdStage, ProjectIdStage, _FinalStage { + private String externalUserId; + + private String projectId; + + private Optional webhookUri = Optional.empty(); + + private Optional successRedirectUri = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional> allowedOrigins = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConnectTokenCreateOpts other) { + externalUserId(other.getExternalUserId()); + projectId(other.getProjectId()); + allowedOrigins(other.getAllowedOrigins()); + errorRedirectUri(other.getErrorRedirectUri()); + successRedirectUri(other.getSuccessRedirectUri()); + webhookUri(other.getWebhookUri()); + return this; + } + + /** + *

    Your end user ID, for whom you're creating the token

    + *

    Your end user ID, for whom you're creating the token

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public ProjectIdStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    The ID of the project

    + *

    The ID of the project

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("project_id") + public _FinalStage projectId(@NotNull String projectId) { + this.projectId = Objects.requireNonNull(projectId, "projectId must not be null"); + return this; + } + + /** + *

    Webhook URI for notifications

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage webhookUri(String webhookUri) { + this.webhookUri = Optional.ofNullable(webhookUri); + return this; + } + + /** + *

    Webhook URI for notifications

    + */ + @java.lang.Override + @JsonSetter(value = "webhook_uri", nulls = Nulls.SKIP) + public _FinalStage webhookUri(Optional webhookUri) { + this.webhookUri = webhookUri; + return this; + } + + /** + *

    URI to redirect to on success

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage successRedirectUri(String successRedirectUri) { + this.successRedirectUri = Optional.ofNullable(successRedirectUri); + return this; + } + + /** + *

    URI to redirect to on success

    + */ + @java.lang.Override + @JsonSetter(value = "success_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage successRedirectUri(Optional successRedirectUri) { + this.successRedirectUri = successRedirectUri; + return this; + } + + /** + *

    URI to redirect to on error

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorRedirectUri(String errorRedirectUri) { + this.errorRedirectUri = Optional.ofNullable(errorRedirectUri); + return this; + } + + /** + *

    URI to redirect to on error

    + */ + @java.lang.Override + @JsonSetter(value = "error_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage errorRedirectUri(Optional errorRedirectUri) { + this.errorRedirectUri = errorRedirectUri; + return this; + } + + /** + *

    List of allowed origins for CORS

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage allowedOrigins(List allowedOrigins) { + this.allowedOrigins = Optional.ofNullable(allowedOrigins); + return this; + } + + /** + *

    List of allowed origins for CORS

    + */ + @java.lang.Override + @JsonSetter(value = "allowed_origins", nulls = Nulls.SKIP) + public _FinalStage allowedOrigins(Optional> allowedOrigins) { + this.allowedOrigins = allowedOrigins; + return this; + } + + @java.lang.Override + public ConnectTokenCreateOpts build() { + return new ConnectTokenCreateOpts( + externalUserId, + projectId, + allowedOrigins, + errorRedirectUri, + successRedirectUri, + webhookUri, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java b/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java new file mode 100644 index 0000000..76aac12 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ConnectTokenResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ConnectTokenResponse.Builder.class) +public final class ConnectTokenResponse { + private final String connectLinkUrl; + + private final OffsetDateTime expiresAt; + + private final String token; + + private final Map additionalProperties; + + private ConnectTokenResponse( + String connectLinkUrl, OffsetDateTime expiresAt, String token, Map additionalProperties) { + this.connectLinkUrl = connectLinkUrl; + this.expiresAt = expiresAt; + this.token = token; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Connect Link URL + */ + @JsonProperty("connect_link_url") + public String getConnectLinkUrl() { + return connectLinkUrl; + } + + /** + * @return The expiration time of the token in ISO 8601 format + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The generated token + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ConnectTokenResponse && equalTo((ConnectTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ConnectTokenResponse other) { + return connectLinkUrl.equals(other.connectLinkUrl) + && expiresAt.equals(other.expiresAt) + && token.equals(other.token); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.connectLinkUrl, this.expiresAt, this.token); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ConnectLinkUrlStage builder() { + return new Builder(); + } + + public interface ConnectLinkUrlStage { + /** + *

    The Connect Link URL

    + */ + ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl); + + Builder from(ConnectTokenResponse other); + } + + public interface ExpiresAtStage { + /** + *

    The expiration time of the token in ISO 8601 format

    + */ + TokenStage expiresAt(@NotNull OffsetDateTime expiresAt); + } + + public interface TokenStage { + /** + *

    The generated token

    + */ + _FinalStage token(@NotNull String token); + } + + public interface _FinalStage { + ConnectTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ConnectLinkUrlStage, ExpiresAtStage, TokenStage, _FinalStage { + private String connectLinkUrl; + + private OffsetDateTime expiresAt; + + private String token; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ConnectTokenResponse other) { + connectLinkUrl(other.getConnectLinkUrl()); + expiresAt(other.getExpiresAt()); + token(other.getToken()); + return this; + } + + /** + *

    The Connect Link URL

    + *

    The Connect Link URL

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("connect_link_url") + public ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl) { + this.connectLinkUrl = Objects.requireNonNull(connectLinkUrl, "connectLinkUrl must not be null"); + return this; + } + + /** + *

    The expiration time of the token in ISO 8601 format

    + *

    The expiration time of the token in ISO 8601 format

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expires_at") + public TokenStage expiresAt(@NotNull OffsetDateTime expiresAt) { + this.expiresAt = Objects.requireNonNull(expiresAt, "expiresAt must not be null"); + return this; + } + + /** + *

    The generated token

    + *

    The generated token

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("token") + public _FinalStage token(@NotNull String token) { + this.token = Objects.requireNonNull(token, "token must not be null"); + return this; + } + + @java.lang.Override + public ConnectTokenResponse build() { + return new ConnectTokenResponse(connectLinkUrl, expiresAt, token, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java b/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java new file mode 100644 index 0000000..96af1a4 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/CreateBrowserClientOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateBrowserClientOpts.Builder.class) +public final class CreateBrowserClientOpts { + private final Optional apiUrl; + + private final Map additionalProperties; + + private CreateBrowserClientOpts(Optional apiUrl, Map additionalProperties) { + this.apiUrl = apiUrl; + this.additionalProperties = additionalProperties; + } + + /** + * @return The API URL to use + */ + @JsonProperty("api_url") + public Optional getApiUrl() { + return apiUrl; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateBrowserClientOpts && equalTo((CreateBrowserClientOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateBrowserClientOpts other) { + return apiUrl.equals(other.apiUrl); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apiUrl); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional apiUrl = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(CreateBrowserClientOpts other) { + apiUrl(other.getApiUrl()); + return this; + } + + /** + *

    The API URL to use

    + */ + @JsonSetter(value = "api_url", nulls = Nulls.SKIP) + public Builder apiUrl(Optional apiUrl) { + this.apiUrl = apiUrl; + return this; + } + + public Builder apiUrl(String apiUrl) { + this.apiUrl = Optional.ofNullable(apiUrl); + return this; + } + + public CreateBrowserClientOpts build() { + return new CreateBrowserClientOpts(apiUrl, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java b/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java new file mode 100644 index 0000000..3f50fd1 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/CreateOAuthTokenResponse.java @@ -0,0 +1,149 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateOAuthTokenResponse.Builder.class) +public final class CreateOAuthTokenResponse { + private final String accessToken; + + private final String tokenType; + + private final int expiresIn; + + private final Map additionalProperties; + + private CreateOAuthTokenResponse( + String accessToken, String tokenType, int expiresIn, Map additionalProperties) { + this.accessToken = accessToken; + this.tokenType = tokenType; + this.expiresIn = expiresIn; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("access_token") + public String getAccessToken() { + return accessToken; + } + + @JsonProperty("token_type") + public String getTokenType() { + return tokenType; + } + + @JsonProperty("expires_in") + public int getExpiresIn() { + return expiresIn; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateOAuthTokenResponse && equalTo((CreateOAuthTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateOAuthTokenResponse other) { + return accessToken.equals(other.accessToken) + && tokenType.equals(other.tokenType) + && expiresIn == other.expiresIn; + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.accessToken, this.tokenType, this.expiresIn); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AccessTokenStage builder() { + return new Builder(); + } + + public interface AccessTokenStage { + TokenTypeStage accessToken(@NotNull String accessToken); + + Builder from(CreateOAuthTokenResponse other); + } + + public interface TokenTypeStage { + ExpiresInStage tokenType(@NotNull String tokenType); + } + + public interface ExpiresInStage { + _FinalStage expiresIn(int expiresIn); + } + + public interface _FinalStage { + CreateOAuthTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AccessTokenStage, TokenTypeStage, ExpiresInStage, _FinalStage { + private String accessToken; + + private String tokenType; + + private int expiresIn; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateOAuthTokenResponse other) { + accessToken(other.getAccessToken()); + tokenType(other.getTokenType()); + expiresIn(other.getExpiresIn()); + return this; + } + + @java.lang.Override + @JsonSetter("access_token") + public TokenTypeStage accessToken(@NotNull String accessToken) { + this.accessToken = Objects.requireNonNull(accessToken, "accessToken must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("token_type") + public ExpiresInStage tokenType(@NotNull String tokenType) { + this.tokenType = Objects.requireNonNull(tokenType, "tokenType must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("expires_in") + public _FinalStage expiresIn(int expiresIn) { + this.expiresIn = expiresIn; + return this; + } + + @java.lang.Override + public CreateOAuthTokenResponse build() { + return new CreateOAuthTokenResponse(accessToken, tokenType, expiresIn, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/CreateTokenResponse.java b/src/main/java/com/pipedream/api/types/CreateTokenResponse.java new file mode 100644 index 0000000..4ce6161 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/CreateTokenResponse.java @@ -0,0 +1,183 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = CreateTokenResponse.Builder.class) +public final class CreateTokenResponse { + private final String connectLinkUrl; + + private final OffsetDateTime expiresAt; + + private final String token; + + private final Map additionalProperties; + + private CreateTokenResponse( + String connectLinkUrl, OffsetDateTime expiresAt, String token, Map additionalProperties) { + this.connectLinkUrl = connectLinkUrl; + this.expiresAt = expiresAt; + this.token = token; + this.additionalProperties = additionalProperties; + } + + /** + * @return The Connect Link URL + */ + @JsonProperty("connect_link_url") + public String getConnectLinkUrl() { + return connectLinkUrl; + } + + /** + * @return The expiration time of the token in ISO 8601 format + */ + @JsonProperty("expires_at") + public OffsetDateTime getExpiresAt() { + return expiresAt; + } + + /** + * @return The generated token + */ + @JsonProperty("token") + public String getToken() { + return token; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof CreateTokenResponse && equalTo((CreateTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(CreateTokenResponse other) { + return connectLinkUrl.equals(other.connectLinkUrl) + && expiresAt.equals(other.expiresAt) + && token.equals(other.token); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.connectLinkUrl, this.expiresAt, this.token); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ConnectLinkUrlStage builder() { + return new Builder(); + } + + public interface ConnectLinkUrlStage { + /** + *

    The Connect Link URL

    + */ + ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl); + + Builder from(CreateTokenResponse other); + } + + public interface ExpiresAtStage { + /** + *

    The expiration time of the token in ISO 8601 format

    + */ + TokenStage expiresAt(@NotNull OffsetDateTime expiresAt); + } + + public interface TokenStage { + /** + *

    The generated token

    + */ + _FinalStage token(@NotNull String token); + } + + public interface _FinalStage { + CreateTokenResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ConnectLinkUrlStage, ExpiresAtStage, TokenStage, _FinalStage { + private String connectLinkUrl; + + private OffsetDateTime expiresAt; + + private String token; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(CreateTokenResponse other) { + connectLinkUrl(other.getConnectLinkUrl()); + expiresAt(other.getExpiresAt()); + token(other.getToken()); + return this; + } + + /** + *

    The Connect Link URL

    + *

    The Connect Link URL

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("connect_link_url") + public ExpiresAtStage connectLinkUrl(@NotNull String connectLinkUrl) { + this.connectLinkUrl = Objects.requireNonNull(connectLinkUrl, "connectLinkUrl must not be null"); + return this; + } + + /** + *

    The expiration time of the token in ISO 8601 format

    + *

    The expiration time of the token in ISO 8601 format

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("expires_at") + public TokenStage expiresAt(@NotNull OffsetDateTime expiresAt) { + this.expiresAt = Objects.requireNonNull(expiresAt, "expiresAt must not be null"); + return this; + } + + /** + *

    The generated token

    + *

    The generated token

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("token") + public _FinalStage token(@NotNull String token) { + this.token = Objects.requireNonNull(token, "token must not be null"); + return this; + } + + @java.lang.Override + public CreateTokenResponse build() { + return new CreateTokenResponse(connectLinkUrl, expiresAt, token, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java b/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java new file mode 100644 index 0000000..70b04b4 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/DeleteTriggerOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeleteTriggerOpts.Builder.class) +public final class DeleteTriggerOpts { + private final Optional ignoreHookErrors; + + private final Map additionalProperties; + + private DeleteTriggerOpts(Optional ignoreHookErrors, Map additionalProperties) { + this.ignoreHookErrors = ignoreHookErrors; + this.additionalProperties = additionalProperties; + } + + /** + * @return Whether to ignore errors during deactivation hook + */ + @JsonProperty("ignore_hook_errors") + public Optional getIgnoreHookErrors() { + return ignoreHookErrors; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeleteTriggerOpts && equalTo((DeleteTriggerOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeleteTriggerOpts other) { + return ignoreHookErrors.equals(other.ignoreHookErrors); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.ignoreHookErrors); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional ignoreHookErrors = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(DeleteTriggerOpts other) { + ignoreHookErrors(other.getIgnoreHookErrors()); + return this; + } + + /** + *

    Whether to ignore errors during deactivation hook

    + */ + @JsonSetter(value = "ignore_hook_errors", nulls = Nulls.SKIP) + public Builder ignoreHookErrors(Optional ignoreHookErrors) { + this.ignoreHookErrors = ignoreHookErrors; + return this; + } + + public Builder ignoreHookErrors(Boolean ignoreHookErrors) { + this.ignoreHookErrors = Optional.ofNullable(ignoreHookErrors); + return this; + } + + public DeleteTriggerOpts build() { + return new DeleteTriggerOpts(ignoreHookErrors, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java b/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java new file mode 100644 index 0000000..09aac9d --- /dev/null +++ b/src/main/java/com/pipedream/api/types/DeployTriggerResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployTriggerResponse.Builder.class) +public final class DeployTriggerResponse { + private final DeployedComponent data; + + private final Map additionalProperties; + + private DeployTriggerResponse(DeployedComponent data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DeployedComponent getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployTriggerResponse && equalTo((DeployTriggerResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployTriggerResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull DeployedComponent data); + + Builder from(DeployTriggerResponse other); + } + + public interface _FinalStage { + DeployTriggerResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private DeployedComponent data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployTriggerResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DeployedComponent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public DeployTriggerResponse build() { + return new DeployTriggerResponse(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/DeployedComponent.java b/src/main/java/com/pipedream/api/types/DeployedComponent.java new file mode 100644 index 0000000..8a6e6b9 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/DeployedComponent.java @@ -0,0 +1,539 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = DeployedComponent.Builder.class) +public final class DeployedComponent { + private final String id; + + private final String ownerId; + + private final String componentId; + + private final List configurableProps; + + private final Map configuredProps; + + private final boolean active; + + private final int createdAt; + + private final int updatedAt; + + private final String name; + + private final String nameSlug; + + private final Optional callbackObservations; + + private final Map additionalProperties; + + private DeployedComponent( + String id, + String ownerId, + String componentId, + List configurableProps, + Map configuredProps, + boolean active, + int createdAt, + int updatedAt, + String name, + String nameSlug, + Optional callbackObservations, + Map additionalProperties) { + this.id = id; + this.ownerId = ownerId; + this.componentId = componentId; + this.configurableProps = configurableProps; + this.configuredProps = configuredProps; + this.active = active; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.name = name; + this.nameSlug = nameSlug; + this.callbackObservations = callbackObservations; + this.additionalProperties = additionalProperties; + } + + /** + * @return The unique ID of the deployed component + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The ID of the owner + */ + @JsonProperty("owner_id") + public String getOwnerId() { + return ownerId; + } + + /** + * @return The ID of the component that was deployed + */ + @JsonProperty("component_id") + public String getComponentId() { + return componentId; + } + + /** + * @return The configurable properties of the component + */ + @JsonProperty("configurable_props") + public List getConfigurableProps() { + return configurableProps; + } + + /** + * @return The configured properties of the component + */ + @JsonProperty("configured_props") + public Map getConfiguredProps() { + return configuredProps; + } + + /** + * @return Whether the deployed component is active + */ + @JsonProperty("active") + public boolean getActive() { + return active; + } + + /** + * @return The timestamp when the component was deployed (epoch milliseconds) + */ + @JsonProperty("created_at") + public int getCreatedAt() { + return createdAt; + } + + /** + * @return The timestamp when the component was last updated (epoch milliseconds) + */ + @JsonProperty("updated_at") + public int getUpdatedAt() { + return updatedAt; + } + + /** + * @return The name of the deployed component + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * @return The name slug of the deployed component + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + @JsonProperty("callback_observations") + public Optional getCallbackObservations() { + return callbackObservations; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof DeployedComponent && equalTo((DeployedComponent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(DeployedComponent other) { + return id.equals(other.id) + && ownerId.equals(other.ownerId) + && componentId.equals(other.componentId) + && configurableProps.equals(other.configurableProps) + && configuredProps.equals(other.configuredProps) + && active == other.active + && createdAt == other.createdAt + && updatedAt == other.updatedAt + && name.equals(other.name) + && nameSlug.equals(other.nameSlug) + && callbackObservations.equals(other.callbackObservations); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.ownerId, + this.componentId, + this.configurableProps, + this.configuredProps, + this.active, + this.createdAt, + this.updatedAt, + this.name, + this.nameSlug, + this.callbackObservations); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

    The unique ID of the deployed component

    + */ + OwnerIdStage id(@NotNull String id); + + Builder from(DeployedComponent other); + } + + public interface OwnerIdStage { + /** + *

    The ID of the owner

    + */ + ComponentIdStage ownerId(@NotNull String ownerId); + } + + public interface ComponentIdStage { + /** + *

    The ID of the component that was deployed

    + */ + ActiveStage componentId(@NotNull String componentId); + } + + public interface ActiveStage { + /** + *

    Whether the deployed component is active

    + */ + CreatedAtStage active(boolean active); + } + + public interface CreatedAtStage { + /** + *

    The timestamp when the component was deployed (epoch milliseconds)

    + */ + UpdatedAtStage createdAt(int createdAt); + } + + public interface UpdatedAtStage { + /** + *

    The timestamp when the component was last updated (epoch milliseconds)

    + */ + NameStage updatedAt(int updatedAt); + } + + public interface NameStage { + /** + *

    The name of the deployed component

    + */ + NameSlugStage name(@NotNull String name); + } + + public interface NameSlugStage { + /** + *

    The name slug of the deployed component

    + */ + _FinalStage nameSlug(@NotNull String nameSlug); + } + + public interface _FinalStage { + DeployedComponent build(); + + /** + *

    The configurable properties of the component

    + */ + _FinalStage configurableProps(List configurableProps); + + _FinalStage addConfigurableProps(ConfigurableProp configurableProps); + + _FinalStage addAllConfigurableProps(List configurableProps); + + /** + *

    The configured properties of the component

    + */ + _FinalStage configuredProps(Map configuredProps); + + _FinalStage putAllConfiguredProps(Map configuredProps); + + _FinalStage configuredProps(String key, Object value); + + _FinalStage callbackObservations(Optional callbackObservations); + + _FinalStage callbackObservations(Object callbackObservations); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, + OwnerIdStage, + ComponentIdStage, + ActiveStage, + CreatedAtStage, + UpdatedAtStage, + NameStage, + NameSlugStage, + _FinalStage { + private String id; + + private String ownerId; + + private String componentId; + + private boolean active; + + private int createdAt; + + private int updatedAt; + + private String name; + + private String nameSlug; + + private Optional callbackObservations = Optional.empty(); + + private Map configuredProps = new LinkedHashMap<>(); + + private List configurableProps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(DeployedComponent other) { + id(other.getId()); + ownerId(other.getOwnerId()); + componentId(other.getComponentId()); + configurableProps(other.getConfigurableProps()); + configuredProps(other.getConfiguredProps()); + active(other.getActive()); + createdAt(other.getCreatedAt()); + updatedAt(other.getUpdatedAt()); + name(other.getName()); + nameSlug(other.getNameSlug()); + callbackObservations(other.getCallbackObservations()); + return this; + } + + /** + *

    The unique ID of the deployed component

    + *

    The unique ID of the deployed component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public OwnerIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The ID of the owner

    + *

    The ID of the owner

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("owner_id") + public ComponentIdStage ownerId(@NotNull String ownerId) { + this.ownerId = Objects.requireNonNull(ownerId, "ownerId must not be null"); + return this; + } + + /** + *

    The ID of the component that was deployed

    + *

    The ID of the component that was deployed

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("component_id") + public ActiveStage componentId(@NotNull String componentId) { + this.componentId = Objects.requireNonNull(componentId, "componentId must not be null"); + return this; + } + + /** + *

    Whether the deployed component is active

    + *

    Whether the deployed component is active

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("active") + public CreatedAtStage active(boolean active) { + this.active = active; + return this; + } + + /** + *

    The timestamp when the component was deployed (epoch milliseconds)

    + *

    The timestamp when the component was deployed (epoch milliseconds)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(int createdAt) { + this.createdAt = createdAt; + return this; + } + + /** + *

    The timestamp when the component was last updated (epoch milliseconds)

    + *

    The timestamp when the component was last updated (epoch milliseconds)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("updated_at") + public NameStage updatedAt(int updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + /** + *

    The name of the deployed component

    + *

    The name of the deployed component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name") + public NameSlugStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); + return this; + } + + /** + *

    The name slug of the deployed component

    + *

    The name slug of the deployed component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name_slug") + public _FinalStage nameSlug(@NotNull String nameSlug) { + this.nameSlug = Objects.requireNonNull(nameSlug, "nameSlug must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage callbackObservations(Object callbackObservations) { + this.callbackObservations = Optional.ofNullable(callbackObservations); + return this; + } + + @java.lang.Override + @JsonSetter(value = "callback_observations", nulls = Nulls.SKIP) + public _FinalStage callbackObservations(Optional callbackObservations) { + this.callbackObservations = callbackObservations; + return this; + } + + /** + *

    The configured properties of the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(String key, Object value) { + this.configuredProps.put(key, value); + return this; + } + + /** + *

    The configured properties of the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllConfiguredProps(Map configuredProps) { + this.configuredProps.putAll(configuredProps); + return this; + } + + /** + *

    The configured properties of the component

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps.clear(); + this.configuredProps.putAll(configuredProps); + return this; + } + + /** + *

    The configurable properties of the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addAllConfigurableProps(List configurableProps) { + this.configurableProps.addAll(configurableProps); + return this; + } + + /** + *

    The configurable properties of the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage addConfigurableProps(ConfigurableProp configurableProps) { + this.configurableProps.add(configurableProps); + return this; + } + + /** + *

    The configurable properties of the component

    + */ + @java.lang.Override + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public _FinalStage configurableProps(List configurableProps) { + this.configurableProps.clear(); + this.configurableProps.addAll(configurableProps); + return this; + } + + @java.lang.Override + public DeployedComponent build() { + return new DeployedComponent( + id, + ownerId, + componentId, + configurableProps, + configuredProps, + active, + createdAt, + updatedAt, + name, + nameSlug, + callbackObservations, + additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/EmittedEvent.java b/src/main/java/com/pipedream/api/types/EmittedEvent.java new file mode 100644 index 0000000..21eebab --- /dev/null +++ b/src/main/java/com/pipedream/api/types/EmittedEvent.java @@ -0,0 +1,235 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = EmittedEvent.Builder.class) +public final class EmittedEvent { + private final Map e; + + private final String k; + + private final int ts; + + private final String id; + + private final Map additionalProperties; + + private EmittedEvent(Map e, String k, int ts, String id, Map additionalProperties) { + this.e = e; + this.k = k; + this.ts = ts; + this.id = id; + this.additionalProperties = additionalProperties; + } + + /** + * @return The event's payload + */ + @JsonProperty("e") + public Map getE() { + return e; + } + + /** + * @return The event's type (set to 'emit' currently) + */ + @JsonProperty("k") + public String getK() { + return k; + } + + /** + * @return The event's timestamp in epoch milliseconds + */ + @JsonProperty("ts") + public int getTs() { + return ts; + } + + /** + * @return The event's unique ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof EmittedEvent && equalTo((EmittedEvent) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(EmittedEvent other) { + return e.equals(other.e) && k.equals(other.k) && ts == other.ts && id.equals(other.id); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.e, this.k, this.ts, this.id); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static KStage builder() { + return new Builder(); + } + + public interface KStage { + /** + *

    The event's type (set to 'emit' currently)

    + */ + TsStage k(@NotNull String k); + + Builder from(EmittedEvent other); + } + + public interface TsStage { + /** + *

    The event's timestamp in epoch milliseconds

    + */ + IdStage ts(int ts); + } + + public interface IdStage { + /** + *

    The event's unique ID

    + */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + EmittedEvent build(); + + /** + *

    The event's payload

    + */ + _FinalStage e(Map e); + + _FinalStage putAllE(Map e); + + _FinalStage e(String key, Object value); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements KStage, TsStage, IdStage, _FinalStage { + private String k; + + private int ts; + + private String id; + + private Map e = new LinkedHashMap<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(EmittedEvent other) { + e(other.getE()); + k(other.getK()); + ts(other.getTs()); + id(other.getId()); + return this; + } + + /** + *

    The event's type (set to 'emit' currently)

    + *

    The event's type (set to 'emit' currently)

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("k") + public TsStage k(@NotNull String k) { + this.k = Objects.requireNonNull(k, "k must not be null"); + return this; + } + + /** + *

    The event's timestamp in epoch milliseconds

    + *

    The event's timestamp in epoch milliseconds

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("ts") + public IdStage ts(int ts) { + this.ts = ts; + return this; + } + + /** + *

    The event's unique ID

    + *

    The event's unique ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The event's payload

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage e(String key, Object value) { + this.e.put(key, value); + return this; + } + + /** + *

    The event's payload

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage putAllE(Map e) { + this.e.putAll(e); + return this; + } + + /** + *

    The event's payload

    + */ + @java.lang.Override + @JsonSetter(value = "e", nulls = Nulls.SKIP) + public _FinalStage e(Map e) { + this.e.clear(); + this.e.putAll(e); + return this; + } + + @java.lang.Override + public EmittedEvent build() { + return new EmittedEvent(e, k, ts, id, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ErrorResponse.java b/src/main/java/com/pipedream/api/types/ErrorResponse.java new file mode 100644 index 0000000..38b2481 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ErrorResponse.java @@ -0,0 +1,201 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ErrorResponse.Builder.class) +public final class ErrorResponse { + private final String error; + + private final Optional code; + + private final Optional> details; + + private final Map additionalProperties; + + private ErrorResponse( + String error, + Optional code, + Optional> details, + Map additionalProperties) { + this.error = error; + this.code = code; + this.details = details; + this.additionalProperties = additionalProperties; + } + + /** + * @return The error message + */ + @JsonProperty("error") + public String getError() { + return error; + } + + /** + * @return The error code + */ + @JsonProperty("code") + public Optional getCode() { + return code; + } + + /** + * @return Additional error details + */ + @JsonProperty("details") + public Optional> getDetails() { + return details; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ErrorResponse && equalTo((ErrorResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ErrorResponse other) { + return error.equals(other.error) && code.equals(other.code) && details.equals(other.details); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.error, this.code, this.details); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static ErrorStage builder() { + return new Builder(); + } + + public interface ErrorStage { + /** + *

    The error message

    + */ + _FinalStage error(@NotNull String error); + + Builder from(ErrorResponse other); + } + + public interface _FinalStage { + ErrorResponse build(); + + /** + *

    The error code

    + */ + _FinalStage code(Optional code); + + _FinalStage code(String code); + + /** + *

    Additional error details

    + */ + _FinalStage details(Optional> details); + + _FinalStage details(Map details); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements ErrorStage, _FinalStage { + private String error; + + private Optional> details = Optional.empty(); + + private Optional code = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ErrorResponse other) { + error(other.getError()); + code(other.getCode()); + details(other.getDetails()); + return this; + } + + /** + *

    The error message

    + *

    The error message

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("error") + public _FinalStage error(@NotNull String error) { + this.error = Objects.requireNonNull(error, "error must not be null"); + return this; + } + + /** + *

    Additional error details

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage details(Map details) { + this.details = Optional.ofNullable(details); + return this; + } + + /** + *

    Additional error details

    + */ + @java.lang.Override + @JsonSetter(value = "details", nulls = Nulls.SKIP) + public _FinalStage details(Optional> details) { + this.details = details; + return this; + } + + /** + *

    The error code

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage code(String code) { + this.code = Optional.ofNullable(code); + return this; + } + + /** + *

    The error code

    + */ + @java.lang.Override + @JsonSetter(value = "code", nulls = Nulls.SKIP) + public _FinalStage code(Optional code) { + this.code = code; + return this; + } + + @java.lang.Override + public ErrorResponse build() { + return new ErrorResponse(error, code, details, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetAccountsResponse.java b/src/main/java/com/pipedream/api/types/GetAccountsResponse.java new file mode 100644 index 0000000..27141c1 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetAccountsResponse.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAccountsResponse.Builder.class) +public final class GetAccountsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetAccountsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAccountsResponse && equalTo((GetAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetAccountsResponse other); + } + + public interface _FinalStage { + GetAccountsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Account data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Account data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetAccountsResponse build() { + return new GetAccountsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetAppResponse.java b/src/main/java/com/pipedream/api/types/GetAppResponse.java new file mode 100644 index 0000000..b8d680d --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetAppResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAppResponse.Builder.class) +public final class GetAppResponse { + private final App data; + + private final Map additionalProperties; + + private GetAppResponse(App data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public App getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAppResponse && equalTo((GetAppResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAppResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull App data); + + Builder from(GetAppResponse other); + } + + public interface _FinalStage { + GetAppResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private App data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAppResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull App data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetAppResponse build() { + return new GetAppResponse(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetAppsResponse.java b/src/main/java/com/pipedream/api/types/GetAppsResponse.java new file mode 100644 index 0000000..9f69b14 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetAppsResponse.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetAppsResponse.Builder.class) +public final class GetAppsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetAppsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetAppsResponse && equalTo((GetAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetAppsResponse other); + } + + public interface _FinalStage { + GetAppsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(App data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(App data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetAppsResponse build() { + return new GetAppsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetComponentResponse.java b/src/main/java/com/pipedream/api/types/GetComponentResponse.java new file mode 100644 index 0000000..f2a0631 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetComponentResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetComponentResponse.Builder.class) +public final class GetComponentResponse { + private final Component data; + + private final Map additionalProperties; + + private GetComponentResponse(Component data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public Component getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetComponentResponse && equalTo((GetComponentResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetComponentResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull Component data); + + Builder from(GetComponentResponse other); + } + + public interface _FinalStage { + GetComponentResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private Component data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetComponentResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull Component data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetComponentResponse build() { + return new GetComponentResponse(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetComponentsResponse.java b/src/main/java/com/pipedream/api/types/GetComponentsResponse.java new file mode 100644 index 0000000..9768dbf --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetComponentsResponse.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetComponentsResponse.Builder.class) +public final class GetComponentsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetComponentsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetComponentsResponse && equalTo((GetComponentsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetComponentsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetComponentsResponse other); + } + + public interface _FinalStage { + GetComponentsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Component data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetComponentsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Component data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetComponentsResponse build() { + return new GetComponentsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java b/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java new file mode 100644 index 0000000..87d47ab --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetTriggerEventsResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerEventsResponse.Builder.class) +public final class GetTriggerEventsResponse { + private final List data; + + private final Map additionalProperties; + + private GetTriggerEventsResponse(List data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerEventsResponse && equalTo((GetTriggerEventsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerEventsResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerEventsResponse other) { + data(other.getData()); + return this; + } + + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public Builder data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + public Builder addData(EmittedEvent data) { + this.data.add(data); + return this; + } + + public Builder addAllData(List data) { + this.data.addAll(data); + return this; + } + + public GetTriggerEventsResponse build() { + return new GetTriggerEventsResponse(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetTriggerResponse.java b/src/main/java/com/pipedream/api/types/GetTriggerResponse.java new file mode 100644 index 0000000..697147e --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetTriggerResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerResponse.Builder.class) +public final class GetTriggerResponse { + private final DeployedComponent data; + + private final Map additionalProperties; + + private GetTriggerResponse(DeployedComponent data, Map additionalProperties) { + this.data = data; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public DeployedComponent getData() { + return data; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerResponse && equalTo((GetTriggerResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerResponse other) { + return data.equals(other.data); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static DataStage builder() { + return new Builder(); + } + + public interface DataStage { + _FinalStage data(@NotNull DeployedComponent data); + + Builder from(GetTriggerResponse other); + } + + public interface _FinalStage { + GetTriggerResponse build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements DataStage, _FinalStage { + private DeployedComponent data; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetTriggerResponse other) { + data(other.getData()); + return this; + } + + @java.lang.Override + @JsonSetter("data") + public _FinalStage data(@NotNull DeployedComponent data) { + this.data = Objects.requireNonNull(data, "data must not be null"); + return this; + } + + @java.lang.Override + public GetTriggerResponse build() { + return new GetTriggerResponse(data, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java b/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java new file mode 100644 index 0000000..1d86176 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetTriggerWebhooksResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerWebhooksResponse.Builder.class) +public final class GetTriggerWebhooksResponse { + private final List webhookUrls; + + private final Map additionalProperties; + + private GetTriggerWebhooksResponse(List webhookUrls, Map additionalProperties) { + this.webhookUrls = webhookUrls; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("webhook_urls") + public List getWebhookUrls() { + return webhookUrls; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerWebhooksResponse && equalTo((GetTriggerWebhooksResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerWebhooksResponse other) { + return webhookUrls.equals(other.webhookUrls); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.webhookUrls); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List webhookUrls = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerWebhooksResponse other) { + webhookUrls(other.getWebhookUrls()); + return this; + } + + @JsonSetter(value = "webhook_urls", nulls = Nulls.SKIP) + public Builder webhookUrls(List webhookUrls) { + this.webhookUrls.clear(); + this.webhookUrls.addAll(webhookUrls); + return this; + } + + public Builder addWebhookUrls(String webhookUrls) { + this.webhookUrls.add(webhookUrls); + return this; + } + + public Builder addAllWebhookUrls(List webhookUrls) { + this.webhookUrls.addAll(webhookUrls); + return this; + } + + public GetTriggerWebhooksResponse build() { + return new GetTriggerWebhooksResponse(webhookUrls, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java b/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java new file mode 100644 index 0000000..e14ed35 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetTriggerWorkflowsResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggerWorkflowsResponse.Builder.class) +public final class GetTriggerWorkflowsResponse { + private final List workflowIds; + + private final Map additionalProperties; + + private GetTriggerWorkflowsResponse(List workflowIds, Map additionalProperties) { + this.workflowIds = workflowIds; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("workflow_ids") + public List getWorkflowIds() { + return workflowIds; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggerWorkflowsResponse && equalTo((GetTriggerWorkflowsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggerWorkflowsResponse other) { + return workflowIds.equals(other.workflowIds); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.workflowIds); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List workflowIds = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(GetTriggerWorkflowsResponse other) { + workflowIds(other.getWorkflowIds()); + return this; + } + + @JsonSetter(value = "workflow_ids", nulls = Nulls.SKIP) + public Builder workflowIds(List workflowIds) { + this.workflowIds.clear(); + this.workflowIds.addAll(workflowIds); + return this; + } + + public Builder addWorkflowIds(String workflowIds) { + this.workflowIds.add(workflowIds); + return this; + } + + public Builder addAllWorkflowIds(List workflowIds) { + this.workflowIds.addAll(workflowIds); + return this; + } + + public GetTriggerWorkflowsResponse build() { + return new GetTriggerWorkflowsResponse(workflowIds, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/GetTriggersResponse.java b/src/main/java/com/pipedream/api/types/GetTriggersResponse.java new file mode 100644 index 0000000..0c6a070 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/GetTriggersResponse.java @@ -0,0 +1,143 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = GetTriggersResponse.Builder.class) +public final class GetTriggersResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private GetTriggersResponse( + List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof GetTriggersResponse && equalTo((GetTriggersResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(GetTriggersResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(GetTriggersResponse other); + } + + public interface _FinalStage { + GetTriggersResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(DeployedComponent data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(GetTriggersResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(DeployedComponent data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public GetTriggersResponse build() { + return new GetTriggersResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ListAccountsResponse.java b/src/main/java/com/pipedream/api/types/ListAccountsResponse.java new file mode 100644 index 0000000..f474727 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ListAccountsResponse.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAccountsResponse.Builder.class) +public final class ListAccountsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAccountsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAccountsResponse && equalTo((ListAccountsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAccountsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAccountsResponse other); + } + + public interface _FinalStage { + ListAccountsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(Account data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAccountsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(Account data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public ListAccountsResponse build() { + return new ListAccountsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ListAppsResponse.java b/src/main/java/com/pipedream/api/types/ListAppsResponse.java new file mode 100644 index 0000000..85fab80 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ListAppsResponse.java @@ -0,0 +1,142 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ListAppsResponse.Builder.class) +public final class ListAppsResponse { + private final List data; + + private final PageInfo pageInfo; + + private final Map additionalProperties; + + private ListAppsResponse(List data, PageInfo pageInfo, Map additionalProperties) { + this.data = data; + this.pageInfo = pageInfo; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("data") + public List getData() { + return data; + } + + @JsonProperty("page_info") + public PageInfo getPageInfo() { + return pageInfo; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ListAppsResponse && equalTo((ListAppsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ListAppsResponse other) { + return data.equals(other.data) && pageInfo.equals(other.pageInfo); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.data, this.pageInfo); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static PageInfoStage builder() { + return new Builder(); + } + + public interface PageInfoStage { + _FinalStage pageInfo(@NotNull PageInfo pageInfo); + + Builder from(ListAppsResponse other); + } + + public interface _FinalStage { + ListAppsResponse build(); + + _FinalStage data(List data); + + _FinalStage addData(App data); + + _FinalStage addAllData(List data); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements PageInfoStage, _FinalStage { + private PageInfo pageInfo; + + private List data = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ListAppsResponse other) { + data(other.getData()); + pageInfo(other.getPageInfo()); + return this; + } + + @java.lang.Override + @JsonSetter("page_info") + public _FinalStage pageInfo(@NotNull PageInfo pageInfo) { + this.pageInfo = Objects.requireNonNull(pageInfo, "pageInfo must not be null"); + return this; + } + + @java.lang.Override + public _FinalStage addAllData(List data) { + this.data.addAll(data); + return this; + } + + @java.lang.Override + public _FinalStage addData(App data) { + this.data.add(data); + return this; + } + + @java.lang.Override + @JsonSetter(value = "data", nulls = Nulls.SKIP) + public _FinalStage data(List data) { + this.data.clear(); + this.data.addAll(data); + return this; + } + + @java.lang.Override + public ListAppsResponse build() { + return new ListAppsResponse(data, pageInfo, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/PageInfo.java b/src/main/java/com/pipedream/api/types/PageInfo.java new file mode 100644 index 0000000..8fbda9e --- /dev/null +++ b/src/main/java/com/pipedream/api/types/PageInfo.java @@ -0,0 +1,169 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PageInfo.Builder.class) +public final class PageInfo { + private final Optional count; + + private final Optional totalCount; + + private final Optional startCursor; + + private final Optional endCursor; + + private final Map additionalProperties; + + private PageInfo( + Optional count, + Optional totalCount, + Optional startCursor, + Optional endCursor, + Map additionalProperties) { + this.count = count; + this.totalCount = totalCount; + this.startCursor = startCursor; + this.endCursor = endCursor; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("count") + public Optional getCount() { + return count; + } + + @JsonProperty("total_count") + public Optional getTotalCount() { + return totalCount; + } + + @JsonProperty("start_cursor") + public Optional getStartCursor() { + return startCursor; + } + + @JsonProperty("end_cursor") + public Optional getEndCursor() { + return endCursor; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PageInfo && equalTo((PageInfo) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PageInfo other) { + return count.equals(other.count) + && totalCount.equals(other.totalCount) + && startCursor.equals(other.startCursor) + && endCursor.equals(other.endCursor); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.count, this.totalCount, this.startCursor, this.endCursor); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional count = Optional.empty(); + + private Optional totalCount = Optional.empty(); + + private Optional startCursor = Optional.empty(); + + private Optional endCursor = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(PageInfo other) { + count(other.getCount()); + totalCount(other.getTotalCount()); + startCursor(other.getStartCursor()); + endCursor(other.getEndCursor()); + return this; + } + + @JsonSetter(value = "count", nulls = Nulls.SKIP) + public Builder count(Optional count) { + this.count = count; + return this; + } + + public Builder count(Integer count) { + this.count = Optional.ofNullable(count); + return this; + } + + @JsonSetter(value = "total_count", nulls = Nulls.SKIP) + public Builder totalCount(Optional totalCount) { + this.totalCount = totalCount; + return this; + } + + public Builder totalCount(Integer totalCount) { + this.totalCount = Optional.ofNullable(totalCount); + return this; + } + + @JsonSetter(value = "start_cursor", nulls = Nulls.SKIP) + public Builder startCursor(Optional startCursor) { + this.startCursor = startCursor; + return this; + } + + public Builder startCursor(String startCursor) { + this.startCursor = Optional.ofNullable(startCursor); + return this; + } + + @JsonSetter(value = "end_cursor", nulls = Nulls.SKIP) + public Builder endCursor(Optional endCursor) { + this.endCursor = endCursor; + return this; + } + + public Builder endCursor(String endCursor) { + this.endCursor = Optional.ofNullable(endCursor); + return this; + } + + public PageInfo build() { + return new PageInfo(count, totalCount, startCursor, endCursor, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ProjectEnvironment.java b/src/main/java/com/pipedream/api/types/ProjectEnvironment.java new file mode 100644 index 0000000..aceb02c --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ProjectEnvironment.java @@ -0,0 +1,24 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum ProjectEnvironment { + DEVELOPMENT("development"), + + PRODUCTION("production"); + + private final String value; + + ProjectEnvironment(String value) { + this.value = value; + } + + @JsonValue + @java.lang.Override + public String toString() { + return this.value; + } +} diff --git a/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java b/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java new file mode 100644 index 0000000..c3f66ca --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ProjectInfoResponse.java @@ -0,0 +1,102 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProjectInfoResponse.Builder.class) +public final class ProjectInfoResponse { + private final List apps; + + private final Map additionalProperties; + + private ProjectInfoResponse(List apps, Map additionalProperties) { + this.apps = apps; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("apps") + public List getApps() { + return apps; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProjectInfoResponse && equalTo((ProjectInfoResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProjectInfoResponse other) { + return apps.equals(other.apps); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.apps); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private List apps = new ArrayList<>(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProjectInfoResponse other) { + apps(other.getApps()); + return this; + } + + @JsonSetter(value = "apps", nulls = Nulls.SKIP) + public Builder apps(List apps) { + this.apps.clear(); + this.apps.addAll(apps); + return this; + } + + public Builder addApps(ProjectInfoResponseAppsItem apps) { + this.apps.add(apps); + return this; + } + + public Builder addAllApps(List apps) { + this.apps.addAll(apps); + return this; + } + + public ProjectInfoResponse build() { + return new ProjectInfoResponse(apps, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java b/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java new file mode 100644 index 0000000..1b6412a --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ProjectInfoResponseAppsItem.java @@ -0,0 +1,157 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProjectInfoResponseAppsItem.Builder.class) +public final class ProjectInfoResponseAppsItem { + private final Optional id; + + private final String nameSlug; + + private final Map additionalProperties; + + private ProjectInfoResponseAppsItem( + Optional id, String nameSlug, Map additionalProperties) { + this.id = id; + this.nameSlug = nameSlug; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the app. Only applies for OAuth apps. + */ + @JsonProperty("id") + public Optional getId() { + return id; + } + + /** + * @return The name slug of the target app + */ + @JsonProperty("name_slug") + public String getNameSlug() { + return nameSlug; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProjectInfoResponseAppsItem && equalTo((ProjectInfoResponseAppsItem) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProjectInfoResponseAppsItem other) { + return id.equals(other.id) && nameSlug.equals(other.nameSlug); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.id, this.nameSlug); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static NameSlugStage builder() { + return new Builder(); + } + + public interface NameSlugStage { + /** + *

    The name slug of the target app

    + */ + _FinalStage nameSlug(@NotNull String nameSlug); + + Builder from(ProjectInfoResponseAppsItem other); + } + + public interface _FinalStage { + ProjectInfoResponseAppsItem build(); + + /** + *

    ID of the app. Only applies for OAuth apps.

    + */ + _FinalStage id(Optional id); + + _FinalStage id(String id); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements NameSlugStage, _FinalStage { + private String nameSlug; + + private Optional id = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ProjectInfoResponseAppsItem other) { + id(other.getId()); + nameSlug(other.getNameSlug()); + return this; + } + + /** + *

    The name slug of the target app

    + *

    The name slug of the target app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("name_slug") + public _FinalStage nameSlug(@NotNull String nameSlug) { + this.nameSlug = Objects.requireNonNull(nameSlug, "nameSlug must not be null"); + return this; + } + + /** + *

    ID of the app. Only applies for OAuth apps.

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage id(String id) { + this.id = Optional.ofNullable(id); + return this; + } + + /** + *

    ID of the app. Only applies for OAuth apps.

    + */ + @java.lang.Override + @JsonSetter(value = "id", nulls = Nulls.SKIP) + public _FinalStage id(Optional id) { + this.id = id; + return this; + } + + @java.lang.Override + public ProjectInfoResponseAppsItem build() { + return new ProjectInfoResponseAppsItem(id, nameSlug, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/PropOption.java b/src/main/java/com/pipedream/api/types/PropOption.java new file mode 100644 index 0000000..f3fd389 --- /dev/null +++ b/src/main/java/com/pipedream/api/types/PropOption.java @@ -0,0 +1,135 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = PropOption.Builder.class) +public final class PropOption { + private final String label; + + private final Object value; + + private final Map additionalProperties; + + private PropOption(String label, Object value, Map additionalProperties) { + this.label = label; + this.value = value; + this.additionalProperties = additionalProperties; + } + + /** + * @return The human-readable label for the option + */ + @JsonProperty("label") + public String getLabel() { + return label; + } + + @JsonProperty("value") + public Object getValue() { + return value; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof PropOption && equalTo((PropOption) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(PropOption other) { + return label.equals(other.label) && value.equals(other.value); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.label, this.value); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static LabelStage builder() { + return new Builder(); + } + + public interface LabelStage { + /** + *

    The human-readable label for the option

    + */ + ValueStage label(@NotNull String label); + + Builder from(PropOption other); + } + + public interface ValueStage { + _FinalStage value(Object value); + } + + public interface _FinalStage { + PropOption build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements LabelStage, ValueStage, _FinalStage { + private String label; + + private Object value; + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(PropOption other) { + label(other.getLabel()); + value(other.getValue()); + return this; + } + + /** + *

    The human-readable label for the option

    + *

    The human-readable label for the option

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("label") + public ValueStage label(@NotNull String label) { + this.label = Objects.requireNonNull(label, "label must not be null"); + return this; + } + + @java.lang.Override + @JsonSetter("value") + public _FinalStage value(Object value) { + this.value = value; + return this; + } + + @java.lang.Override + public PropOption build() { + return new PropOption(label, value, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ProxyResponse.java b/src/main/java/com/pipedream/api/types/ProxyResponse.java new file mode 100644 index 0000000..60a46ab --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ProxyResponse.java @@ -0,0 +1,155 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ProxyResponse.Builder.class) +public final class ProxyResponse { + private final Optional status; + + private final Optional> headers; + + private final Optional body; + + private final Map additionalProperties; + + private ProxyResponse( + Optional status, + Optional> headers, + Optional body, + Map additionalProperties) { + this.status = status; + this.headers = headers; + this.body = body; + this.additionalProperties = additionalProperties; + } + + /** + * @return HTTP status code + */ + @JsonProperty("status") + public Optional getStatus() { + return status; + } + + /** + * @return Response headers + */ + @JsonProperty("headers") + public Optional> getHeaders() { + return headers; + } + + @JsonProperty("body") + public Optional getBody() { + return body; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ProxyResponse && equalTo((ProxyResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ProxyResponse other) { + return status.equals(other.status) && headers.equals(other.headers) && body.equals(other.body); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.status, this.headers, this.body); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional status = Optional.empty(); + + private Optional> headers = Optional.empty(); + + private Optional body = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ProxyResponse other) { + status(other.getStatus()); + headers(other.getHeaders()); + body(other.getBody()); + return this; + } + + /** + *

    HTTP status code

    + */ + @JsonSetter(value = "status", nulls = Nulls.SKIP) + public Builder status(Optional status) { + this.status = status; + return this; + } + + public Builder status(Integer status) { + this.status = Optional.ofNullable(status); + return this; + } + + /** + *

    Response headers

    + */ + @JsonSetter(value = "headers", nulls = Nulls.SKIP) + public Builder headers(Optional> headers) { + this.headers = headers; + return this; + } + + public Builder headers(Map headers) { + this.headers = Optional.ofNullable(headers); + return this; + } + + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public Builder body(Optional body) { + this.body = body; + return this; + } + + public Builder body(Object body) { + this.body = Optional.ofNullable(body); + return this; + } + + public ProxyResponse build() { + return new ProxyResponse(status, headers, body, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java b/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java new file mode 100644 index 0000000..c10ebce --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ReloadPropsOpts.java @@ -0,0 +1,331 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReloadPropsOpts.Builder.class) +public final class ReloadPropsOpts { + private final String id; + + private final String externalUserId; + + private final Optional blocking; + + private final Optional> configuredProps; + + private final Optional dynamicPropsId; + + private final Optional asyncHandle; + + private final Map additionalProperties; + + private ReloadPropsOpts( + String id, + String externalUserId, + Optional blocking, + Optional> configuredProps, + Optional dynamicPropsId, + Optional asyncHandle, + Map additionalProperties) { + this.id = id; + this.externalUserId = externalUserId; + this.blocking = blocking; + this.configuredProps = configuredProps; + this.dynamicPropsId = dynamicPropsId; + this.asyncHandle = asyncHandle; + this.additionalProperties = additionalProperties; + } + + /** + * @return The component ID + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * @return The external user ID + */ + @JsonProperty("external_user_id") + public String getExternalUserId() { + return externalUserId; + } + + /** + * @return Whether this operation should block until completion + */ + @JsonProperty("blocking") + public Optional getBlocking() { + return blocking; + } + + /** + * @return The configured properties for the component + */ + @JsonProperty("configured_props") + public Optional> getConfiguredProps() { + return configuredProps; + } + + /** + * @return The ID for dynamic props + */ + @JsonProperty("dynamic_props_id") + public Optional getDynamicPropsId() { + return dynamicPropsId; + } + + /** + * @return Handle for async operations + */ + @JsonProperty("async_handle") + public Optional getAsyncHandle() { + return asyncHandle; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReloadPropsOpts && equalTo((ReloadPropsOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReloadPropsOpts other) { + return id.equals(other.id) + && externalUserId.equals(other.externalUserId) + && blocking.equals(other.blocking) + && configuredProps.equals(other.configuredProps) + && dynamicPropsId.equals(other.dynamicPropsId) + && asyncHandle.equals(other.asyncHandle); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.id, + this.externalUserId, + this.blocking, + this.configuredProps, + this.dynamicPropsId, + this.asyncHandle); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static IdStage builder() { + return new Builder(); + } + + public interface IdStage { + /** + *

    The component ID

    + */ + ExternalUserIdStage id(@NotNull String id); + + Builder from(ReloadPropsOpts other); + } + + public interface ExternalUserIdStage { + /** + *

    The external user ID

    + */ + _FinalStage externalUserId(@NotNull String externalUserId); + } + + public interface _FinalStage { + ReloadPropsOpts build(); + + /** + *

    Whether this operation should block until completion

    + */ + _FinalStage blocking(Optional blocking); + + _FinalStage blocking(Boolean blocking); + + /** + *

    The configured properties for the component

    + */ + _FinalStage configuredProps(Optional> configuredProps); + + _FinalStage configuredProps(Map configuredProps); + + /** + *

    The ID for dynamic props

    + */ + _FinalStage dynamicPropsId(Optional dynamicPropsId); + + _FinalStage dynamicPropsId(String dynamicPropsId); + + /** + *

    Handle for async operations

    + */ + _FinalStage asyncHandle(Optional asyncHandle); + + _FinalStage asyncHandle(String asyncHandle); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, ExternalUserIdStage, _FinalStage { + private String id; + + private String externalUserId; + + private Optional asyncHandle = Optional.empty(); + + private Optional dynamicPropsId = Optional.empty(); + + private Optional> configuredProps = Optional.empty(); + + private Optional blocking = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ReloadPropsOpts other) { + id(other.getId()); + externalUserId(other.getExternalUserId()); + blocking(other.getBlocking()); + configuredProps(other.getConfiguredProps()); + dynamicPropsId(other.getDynamicPropsId()); + asyncHandle(other.getAsyncHandle()); + return this; + } + + /** + *

    The component ID

    + *

    The component ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public ExternalUserIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); + return this; + } + + /** + *

    The external user ID

    + *

    The external user ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("external_user_id") + public _FinalStage externalUserId(@NotNull String externalUserId) { + this.externalUserId = Objects.requireNonNull(externalUserId, "externalUserId must not be null"); + return this; + } + + /** + *

    Handle for async operations

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage asyncHandle(String asyncHandle) { + this.asyncHandle = Optional.ofNullable(asyncHandle); + return this; + } + + /** + *

    Handle for async operations

    + */ + @java.lang.Override + @JsonSetter(value = "async_handle", nulls = Nulls.SKIP) + public _FinalStage asyncHandle(Optional asyncHandle) { + this.asyncHandle = asyncHandle; + return this; + } + + /** + *

    The ID for dynamic props

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage dynamicPropsId(String dynamicPropsId) { + this.dynamicPropsId = Optional.ofNullable(dynamicPropsId); + return this; + } + + /** + *

    The ID for dynamic props

    + */ + @java.lang.Override + @JsonSetter(value = "dynamic_props_id", nulls = Nulls.SKIP) + public _FinalStage dynamicPropsId(Optional dynamicPropsId) { + this.dynamicPropsId = dynamicPropsId; + return this; + } + + /** + *

    The configured properties for the component

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage configuredProps(Map configuredProps) { + this.configuredProps = Optional.ofNullable(configuredProps); + return this; + } + + /** + *

    The configured properties for the component

    + */ + @java.lang.Override + @JsonSetter(value = "configured_props", nulls = Nulls.SKIP) + public _FinalStage configuredProps(Optional> configuredProps) { + this.configuredProps = configuredProps; + return this; + } + + /** + *

    Whether this operation should block until completion

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage blocking(Boolean blocking) { + this.blocking = Optional.ofNullable(blocking); + return this; + } + + /** + *

    Whether this operation should block until completion

    + */ + @java.lang.Override + @JsonSetter(value = "blocking", nulls = Nulls.SKIP) + public _FinalStage blocking(Optional blocking) { + this.blocking = blocking; + return this; + } + + @java.lang.Override + public ReloadPropsOpts build() { + return new ReloadPropsOpts( + id, externalUserId, blocking, configuredProps, dynamicPropsId, asyncHandle, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java b/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java new file mode 100644 index 0000000..56e3dae --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ReloadPropsResponse.java @@ -0,0 +1,103 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ReloadPropsResponse.Builder.class) +public final class ReloadPropsResponse { + private final Optional> configurableProps; + + private final Map additionalProperties; + + private ReloadPropsResponse( + Optional> configurableProps, Map additionalProperties) { + this.configurableProps = configurableProps; + this.additionalProperties = additionalProperties; + } + + /** + * @return The updated configurable properties + */ + @JsonProperty("configurable_props") + public Optional> getConfigurableProps() { + return configurableProps; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ReloadPropsResponse && equalTo((ReloadPropsResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ReloadPropsResponse other) { + return configurableProps.equals(other.configurableProps); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.configurableProps); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional> configurableProps = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(ReloadPropsResponse other) { + configurableProps(other.getConfigurableProps()); + return this; + } + + /** + *

    The updated configurable properties

    + */ + @JsonSetter(value = "configurable_props", nulls = Nulls.SKIP) + public Builder configurableProps(Optional> configurableProps) { + this.configurableProps = configurableProps; + return this; + } + + public Builder configurableProps(List configurableProps) { + this.configurableProps = Optional.ofNullable(configurableProps); + return this; + } + + public ReloadPropsResponse build() { + return new ReloadPropsResponse(configurableProps, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/RunActionResponse.java b/src/main/java/com/pipedream/api/types/RunActionResponse.java new file mode 100644 index 0000000..585a35a --- /dev/null +++ b/src/main/java/com/pipedream/api/types/RunActionResponse.java @@ -0,0 +1,175 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = RunActionResponse.Builder.class) +public final class RunActionResponse { + private final Optional exports; + + private final Optional os; + + private final Optional ret; + + private final Optional stashId; + + private final Map additionalProperties; + + private RunActionResponse( + Optional exports, + Optional os, + Optional ret, + Optional stashId, + Map additionalProperties) { + this.exports = exports; + this.os = os; + this.ret = ret; + this.stashId = stashId; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("exports") + public Optional getExports() { + return exports; + } + + @JsonProperty("os") + public Optional getOs() { + return os; + } + + @JsonProperty("ret") + public Optional getRet() { + return ret; + } + + /** + * @return The ID of the File Stash that was used to sync the action's /tmp directory + */ + @JsonProperty("stash_id") + public Optional getStashId() { + return stashId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof RunActionResponse && equalTo((RunActionResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(RunActionResponse other) { + return exports.equals(other.exports) + && os.equals(other.os) + && ret.equals(other.ret) + && stashId.equals(other.stashId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.exports, this.os, this.ret, this.stashId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional exports = Optional.empty(); + + private Optional os = Optional.empty(); + + private Optional ret = Optional.empty(); + + private Optional stashId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(RunActionResponse other) { + exports(other.getExports()); + os(other.getOs()); + ret(other.getRet()); + stashId(other.getStashId()); + return this; + } + + @JsonSetter(value = "exports", nulls = Nulls.SKIP) + public Builder exports(Optional exports) { + this.exports = exports; + return this; + } + + public Builder exports(Object exports) { + this.exports = Optional.ofNullable(exports); + return this; + } + + @JsonSetter(value = "os", nulls = Nulls.SKIP) + public Builder os(Optional os) { + this.os = os; + return this; + } + + public Builder os(Object os) { + this.os = Optional.ofNullable(os); + return this; + } + + @JsonSetter(value = "ret", nulls = Nulls.SKIP) + public Builder ret(Optional ret) { + this.ret = ret; + return this; + } + + public Builder ret(Object ret) { + this.ret = Optional.ofNullable(ret); + return this; + } + + /** + *

    The ID of the File Stash that was used to sync the action's /tmp directory

    + */ + @JsonSetter(value = "stash_id", nulls = Nulls.SKIP) + public Builder stashId(Optional stashId) { + this.stashId = stashId; + return this; + } + + public Builder stashId(String stashId) { + this.stashId = Optional.ofNullable(stashId); + return this; + } + + public RunActionResponse build() { + return new RunActionResponse(exports, os, ret, stashId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/StartConnectOpts.java b/src/main/java/com/pipedream/api/types/StartConnectOpts.java new file mode 100644 index 0000000..74e494d --- /dev/null +++ b/src/main/java/com/pipedream/api/types/StartConnectOpts.java @@ -0,0 +1,101 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = StartConnectOpts.Builder.class) +public final class StartConnectOpts { + private final Optional iframe; + + private final Map additionalProperties; + + private StartConnectOpts(Optional iframe, Map additionalProperties) { + this.iframe = iframe; + this.additionalProperties = additionalProperties; + } + + /** + * @return ID of the iframe element to use + */ + @JsonProperty("iframe") + public Optional getIframe() { + return iframe; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof StartConnectOpts && equalTo((StartConnectOpts) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(StartConnectOpts other) { + return iframe.equals(other.iframe); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.iframe); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static Builder builder() { + return new Builder(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder { + private Optional iframe = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + public Builder from(StartConnectOpts other) { + iframe(other.getIframe()); + return this; + } + + /** + *

    ID of the iframe element to use

    + */ + @JsonSetter(value = "iframe", nulls = Nulls.SKIP) + public Builder iframe(Optional iframe) { + this.iframe = iframe; + return this; + } + + public Builder iframe(String iframe) { + this.iframe = Optional.ofNullable(iframe); + return this; + } + + public StartConnectOpts build() { + return new StartConnectOpts(iframe, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ValidateTokenParams.java b/src/main/java/com/pipedream/api/types/ValidateTokenParams.java new file mode 100644 index 0000000..26f43cb --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ValidateTokenParams.java @@ -0,0 +1,156 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; +import org.jetbrains.annotations.NotNull; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ValidateTokenParams.Builder.class) +public final class ValidateTokenParams { + private final String appId; + + private final Optional oauthAppId; + + private final Map additionalProperties; + + private ValidateTokenParams(String appId, Optional oauthAppId, Map additionalProperties) { + this.appId = appId; + this.oauthAppId = oauthAppId; + this.additionalProperties = additionalProperties; + } + + /** + * @return The app ID to validate against + */ + @JsonProperty("app_id") + public String getAppId() { + return appId; + } + + /** + * @return The OAuth app ID + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidateTokenParams && equalTo((ValidateTokenParams) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidateTokenParams other) { + return appId.equals(other.appId) && oauthAppId.equals(other.oauthAppId); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash(this.appId, this.oauthAppId); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static AppIdStage builder() { + return new Builder(); + } + + public interface AppIdStage { + /** + *

    The app ID to validate against

    + */ + _FinalStage appId(@NotNull String appId); + + Builder from(ValidateTokenParams other); + } + + public interface _FinalStage { + ValidateTokenParams build(); + + /** + *

    The OAuth app ID

    + */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements AppIdStage, _FinalStage { + private String appId; + + private Optional oauthAppId = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ValidateTokenParams other) { + appId(other.getAppId()); + oauthAppId(other.getOauthAppId()); + return this; + } + + /** + *

    The app ID to validate against

    + *

    The app ID to validate against

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("app_id") + public _FinalStage appId(@NotNull String appId) { + this.appId = Objects.requireNonNull(appId, "appId must not be null"); + return this; + } + + /** + *

    The OAuth app ID

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

    The OAuth app ID

    + */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + @java.lang.Override + public ValidateTokenParams build() { + return new ValidateTokenParams(appId, oauthAppId, additionalProperties); + } + } +} diff --git a/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java b/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java new file mode 100644 index 0000000..5691d9d --- /dev/null +++ b/src/main/java/com/pipedream/api/types/ValidateTokenResponse.java @@ -0,0 +1,511 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.types; + +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSetter; +import com.fasterxml.jackson.annotation.Nulls; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.pipedream.api.core.ObjectMappers; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +@JsonInclude(JsonInclude.Include.NON_ABSENT) +@JsonDeserialize(builder = ValidateTokenResponse.Builder.class) +public final class ValidateTokenResponse { + private final Optional app; + + private final Optional error; + + private final Optional errorRedirectUri; + + private final Optional oauthAppId; + + private final Optional projectAppName; + + private final Optional projectEnvironment; + + private final Optional projectId; + + private final Optional projectSupportEmail; + + private final boolean success; + + private final Optional successRedirectUri; + + private final Map additionalProperties; + + private ValidateTokenResponse( + Optional app, + Optional error, + Optional errorRedirectUri, + Optional oauthAppId, + Optional projectAppName, + Optional projectEnvironment, + Optional projectId, + Optional projectSupportEmail, + boolean success, + Optional successRedirectUri, + Map additionalProperties) { + this.app = app; + this.error = error; + this.errorRedirectUri = errorRedirectUri; + this.oauthAppId = oauthAppId; + this.projectAppName = projectAppName; + this.projectEnvironment = projectEnvironment; + this.projectId = projectId; + this.projectSupportEmail = projectSupportEmail; + this.success = success; + this.successRedirectUri = successRedirectUri; + this.additionalProperties = additionalProperties; + } + + @JsonProperty("app") + public Optional getApp() { + return app; + } + + /** + * @return Error message if validation failed + */ + @JsonProperty("error") + public Optional getError() { + return error; + } + + /** + * @return URI to redirect to on error + */ + @JsonProperty("error_redirect_uri") + public Optional getErrorRedirectUri() { + return errorRedirectUri; + } + + /** + * @return OAuth app ID if applicable + */ + @JsonProperty("oauth_app_id") + public Optional getOauthAppId() { + return oauthAppId; + } + + /** + * @return Name of the project app + */ + @JsonProperty("project_app_name") + public Optional getProjectAppName() { + return projectAppName; + } + + /** + * @return Environment of the project + */ + @JsonProperty("project_environment") + public Optional getProjectEnvironment() { + return projectEnvironment; + } + + /** + * @return ID of the project + */ + @JsonProperty("project_id") + public Optional getProjectId() { + return projectId; + } + + /** + * @return Support email for the project + */ + @JsonProperty("project_support_email") + public Optional getProjectSupportEmail() { + return projectSupportEmail; + } + + /** + * @return Whether the token validation was successful + */ + @JsonProperty("success") + public boolean getSuccess() { + return success; + } + + /** + * @return URI to redirect to on success + */ + @JsonProperty("success_redirect_uri") + public Optional getSuccessRedirectUri() { + return successRedirectUri; + } + + @java.lang.Override + public boolean equals(Object other) { + if (this == other) return true; + return other instanceof ValidateTokenResponse && equalTo((ValidateTokenResponse) other); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + private boolean equalTo(ValidateTokenResponse other) { + return app.equals(other.app) + && error.equals(other.error) + && errorRedirectUri.equals(other.errorRedirectUri) + && oauthAppId.equals(other.oauthAppId) + && projectAppName.equals(other.projectAppName) + && projectEnvironment.equals(other.projectEnvironment) + && projectId.equals(other.projectId) + && projectSupportEmail.equals(other.projectSupportEmail) + && success == other.success + && successRedirectUri.equals(other.successRedirectUri); + } + + @java.lang.Override + public int hashCode() { + return Objects.hash( + this.app, + this.error, + this.errorRedirectUri, + this.oauthAppId, + this.projectAppName, + this.projectEnvironment, + this.projectId, + this.projectSupportEmail, + this.success, + this.successRedirectUri); + } + + @java.lang.Override + public String toString() { + return ObjectMappers.stringify(this); + } + + public static SuccessStage builder() { + return new Builder(); + } + + public interface SuccessStage { + /** + *

    Whether the token validation was successful

    + */ + _FinalStage success(boolean success); + + Builder from(ValidateTokenResponse other); + } + + public interface _FinalStage { + ValidateTokenResponse build(); + + _FinalStage app(Optional app); + + _FinalStage app(App app); + + /** + *

    Error message if validation failed

    + */ + _FinalStage error(Optional error); + + _FinalStage error(String error); + + /** + *

    URI to redirect to on error

    + */ + _FinalStage errorRedirectUri(Optional errorRedirectUri); + + _FinalStage errorRedirectUri(String errorRedirectUri); + + /** + *

    OAuth app ID if applicable

    + */ + _FinalStage oauthAppId(Optional oauthAppId); + + _FinalStage oauthAppId(String oauthAppId); + + /** + *

    Name of the project app

    + */ + _FinalStage projectAppName(Optional projectAppName); + + _FinalStage projectAppName(String projectAppName); + + /** + *

    Environment of the project

    + */ + _FinalStage projectEnvironment(Optional projectEnvironment); + + _FinalStage projectEnvironment(String projectEnvironment); + + /** + *

    ID of the project

    + */ + _FinalStage projectId(Optional projectId); + + _FinalStage projectId(String projectId); + + /** + *

    Support email for the project

    + */ + _FinalStage projectSupportEmail(Optional projectSupportEmail); + + _FinalStage projectSupportEmail(String projectSupportEmail); + + /** + *

    URI to redirect to on success

    + */ + _FinalStage successRedirectUri(Optional successRedirectUri); + + _FinalStage successRedirectUri(String successRedirectUri); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements SuccessStage, _FinalStage { + private boolean success; + + private Optional successRedirectUri = Optional.empty(); + + private Optional projectSupportEmail = Optional.empty(); + + private Optional projectId = Optional.empty(); + + private Optional projectEnvironment = Optional.empty(); + + private Optional projectAppName = Optional.empty(); + + private Optional oauthAppId = Optional.empty(); + + private Optional errorRedirectUri = Optional.empty(); + + private Optional error = Optional.empty(); + + private Optional app = Optional.empty(); + + @JsonAnySetter + private Map additionalProperties = new HashMap<>(); + + private Builder() {} + + @java.lang.Override + public Builder from(ValidateTokenResponse other) { + app(other.getApp()); + error(other.getError()); + errorRedirectUri(other.getErrorRedirectUri()); + oauthAppId(other.getOauthAppId()); + projectAppName(other.getProjectAppName()); + projectEnvironment(other.getProjectEnvironment()); + projectId(other.getProjectId()); + projectSupportEmail(other.getProjectSupportEmail()); + success(other.getSuccess()); + successRedirectUri(other.getSuccessRedirectUri()); + return this; + } + + /** + *

    Whether the token validation was successful

    + *

    Whether the token validation was successful

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("success") + public _FinalStage success(boolean success) { + this.success = success; + return this; + } + + /** + *

    URI to redirect to on success

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage successRedirectUri(String successRedirectUri) { + this.successRedirectUri = Optional.ofNullable(successRedirectUri); + return this; + } + + /** + *

    URI to redirect to on success

    + */ + @java.lang.Override + @JsonSetter(value = "success_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage successRedirectUri(Optional successRedirectUri) { + this.successRedirectUri = successRedirectUri; + return this; + } + + /** + *

    Support email for the project

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage projectSupportEmail(String projectSupportEmail) { + this.projectSupportEmail = Optional.ofNullable(projectSupportEmail); + return this; + } + + /** + *

    Support email for the project

    + */ + @java.lang.Override + @JsonSetter(value = "project_support_email", nulls = Nulls.SKIP) + public _FinalStage projectSupportEmail(Optional projectSupportEmail) { + this.projectSupportEmail = projectSupportEmail; + return this; + } + + /** + *

    ID of the project

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage projectId(String projectId) { + this.projectId = Optional.ofNullable(projectId); + return this; + } + + /** + *

    ID of the project

    + */ + @java.lang.Override + @JsonSetter(value = "project_id", nulls = Nulls.SKIP) + public _FinalStage projectId(Optional projectId) { + this.projectId = projectId; + return this; + } + + /** + *

    Environment of the project

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage projectEnvironment(String projectEnvironment) { + this.projectEnvironment = Optional.ofNullable(projectEnvironment); + return this; + } + + /** + *

    Environment of the project

    + */ + @java.lang.Override + @JsonSetter(value = "project_environment", nulls = Nulls.SKIP) + public _FinalStage projectEnvironment(Optional projectEnvironment) { + this.projectEnvironment = projectEnvironment; + return this; + } + + /** + *

    Name of the project app

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage projectAppName(String projectAppName) { + this.projectAppName = Optional.ofNullable(projectAppName); + return this; + } + + /** + *

    Name of the project app

    + */ + @java.lang.Override + @JsonSetter(value = "project_app_name", nulls = Nulls.SKIP) + public _FinalStage projectAppName(Optional projectAppName) { + this.projectAppName = projectAppName; + return this; + } + + /** + *

    OAuth app ID if applicable

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage oauthAppId(String oauthAppId) { + this.oauthAppId = Optional.ofNullable(oauthAppId); + return this; + } + + /** + *

    OAuth app ID if applicable

    + */ + @java.lang.Override + @JsonSetter(value = "oauth_app_id", nulls = Nulls.SKIP) + public _FinalStage oauthAppId(Optional oauthAppId) { + this.oauthAppId = oauthAppId; + return this; + } + + /** + *

    URI to redirect to on error

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage errorRedirectUri(String errorRedirectUri) { + this.errorRedirectUri = Optional.ofNullable(errorRedirectUri); + return this; + } + + /** + *

    URI to redirect to on error

    + */ + @java.lang.Override + @JsonSetter(value = "error_redirect_uri", nulls = Nulls.SKIP) + public _FinalStage errorRedirectUri(Optional errorRedirectUri) { + this.errorRedirectUri = errorRedirectUri; + return this; + } + + /** + *

    Error message if validation failed

    + * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage error(String error) { + this.error = Optional.ofNullable(error); + return this; + } + + /** + *

    Error message if validation failed

    + */ + @java.lang.Override + @JsonSetter(value = "error", nulls = Nulls.SKIP) + public _FinalStage error(Optional error) { + this.error = error; + return this; + } + + @java.lang.Override + public _FinalStage app(App app) { + this.app = Optional.ofNullable(app); + return this; + } + + @java.lang.Override + @JsonSetter(value = "app", nulls = Nulls.SKIP) + public _FinalStage app(Optional app) { + this.app = app; + return this; + } + + @java.lang.Override + public ValidateTokenResponse build() { + return new ValidateTokenResponse( + app, + error, + errorRedirectUri, + oauthAppId, + projectAppName, + projectEnvironment, + projectId, + projectSupportEmail, + success, + successRedirectUri, + additionalProperties); + } + } +} diff --git a/src/test/java/com/pipedream/api/StreamTest.java b/src/test/java/com/pipedream/api/StreamTest.java new file mode 100644 index 0000000..a0f9ca9 --- /dev/null +++ b/src/test/java/com/pipedream/api/StreamTest.java @@ -0,0 +1,86 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +import static org.junit.jupiter.api.Assertions.*; + +import com.pipedream.api.core.ObjectMappers; +import com.pipedream.api.core.Stream; +import java.io.IOException; +import java.io.StringReader; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; +import org.junit.jupiter.api.Test; + +public final class StreamTest { + @Test + public void testJsonStream() { + List messages = List.of(Map.of("message", "hello"), Map.of("message", "world")); + List jsonStrings = messages.stream().map(StreamTest::mapToJson).toList(); + String input = String.join("\n", jsonStrings); + StringReader jsonInput = new StringReader(input); + Stream jsonStream = Stream.fromJson(Map.class, jsonInput); + int expectedMessages = 2; + int actualMessages = 0; + for (Map jsonObject : jsonStream) { + actualMessages++; + assertTrue(jsonObject.containsKey("message")); + } + assertEquals(expectedMessages, actualMessages); + } + + @Test + public void testSseStream() { + List events = List.of(Map.of("event", "start"), Map.of("event", "end")); + List sseStrings = events.stream().map(StreamTest::mapToSse).toList(); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSse(Map.class, sseInput); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + assertTrue(eventData.containsKey("event")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testSseStreamWithTerminator() { + List events = List.of(Map.of("message", "first"), Map.of("message", "second")); + List sseStrings = events.stream().map(StreamTest::mapToSse).collect(Collectors.toList()); + sseStrings.add("data: [DONE]"); + String input = String.join("\n" + "\n", sseStrings); + StringReader sseInput = new StringReader(input); + Stream sseStream = Stream.fromSse(Map.class, sseInput, "[DONE]"); + int expectedEvents = 2; + int actualEvents = 0; + for (Map eventData : sseStream) { + actualEvents++; + assertTrue(eventData.containsKey("message")); + } + assertEquals(expectedEvents, actualEvents); + } + + @Test + public void testStreamResourceManagement() throws IOException { + StringReader testInput = new StringReader("{\"test\":\"data\"}"); + Stream testStream = Stream.fromJson(Map.class, testInput); + testStream.close(); + assertFalse(testStream.iterator().hasNext()); + } + + private static String mapToJson(Map map) { + try { + return ObjectMappers.JSON_MAPPER.writeValueAsString(map); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + private static String mapToSse(Map map) { + return "data: " + mapToJson(map); + } +} diff --git a/src/test/java/com/pipedream/api/TestClient.java b/src/test/java/com/pipedream/api/TestClient.java new file mode 100644 index 0000000..157ade0 --- /dev/null +++ b/src/test/java/com/pipedream/api/TestClient.java @@ -0,0 +1,11 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api; + +public final class TestClient { + public void test() { + // Add tests here and mark this file in .fernignore + assert true; + } +} diff --git a/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java b/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java new file mode 100644 index 0000000..d8eac81 --- /dev/null +++ b/src/test/java/com/pipedream/api/core/QueryStringMapperTest.java @@ -0,0 +1,339 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ +package com.pipedream.api.core; + +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import okhttp3.HttpUrl; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public final class QueryStringMapperTest { + @Test + public void testObjectWithQuotedString_indexedArrays() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithQuotedString_arraysAsRepeats() { + Map map = new HashMap() { + { + put("hello", "\"world\""); + } + }; + + String expectedQueryString = "withquoted%5Bhello%5D=%22world%22"; + + String actualQueryString = queryString( + new HashMap() { + { + put("withquoted", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_indexedArrays() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObject_arraysAsRepeats() { + Map map = new HashMap() { + { + put("foo", "bar"); + put("baz", "qux"); + } + }; + + String expectedQueryString = "metadata%5Bfoo%5D=bar&metadata%5Bbaz%5D=qux"; + + String actualQueryString = queryString( + new HashMap() { + { + put("metadata", map); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_indexedArrays() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testNestedObject_arraysAsRepeats() { + Map> nestedMap = new HashMap>() { + { + put("mapkey1", new HashMap() { + { + put("mapkey1mapkey1", "mapkey1mapkey1value"); + put("mapkey1mapkey2", "mapkey1mapkey2value"); + } + }); + put("mapkey2", new HashMap() { + { + put("mapkey2mapkey1", "mapkey2mapkey1value"); + } + }); + } + }; + + String expectedQueryString = + "nested%5Bmapkey2%5D%5Bmapkey2mapkey1%5D=mapkey2mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey1" + + "%5D=mapkey1mapkey1value&nested%5Bmapkey1%5D%5Bmapkey1mapkey2%5D=mapkey1mapkey2value"; + + String actualQueryString = queryString( + new HashMap() { + { + put("nested", nestedMap); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_indexedArrays() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testDateTime_arraysAsRepeats() { + OffsetDateTime dateTime = + OffsetDateTime.ofInstant(Instant.ofEpochSecond(1740412107L), ZoneId.of("America/New_York")); + + String expectedQueryString = "datetime=2025-02-24T10%3A48%3A27-05%3A00"; + + String actualQueryString = queryString( + new HashMap() { + { + put("datetime", dateTime); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_indexedArrays() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = "objects%5B0%5D%5Bvalue%5D=world&objects%5B0%5D%5Bkey%5D=hello&objects%5B1%5D" + + "%5Bvalue%5D=bar&objects%5B1%5D%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectArray_arraysAsRepeats() { + List> mapArray = new ArrayList>() { + { + add(new HashMap() { + { + put("key", "hello"); + put("value", "world"); + } + }); + add(new HashMap() { + { + put("key", "foo"); + put("value", "bar"); + } + }); + add(new HashMap<>()); + } + }; + + String expectedQueryString = + "objects%5Bvalue%5D=world&objects%5Bkey%5D=hello&objects%5Bvalue" + "%5D=bar&objects%5Bkey%5D=foo"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objects", mapArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_indexedArrays() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = + "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds%5D%5B0%5D=id1&objectwitharray" + + "%5BcontactIds%5D%5B1%5D=id2&objectwitharray%5BcontactIds%5D%5B2%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + false); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + @Test + public void testObjectWithArray_arraysAsRepeats() { + Map objectWithArray = new HashMap() { + { + put("id", "abc123"); + put("contactIds", new ArrayList() { + { + add("id1"); + add("id2"); + add("id3"); + } + }); + } + }; + + String expectedQueryString = "objectwitharray%5Bid%5D=abc123&objectwitharray%5BcontactIds" + + "%5D=id1&objectwitharray%5BcontactIds%5D=id2&objectwitharray%5BcontactIds%5D=id3"; + + String actualQueryString = queryString( + new HashMap() { + { + put("objectwitharray", objectWithArray); + } + }, + true); + + Assertions.assertEquals(expectedQueryString, actualQueryString); + } + + private static String queryString(Map params, boolean arraysAsRepeats) { + HttpUrl.Builder httpUrl = HttpUrl.parse("http://www.fakewebsite.com/").newBuilder(); + params.forEach((paramName, paramValue) -> + QueryStringMapper.addQueryParameter(httpUrl, paramName, paramValue, arraysAsRepeats)); + return httpUrl.build().encodedQuery(); + } +}