The type of the data returned in a successful result. Defaults to never.
The data payload of a successful result.
OptionalerrorThe error object of a failed result.
Indicates whether the result represents a successful operation.
true if there is no error; otherwise false.
Implements the JSON.stringify() behavior.
It uses toStruct to get the plain object structure under the hood.
It is encouraged to use toStruct instead of this method because it provides better
clarity and expressiveness about the data structure being serialized. This method is provided
only to support the JSON.stringify() serialization.
A plain object structure containing the model's serializable properties.
Converts the result instance into a plain data structure (struct).
A plain object structure containing the result properties.
Represents the outcome of an operation, which can be either a success containing data or a failure containing an error.
Example
Example demonstrating creating and serializing successful and failed results