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

adds batch export path #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Core/CWRequestConditions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private enum Delimiter
Comma
}

private StringBuilder sb = null;
private StringBuilder sb;

internal string ToUriConditions(CWConditionOptions options, bool appendToExisting = false)
{
Expand Down
4 changes: 2 additions & 2 deletions ModuleTypes/SubModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace ConnectWise.Http.ModuleTypes
/// </summary>
public abstract class SubModule
{
private string module;
private string endpoint;
private readonly string module;
private readonly string endpoint;

internal SubModule(string module, string endpoint)
{
Expand Down
6 changes: 3 additions & 3 deletions ModuleTypes/SubModuleChild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ namespace ConnectWise.Http.ModuleTypes
/// </summary>
public abstract class SubModuleChild
{
private string module;
private string endpoint;
private string child;
private readonly string module;
private readonly string endpoint;
private readonly string child;
egbertn marked this conversation as resolved.
Show resolved Hide resolved

internal SubModuleChild(string module, string endpoint, string child)
{
Expand Down
8 changes: 4 additions & 4 deletions ModuleTypes/SubModuleGrandChild.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ namespace ConnectWise.Http.ModuleTypes
/// </summary>
public abstract class SubModuleGrandChild
{
private string module;
private string endpoint;
private string child;
private string grandChild;
private readonly string module;
private readonly string endpoint;
private readonly string child;
private readonly string grandChild;

internal SubModuleGrandChild(string module, string endpoint, string child, string grandChild)
{
Expand Down
2 changes: 2 additions & 0 deletions Modules/Finance/Finance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public static class FinanceModule
{
private const string module = "finance";

public static readonly AccountingSubModule Accounting = new AccountingSubModule(module, "accounting");

public static readonly AccountingBatchesSubModule AccountingBatches = new AccountingBatchesSubModule(module, "accounting/batches");

public static readonly GetSubModule AccountingPackages = new GetSubModule(module, "accountingPackages");
Expand Down
12 changes: 11 additions & 1 deletion Modules/Finance/SubModules/AccountingBatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,15 @@ public CWRequest ExportRequest(int batchId, string serializedExportAccountingBat
{
return new CWRequest(CWHttpMethod.Post, $"{getPrefix()}/{batchId}/export", serializedExportAccountingBatchRequest);
}
}

/// <summary>
/// Export the payload data from an existing batch.
/// </summary>
/// <param name="exportAccountingBatchParameters">ExportAccountingBatchParameters object to be included in the body of the request.</param>
/// <returns>CWRequest to be sent using CWHttpClient.</returns>
public CWRequest ExportRequest(object exportAccountingBatchParameters)
egbertn marked this conversation as resolved.
Show resolved Hide resolved
{
return new CWRequest(CWHttpMethod.Post, $"{getPrefix()}", exportAccountingBatchParameters);
}
}
}
27 changes: 27 additions & 0 deletions Modules/Finance/SubModules/Export.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using ConnectWise.Http.ModuleTypes;

namespace ConnectWise.Http.Modules.Finance.SubModules
{
public class AccountingSubModule : SubModule
{
internal AccountingSubModule(string module, string endpoint) : base(module, endpoint) { }
/// <summary>
/// posts to endpoint /accounting/export
/// Required before doing a definite export using AccountingBatches
/// </summary>
/// <param name="exportAccountingBatchRequest">your AccountingBatchRequest instance</param>
public CWRequest ExportRequest(object exportAccountingBatchRequest)
egbertn marked this conversation as resolved.
Show resolved Hide resolved
{
return new CWRequest(CWHttpMethod.Post, $"{getPrefix()}/export", exportAccountingBatchRequest);
}
/// <summary>
/// posts to endpoint /accounting/export
/// Required before doing a definite export using AccountingBatches
/// </summary>
/// <param name="exportAccountingBatchRequest">your AccountingBatchRequest serialized JSON instance</param>
public CWRequest ExportRequest(string serializedExportAccountingBatchRequest)
{
return new CWRequest(CWHttpMethod.Post, $"{getPrefix()}/export", serializedExportAccountingBatchRequest);
}
}
}
4 changes: 2 additions & 2 deletions Settings/IntegratorAuthSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace ConnectWise.Http.Options
{
public class IntegratorAuthSettings : IAuthSettings
{
private string login;
private string password;
private readonly string login;
private readonly string password;

public IntegratorAuthSettings(string integratorLogin, string integratorPassword)
{
Expand Down
4 changes: 2 additions & 2 deletions Settings/MemberAuthSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ namespace ConnectWise.Http
{
public class MemberAuthSettings : IAuthSettings
{
private string publicKey;
private string privateKey;
private readonly string publicKey;
private readonly string privateKey;

public MemberAuthSettings(string publicKey, string privateKey)
{
Expand Down
2 changes: 1 addition & 1 deletion connectwise.http.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ https://github.com/ajwaka</PackageReleaseNotes>
<RepositoryType>Class Library</RepositoryType>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.1.0.0</FileVersion>
<Version>1.1.1</Version>
<Version>1.1.2</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
</PropertyGroup>
Expand Down