Skip to content

Instantly share code, notes, and snippets.

@an01f01
Created June 20, 2023 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save an01f01/ae8ab6ba2b0badaac315b0c5b2c108d8 to your computer and use it in GitHub Desktop.
Save an01f01/ae8ab6ba2b0badaac315b0c5b2c108d8 to your computer and use it in GitHub Desktop.
ITodo = interface
end;
TErrorTodo = class(TInterfacedObject, ITodo)
public
[JSONMarshalled(True)][JSONName('error_message')]
ErrorMessage: string;
constructor Create(ErrorMessage: string);
function GetSelf: TObject;
function ToString: string;
end;
TItemTodo = class(TInterfacedObject, ITodo)
public
[JSONMarshalled(True)][JSONName('task')]
Task: string;
[JSONMarshalled(True)][JSONName('is_completed')]
IsCompleted: Boolean;
constructor Create(Task: string; IsCompleted: Boolean);
function GetSelf: TObject;
function ToString: string;
end;
TListTodo = class(TInterfacedObject, ITodo)
private
public
[JSONMarshalled(True)][JSONName('name')]
Name: string;
[JSONMarshalled(True)][JSONName('todos')]
Todos: TList<TItemTodo>;
constructor Create();
destructor Destroy; override;
function GetSelf: TObject;
function ToString: string;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment