Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e190e39

Browse files
Accept "stash ID" when running actions (#31)
* Add the `stash_id` field to the "run action" opts * Bump version --------- Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: Jay Vercellone <[email protected]> Co-authored-by: Jay Vercellone <[email protected]>
1 parent 03a3412 commit e190e39

File tree

5 files changed

+155
-5
lines changed

5 files changed

+155
-5
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ java {
4747

4848
group = 'com.pipedream'
4949

50-
version = '0.0.2'
50+
version = '1.0.0'
5151

5252
jar {
5353
dependsOn(":generatePomFileForMavenPublication")
@@ -78,7 +78,7 @@ publishing {
7878
maven(MavenPublication) {
7979
groupId = 'com.pipedream'
8080
artifactId = 'pipedream'
81-
version = '0.0.2'
81+
version = '1.0.0'
8282
from components.java
8383
pom {
8484
name = 'pipedream'

src/main/java/com/pipedream/api/resources/actions/AsyncRawActionsClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,9 @@ public CompletableFuture<BaseClientHttpResponse<RunActionResponse>> run(
343343
if (request.getDynamicPropsId().isPresent()) {
344344
properties.put("dynamic_props_id", request.getDynamicPropsId());
345345
}
346+
if (request.getStashId().isPresent()) {
347+
properties.put("stash_id", request.getStashId());
348+
}
346349
RequestBody body;
347350
try {
348351
body = RequestBody.create(

src/main/java/com/pipedream/api/resources/actions/RawActionsClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ public BaseClientHttpResponse<RunActionResponse> run(RunActionOpts request, Requ
275275
if (request.getDynamicPropsId().isPresent()) {
276276
properties.put("dynamic_props_id", request.getDynamicPropsId());
277277
}
278+
if (request.getStashId().isPresent()) {
279+
properties.put("stash_id", request.getStashId());
280+
}
278281
RequestBody body;
279282
try {
280283
body = RequestBody.create(

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

Lines changed: 53 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.resources.actions.types.RunActionOptsStashId;
1516
import java.util.HashMap;
1617
import java.util.Map;
1718
import java.util.Objects;
@@ -31,6 +32,8 @@ public final class RunActionOpts {
3132

3233
private final Optional<String> dynamicPropsId;
3334

35+
private final Optional<RunActionOptsStashId> stashId;
36+
3437
private final Map<String, Object> additionalProperties;
3538

3639
private RunActionOpts(
@@ -39,12 +42,14 @@ private RunActionOpts(
3942
String externalUserId,
4043
Optional<Map<String, Object>> configuredProps,
4144
Optional<String> dynamicPropsId,
45+
Optional<RunActionOptsStashId> stashId,
4246
Map<String, Object> additionalProperties) {
4347
this.asyncHandle = asyncHandle;
4448
this.id = id;
4549
this.externalUserId = externalUserId;
4650
this.configuredProps = configuredProps;
4751
this.dynamicPropsId = dynamicPropsId;
52+
this.stashId = stashId;
4853
this.additionalProperties = additionalProperties;
4954
}
5055

@@ -85,6 +90,14 @@ public Optional<String> getDynamicPropsId() {
8590
return dynamicPropsId;
8691
}
8792

93+
/**
94+
* @return The ID of the File Stash to use for syncing the action's /tmp directory
95+
*/
96+
@JsonProperty("stash_id")
97+
public Optional<RunActionOptsStashId> getStashId() {
98+
return stashId;
99+
}
100+
88101
@java.lang.Override
89102
public boolean equals(Object other) {
90103
if (this == other) return true;
@@ -101,12 +114,19 @@ private boolean equalTo(RunActionOpts other) {
101114
&& id.equals(other.id)
102115
&& externalUserId.equals(other.externalUserId)
103116
&& configuredProps.equals(other.configuredProps)
104-
&& dynamicPropsId.equals(other.dynamicPropsId);
117+
&& dynamicPropsId.equals(other.dynamicPropsId)
118+
&& stashId.equals(other.stashId);
105119
}
106120

107121
@java.lang.Override
108122
public int hashCode() {
109-
return Objects.hash(this.asyncHandle, this.id, this.externalUserId, this.configuredProps, this.dynamicPropsId);
123+
return Objects.hash(
124+
this.asyncHandle,
125+
this.id,
126+
this.externalUserId,
127+
this.configuredProps,
128+
this.dynamicPropsId,
129+
this.stashId);
110130
}
111131

112132
@java.lang.Override
@@ -154,6 +174,13 @@ public interface _FinalStage {
154174
_FinalStage dynamicPropsId(Optional<String> dynamicPropsId);
155175

156176
_FinalStage dynamicPropsId(String dynamicPropsId);
177+
178+
/**
179+
* <p>The ID of the File Stash to use for syncing the action's /tmp directory</p>
180+
*/
181+
_FinalStage stashId(Optional<RunActionOptsStashId> stashId);
182+
183+
_FinalStage stashId(RunActionOptsStashId stashId);
157184
}
158185

159186
@JsonIgnoreProperties(ignoreUnknown = true)
@@ -162,6 +189,8 @@ public static final class Builder implements IdStage, ExternalUserIdStage, _Fina
162189

163190
private String externalUserId;
164191

192+
private Optional<RunActionOptsStashId> stashId = Optional.empty();
193+
165194
private Optional<String> dynamicPropsId = Optional.empty();
166195

167196
private Optional<Map<String, Object>> configuredProps = Optional.empty();
@@ -180,6 +209,7 @@ public Builder from(RunActionOpts other) {
180209
externalUserId(other.getExternalUserId());
181210
configuredProps(other.getConfiguredProps());
182211
dynamicPropsId(other.getDynamicPropsId());
212+
stashId(other.getStashId());
183213
return this;
184214
}
185215

@@ -207,6 +237,26 @@ public _FinalStage externalUserId(@NotNull String externalUserId) {
207237
return this;
208238
}
209239

240+
/**
241+
* <p>The ID of the File Stash to use for syncing the action's /tmp directory</p>
242+
* @return Reference to {@code this} so that method calls can be chained together.
243+
*/
244+
@java.lang.Override
245+
public _FinalStage stashId(RunActionOptsStashId stashId) {
246+
this.stashId = Optional.ofNullable(stashId);
247+
return this;
248+
}
249+
250+
/**
251+
* <p>The ID of the File Stash to use for syncing the action's /tmp directory</p>
252+
*/
253+
@java.lang.Override
254+
@JsonSetter(value = "stash_id", nulls = Nulls.SKIP)
255+
public _FinalStage stashId(Optional<RunActionOptsStashId> stashId) {
256+
this.stashId = stashId;
257+
return this;
258+
}
259+
210260
/**
211261
* <p>The ID for dynamic props</p>
212262
* @return Reference to {@code this} so that method calls can be chained together.
@@ -263,7 +313,7 @@ public _FinalStage asyncHandle(Optional<String> asyncHandle) {
263313
@java.lang.Override
264314
public RunActionOpts build() {
265315
return new RunActionOpts(
266-
asyncHandle, id, externalUserId, configuredProps, dynamicPropsId, additionalProperties);
316+
asyncHandle, id, externalUserId, configuredProps, dynamicPropsId, stashId, additionalProperties);
267317
}
268318
}
269319
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/**
2+
* This file was auto-generated by Fern from our API Definition.
3+
*/
4+
package com.pipedream.api.resources.actions.types;
5+
6+
import com.fasterxml.jackson.annotation.JsonValue;
7+
import com.fasterxml.jackson.core.JsonParseException;
8+
import com.fasterxml.jackson.core.JsonParser;
9+
import com.fasterxml.jackson.databind.DeserializationContext;
10+
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
11+
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
12+
import com.pipedream.api.core.ObjectMappers;
13+
import java.io.IOException;
14+
import java.util.Objects;
15+
16+
@JsonDeserialize(using = RunActionOptsStashId.Deserializer.class)
17+
public final class RunActionOptsStashId {
18+
private final Object value;
19+
20+
private final int type;
21+
22+
private RunActionOptsStashId(Object value, int type) {
23+
this.value = value;
24+
this.type = type;
25+
}
26+
27+
@JsonValue
28+
public Object get() {
29+
return this.value;
30+
}
31+
32+
@SuppressWarnings("unchecked")
33+
public <T> T visit(Visitor<T> visitor) {
34+
if (this.type == 0) {
35+
return visitor.visit((String) this.value);
36+
} else if (this.type == 1) {
37+
return visitor.visit((boolean) this.value);
38+
}
39+
throw new IllegalStateException("Failed to visit value. This should never happen.");
40+
}
41+
42+
@java.lang.Override
43+
public boolean equals(Object other) {
44+
if (this == other) return true;
45+
return other instanceof RunActionOptsStashId && equalTo((RunActionOptsStashId) other);
46+
}
47+
48+
private boolean equalTo(RunActionOptsStashId other) {
49+
return value.equals(other.value);
50+
}
51+
52+
@java.lang.Override
53+
public int hashCode() {
54+
return Objects.hash(this.value);
55+
}
56+
57+
@java.lang.Override
58+
public String toString() {
59+
return this.value.toString();
60+
}
61+
62+
public static RunActionOptsStashId of(String value) {
63+
return new RunActionOptsStashId(value, 0);
64+
}
65+
66+
public static RunActionOptsStashId of(boolean value) {
67+
return new RunActionOptsStashId(value, 1);
68+
}
69+
70+
public interface Visitor<T> {
71+
T visit(String value);
72+
73+
T visit(boolean value);
74+
}
75+
76+
static final class Deserializer extends StdDeserializer<RunActionOptsStashId> {
77+
Deserializer() {
78+
super(RunActionOptsStashId.class);
79+
}
80+
81+
@java.lang.Override
82+
public RunActionOptsStashId deserialize(JsonParser p, DeserializationContext context) throws IOException {
83+
Object value = p.readValueAs(Object.class);
84+
try {
85+
return of(ObjectMappers.JSON_MAPPER.convertValue(value, String.class));
86+
} catch (IllegalArgumentException e) {
87+
}
88+
if (value instanceof Boolean) {
89+
return of((Boolean) value);
90+
}
91+
throw new JsonParseException(p, "Failed to deserialize");
92+
}
93+
}
94+
}

0 commit comments

Comments
 (0)