digitaluapi

<back to all web services

Files

Requires Authentication
Requires any of the roles:Client, Admin, Partner
The following routes are available for this service:
All Verbs/restfiles/files
All Verbs/restfiles/files/{Path*}
import 'package:servicestack/servicestack.dart';

class Files implements IConvertible
{
    String? Path;
    String? TextContents;
    bool? ForDownload;

    Files({this.Path,this.TextContents,this.ForDownload});
    Files.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Path = json['Path'];
        TextContents = json['TextContents'];
        ForDownload = json['ForDownload'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Path': Path,
        'TextContents': TextContents,
        'ForDownload': ForDownload
    };

    getTypeName() => "Files";
    TypeContext? context = _ctx;
}

class Folder implements IConvertible
{
    String? Name;
    DateTime? ModifiedDate;
    int? FileCount;

    Folder({this.Name,this.ModifiedDate,this.FileCount});
    Folder.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Name = json['Name'];
        ModifiedDate = JsonConverters.fromJson(json['ModifiedDate'],'DateTime',context!);
        FileCount = json['FileCount'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Name': Name,
        'ModifiedDate': JsonConverters.toJson(ModifiedDate,'DateTime',context!),
        'FileCount': FileCount
    };

    getTypeName() => "Folder";
    TypeContext? context = _ctx;
}

class File implements IConvertible
{
    String? Name;
    String? Extension;
    int? FileSizeBytes;
    DateTime? ModifiedDate;
    bool? IsTextFile;

    File({this.Name,this.Extension,this.FileSizeBytes,this.ModifiedDate,this.IsTextFile});
    File.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Name = json['Name'];
        Extension = json['Extension'];
        FileSizeBytes = json['FileSizeBytes'];
        ModifiedDate = JsonConverters.fromJson(json['ModifiedDate'],'DateTime',context!);
        IsTextFile = json['IsTextFile'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Name': Name,
        'Extension': Extension,
        'FileSizeBytes': FileSizeBytes,
        'ModifiedDate': JsonConverters.toJson(ModifiedDate,'DateTime',context!),
        'IsTextFile': IsTextFile
    };

    getTypeName() => "File";
    TypeContext? context = _ctx;
}

class FolderResult implements IConvertible
{
    List<Folder>? Folders;
    List<File>? Files;

    FolderResult({this.Folders,this.Files});
    FolderResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Folders = JsonConverters.fromJson(json['Folders'],'List<Folder>',context!);
        Files = JsonConverters.fromJson(json['Files'],'List<File>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Folders': JsonConverters.toJson(Folders,'List<Folder>',context!),
        'Files': JsonConverters.toJson(Files,'List<File>',context!)
    };

    getTypeName() => "FolderResult";
    TypeContext? context = _ctx;
}

class FileResult implements IConvertible
{
    String? Name;
    String? Extension;
    int? FileSizeBytes;
    DateTime? ModifiedDate;
    bool? IsTextFile;
    String? Contents;

    FileResult({this.Name,this.Extension,this.FileSizeBytes,this.ModifiedDate,this.IsTextFile,this.Contents});
    FileResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Name = json['Name'];
        Extension = json['Extension'];
        FileSizeBytes = json['FileSizeBytes'];
        ModifiedDate = JsonConverters.fromJson(json['ModifiedDate'],'DateTime',context!);
        IsTextFile = json['IsTextFile'];
        Contents = json['Contents'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Name': Name,
        'Extension': Extension,
        'FileSizeBytes': FileSizeBytes,
        'ModifiedDate': JsonConverters.toJson(ModifiedDate,'DateTime',context!),
        'IsTextFile': IsTextFile,
        'Contents': Contents
    };

    getTypeName() => "FileResult";
    TypeContext? context = _ctx;
}

class FilesResponse implements IConvertible
{
    FolderResult? Directory;
    FileResult? File;
    ResponseStatus? ResponseStatus;

    FilesResponse({this.Directory,this.File,this.ResponseStatus});
    FilesResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Directory = JsonConverters.fromJson(json['Directory'],'FolderResult',context!);
        File = JsonConverters.fromJson(json['File'],'FileResult',context!);
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Directory': JsonConverters.toJson(Directory,'FolderResult',context!),
        'File': JsonConverters.toJson(File,'FileResult',context!),
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

    getTypeName() => "FilesResponse";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'duengageapi.uat.scadsoftware.com', types: <String, TypeInfo> {
    'Files': TypeInfo(TypeOf.Class, create:() => Files()),
    'Folder': TypeInfo(TypeOf.Class, create:() => Folder()),
    'File': TypeInfo(TypeOf.Class, create:() => File()),
    'FolderResult': TypeInfo(TypeOf.Class, create:() => FolderResult()),
    'List<Folder>': TypeInfo(TypeOf.Class, create:() => <Folder>[]),
    'List<File>': TypeInfo(TypeOf.Class, create:() => <File>[]),
    'FileResult': TypeInfo(TypeOf.Class, create:() => FileResult()),
    'FilesResponse': TypeInfo(TypeOf.Class, create:() => FilesResponse()),
});

Dart Files DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /restfiles/files HTTP/1.1 
Host: duengageapi.uat.scadsoftware.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Path":"String","TextContents":"String","ForDownload":false}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Directory":{"Folders":[{"Name":"String","ModifiedDate":"0001-01-01T00:00:00.0000000","FileCount":0}],"Files":[{"Name":"String","Extension":"String","FileSizeBytes":0,"ModifiedDate":"0001-01-01T00:00:00.0000000","IsTextFile":false}]},"File":{"Name":"String","Extension":"String","FileSizeBytes":0,"ModifiedDate":"0001-01-01T00:00:00.0000000","IsTextFile":false,"Contents":"String"},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}