-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBatchResult.cs
116 lines (102 loc) · 3.96 KB
/
BatchResult.cs
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Copyright © 2023 Textkernel BV. All rights reserved.
// This file is provided for use by, or on behalf of, Textkernel licensees
// within the terms of their license of Textkernel products or Textkernel customers
// within the Terms of Service pertaining to the Textkernel SaaS products.
using Textkernel.Tx.Models.API.Parsing;
namespace Textkernel.Tx.Batches
{
/// <summary>
/// A single parse result from the batch parser
/// </summary>
public abstract class BatchResult
{
/// <summary>
/// The DocumentId that was assigned for this file by you or automatically (if you did not provide your own logic to the <see cref="BatchParser"/>)
/// </summary>
public string DocumentId { get; protected set; }
/// <summary>
/// The file path for this file
/// </summary>
public string File { get; protected set; }
internal BatchResult(string file, string docId)
{
DocumentId = docId;
File = file;
}
}
/// <summary>
/// A result indicating the file was parsed successfully (and if specified, the file was also geocoded/indexed successfully)
/// </summary>
public class ResumeBatchSuccessResult : BatchResult
{
/// <summary>
/// The response from the Tx API when parsing this file
/// </summary>
public ParseResumeResponse Response { get; protected set; }
internal ResumeBatchSuccessResult(string file, string docId, ParseResumeResponse response)
: base(file, docId)
{
Response = response;
}
}
/// <summary>
/// A result indicating the file was parsed, but some error occurred during/after parsing
/// </summary>
public class ResumeBatchPartialSuccessResult : ResumeBatchSuccessResult
{
/// <summary>
/// The error that occurred when parsing this file. There is probably still usable data in the <see cref="ResumeBatchSuccessResult.Response"/>
/// </summary>
public TxUsableResumeException Error { get; protected set; }
internal ResumeBatchPartialSuccessResult(string file, string docId, TxUsableResumeException e)
: base(file, docId, e.Response)
{
Error = e;
}
}
/// <summary>
/// A result indicating the file was parsed successfully (and if specified, the file was also geocoded/indexed successfully)
/// </summary>
public class JobBatchSuccessResult : BatchResult
{
/// <summary>
/// The response from the Tx API when parsing this file
/// </summary>
public ParseJobResponse Response { get; protected set; }
internal JobBatchSuccessResult(string file, string docId, ParseJobResponse response)
: base(file, docId)
{
Response = response;
}
}
/// <summary>
/// A result indicating the file was parsed, but some error occurred during/after parsing
/// </summary>
public class JobBatchPartialSuccessResult : JobBatchSuccessResult
{
/// <summary>
/// The error that occurred when parsing this file. There is probably still usable data in the <see cref="JobBatchSuccessResult.Response"/>
/// </summary>
public TxUsableJobException Error { get; protected set; }
internal JobBatchPartialSuccessResult(string file, string docId, TxUsableJobException e)
: base(file, docId, e.Response)
{
Error = e;
}
}
/// <summary>
/// A result indicating an error occurred and particular file could not be parsed
/// </summary>
public class BatchErrorResult : BatchResult
{
/// <summary>
/// The error that occurred when parsing this file
/// </summary>
public TxException Error { get; protected set; }
internal BatchErrorResult(string file, string docId, TxException e)
: base(file, docId)
{
Error = e;
}
}
}