Skip to content

Commit eb3fe32

Browse files
Add dropdown options to template responses (#560)
1 parent 330e294 commit eb3fe32

20 files changed

Lines changed: 249 additions & 12 deletions

openapi-raw.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12589,6 +12589,11 @@ components:
1258912589
description: '_t__TemplateResponseDocumentFormField::GROUP'
1259012590
type: string
1259112591
nullable: true
12592+
options:
12593+
description: '_t__TemplateResponseDocumentFormField::OPTIONS'
12594+
type: array
12595+
items:
12596+
type: string
1259212597
type: object
1259312598
TemplateResponseDocumentFormFieldHyperlink:
1259412599
description: '_t__TemplateResponseDocumentFormField::DESCRIPTION_EXTENDS'

openapi-sdk.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13072,6 +13072,11 @@ components:
1307213072
description: 'The name of the group this field is in. If this field is not a group, this defaults to `null` except for Radio fields.'
1307313073
type: string
1307413074
nullable: true
13075+
options:
13076+
description: 'The options available for this dropdown form field.'
13077+
type: array
13078+
items:
13079+
type: string
1307513080
type: object
1307613081
TemplateResponseDocumentFormFieldHyperlink:
1307713082
description: 'This class extends `TemplateResponseDocumentFormFieldBase`'

openapi.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13058,6 +13058,11 @@ components:
1305813058
description: 'The name of the group this field is in. If this field is not a group, this defaults to `null` except for Radio fields.'
1305913059
type: string
1306013060
nullable: true
13061+
options:
13062+
description: 'The options available for this dropdown form field.'
13063+
type: array
13064+
items:
13065+
type: string
1306113066
type: object
1306213067
TemplateResponseDocumentFormFieldHyperlink:
1306313068
description: 'This class extends `TemplateResponseDocumentFormFieldBase`'

sdks/dotnet/docs/TemplateResponseDocumentFormFieldDropdown.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Name | Type | Description | Notes
1313
**Width** | **int** | The width in pixels of this form field. | [optional]
1414
**Height** | **int** | The height in pixels of this form field. | [optional]
1515
**Required** | **bool** | Boolean showing whether or not this field is required. | [optional]
16-
**Type** | **string** | The type of this form field. See [field types](/api/reference/constants/#field-types).<br><br>* Text Field uses `TemplateResponseDocumentFormFieldText`<br>* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`<br>* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`<br>* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`<br>* Radio Field uses `TemplateResponseDocumentFormFieldRadio`<br>* Signature Field uses `TemplateResponseDocumentFormFieldSignature`<br>* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`<br>* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | [default to "dropdown"]**Group** | **string** | The name of the group this field is in. If this field is not a group, this defaults to `null` except for Radio fields. | [optional]
16+
**Type** | **string** | The type of this form field. See [field types](/api/reference/constants/#field-types).<br><br>* Text Field uses `TemplateResponseDocumentFormFieldText`<br>* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`<br>* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`<br>* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`<br>* Radio Field uses `TemplateResponseDocumentFormFieldRadio`<br>* Signature Field uses `TemplateResponseDocumentFormFieldSignature`<br>* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`<br>* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | [default to "dropdown"]**Group** | **string** | The name of the group this field is in. If this field is not a group, this defaults to `null` except for Radio fields. | [optional] **Options** | **List&lt;string&gt;** | The options available for this dropdown form field. | [optional]
1717

1818
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1919

sdks/dotnet/src/Dropbox.Sign/Model/TemplateResponseDocumentFormFieldDropdown.cs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ protected TemplateResponseDocumentFormFieldDropdown() { }
4343
/// </summary>
4444
/// <param name="type">The type of this form field. See [field types](/api/reference/constants/#field-types). * Text Field uses &#x60;TemplateResponseDocumentFormFieldText&#x60; * Dropdown Field uses &#x60;TemplateResponseDocumentFormFieldDropdown&#x60; * Hyperlink Field uses &#x60;TemplateResponseDocumentFormFieldHyperlink&#x60; * Checkbox Field uses &#x60;TemplateResponseDocumentFormFieldCheckbox&#x60; * Radio Field uses &#x60;TemplateResponseDocumentFormFieldRadio&#x60; * Signature Field uses &#x60;TemplateResponseDocumentFormFieldSignature&#x60; * Date Signed Field uses &#x60;TemplateResponseDocumentFormFieldDateSigned&#x60; * Initials Field uses &#x60;TemplateResponseDocumentFormFieldInitials&#x60; (required) (default to &quot;dropdown&quot;).</param>
4545
/// <param name="group">The name of the group this field is in. If this field is not a group, this defaults to &#x60;null&#x60; except for Radio fields..</param>
46+
/// <param name="options">The options available for this dropdown form field..</param>
4647
/// <param name="apiId">A unique id for the form field..</param>
4748
/// <param name="name">The name of the form field..</param>
4849
/// <param name="signer">The signer of the Form Field..</param>
@@ -51,7 +52,7 @@ protected TemplateResponseDocumentFormFieldDropdown() { }
5152
/// <param name="width">The width in pixels of this form field..</param>
5253
/// <param name="height">The height in pixels of this form field..</param>
5354
/// <param name="required">Boolean showing whether or not this field is required..</param>
54-
public TemplateResponseDocumentFormFieldDropdown(string type = @"dropdown", string group = default(string), string apiId = default(string), string name = default(string), Object signer = null, int x = default(int), int y = default(int), int width = default(int), int height = default(int), bool required = default(bool))
55+
public TemplateResponseDocumentFormFieldDropdown(string type = @"dropdown", string group = default(string), List<string> options = default(List<string>), string apiId = default(string), string name = default(string), Object signer = null, int x = default(int), int y = default(int), int width = default(int), int height = default(int), bool required = default(bool))
5556
{
5657
this.ApiId = apiId;
5758
this.Name = name;
@@ -69,6 +70,7 @@ protected TemplateResponseDocumentFormFieldDropdown() { }
6970
}
7071
this.Type = type;
7172
this.Group = group;
73+
this.Options = options;
7274
}
7375

7476
/// <summary>
@@ -101,6 +103,13 @@ public static TemplateResponseDocumentFormFieldDropdown Init(string jsonData)
101103
[DataMember(Name = "group", EmitDefaultValue = true)]
102104
public string Group { get; set; }
103105

106+
/// <summary>
107+
/// The options available for this dropdown form field.
108+
/// </summary>
109+
/// <value>The options available for this dropdown form field.</value>
110+
[DataMember(Name = "options", EmitDefaultValue = true)]
111+
public List<string> Options { get; set; }
112+
104113
/// <summary>
105114
/// Returns the string presentation of the object
106115
/// </summary>
@@ -112,6 +121,7 @@ public override string ToString()
112121
sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n");
113122
sb.Append(" Type: ").Append(Type).Append("\n");
114123
sb.Append(" Group: ").Append(Group).Append("\n");
124+
sb.Append(" Options: ").Append(Options).Append("\n");
115125
sb.Append("}\n");
116126
return sb.ToString();
117127
}
@@ -156,6 +166,12 @@ public bool Equals(TemplateResponseDocumentFormFieldDropdown input)
156166
this.Group == input.Group ||
157167
(this.Group != null &&
158168
this.Group.Equals(input.Group))
169+
) && base.Equals(input) &&
170+
(
171+
this.Options == input.Options ||
172+
this.Options != null &&
173+
input.Options != null &&
174+
this.Options.SequenceEqual(input.Options)
159175
);
160176
}
161177

