forked from f1code/IntacctClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntacctServiceResponse.cs
More file actions
40 lines (31 loc) · 1.18 KB
/
Copy pathIntacctServiceResponse.cs
File metadata and controls
40 lines (31 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Intacct.Operations;
namespace Intacct
{
public class IntacctServiceResponse : IIntacctServiceResponse
{
private readonly List<IntacctError> _errors = new List<IntacctError>();
private readonly List<IntacctOperationResult> _operationResults = new List<IntacctOperationResult>();
public bool Success { get; private set; }
public IReadOnlyList<IntacctError> Errors => new ReadOnlyCollection<IntacctError>(_errors);
public IReadOnlyList<IntacctOperationResult> OperationResults => new ReadOnlyCollection<IntacctOperationResult>(_operationResults);
internal static IntacctServiceResponse Failed => new IntacctServiceResponse { Success = false };
internal static IntacctServiceResponse Successful => new IntacctServiceResponse { Success = true };
private IntacctServiceResponse() {}
internal void AddError(IntacctError error)
{
_errors.Add(error);
Success = false;
}
internal void AddErrors(IEnumerable<IntacctError> errors)
{
_errors.AddRange(errors);
Success = false;
}
internal void AddOperationResult(IntacctOperationResult result)
{
_operationResults.Add(result);
}
}
}