Result classβ
A class used to handle the result of a function call or sub-process. Functions/process should return back this object so that the calling function can evaluate it's success.
Signature:export declare class Result<TReturned = any | undefined> extends ResultBase implements IResult<TReturned>
Constructorsβ
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(params) | Constructs a new instance of the Result class |
Propertiesβ
| Property | Modifiers | Type | Description |
|---|---|---|---|
| callback? | CallbackFunction | (Optional) A field containing any values returned from the function call | |
| context? | unknown | (Optional) A free-format field that will be added to all IEvent objects (to be used in custom logic added by the user). | |
| create | static | <TReturned_1 = any>(params: string | Error | Partial<ResultBaseParams<TReturned_1>>) => Result<TReturned_1> | A helper function to create a result object |
| data? | TReturned | (Optional) A field containing any values returned from the function call | |
| details? | string | null | (Optional) A string that includes additional information about the event | |
| id | string | A unique string that can be used to identify the event | |
| isValidated? | boolean | null | (Optional) An indicator specifying the last results of isValidated. If it has not been validated yet, return null | |
| severity | Severity | Determines the severity level of the event (a number 0 through 10). This field is used to determine how the system should respond to an event | |
| source? | string | null | (Optional) A string representing the source that initiated the event | |
| success | static | <TReturned_1 = any>(data?: TReturned_1 | undefined, type?: EventType | undefined) => Result<TReturned_1> | A helper function to return back a success result |
| type | EventType | The type of the event (values can be defined by the user) | |
| userId? | string | (Optional) A string that can be used to represent the current user performing actions in the application/triggering processes | |
| validate | () => boolean | A function call to validate if the result is a success or failure | |
| warning | static | <TReturned_1 = any>(message?: any, data?: TReturned_1 | undefined, type?: EventType | undefined) => Result<TReturned_1> | A helper function to return back an warning result |
Methodsβ
| Method | Modifiers | Description |
|---|---|---|
| error(error, type) | static | A helper function to return back an error result |