GET | /RestApi/files-api |
---|
import 'package:servicestack/servicestack.dart';
class FilesGetRequest implements IConvertible
{
String? Path;
String? Extension;
int? Skip;
int? Take;
FilesGetRequest({this.Path,this.Extension,this.Skip,this.Take});
FilesGetRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Path = json['Path'];
Extension = json['Extension'];
Skip = json['Skip'];
Take = json['Take'];
return this;
}
Map<String, dynamic> toJson() => {
'Path': Path,
'Extension': Extension,
'Skip': Skip,
'Take': Take
};
getTypeName() => "FilesGetRequest";
TypeContext? context = _ctx;
}
class FilesItemViewModel implements IConvertible
{
String? Name;
bool? IsFolder;
bool? HasChildren;
FilesItemViewModel({this.Name,this.IsFolder,this.HasChildren});
FilesItemViewModel.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Name = json['Name'];
IsFolder = json['IsFolder'];
HasChildren = json['HasChildren'];
return this;
}
Map<String, dynamic> toJson() => {
'Name': Name,
'IsFolder': IsFolder,
'HasChildren': HasChildren
};
getTypeName() => "FilesItemViewModel";
TypeContext? context = _ctx;
}
class FilesViewModel implements IConvertible
{
List<FilesItemViewModel>? Items;
String? Error;
FilesViewModel({this.Items,this.Error});
FilesViewModel.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Items = JsonConverters.fromJson(json['Items'],'List<FilesItemViewModel>',context!);
Error = json['Error'];
return this;
}
Map<String, dynamic> toJson() => {
'Items': JsonConverters.toJson(Items,'List<FilesItemViewModel>',context!),
'Error': Error
};
getTypeName() => "FilesViewModel";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'www.asg.com.au', types: <String, TypeInfo> {
'FilesGetRequest': TypeInfo(TypeOf.Class, create:() => FilesGetRequest()),
'FilesItemViewModel': TypeInfo(TypeOf.Class, create:() => FilesItemViewModel()),
'FilesViewModel': TypeInfo(TypeOf.Class, create:() => FilesViewModel()),
'List<FilesItemViewModel>': TypeInfo(TypeOf.Class, create:() => <FilesItemViewModel>[]),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /RestApi/files-api HTTP/1.1 Host: www.asg.com.au Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"Error":"String"}