Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 7 additions & 2 deletions examples/BoldSign.Examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
<RootNamespace>BoldSign.Examples</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
<RunAnalyzersDuringLiveAnalysis>true</RunAnalyzersDuringLiveAnalysis>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.22" />
</ItemGroup>

<ItemGroup>
Expand Down
57 changes: 50 additions & 7 deletions examples/BrandingExamples.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using BoldSign.Api;
using System.IO;
using BoldSign.Api;
using BoldSign.Model;

namespace BoldSign.Examples
Expand Down Expand Up @@ -41,14 +42,27 @@ public void ResetDefaultBrand()
/// </summary>
public BrandingData CreateBrand()
{
var fileBytes = File.ReadAllBytes("assets/sample.jpg");
var stream = new MemoryStream(fileBytes);

var createBrandData = new BrandSettings()
{
// This is an example brand settings data to create, add your own brand settings upon usage.
BrandName = "Brand from SDK",
BrandLogo = new DocumentFileBytes
// BrandLogo = new ImageFileBytes()
// {
// ContentType = "image/jpeg",
// FileBytes = fileBytes,
// },
// BrandLogo = new ImageFileStream()
// {
// FileStream = stream,
// ContentType = "image/jpeg",
// },
BrandLogo = new ImageFilePath()
{
ContentType = "image/jpg",
FileName = "assets/sample.jpg",
FilePath = "assets/sample.jpg",
ContentType = "image/jpeg",
},
CombineAuditTrail = false,
IsDefault = false,
Expand All @@ -60,6 +74,11 @@ public BrandingData CreateBrand()
ButtonColor = "#00BDD4",
ButtonTextColor = "#FFFFFF",
RedirectUrl = "https://app.boldsign.com/dashboard",
AllowCustomFieldCreation = false,
ShowBuiltInFormFields = true,
ShowSharedCustomFields = false,
HideDecline = false,
HideSave = false,
};
var result = this.BrandingClient.CreateBrand(createBrandData);
return result;
Expand All @@ -71,15 +90,27 @@ public BrandingData CreateBrand()
public BrandingData EditBrand()
{
string brandId = "Your brand-id";
var fileBytes = File.ReadAllBytes("assets/sample.jpg");
var stream = new MemoryStream(fileBytes);

var editBrandData = new BrandSettings()
{
// This is an example brand settings data to edit, add your own brand settings upon usage.
BrandName = "Brand edit from SDK",
BrandLogo = new DocumentFileBytes
// BrandLogo = new ImageFileBytes()
// {
// ContentType = "image/jpeg",
// FileBytes = fileBytes,
// },
// BrandLogo = new ImageFileStream()
// {
// FileStream = stream,
// ContentType = "image/jpeg",
// },
BrandLogo = new ImageFilePath()
{
ContentType = "image/jpg",
FileName = "assets/sample.jpg",
FilePath = "assets/sample.jpg",
ContentType = "image/jpeg",
},
CombineAuditTrail = false,
IsDefault = false,
Expand All @@ -104,5 +135,17 @@ public BrandingRecords ListBrand()
var brandRecords = this.BrandingClient.ListBrand();
return brandRecords;
}

/// <summary>
/// Get the brand.
/// </summary>
public BrandDetails GetBrand()
{
// This is an example brand id, add your own brand id upon usage.
var brandId = "your brand-id";

var brandSettings = this.BrandingClient.GetBrandDetails(brandId);
return brandSettings;
}
}
}
97 changes: 97 additions & 0 deletions examples/ContactExamples.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
namespace BoldSign.Examples
{
using System.Collections.Generic;
using BoldSign.Api;
using BoldSign.Api.Model;
using BoldSign.Model;
using System.Threading.Tasks;

/// <summary>
/// The create user examples.
/// </summary>
public class ContactExamples
{
private readonly ContactClient ContactClient;

/// <summary>
/// Initializes a new instance of the <see cref="ContactExamples" /> class.
/// </summary>
/// <param name="ContactClient">The create user api.</param>
public ContactExamples(ContactClient ContactClient)
{
this.ContactClient = ContactClient;
}

///<summary>
/// Get contact list
/// </summary>
public ContactsList ContactList()
{
var response = this.ContactClient.ListContacts(1, 10, "", ContactType.AllContacts);
return response;
}

/// <summary>
/// Delete Contact details
/// </summary>
public void DeleteContact()
{
// This is an example contact id, add your own brand id upon usage.
var id = "contact-Id";
this.ContactClient.DeleteContact(id);
}

/// <summary>
/// Create Contact details
/// </summary>
public CreatedContact CreateContact()
{
var contactsDetailsList = new List<ContactDetails>();
ContactDetails contactsDetails = new ContactDetails()
{
Email = "test1711@gmail.com",
Name = "API-SDK_Test",
PhoneNumber = new PhoneNumber()
{
CountryCode = "91",
Number = "6547456721"
},
CompanyName = "1711",
JobTitle = "Test"
};

contactsDetailsList.Add(contactsDetails);
var response = this.ContactClient.CreateContact(contactsDetailsList);
return response;
}

/// <summary>
/// Update Contact details
/// </summary>
public void UpdateContact()
{
string id = "6797a07d-26d7-41fa-b3a8-c8f72378a7a6c_gEkPI";
var updateContact = new ContactDetails()
{
Email = "test1711@gmail.com",
Name = "Test_Engineer",
PhoneNumber = new PhoneNumber()
{
CountryCode = "91",
Number = "9182736450"
},
CompanyName = "1711_1802",
JobTitle = "Test"
};

this.ContactClient.UpdateContact(id, updateContact);
}

public ContactsDetails GetContact()
{
string id = "6797a07d-26d7-41fa-b3a8-c8f72378a7a6c_KRMh4";
var response = this.ContactClient.GetContact(id);
return response;
}
}
}
90 changes: 90 additions & 0 deletions examples/CustomFieldExamples.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
using BoldSign.Api;
using BoldSign.Model;
using System;

namespace BoldSign.Examples
{
/// <summary>
/// The Custom Field Examples.
/// </summary>
public class CustomFieldExamples
{
private readonly ICustomFieldClient CustomFieldClient;

public CustomFieldExamples(ICustomFieldClient customFieldClient) => this.CustomFieldClient = customFieldClient;

/// <summary>
/// Creates a custom field for the specified brand.
/// </summary>
public void CreateCustomField()
{
var brandCustomFieldDetails = new BrandCustomFieldDetails()
{
FieldName = "Field Name",
FieldDescription = "Description",
FieldOrder = 1,
BrandId = "Brand Id",
FormField = new CustomFormField(
type: FieldType.Signature,
isRequired: true),
};

this.CustomFieldClient.CreateCustomField(brandCustomFieldDetails);
}

/// <summary>
/// Edits a custom field for the specified brand.
/// </summary>
public void EditCustomField()
{
var brandCustomFieldDetails = new BrandCustomFieldDetails()
{
FieldName = "Field Name",
FieldDescription = "Description",
FieldOrder = 1,
BrandId = "Brand Id",
FormField = new CustomFormField(
type: FieldType.Signature,
isRequired: true),
};

var customFieldId = "custom field id";

this.CustomFieldClient.EditCustomField(customFieldId, brandCustomFieldDetails);
}

/// <summary>
/// Deletes a custom field for the specified brand.
/// </summary>
public void DeleteCustomField()
{
var customFieldId = "custom field id";

this.CustomFieldClient.DeleteCustomField(customFieldId);
}

/// <summary>
/// Gets the all custom field for the specified brand.
/// </summary>
public void GetCustomField()
{
var brandId = "Brand Id";

this.CustomFieldClient.GetBrandBasedCustomFields(brandId);
}

/// <summary>
/// Generates a URL to embed manipulation of custom field process.
/// </summary>
public void CreateEmbeddedCustomFieldUrl()
{
var embeddedCustomFieldDetails = new EmbeddedCustomFieldDetails()
{
BrandId = "Brand Id",
LinkValidTill = DateTime.UtcNow.AddDays(1),
};

this.CustomFieldClient.CreateEmbeddedCustomFieldUrl(embeddedCustomFieldDetails);
}
}
}
Loading