Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows form_fields_per_document.signer to be int or string type #238

Merged
merged 4 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions openapi-raw.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7224,6 +7224,7 @@ components:
signer:
description: '_t__Sub::FormFieldsPerDocument::SIGNER'
type: string
x-int-or-string: true
type:
type: string
width:
Expand Down
1 change: 1 addition & 0 deletions openapi-sdk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7585,6 +7585,7 @@ components:

**NOTE**: If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
type: string
x-int-or-string: true
type:
type: string
width:
Expand Down
1 change: 1 addition & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7585,6 +7585,7 @@ components:

**NOTE**: If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
type: string
x-int-or-string: true
type:
type: string
width:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,60 @@ public void SubFormFieldsPerDocumentBaseTest(Dictionary<string, object> items)
}
}

[Theory]
[MemberData(nameof(Data))]
public void SignerAllowsIntTest(Dictionary<string, object> items)
{
var signer1 = new JObject(
new JProperty("name", "Signer 1"),
new JProperty("email_address", "s1@example.com")
);

foreach (var item in items)
{
var formFieldData = new JArray(item.Value);
formFieldData[0]["signer"] = 1234;
var expectedSigner = "1234";

var data = new JObject(
new JProperty("signers", new JArray(signer1)),
new JProperty("form_fields_per_document", formFieldData)
);

var obj = SignatureRequestSendRequest.Init(data.ToString());
var field = obj.FormFieldsPerDocument[0];

Assert.Equal(expectedSigner, field.Signer);
}
}

[Theory]
[MemberData(nameof(Data))]
public void SignerAllowsStringTest(Dictionary<string, object> items)
{
var signer1 = new JObject(
new JProperty("name", "Signer 1"),
new JProperty("email_address", "s1@example.com")
);

foreach (var item in items)
{
var formFieldData = new JArray(item.Value);
formFieldData[0]["signer"] = "sender";
var expectedSigner = "sender";

var data = new JObject(
new JProperty("signers", new JArray(signer1)),
new JProperty("form_fields_per_document", formFieldData)
);

var obj = SignatureRequestSendRequest.Init(data.ToString());
var field = obj.FormFieldsPerDocument[0];

Assert.Equal(expectedSigner, field.Signer);
}
}

