MyApp

<back to all web services

CreateFileSystemItem

Files
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

enum FileAccessType
{
    Public,
    Team,
    Private,
}

class FileSystemFile implements IFile, IConvertible
{
    int? id;
    String? fileName;
    String? filePath;
    String? contentType;
    int? contentLength;
    // @References(typeof(FileSystemItem))
    int? fileSystemItemId;

    FileSystemFile({this.id,this.fileName,this.filePath,this.contentType,this.contentLength,this.fileSystemItemId});
    FileSystemFile.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        fileName = json['fileName'];
        filePath = json['filePath'];
        contentType = json['contentType'];
        contentLength = json['contentLength'];
        fileSystemItemId = json['fileSystemItemId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'fileName': fileName,
        'filePath': filePath,
        'contentType': contentType,
        'contentLength': contentLength,
        'fileSystemItemId': fileSystemItemId
    };

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

class FileSystemItem implements IFileItem, IConvertible
{
    int? id;
    FileAccessType? fileAccessType;
    FileSystemFile? file;
    String? appUserId;

    FileSystemItem({this.id,this.fileAccessType,this.file,this.appUserId});
    FileSystemItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        fileAccessType = JsonConverters.fromJson(json['fileAccessType'],'FileAccessType',context!);
        file = JsonConverters.fromJson(json['file'],'FileSystemFile',context!);
        appUserId = json['appUserId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'fileAccessType': JsonConverters.toJson(fileAccessType,'FileAccessType',context!),
        'file': JsonConverters.toJson(file,'FileSystemFile',context!),
        'appUserId': appUserId
    };

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

class CreateFileSystemItem implements ICreateDb<FileSystemItem>, IFileItem, IConvertible
{
    FileAccessType? fileAccessType;
    FileSystemFile? file;

    CreateFileSystemItem({this.fileAccessType,this.file});
    CreateFileSystemItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        fileAccessType = JsonConverters.fromJson(json['fileAccessType'],'FileAccessType',context!);
        file = JsonConverters.fromJson(json['file'],'FileSystemFile',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'fileAccessType': JsonConverters.toJson(fileAccessType,'FileAccessType',context!),
        'file': JsonConverters.toJson(file,'FileSystemFile',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'blazor_gallery.servicestack.net', types: <String, TypeInfo> {
    'FileAccessType': TypeInfo(TypeOf.Enum, enumValues:FileAccessType.values),
    'FileSystemFile': TypeInfo(TypeOf.Class, create:() => FileSystemFile()),
    'FileSystemItem': TypeInfo(TypeOf.Class, create:() => FileSystemItem()),
    'CreateFileSystemItem': TypeInfo(TypeOf.Class, create:() => CreateFileSystemItem()),
});

Dart CreateFileSystemItem 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 /json/reply/CreateFileSystemItem HTTP/1.1 
Host: blazor-gallery.servicestack.net 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"fileAccessType":"Public","file":{"id":0,"fileName":"String","filePath":"String","contentType":"String","contentLength":0,"fileSystemItemId":0}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"id":0,"fileAccessType":"Public","file":{"id":0,"fileName":"String","filePath":"String","contentType":"String","contentLength":0,"fileSystemItemId":0},"appUserId":"String"}