Skip to content

Commit e8d824a

Browse files
Type-related improvements (#106)
* Define the types for all configured and configurable props * Fix the "observations" type when configuring a prop * Add the `component_type` query param when listing components using the "generic" route/path --------- Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
1 parent 092f40f commit e8d824a

File tree

61 files changed

+1786
-1112
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1786
-1112
lines changed

README.md

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![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)
44
[![Maven Central](https://img.shields.io/maven-central/v/com.pipedream/pipedream)](https://central.sonatype.com/artifact/com.pipedream/pipedream)
55

6-
The Pipedream Java library provides convenient access to the Pipedream API from Java.
6+
The Pipedream Java library provides convenient access to the Pipedream APIs from Java.
77

88
## Installation
99

@@ -25,7 +25,7 @@ Add the dependency in your `pom.xml` file:
2525
<dependency>
2626
<groupId>com.pipedream</groupId>
2727
<artifactId>pipedream</artifactId>
28-
<version>1.0.2</version>
28+
<version>1.0.3</version>
2929
</dependency>
3030
```
3131

@@ -166,6 +166,32 @@ client.actions().run(
166166
);
167167
```
168168

169+
### Custom Headers
170+
171+
The SDK allows you to add custom headers to requests. You can configure headers at the client level or at the request level.
172+
173+
```java
174+
import com.pipedream.api.BaseClient;
175+
import com.pipedream.api.core.RequestOptions;
176+
177+
// Client level
178+
BaseClient client = BaseClient
179+
.builder()
180+
.addHeader("X-Custom-Header", "custom-value")
181+
.addHeader("X-Request-Id", "abc-123")
182+
.build();
183+
;
184+
185+
// Request level
186+
client.actions().run(
187+
...,
188+
RequestOptions
189+
.builder()
190+
.addHeader("X-Request-Header", "request-value")
191+
.build()
192+
);
193+
```
194+
169195
## Contributing
170196

171197
While we value open-source contributions to this SDK, this library is generated programmatically.
@@ -174,4 +200,7 @@ otherwise they would be overwritten upon the next generated release. Feel free t
174200
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
175201
an issue first to discuss with us!
176202

177-
On the other hand, contributions to the README are always very welcome!
203+
On the other hand, contributions to the README are always very welcome!
204+
## Reference
205+
206+
A full reference for this library is available [here](https://github.com/PipedreamHQ/pipedream-sdk-java/blob/HEAD/./reference.md).

build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ java {
4848

4949
group = 'com.pipedream'
5050

51-
version = '1.0.2'
51+
version = '1.0.3'
5252

5353
jar {
5454
dependsOn(":generatePomFileForMavenPublication")
@@ -79,7 +79,7 @@ publishing {
7979
maven(MavenPublication) {
8080
groupId = 'com.pipedream'
8181
artifactId = 'pipedream'
82-
version = '1.0.2'
82+
version = '1.0.3'
8383
from components.java
8484
pom {
8585
name = 'pipedream'
@@ -123,9 +123,10 @@ sonatypeCentralUpload {
123123
}
124124

125125
signing {
126-
def signingKeyId = "$System.env.MAVEN_SIGNATURE_SECRET_KEY"
126+
def signingKeyId = "$System.env.MAVEN_SIGNATURE_KID"
127+
def signingKey = "$System.env.MAVEN_SIGNATURE_SECRET_KEY"
127128
def signingPassword = "$System.env.MAVEN_SIGNATURE_PASSWORD"
128-
useInMemoryPgpKeys(signingKeyId, signingPassword)
129+
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
129130
sign publishing.publications.maven
130131
}
131132

src/main/java/com/pipedream/api/core/ClientOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ private ClientOptions(
3535
this.headers.putAll(headers);
3636
this.headers.putAll(new HashMap<String, String>() {
3737
{
38-
put("User-Agent", "com.pipedream:pipedream/1.0.2");
38+
put("User-Agent", "com.pipedream:pipedream/1.0.3");
3939
put("X-Fern-Language", "JAVA");
4040
put("X-Fern-SDK-Name", "com.pipedream.fern:api-sdk");
41-
put("X-Fern-SDK-Version", "1.0.2");
41+
put("X-Fern-SDK-Version", "1.0.3");
4242
}
4343
});
4444
this.headerSuppliers = headerSuppliers;

src/main/java/com/pipedream/api/resources/actions/requests/RunActionOpts.java

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.fasterxml.jackson.annotation.Nulls;
1313
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
1414
import com.pipedream.api.core.ObjectMappers;
15+
import com.pipedream.api.types.ConfiguredPropValue;
1516
import com.pipedream.api.types.RunActionOptsStashId;
1617
import java.util.HashMap;
1718
import java.util.Map;
@@ -26,7 +27,7 @@ public final class RunActionOpts {
2627

2728
private final String externalUserId;
2829

29-
private final Optional<Map<String, Object>> configuredProps;
30+
private final Optional<Map<String, ConfiguredPropValue>> configuredProps;
3031

3132
private final Optional<String> dynamicPropsId;
3233

@@ -37,7 +38,7 @@ public final class RunActionOpts {
3738
private RunActionOpts(
3839
String id,
3940
String externalUserId,
40-
Optional<Map<String, Object>> configuredProps,
41+
Optional<Map<String, ConfiguredPropValue>> configuredProps,
4142
Optional<String> dynamicPropsId,
4243
Optional<RunActionOptsStashId> stashId,
4344
Map<String, Object> additionalProperties) {
@@ -65,11 +66,8 @@ public String getExternalUserId() {
6566
return externalUserId;
6667
}
6768

68-
/**
69-
* @return The configured properties for the action
70-
*/
7169
@JsonProperty("configured_props")
72-
public Optional<Map<String, Object>> getConfiguredProps() {
70+
public Optional<Map<String, ConfiguredPropValue>> getConfiguredProps() {
7371
return configuredProps;
7472
}
7573

@@ -138,12 +136,9 @@ public interface ExternalUserIdStage {
138136
public interface _FinalStage {
139137
RunActionOpts build();
140138

141-
/**
142-
* <p>The configured properties for the action</p>
143-
*/
144-
_FinalStage configuredProps(Optional<Map<String, Object>> configuredProps);
139+
_FinalStage configuredProps(Optional<Map<String, ConfiguredPropValue>> configuredProps);
145140

146-
_FinalStage configuredProps(Map<String, Object> configuredProps);
141+
_FinalStage configuredProps(Map<String, ConfiguredPropValue> configuredProps);
147142

148143
/**
149144
* <p>The ID for dynamic props</p>
@@ -167,7 +162,7 @@ public static final class Builder implements IdStage, ExternalUserIdStage, _Fina
167162

168163
private Optional<String> dynamicPropsId = Optional.empty();
169164

170-
private Optional<Map<String, Object>> configuredProps = Optional.empty();
165+
private Optional<Map<String, ConfiguredPropValue>> configuredProps = Optional.empty();
171166

172167
@JsonAnySetter
173168
private Map<String, Object> additionalProperties = new HashMap<>();
@@ -241,22 +236,15 @@ public _FinalStage dynamicPropsId(Optional<String> dynamicPropsId) {
241236
return this;
242237
}
243238

244-
/**
245-
* <p>The configured properties for the action</p>
246-
* @return Reference to {@code this} so that method calls can be chained together.
247-
*/
248239
@java.lang.Override
249-
public _FinalStage configuredProps(Map<String, Object> configuredProps) {
240+
public _FinalStage configuredProps(Map<String, ConfiguredPropValue> configuredProps) {
250241
this.configuredProps = Optional.ofNullable(configuredProps);
251242
return this;
252243
}
253244

254-
/**
255-
* <p>The configured properties for the action</p>
256-
*/
257245
@java.lang.Override
258246
@JsonSetter(value = "configured_props", nulls = Nulls.SKIP)
259-
public _FinalStage configuredProps(Optional<Map<String, Object>> configuredProps) {
247+
public _FinalStage configuredProps(Optional<Map<String, ConfiguredPropValue>> configuredProps) {
260248
this.configuredProps = configuredProps;
261249
return this;
262250
}

src/main/java/com/pipedream/api/resources/components/AsyncRawComponentsClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ public CompletableFuture<BaseClientHttpResponse<SyncPagingIterable<Component>>>
8787
if (request.getApp().isPresent()) {
8888
QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false);
8989
}
90+
if (request.getComponentType().isPresent()) {
91+
QueryStringMapper.addQueryParameter(
92+
httpUrl, "component_type", request.getComponentType().get(), false);
93+
}
9094
Request.Builder _requestBuilder = new Request.Builder()
9195
.url(httpUrl.build())
9296
.method("GET", null)

src/main/java/com/pipedream/api/resources/components/RawComponentsClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public BaseClientHttpResponse<SyncPagingIterable<Component>> list(
8181
if (request.getApp().isPresent()) {
8282
QueryStringMapper.addQueryParameter(httpUrl, "app", request.getApp().get(), false);
8383
}
84+
if (request.getComponentType().isPresent()) {
85+
QueryStringMapper.addQueryParameter(
86+
httpUrl, "component_type", request.getComponentType().get(), false);
87+
}
8488
Request.Builder _requestBuilder = new Request.Builder()
8589
.url(httpUrl.build())
8690
.method("GET", null)

src/main/java/com/pipedream/api/resources/components/requests/ComponentsListRequest.java

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.fasterxml.jackson.annotation.Nulls;
1313
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
1414
import com.pipedream.api.core.ObjectMappers;
15+
import com.pipedream.api.types.ComponentType;
1516
import java.util.HashMap;
1617
import java.util.Map;
1718
import java.util.Objects;
@@ -30,6 +31,8 @@ public final class ComponentsListRequest {
3031

3132
private final Optional<String> app;
3233

34+
private final Optional<ComponentType> componentType;
35+
3336
private final Map<String, Object> additionalProperties;
3437

3538
private ComponentsListRequest(
@@ -38,12 +41,14 @@ private ComponentsListRequest(
3841
Optional<Integer> limit,
3942
Optional<String> q,
4043
Optional<String> app,
44+
Optional<ComponentType> componentType,
4145
Map<String, Object> additionalProperties) {
4246
this.after = after;
4347
this.before = before;
4448
this.limit = limit;
4549
this.q = q;
4650
this.app = app;
51+
this.componentType = componentType;
4752
this.additionalProperties = additionalProperties;
4853
}
4954

@@ -87,6 +92,14 @@ public Optional<String> getApp() {
8792
return app;
8893
}
8994

95+
/**
96+
* @return The type of the component to filter the components
97+
*/
98+
@JsonProperty("component_type")
99+
public Optional<ComponentType> getComponentType() {
100+
return componentType;
101+
}
102+
90103
@java.lang.Override
91104
public boolean equals(Object other) {
92105
if (this == other) return true;
@@ -103,12 +116,13 @@ private boolean equalTo(ComponentsListRequest other) {
103116
&& before.equals(other.before)
104117
&& limit.equals(other.limit)
105118
&& q.equals(other.q)
106-
&& app.equals(other.app);
119+
&& app.equals(other.app)
120+
&& componentType.equals(other.componentType);
107121
}
108122

109123
@java.lang.Override
110124
public int hashCode() {
111-
return Objects.hash(this.after, this.before, this.limit, this.q, this.app);
125+
return Objects.hash(this.after, this.before, this.limit, this.q, this.app, this.componentType);
112126
}
113127

114128
@java.lang.Override
@@ -132,6 +146,8 @@ public static final class Builder {
132146

133147
private Optional<String> app = Optional.empty();
134148

149+
private Optional<ComponentType> componentType = Optional.empty();
150+
135151
@JsonAnySetter
136152
private Map<String, Object> additionalProperties = new HashMap<>();
137153

@@ -143,6 +159,7 @@ public Builder from(ComponentsListRequest other) {
143159
limit(other.getLimit());
144160
q(other.getQ());
145161
app(other.getApp());
162+
componentType(other.getComponentType());
146163
return this;
147164
}
148165

@@ -216,8 +233,22 @@ public Builder app(String app) {
216233
return this;
217234
}
218235

236+
/**
237+
* <p>The type of the component to filter the components</p>
238+
*/
239+
@JsonSetter(value = "component_type", nulls = Nulls.SKIP)
240+
public Builder componentType(Optional<ComponentType> componentType) {
241+
this.componentType = componentType;
242+
return this;
243+
}
244+
245+
public Builder componentType(ComponentType componentType) {
246+
this.componentType = Optional.ofNullable(componentType);
247+
return this;
248+
}
249+
219250
public ComponentsListRequest build() {
220-
return new ComponentsListRequest(after, before, limit, q, app, additionalProperties);
251+
return new ComponentsListRequest(after, before, limit, q, app, componentType, additionalProperties);
221252
}
222253
}
223254
}

0 commit comments

Comments
 (0)