@@ -176,6 +192,10 @@ public override int GetHashCode()
176192
{
177193
hashCode = (hashCode * 59) + this.Group.GetHashCode();
178194
}
195+
if (this.Options != null)
196+
{
197+
hashCode = (hashCode * 59) + this.Options.GetHashCode();
198+
}
179199
return hashCode;
180200
}
181201
}
@@ -220,6 +240,13 @@ public List<OpenApiType> GetOpenApiTypes()
220240
Type = "string",
221241
Value = Group,
222242
});
243+
types.Add(new OpenApiType()
244+
{
245+
Name = "options",
246+
Property = "Options",
247+
Type = "List<string>",
248+
Value = Options,
249+
});
223250

224251
return types;
225252
}

sdks/java-v1/docs/TemplateResponseDocumentFormFieldDropdown.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This class extends `TemplateResponseDocumentFormFieldBase`
1010
|------------ | ------------- | ------------- | -------------|
1111
| `type`<sup>*_required_</sup> | ```String``` | The type of this form field. See [field types](/api/reference/constants/#field-types).<br><br>* Text Field uses `TemplateResponseDocumentFormFieldText`<br>* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`<br>* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`<br>* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`<br>* Radio Field uses `TemplateResponseDocumentFormFieldRadio`<br>* Signature Field uses `TemplateResponseDocumentFormFieldSignature`<br>* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`<br>* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | |
1212
| `group` | ```String``` | The name of the group this field is in. If this field is not a group, this defaults to `null` except for Radio fields. | |
13+
| `options` | ```List<String>``` | The options available for this dropdown form field. | |
1314

1415

1516

sdks/java-v1/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDropdown.java

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@
2020
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
2121
import com.fasterxml.jackson.annotation.JsonTypeInfo;
2222
import com.fasterxml.jackson.databind.ObjectMapper;
23+
import java.util.ArrayList;
2324
import java.util.HashMap;
25+
import java.util.List;
2426
import java.util.Map;
2527
import java.util.Objects;
2628

2729
/** This class extends &#x60;TemplateResponseDocumentFormFieldBase&#x60; */
2830
@JsonPropertyOrder({
2931
TemplateResponseDocumentFormFieldDropdown.JSON_PROPERTY_TYPE,
30-
TemplateResponseDocumentFormFieldDropdown.JSON_PROPERTY_GROUP
32+
TemplateResponseDocumentFormFieldDropdown.JSON_PROPERTY_GROUP,
33+
TemplateResponseDocumentFormFieldDropdown.JSON_PROPERTY_OPTIONS
3134
})
3235
@javax.annotation.Generated(
3336
value = "org.openapitools.codegen.languages.JavaClientCodegen",
@@ -48,6 +51,9 @@ public class TemplateResponseDocumentFormFieldDropdown
4851
public static final String JSON_PROPERTY_GROUP = "group";
4952
@javax.annotation.Nullable private String group;
5053

54+
public static final String JSON_PROPERTY_OPTIONS = "options";
55+
@javax.annotation.Nullable private List<String> options = null;
56+
5157
public TemplateResponseDocumentFormFieldDropdown() {}
5258

5359
/**
@@ -122,6 +128,37 @@ public void setGroup(@javax.annotation.Nullable String group) {
122128
this.group = group;
123129
}
124130

131+
public TemplateResponseDocumentFormFieldDropdown options(
132+
@javax.annotation.Nullable List<String> options) {
133+
this.options = options;
134+
return this;
135+
}
136+
137+
public TemplateResponseDocumentFormFieldDropdown addOptionsItem(String optionsItem) {
138+
if (this.options == null) {
139+
this.options = new ArrayList<>();
140+
}
141+
this.options.add(optionsItem);
142+
return this;
143+
}
144+
145+
/**
146+
* The options available for this dropdown form field.
147+
*
148+
* @return options
149+
*/
150+
@javax.annotation.Nullable @JsonProperty(JSON_PROPERTY_OPTIONS)
151+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
152+
public List<String> getOptions() {
153+
return options;
154+
}
155+
156+
@JsonProperty(JSON_PROPERTY_OPTIONS)
157+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
158+
public void setOptions(@javax.annotation.Nullable List<String> options) {
159+
this.options = options;
160+
}
161+
125162
/** Return true if this TemplateResponseDocumentFormFieldDropdown object is equal to o. */
126163
@Override
127164
public boolean equals(Object o) {
@@ -135,12 +172,13 @@ public boolean equals(Object o) {
135172
(TemplateResponseDocumentFormFieldDropdown) o;
136173
return Objects.equals(this.type, templateResponseDocumentFormFieldDropdown.type)
137174
&& Objects.equals(this.group, templateResponseDocumentFormFieldDropdown.group)
175+
&& Objects.equals(this.options, templateResponseDocumentFormFieldDropdown.options)
138176
&& super.equals(o);
139177
}
140178

141179
@Override
142180
public int hashCode() {
143-
return Objects.hash(type, group, super.hashCode());
181+
return Objects.hash(type, group, options, super.hashCode());
144182
}
145183

146184
@Override
@@ -150,6 +188,7 @@ public String toString() {
150188
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
151189
sb.append(" type: ").append(toIndentedString(type)).append("\n");
152190
sb.append(" group: ").append(toIndentedString(group)).append("\n");
191+
sb.append(" options: ").append(toIndentedString(options)).append("\n");
153192
sb.append("}");
154193
return sb.toString();
155194
}
@@ -195,6 +234,24 @@ public Map<String, Object> createFormData() throws ApiException {
195234
map.put("group", JSON.getDefault().getMapper().writeValueAsString(group));
196235
}
197236
}
237+
if (options != null) {
238+
if (isFileTypeOrListOfFiles(options)) {
239+
fileTypeFound = true;
240+
}
241+
242+
if (options.getClass().equals(java.io.File.class)
243+
|| options.getClass().equals(Integer.class)
244+
|| options.getClass().equals(String.class)
245+
|| options.getClass().isEnum()) {
246+
map.put("options", options);
247+
} else if (isListOfFile(options)) {
248+
for (int i = 0; i < getListSize(options); i++) {
249+
map.put("options[" + i + "]", getFromList(options, i));
250+
}
251+
} else {
252+
map.put("options", JSON.getDefault().getMapper().writeValueAsString(options));
253+
}
254+
}
198255
} catch (Exception e) {
199256
throw new ApiException(e);
200257
}

sdks/java-v2/docs/TemplateResponseDocumentFormFieldDropdown.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This class extends `TemplateResponseDocumentFormFieldBase`
1010
|------------ | ------------- | ------------- | -------------|
1111
| `type`<sup>*_required_</sup> | ```String``` | The type of this form field. See [field types](/api/reference/constants/#field-types).<br><br>* Text Field uses `TemplateResponseDocumentFormFieldText`<br>* Dropdown Field uses `TemplateResponseDocumentFormFieldDropdown`<br>* Hyperlink Field uses `TemplateResponseDocumentFormFieldHyperlink`<br>* Checkbox Field uses `TemplateResponseDocumentFormFieldCheckbox`<br>* Radio Field uses `TemplateResponseDocumentFormFieldRadio`<br>* Signature Field uses `TemplateResponseDocumentFormFieldSignature`<br>* Date Signed Field uses `TemplateResponseDocumentFormFieldDateSigned`<br>* Initials Field uses `TemplateResponseDocumentFormFieldInitials` | |
1212
| `group` | ```String``` | The name of the group this field is in. If this field is not a group, this defaults to `null` except for Radio fields. | |
13+
| `options` | ```List<String>``` | The options available for this dropdown form field. | |
1314

1415

1516

sdks/java-v2/src/main/java/com/dropbox/sign/model/TemplateResponseDocumentFormFieldDropdown.java

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
import com.fasterxml.jackson.annotation.JsonTypeInfo;
2626
import com.fasterxml.jackson.annotation.JsonTypeName;
2727
import com.fasterxml.jackson.annotation.JsonValue;
28+
import java.util.ArrayList;
2829
import java.util.Arrays;
30+
import java.util.List;
2931
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
3032
import com.dropbox.sign.JSON;
3133
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
@@ -38,7 +40,8 @@
3840
*/
3941
@JsonPropertyOrder({
4042
TemplateResponseDocumentFormFieldDropdown.JSON_PROPERTY_TYPE,
41-
TemplateResponseDocumentFormFieldDropdown.JSON_PROPERTY_GROUP
43+
TemplateResponseDocumentFormFieldDropdown.JSON_PROPERTY_GROUP,
44+
TemplateResponseDocumentFormFieldDropdown.JSON_PROPERTY_OPTIONS
4245
})
4346
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.12.0")
4447
@JsonIgnoreProperties(
@@ -56,6 +59,10 @@ public class TemplateResponseDocumentFormFieldDropdown extends TemplateResponseD
5659
@jakarta.annotation.Nullable
5760
private String group;
5861

62+
public static final String JSON_PROPERTY_OPTIONS = "options";
63+
@jakarta.annotation.Nullable
64+
private List<String> options = null;
65+
5966
public TemplateResponseDocumentFormFieldDropdown() {
6067
}
6168

@@ -124,6 +131,39 @@ public void setGroup(@jakarta.annotation.Nullable String group) {
124131
}
125132

126133

134+
public TemplateResponseDocumentFormFieldDropdown options(@jakarta.annotation.Nullable List<String> options) {
135+
this.options = options;
136+
return this;
137+
}
138+
139+
public TemplateResponseDocumentFormFieldDropdown addOptionsItem(String optionsItem) {
140+
if (this.options == null) {
141+
this.options = new ArrayList<>();
142+
}
143+
this.options.add(optionsItem);
144+
return this;
145+
}
146+
147+
/**
148+
* The options available for this dropdown form field.
149+
* @return options
150+
*/
151+
@jakarta.annotation.Nullable
152+
@JsonProperty(JSON_PROPERTY_OPTIONS)
153+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
154+
155+
public List<String> getOptions() {
156+
return options;
157+
}
158+
159+
160+
@JsonProperty(JSON_PROPERTY_OPTIONS)
161+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
162+
public void setOptions(@jakarta.annotation.Nullable List<String> options) {
163+
this.options = options;
164+
}
165+
166+
127167
/**
128168
* Return true if this TemplateResponseDocumentFormFieldDropdown object is equal to o.
129169
*/
@@ -138,12 +178,13 @@ public boolean equals(Object o) {
138178
TemplateResponseDocumentFormFieldDropdown templateResponseDocumentFormFieldDropdown = (TemplateResponseDocumentFormFieldDropdown) o;
139179
return Objects.equals(this.type, templateResponseDocumentFormFieldDropdown.type) &&
140180
Objects.equals(this.group, templateResponseDocumentFormFieldDropdown.group) &&
181+
Objects.equals(this.options, templateResponseDocumentFormFieldDropdown.options) &&
141182
super.equals(o);
142183
}
143184

144185
@Override
145186
public int hashCode() {
146-
return Objects.hash(type, group, super.hashCode());
187+
return Objects.hash(type, group, options, super.hashCode());
147188
}
148189

149190
@Override
@@ -153,6 +194,7 @@ public String toString() {
153194
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
154195
sb.append(" type: ").append(toIndentedString(type)).append("\n");
155196
sb.append(" group: ").append(toIndentedString(group)).append("\n");
197+
sb.append(" options: ").append(toIndentedString(options)).append("\n");
156198
sb.append("}");
157199
return sb.toString();
158200
}
@@ -200,6 +242,25 @@ public Map<String, Object> createFormData() throws ApiException {
200242
map.put("group", JSON.getDefault().getMapper().writeValueAsString(group));
201243
}
202244
}
245+
if (options != null) {
246+
if (isFileTypeOrListOfFiles(options)) {
247+
fileTypeFound = true;
248+
}
249+
250+
if (options.getClass().equals(java.io.File.class) ||
251+
options.getClass().equals(Integer.class) ||
252+
options.getClass().equals(String.class) ||
253+
options.getClass().isEnum()) {
254+
map.put("options", options);
255+
} else if (isListOfFile(options)) {
256+
for(int i = 0; i< getListSize(options); i++) {
257+
map.put("options[" + i + "]", getFromList(options, i));
258+
}
259+
}
260+
else {
261+
map.put("options", JSON.getDefault().getMapper().writeValueAsString(options));
262+
}
263+
}
203264
} catch (Exception e) {
204265
throw new ApiException(e);
205266
}

0 commit comments

Comments
 (0)