Class EthosErrorsClient
An EthosClient used to perform Create, Read, and Delete operations for Error objects, using the Ethos Integration errors service.
The preferred way to instantiate this class is via the EthosClientBuilder.
Inherited Members
Namespace: Ellucian.Ethos.Integration.Client.Errors
Assembly: Ellucian.Ethos.Integration.dll
Syntax
public class EthosErrorsClient : EthosClient
Constructors
EthosErrorsClient(String, HttpClient)
Constructs an EthosErrorClient using the given API key. Note that the preferred way to get an instance of this class is through the EthosClientBuilder.
Declaration
public EthosErrorsClient(string apiKey, HttpClient client)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | apiKey | A valid API key from Ethos Integration. This is required to be a valid 36 character GUID string.
If it is null, empty, |
| HttpClient | client | A HttiClient. If it is null, empty, then an |
Fields
DefaultErrorPageSize
The default page size (limit) when paging for errors.
Declaration
public const int DefaultErrorPageSize = null
Field Value
| Type | Description |
|---|---|
| System.Int32 |
errorType
Accept header value for Error type.
Declaration
const string errorType = null
Field Value
| Type | Description |
|---|---|
| System.String |
ethosResponseConverter
Used to convert EthosResponses to EthosError objects.
Declaration
EthosResponseConverter ethosResponseConverter
Field Value
| Type | Description |
|---|---|
| EthosResponseConverter |
HDR_REMAINING_COUNT
The remaining count header found in the EthosResponse. This value is equal to the total count minus the page size of the given request/response.
Declaration
public const string HDR_REMAINING_COUNT = null
Field Value
| Type | Description |
|---|---|
| System.String |
HDR_TOTAL_COUNT
The x-total-count header, representing the number of items in the request.
Declaration
public const string HDR_TOTAL_COUNT = null
Field Value
| Type | Description |
|---|---|
| System.String |
Methods
BuildHeadersMap()
Builds the headers dictionary used when making requests for errors.
Declaration
Dictionary<string, string> BuildHeadersMap()
Returns
| Type | Description |
|---|---|
| Dictionary<System.String, System.String> | A dictionary containing the headers needed for making a request to the Ethos Integration Errors API service. |
CalculateNumberOfPages(Int32, Int32, Int32)
Calculates the number of pages given the input params. Input param values are not validated, so specifying invalid negative values could produce unpredictable results. A 0 value is valid for the offset, but not for the other params.
The calculation is as follows:
double numPages = Math.Ceiling(Convert.ToDouble((totalErrorCount - offset)/pageSize));
The numPages returned value is cast to an int.
Declaration
public int CalculateNumberOfPages(int totalErrorCount, int pageSize, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | totalErrorCount | The total number of errors. |
| System.Int32 | pageSize | The limit number of errors to include in each page. |
| System.Int32 | offset | The 0 based index from which to begin paging for errors. |
Returns
| Type | Description |
|---|---|
| System.Int32 | The number of pages. |
DeleteAsync(String)
Delete the Error with the given ID from the tenant associated with the AccessToken.
Declaration
public async Task DeleteAsync(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The ID of the Error that you want to delete |
Returns
| Type | Description |
|---|---|
| Task |
DoPagingAsync(Int32, Int32, Int32)
Intended to be used internally within the SDK.
Handles paging for errors.If the given pageSize is <= 0, the default page size is used. If the offset is < 0, 0 will be used for the offset.Declaration
protected async Task<IEnumerable<EthosResponse>> DoPagingAsync(int totalErrorCount, int pageSize, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | totalErrorCount | The total count of errors for the given tenant per access token. |
| System.Int32 | pageSize | The number of errors to include in each page (EthosResponse) of the list returned. |
| System.Int32 | offset | The 0 based index from which to begin paging for errors. To get all errors, the offset should be 0. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<EthosResponse>> | IEnumerable<EthosResponse> |
GetAllErrorsAsEthosErrorsAsync()
Gets all of the errors for the given tenant per access token, as a list of EthosErrors.
Declaration
public async Task<IEnumerable<EthosError>> GetAllErrorsAsEthosErrorsAsync()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<EthosError>> | A list of EthosErrors where each EthosError in the list is for an individual error. |
GetAllErrorsAsJArrayAsync()
Get all of the errors for the given tenant per access token, as a list of Jarrays.
Declaration
public async Task<IEnumerable<JArray>> GetAllErrorsAsJArrayAsync()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<JArray>> | A list of JArrays where each JArray in the list contains a page of errors. |
GetAllErrorsAsStringsAsync()
Gets all of the errors for the given tenant per access token, as a list of Strings in JSON format.
Declaration
public async Task<IEnumerable<string>> GetAllErrorsAsStringsAsync()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<System.String>> | A list of strings where each string in the list contains a page of errors. |
GetAllErrorsAsync()
Gets all of the errors for the given tenant per access token.
Declaration
public async Task<IEnumerable<EthosResponse>> GetAllErrorsAsync()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<EthosResponse>> | A list of EthosResponses where each ethosResponse in the list contains a page of errors. |
GetAllErrorsWithPageSizeAsJArraysAsync(Int32)
Gets all of the errors for the given tenant per access token using the given page size as a list of JArrays.
Declaration
public async Task<IEnumerable<JArray>> GetAllErrorsWithPageSizeAsJArraysAsync(int pageSize)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | pageSize | The limit number of errors to include in each page of errors returned. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<JArray>> | A list of EthosResponses where each ethosResponse in the list contains a page of errors and each page contains up to the number of errors specified as the page size. |
GetAllErrorsWithPageSizeAsStringsAsync(Int32)
Gets all of the errors for the given tenant per access token using the given page size as a list of strings.
Declaration
public async Task<IEnumerable<string>> GetAllErrorsWithPageSizeAsStringsAsync(int pageSize)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | pageSize | The limit number of errors to include in each page of errors returned. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<System.String>> | A list of EthosResponses where each ethosResponse in the list contains a page of errors and each page contains up to the number of errors specified as the page size. |
GetAllErrorsWithPageSizeAsync(Int32)
Gets all of the errors for the given tenant per access token using the given page size.
Declaration
public async Task<IEnumerable<EthosResponse>> GetAllErrorsWithPageSizeAsync(int pageSize)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | pageSize | The limit number of errors to include in each page of errors returned. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<EthosResponse>> | A list of EthosResponses where each ethosResponse in the list contains a page of errors and each page contains up to the number of errors specified as the page size. |
GetAsEthosErrorsAsync()
Get an initial list of EthosErrors from the tenant associated with the access token.
Declaration
public async Task<IEnumerable<EthosError>> GetAsEthosErrorsAsync()
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<EthosError>> | An initial list of EthosErrors. |
GetAsJArrayAsync()
Gets an initial array (page) of Errors from the tenant associated with the access token, as a JArray.
Declaration
public async Task<JArray> GetAsJArrayAsync()
Returns
| Type | Description |
|---|---|
| Task<JArray> | A JArray containing child nodes for each error. |
GetAsStringAsync()
Gets an initial array (page) of Errors from the tenant associated with the access token, as a string.
Declaration
public async Task<string> GetAsStringAsync()
Returns
| Type | Description |
|---|---|
| Task<System.String> | Returns content as string. |
GetAsync()
Get an initial array (page) of Errors from the tenant associated with the access token.
Declaration
public async Task<EthosResponse> GetAsync()
Returns
| Type | Description |
|---|---|
| Task<EthosResponse> | An EthosResponse containing an array of errors in the content body. |
GetByIdAsEthosErrorAsync(String)
Get a single error as an EthosError object, using the given ID.
Declaration
public async Task<EthosError> GetByIdAsEthosErrorAsync(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The ID of the Error to get. This is a required parameter. If it is null or empty, then an ArgumentNullException will be thrown. |
Returns
| Type | Description |
|---|---|
| Task<EthosError> | An EthosError object representing the error for the given ID. |
GetByIdAsJObjectAsync(String)
Get a single error as a JObject, using the given ID.
Declaration
public async Task<JObject> GetByIdAsJObjectAsync(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The ID of the Error to get. This is a required parameter. If it is null or empty, then an ArgumentNullException will be thrown. |
Returns
| Type | Description |
|---|---|
| Task<JObject> | A JObject representing the error for the given ID. |
GetByIdAsStringAsync(String)
Get a single error as a JObject, using the given ID.
Declaration
public async Task<string> GetByIdAsStringAsync(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | The ID of the Error to get. This is a required parameter. If it is null or empty, then an ArgumentNullException will be thrown. |
Returns
| Type | Description |
|---|---|
| Task<System.String> | A string representing the error for the given ID. |
GetByIdAsync(String)
Get a specific error assigned the ID passed in.
Declaration
public async Task<EthosResponse> GetByIdAsync(string id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | id | Error ID |
Returns
| Type | Description |
|---|---|
| Task<EthosResponse> | An EthosResponse object containing the EthosError in the content body. |
GetErrorsFromOffsetAsEthosErrorsAsync(Int32)
Gets all of the errors for the given tenant per access token from the given offset, as a list of EthosErrors.
Declaration
public async Task<IEnumerable<EthosError>> GetErrorsFromOffsetAsEthosErrorsAsync(int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | offset | The 0 based index from which to begin paging for errors. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<EthosError>> | A list of EthosErrors starting from the given offset. |
GetErrorsFromOffsetAsJArrayAsync(Int32)
Gets all of the errors for the given tenant per access token from the given offset, as a list of JArrays. Uses the default page size.
Declaration
public async Task<IEnumerable<JArray>> GetErrorsFromOffsetAsJArrayAsync(int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | offset | The 0 based index from which to begin paging for the given resource. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<JArray>> | IEnumerable<JArray> |
GetErrorsFromOffsetAsJsonStringsAsync(Int32)
Gets all of the errors for the given tenant per access token from the given offset, as a list of strings. Uses the default page size.
Declaration
public async Task<IEnumerable<string>> GetErrorsFromOffsetAsJsonStringsAsync(int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | offset |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<System.String>> | IEnumerable<string> |
GetErrorsFromOffsetAsync(Int32)
Gets all of the errors for the given tenant per access token from the given offset. Uses the default page size.
Declaration
public async Task<IEnumerable<EthosResponse>> GetErrorsFromOffsetAsync(int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | offset | The 0 based index from which to begin paging for errors. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<EthosResponse>> | IEnumerable<EthosResponse> |
GetErrorsFromOffsetWithPageSizeAsJArrayAsync(Int32, Int32)
Gets all of the errors for the given tenant per access token from the given offset, as a list of JArrays.
Declaration
public async Task<IEnumerable<JArray>> GetErrorsFromOffsetWithPageSizeAsJArrayAsync(int offset, int pageSize)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | offset | |
| System.Int32 | pageSize | The limit number of Errors to include in each page of errors returned. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<JArray>> | IEnumerable<JArray> |
GetErrorsFromOffsetWithPageSizeAsJsonStringsAsync(Int32, Int32)
Gets all of the errors for the given tenant per access token from the given offset, as a list of strings.
Declaration
public async Task<IEnumerable<string>> GetErrorsFromOffsetWithPageSizeAsJsonStringsAsync(int offset, int pageSize)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | offset | |
| System.Int32 | pageSize | The limit number of Errors to include in each page of errors returned. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<System.String>> | IEnumerable<string> |
GetErrorsFromOffsetWithPageSizeAsync(Int32, Int32)
Gets all of the errors for the given tenant per access token from the given offset. Uses the given page size.
Declaration
public async Task<IEnumerable<EthosResponse>> GetErrorsFromOffsetWithPageSizeAsync(int offset, int pageSize)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | offset | The 0 based index from which to begin paging for errors. |
| System.Int32 | pageSize | The limit number of Errors to include in each page of errors returned. |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<EthosResponse>> | IEnumerable<EthosResponse> |
GetTotalErrorCountAsync()
Gets the total number of errors according to the 'x-total-count' response header for the given tenant per access token.
Declaration
public async Task<int> GetTotalErrorCountAsync()
Returns
| Type | Description |
|---|---|
| Task<System.Int32> | The total number of errors for the given tenant, or 0 if the 'x-total-count' header is not found. |
PostAsync(EthosError)
Create the given Error in the tenant associated with the AccessToken. See the examples directory for how to do this.
Declaration
public async Task<EthosResponse> PostAsync(EthosError newError)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosError | newError | An Error object. |
Returns
| Type | Description |
|---|---|
| Task<EthosResponse> | The response payload from the errors service. |