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 .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 /import-from-excel HTTP/1.1 
Host: etc-api.vsmlab.vn 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<ReadAndImportDataApi xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/tvpl.api.ServiceModel">
  <DataFile i:nil="true" />
  <IsInternal>false</IsInternal>
</ReadAndImportDataApi>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ReadExcelResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/tvpl.api.ServiceModel">
  <MaxColumnR>0</MaxColumnR>
  <Rows xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:ArrayOfstring>
      <d2p1:string>String</d2p1:string>
    </d2p1:ArrayOfstring>
  </Rows>
</ReadExcelResponse>