Skip to content

Commit

Permalink
Add separate constructors for prefill tags
Browse files Browse the repository at this point in the history
  • Loading branch information
mwwoda committed Nov 2, 2021
1 parent eb7231b commit 2ef0eb4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 11 deletions.
11 changes: 4 additions & 7 deletions Box.V2.Test/BoxSignRequestsManagerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,10 @@ public async Task CreateSignRequest_OptionalParams_Success()
PrefillTags = new List<BoxSignRequestPrefillTag>
{
new BoxSignRequestPrefillTag
{
DocumentTagId = "1234",
TextValue = "text",
CheckboxValue = true,
DateValue = DateTimeOffset.Parse("2021-04-26T08:12:13.982Z")
}
(
"1234",
"text"
)
}
};

Expand Down Expand Up @@ -164,7 +162,6 @@ public async Task CreateSignRequest_OptionalParams_Success()
Assert.AreEqual(1, response.PrefillTags.Count);
Assert.AreEqual("1234", response.PrefillTags[0].DocumentTagId);
Assert.AreEqual("text", response.PrefillTags[0].TextValue);
Assert.IsTrue(response.PrefillTags[0].CheckboxValue.Value);
Assert.AreEqual(DateTimeOffset.Parse("2021-04-26T08:12:13.982Z"), response.PrefillTags[0].DateValue);
}

Expand Down
47 changes: 43 additions & 4 deletions Box.V2/Models/BoxSignRequestPrefillTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,67 @@ public class BoxSignRequestPrefillTag
public const string FieldDocumentTagId = "document_tag_id";
public const string FieldTextValue = "text_value";

// For serialization
private BoxSignRequestPrefillTag() { }

/// <summary>
/// Creates prefill tag with checkbox value.
/// </summary>
/// <param name="documentTagId">References the ID of a specific tag contained in a file of the sign request.</param>
/// <param name="checkboxValue">Checkbox prefill value.</param>
/// <returns>A prefill tag</returns>
public BoxSignRequestPrefillTag(string documentTagId, bool checkboxValue)
{
DocumentTagId = documentTagId;
CheckboxValue = checkboxValue;
}

/// <summary>
/// Creates prefill tag with date value.
/// </summary>
/// <param name="documentTagId">References the ID of a specific tag contained in a file of the sign request.</param>
/// <param name="dateValue">Date prefill value.</param>
/// <returns>A prefill tag</returns>
public BoxSignRequestPrefillTag(string documentTagId, DateTimeOffset dateValue)
{
DocumentTagId = documentTagId;
DateValue = dateValue;
}

/// <summary>
/// Creates prefill tag with text value.
/// </summary>
/// <param name="documentTagId">References the ID of a specific tag contained in a file of the sign request.</param>
/// <param name="checkboxValue">Text prefill value.</param>
/// <returns>A prefill tag</returns>
public BoxSignRequestPrefillTag(string documentTagId, string textValue)
{
DocumentTagId = documentTagId;
TextValue = textValue;
}

/// <summary>
/// Checkbox prefill value.
/// </summary>
[JsonProperty(PropertyName = FieldCheckboxValue)]
public virtual bool? CheckboxValue { get; set; }
public virtual bool? CheckboxValue { get; private set; }

/// <summary>
/// Date prefill value.
/// </summary>
[JsonProperty(PropertyName = FieldDateValue)]
public virtual DateTimeOffset? DateValue { get; set; }
public virtual DateTimeOffset? DateValue { get; private set; }

/// <summary>
/// This references the ID of a specific tag contained in a file of the sign request.
/// </summary>
[JsonProperty(PropertyName = FieldDocumentTagId)]
public virtual string DocumentTagId { get; set; }
public virtual string DocumentTagId { get; private set; }

/// <summary>
/// Text prefill value.
/// </summary>
[JsonProperty(PropertyName = FieldTextValue)]
public virtual string TextValue { get; set; }
public virtual string TextValue { get; private set; }
}
}

0 comments on commit 2ef0eb4

Please sign in to comment.