1010import com .pipedream .api .resources .proxy .requests .ProxyPatchRequest ;
1111import com .pipedream .api .resources .proxy .requests .ProxyPostRequest ;
1212import com .pipedream .api .resources .proxy .requests .ProxyPutRequest ;
13+
14+ import java .util .Base64 ;
1315import java .util .concurrent .CompletableFuture ;
1416
1517public class AsyncProxyClient {
@@ -22,6 +24,10 @@ public AsyncProxyClient(ClientOptions clientOptions) {
2224 this .rawClient = new AsyncRawProxyClient (clientOptions );
2325 }
2426
27+ private String encodeUrl (String url ) {
28+ return Base64 .getUrlEncoder ().encodeToString (url .getBytes ());
29+ }
30+
2531 /**
2632 * Get responses with HTTP metadata like headers
2733 */
@@ -32,70 +38,80 @@ public AsyncRawProxyClient withRawResponse() {
3238 /**
3339 * Forward an authenticated GET request to an external API using an external user's account credentials
3440 */
35- public CompletableFuture <Object > get (String url64 , ProxyGetRequest request ) {
41+ public CompletableFuture <Object > get (String url , ProxyGetRequest request ) {
42+ final String url64 = encodeUrl (url );
3643 return this .rawClient .get (url64 , request ).thenApply (response -> response .body ());
3744 }
3845
3946 /**
4047 * Forward an authenticated GET request to an external API using an external user's account credentials
4148 */
42- public CompletableFuture <Object > get (String url64 , ProxyGetRequest request , RequestOptions requestOptions ) {
49+ public CompletableFuture <Object > get (String url , ProxyGetRequest request , RequestOptions requestOptions ) {
50+ final String url64 = encodeUrl (url );
4351 return this .rawClient .get (url64 , request , requestOptions ).thenApply (response -> response .body ());
4452 }
4553
4654 /**
4755 * Forward an authenticated POST request to an external API using an external user's account credentials
4856 */
49- public CompletableFuture <Object > post (String url64 , ProxyPostRequest request ) {
57+ public CompletableFuture <Object > post (String url , ProxyPostRequest request ) {
58+ final String url64 = encodeUrl (url );
5059 return this .rawClient .post (url64 , request ).thenApply (response -> response .body ());
5160 }
5261
5362 /**
5463 * Forward an authenticated POST request to an external API using an external user's account credentials
5564 */
56- public CompletableFuture <Object > post (String url64 , ProxyPostRequest request , RequestOptions requestOptions ) {
65+ public CompletableFuture <Object > post (String url , ProxyPostRequest request , RequestOptions requestOptions ) {
66+ final String url64 = encodeUrl (url );
5767 return this .rawClient .post (url64 , request , requestOptions ).thenApply (response -> response .body ());
5868 }
5969
6070 /**
6171 * Forward an authenticated PUT request to an external API using an external user's account credentials
6272 */
63- public CompletableFuture <Object > put (String url64 , ProxyPutRequest request ) {
73+ public CompletableFuture <Object > put (String url , ProxyPutRequest request ) {
74+ final String url64 = encodeUrl (url );
6475 return this .rawClient .put (url64 , request ).thenApply (response -> response .body ());
6576 }
6677
6778 /**
6879 * Forward an authenticated PUT request to an external API using an external user's account credentials
6980 */
70- public CompletableFuture <Object > put (String url64 , ProxyPutRequest request , RequestOptions requestOptions ) {
81+ public CompletableFuture <Object > put (String url , ProxyPutRequest request , RequestOptions requestOptions ) {
82+ final String url64 = encodeUrl (url );
7183 return this .rawClient .put (url64 , request , requestOptions ).thenApply (response -> response .body ());
7284 }
7385
7486 /**
7587 * Forward an authenticated DELETE request to an external API using an external user's account credentials
7688 */
77- public CompletableFuture <Object > delete (String url64 , ProxyDeleteRequest request ) {
89+ public CompletableFuture <Object > delete (String url , ProxyDeleteRequest request ) {
90+ final String url64 = encodeUrl (url );
7891 return this .rawClient .delete (url64 , request ).thenApply (response -> response .body ());
7992 }
8093
8194 /**
8295 * Forward an authenticated DELETE request to an external API using an external user's account credentials
8396 */
84- public CompletableFuture <Object > delete (String url64 , ProxyDeleteRequest request , RequestOptions requestOptions ) {
97+ public CompletableFuture <Object > delete (String url , ProxyDeleteRequest request , RequestOptions requestOptions ) {
98+ final String url64 = encodeUrl (url );
8599 return this .rawClient .delete (url64 , request , requestOptions ).thenApply (response -> response .body ());
86100 }
87101
88102 /**
89103 * Forward an authenticated PATCH request to an external API using an external user's account credentials
90104 */
91- public CompletableFuture <Object > patch (String url64 , ProxyPatchRequest request ) {
105+ public CompletableFuture <Object > patch (String url , ProxyPatchRequest request ) {
106+ final String url64 = encodeUrl (url );
92107 return this .rawClient .patch (url64 , request ).thenApply (response -> response .body ());
93108 }
94109
95110 /**
96111 * Forward an authenticated PATCH request to an external API using an external user's account credentials
97112 */
98- public CompletableFuture <Object > patch (String url64 , ProxyPatchRequest request , RequestOptions requestOptions ) {
113+ public CompletableFuture <Object > patch (String url , ProxyPatchRequest request , RequestOptions requestOptions ) {
114+ final String url64 = encodeUrl (url );
99115 return this .rawClient .patch (url64 , request , requestOptions ).thenApply (response -> response .body ());
100116 }
101117}
0 commit comments