public static IEnumerable<object[]> Data()
{
using (var r = TestHelper.ReadFileFromResource("SubFormFieldsPerDocument"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected SubFormFieldsPerDocumentBase() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentBase(int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), string type = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentBase(int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, string type = default(string), int width = default(int), int x = default(int), int y = default(int))
{

this.DocumentIndex = documentIndex;
Expand All @@ -91,7 +91,7 @@ protected SubFormFieldsPerDocumentBase() { }
{
throw new ArgumentNullException("signer is a required property for SubFormFieldsPerDocumentBase and cannot be null");
}
this.Signer = signer;
this.Signer = Convert.ToString(signer);
// to ensure "type" is required (not null)
if (type == null)
{
Expand Down Expand Up @@ -154,7 +154,12 @@ public static SubFormFieldsPerDocumentBase Init(string jsonData)
/// </summary>
/// <value>Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE**: If type is &#x60;text-merge&#x60; or &#x60;checkbox-merge&#x60;, you must set this to sender in order to use pre-filled data.</value>
[DataMember(Name = "signer", IsRequired = true, EmitDefaultValue = true)]
public string Signer { get; set; }
public object Signer {
get => this._signer;
set => this._signer = Convert.ToString(value);
}

private string _signer;

/// <summary>
/// Gets or Sets Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ protected SubFormFieldsPerDocumentCheckbox() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentCheckbox(string type = "checkbox", string group = default(string), bool isChecked = default(bool), int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentCheckbox(string type = "checkbox", string group = default(string), bool isChecked = default(bool), int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, int width = default(int), int x = default(int), int y = default(int))
{
this.DocumentIndex = documentIndex;
this.ApiId = apiId;
this.Height = height;
this.Required = required;
this.Signer = signer;
this.Signer = Convert.ToString(signer);
this.Width = width;
this.X = x;
this.Y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ protected SubFormFieldsPerDocumentCheckboxMerge() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentCheckboxMerge(string type = "checkbox-merge", int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentCheckboxMerge(string type = "checkbox-merge", int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, int width = default(int), int x = default(int), int y = default(int))
{
this.DocumentIndex = documentIndex;
this.ApiId = apiId;
this.Height = height;
this.Required = required;
this.Signer = signer;
this.Signer = Convert.ToString(signer);
this.Width = width;
this.X = x;
this.Y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ protected SubFormFieldsPerDocumentDateSigned() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentDateSigned(string type = "date_signed", int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentDateSigned(string type = "date_signed", int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, int width = default(int), int x = default(int), int y = default(int))
{
this.DocumentIndex = documentIndex;
this.ApiId = apiId;
this.Height = height;
this.Required = required;
this.Signer = signer;
this.Signer = Convert.ToString(signer);
this.Width = width;
this.X = x;
this.Y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ protected SubFormFieldsPerDocumentDropdown() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentDropdown(string type = "dropdown", List<string> options = default(List<string>), string content = default(string), int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentDropdown(string type = "dropdown", List<string> options = default(List<string>), string content = default(string), int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, int width = default(int), int x = default(int), int y = default(int))
{
this.DocumentIndex = documentIndex;
this.ApiId = apiId;
this.Height = height;
this.Required = required;
this.Signer = signer;
this.Signer = Convert.ToString(signer);
this.Width = width;
this.X = x;
this.Y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ protected SubFormFieldsPerDocumentHyperlink() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentHyperlink(string type = "hyperlink", string content = default(string), string contentUrl = default(string), int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentHyperlink(string type = "hyperlink", string content = default(string), string contentUrl = default(string), int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, int width = default(int), int x = default(int), int y = default(int))
{
this.DocumentIndex = documentIndex;
this.ApiId = apiId;
this.Height = height;
this.Required = required;
this.Signer = signer;
this.Signer = Convert.ToString(signer);
this.Width = width;
this.X = x;
this.Y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ protected SubFormFieldsPerDocumentInitials() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentInitials(string type = "initials", int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentInitials(string type = "initials", int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, int width = default(int), int x = default(int), int y = default(int))
{
this.DocumentIndex = documentIndex;
this.ApiId = apiId;
this.Height = height;
this.Required = required;
this.Signer = signer;
this.Signer = Convert.ToString(signer);
this.Width = width;
this.X = x;
this.Y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ protected SubFormFieldsPerDocumentRadio() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentRadio(string type = "radio", string group = default(string), bool isChecked = default(bool), int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentRadio(string type = "radio", string group = default(string), bool isChecked = default(bool), int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, int width = default(int), int x = default(int), int y = default(int))
{
this.DocumentIndex = documentIndex;
this.ApiId = apiId;
this.Height = height;
this.Required = required;
this.Signer = signer;
this.Signer = Convert.ToString(signer);
this.Width = width;
this.X = x;
this.Y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ protected SubFormFieldsPerDocumentSignature() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentSignature(string type = "signature", int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentSignature(string type = "signature", int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, int width = default(int), int x = default(int), int y = default(int))
{
this.DocumentIndex = documentIndex;
this.ApiId = apiId;
this.Height = height;
this.Required = required;
this.Signer = signer;
this.Signer = Convert.ToString(signer);
this.Width = width;
this.X = x;
this.Y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ protected SubFormFieldsPerDocumentText() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentText(string type = "text", string placeholder = default(string), string autoFillType = default(string), string linkId = default(string), bool masked = default(bool), ValidationTypeEnum? validationType = default(ValidationTypeEnum?), string validationCustomRegex = default(string), string validationCustomRegexFormatLabel = default(string), int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentText(string type = "text", string placeholder = default(string), string autoFillType = default(string), string linkId = default(string), bool masked = default(bool), ValidationTypeEnum? validationType = default(ValidationTypeEnum?), string validationCustomRegex = default(string), string validationCustomRegexFormatLabel = default(string), int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, int width = default(int), int x = default(int), int y = default(int))
{
this.DocumentIndex = documentIndex;
this.ApiId = apiId;
this.Height = height;
this.Required = required;
this.Signer = signer;
this.Signer = Convert.ToString(signer);
this.Width = width;
this.X = x;
this.Y = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ protected SubFormFieldsPerDocumentTextMerge() { }
/// <param name="width">Size of the field in pixels. (required).</param>
/// <param name="x">Location coordinates of the field in pixels. (required).</param>
/// <param name="y">Location coordinates of the field in pixels. (required).</param>
public SubFormFieldsPerDocumentTextMerge(string type = "text-merge", int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), string signer = default(string), int width = default(int), int x = default(int), int y = default(int))
public SubFormFieldsPerDocumentTextMerge(string type = "text-merge", int documentIndex = default(int), string apiId = default(string), int height = default(int), string name = default(string), int? page = default(int?), bool required = default(bool), Object signer = null, int width = default(int), int x = default(int), int y = default(int))
{
this.DocumentIndex = documentIndex;
this.ApiId = apiId;
this.Height = height;
this.Required = required;
this.Signer = signer;
this.Signer = Convert.ToString(signer);
this.Width = width;
this.X = x;
this.Y = y;
Expand Down
Loading