tvpl.api

<back to all web services

ReadAndImportDataApi

Requires Authentication
Required role:super-admin
The following routes are available for this service:
POST/import-from-excel
import 'package:servicestack/servicestack.dart';

class ReadExcelResponse implements IConvertible
{
    List<List<String>>? rows;
    double? maxColumnR;

    ReadExcelResponse({this.rows,this.maxColumnR});
    ReadExcelResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        rows = JsonConverters.fromJson(json['rows'],'List<List<String>>',context!);
        maxColumnR = JsonConverters.toDouble(json['maxColumnR']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'rows': JsonConverters.toJson(rows,'List<List<String>>',context!),
        'maxColumnR': maxColumnR
    };

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

abstract class IHttpFile
{
    String? name;
    String? fileName;
    int? contentLength;
    String? contentType;
    Uint8List? inputStream;
}

class ReadAndImportDataApi implements IConvertible
{
    IHttpFile? dataFile;
    bool? isInternal;

    ReadAndImportDataApi({this.dataFile,this.isInternal});
    ReadAndImportDataApi.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        dataFile = JsonConverters.fromJson(json['dataFile'],'IHttpFile',context!);
        isInternal = json['isInternal'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'dataFile': JsonConverters.toJson(dataFile,'IHttpFile',context!),
        'isInternal': isInternal
    };

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

TypeContext _ctx = TypeContext(library: 'etc_api.vsmlab.vn', types: <String, TypeInfo> {
    'ReadExcelResponse': TypeInfo(TypeOf.Class, create:() => ReadExcelResponse()),
    'List<List<String>>': TypeInfo(TypeOf.Class, create:() => <List<String>>[]),
    'IHttpFile': TypeInfo(TypeOf.Interface),
    'ReadAndImportDataApi': TypeInfo(TypeOf.Class, create:() => ReadAndImportDataApi()),
});

Dart ReadAndImportDataApi DTOs

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

HTTP + OTHER

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

POST /import-from-excel HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"dataFile":null,"isInternal":false}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"rows":[["String"]],"maxColumnR":0}