Class EthosResponseConverter
Converter class extending the EthosResponseBuilder, the primary purpose of which is to handle manipulation
of the response body content for paging calculations, such as trimming the response body content for a given offset or
number of rows.Also converts an EthosResponse to
Inherited Members
Namespace: Ellucian.Ethos.Integration.Client
Assembly: Ellucian.Ethos.Integration.dll
Syntax
public class EthosResponseConverter : EthosResponseBuilder
Methods
CopyHeaders(EthosResponse)
Returns a copy of the headers map from the given EthosResponse. Uses the HeadersMap in the EthosResponseBuilder class to copy headers into the returned headers map.
Declaration
HttpResponseHeaders CopyHeaders(EthosResponse sourceResponse)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | sourceResponse |
Returns
| Type | Description |
|---|---|
| HttpResponseHeaders | Returns Http Response Header values. |
ParamsValid(EthosResponse, Int32)
Validates whether the given params are valid. If the given sourceResponse is not null, and
contains content that is not null or empty, and if the positiveParam( which is intended to be either the offset
or numRows ) is not less than 0 (positive), then returns true. Otherwise returns false.
Declaration
bool ParamsValid(EthosResponse sourceResponse, int positiveParam)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | sourceResponse | The EthosResponse to validate the content for. |
| System.Int32 | positiveParam | Should be either the offset or numRows as called from other methods. |
Returns
| Type | Description |
|---|---|
| System.Boolean | False if the given |
ToCNList(EthosResponse)
Converts the given ethosResponse to a list of ChangeNotification object.
Declaration
public IEnumerable<ChangeNotification> ToCNList(EthosResponse ethosResponse)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | ethosResponse | The EthosResponse to convert containing content for the ChangeNotifications. |
Returns
| Type | Description |
|---|---|
| IEnumerable<ChangeNotification> | A list of ChangeNotifications from the content of the given ethosResponse, or null if the ethosResponse is null or it's content is null or blank. |
ToContentString(EthosResponse)
Returns the content body of the given EthosResponse, or null if the EthosResponse is null.
Declaration
public string ToContentString(EthosResponse ethosResponse)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | ethosResponse | The EthosResponse to get the content body from. |
Returns
| Type | Description |
|---|---|
| System.String | The content body of the given EthosResponse. |
ToEthosErrorList(EthosResponse)
Converts an ethosResponse to a list of EthosError objects. The given ethosResponse.getContent() should contain an entire page of errors as an errors array in JSON format.
Declaration
public IEnumerable<EthosError> ToEthosErrorList(EthosResponse ethosResponse)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | ethosResponse | The EthosResponse to convert containing content for a page of EthosErrors. |
Returns
| Type | Description |
|---|---|
| IEnumerable<EthosError> | An IEnumerable of EthosErrors from the content of the given ethosResponse, or an empty list if the ethosResponse is null or it's content is null or blank. |
ToJArray(EthosResponse)
Returns a
Declaration
public JArray ToJArray(EthosResponse ethosResponse)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | ethosResponse | The given EthosResponse to convert to a |
Returns
| Type | Description |
|---|---|
| JArray | A |
ToJArray(IEnumerable<EthosResponse>)
Converts the given list of EthosResponse objects into a
Declaration
public JArray ToJArray(IEnumerable<EthosResponse> ethosResponseList)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<EthosResponse> | ethosResponseList | The list of EthosResponse objects to convert to a |
Returns
| Type | Description |
|---|---|
| JArray | a |
ToJArrayList(IEnumerable<EthosResponse>)
Converts the given list of EthosResponse objects into a list of
Declaration
public IEnumerable<JArray> ToJArrayList(IEnumerable<EthosResponse> ethosResponseList)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<EthosResponse> | ethosResponseList | The list of EthosResponse objects to convert to a list of |
Returns
| Type | Description |
|---|---|
| IEnumerable<JArray> | A list of |
ToJObjectSingle(EthosResponse)
Returns a
Declaration
public JObject ToJObjectSingle(EthosResponse ethosResponse)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | ethosResponse | The given EthosResponse to convert to a |
Returns
| Type | Description |
|---|---|
| JObject | A |
ToPagedStringList(IEnumerable<EthosResponse>)
Converts the given list of EthosResponse objects into a list of
Declaration
public IEnumerable<string> ToPagedStringList(IEnumerable<EthosResponse> ethosResponseList)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<EthosResponse> | ethosResponseList | The list of EthosResponse objects to convert to a list of |
Returns
| Type | Description |
|---|---|
| IEnumerable<System.String> | a list of |
ToSingleEthosError(EthosResponse)
Converts an EthosResponse to an EthosError object. The given ethosResponse.Content should contain data for only a single error, and not an entire page of errors.
Declaration
public EthosError ToSingleEthosError(EthosResponse ethosResponse)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | ethosResponse | An EthosError from the content of the given ethosResponse, or null if the ethosResponse is null or its content is null or blank. |
Returns
| Type | Description |
|---|---|
| EthosError | EthosError with error content. |
ToStringList(IEnumerable<EthosResponse>)
Converts the given list of EthosResponse objects into a list of
Declaration
public IEnumerable<string> ToStringList(IEnumerable<EthosResponse> ethosResponseList)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<EthosResponse> | ethosResponseList | The list of EthosResponse objects to convert to a list of |
Returns
| Type | Description |
|---|---|
| IEnumerable<System.String> | a list of |
TrimContentForNumRows(EthosResponse, Int32)
Takes the given EthosResponse and trims it's content for the given number of rows.
For example, if the given content contains 10 rows, and numRows is 7, the returned EthosResponse content will
contain rows 0 through 6 (for a total of 7) of the sourceResponse content. The returned EthosResponse
will also contain the headers and Http status code from the given sourceResponse.
Declaration
public EthosResponse TrimContentForNumRows(EthosResponse sourceResponse, int numRows)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | sourceResponse | The EthosResponse to trim content for. |
| System.Int32 | numRows | The number of rows to trim the content for. |
Returns
| Type | Description |
|---|---|
| EthosResponse | An EthosResponse containing the same content as the |
TrimContentFromOffset(EthosResponse, Int32)
Takes the given EthosResponse and trims it's content from the given offset. For example,
if the given content contains 10 rows, and the offset is 3, the returned EthosResponse content will
contain rows 3 through the end of the sourceResponse content.
The returned EthosResponse will also contain the headers and Http status code from the given sourceResponse.
Declaration
public EthosResponse TrimContentFromOffset(EthosResponse sourceResponse, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | sourceResponse | The EthosResponse to trim content for. |
| System.Int32 | offset | The offset (row num) from which to begin trimming content. |
Returns
| Type | Description |
|---|---|
| EthosResponse | An EthosResponse containing the same content as the |
TrimContentFromOffsetForNumRows(EthosResponse, Int32, Int32)
Takes the given EthosResponse and trims it's content from the given offset for the given number of rows. For example,
if the given content contains 10 rows, the offset is 3, and numRows is 7, the returnedEthosResponse content will
contain rows 3 through 6 (for a total of 4) of thesourceResponse content.
The returned EthosResponse will also contain the headers and Http status code from the given sourceResponse.
Declaration
public EthosResponse TrimContentFromOffsetForNumRows(EthosResponse sourceResponse, int offset, int numRows)
Parameters
| Type | Name | Description |
|---|---|---|
| EthosResponse | sourceResponse | The EthosResponse to trim content for. |
| System.Int32 | offset | The offset (row num) from which to begin trimming content. |
| System.Int32 | numRows | The number of rows to trim the content for. |
Returns
| Type | Description |
|---|---|
| EthosResponse | An EthosResponse containing the same content as the |