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 .xml suffix or ?format=xml

HTTP + XML

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

POST /xml/reply/CreateFileSystemItem HTTP/1.1 
Host: blazor-gallery.servicestack.net 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<CreateFileSystemItem xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyApp.ServiceModel">
  <File>
    <ContentLength>0</ContentLength>
    <ContentType>String</ContentType>
    <FileName>String</FileName>
    <FilePath>String</FilePath>
    <FileSystemItemId>0</FileSystemItemId>
    <Id>0</Id>
  </File>
  <FileAccessType>Public</FileAccessType>
</CreateFileSystemItem>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<FileSystemItem xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyApp.ServiceModel">
  <AppUserId>String</AppUserId>
  <File>
    <ContentLength>0</ContentLength>
    <ContentType>String</ContentType>
    <FileName>String</FileName>
    <FilePath>String</FilePath>
    <FileSystemItemId>0</FileSystemItemId>
    <Id>0</Id>
  </File>
  <FileAccessType>Public</FileAccessType>
  <Id>0</Id>
</FileSystemItem>