| POST | /s3/files |
|---|
import 'package:servicestack/servicestack.dart';
class HttpFile implements IConvertible
{
String? name;
String? fileName;
int? contentLength;
String? contentType;
Uint8List? inputStream;
HttpFile({this.name,this.fileName,this.contentLength,this.contentType,this.inputStream});
HttpFile.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
name = json['name'];
fileName = json['fileName'];
contentLength = json['contentLength'];
contentType = json['contentType'];
inputStream = JsonConverters.fromJson(json['inputStream'],'Uint8List',context!);
return this;
}
Map<String, dynamic> toJson() => {
'name': name,
'fileName': fileName,
'contentLength': contentLength,
'contentType': contentType,
'inputStream': JsonConverters.toJson(inputStream,'Uint8List',context!)
};
getTypeName() => "HttpFile";
TypeContext? context = _ctx;
}
class UploadS3FileRequest implements IConvertible
{
String? path;
HttpFile? file;
UploadS3FileRequest({this.path,this.file});
UploadS3FileRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
path = json['path'];
file = JsonConverters.fromJson(json['file'],'HttpFile',context!);
return this;
}
Map<String, dynamic> toJson() => {
'path': path,
'file': JsonConverters.toJson(file,'HttpFile',context!)
};
getTypeName() => "UploadS3FileRequest";
TypeContext? context = _ctx;
}
class SystemConfig implements ICreated, IUpdate, IConvertible
{
int? id;
String? name;
String? value;
String? description;
bool? isActive;
// @required()
DateTime? createdDate;
// @required()
DateTime? updatedDate;
SystemConfig({this.id,this.name,this.value,this.description,this.isActive,this.createdDate,this.updatedDate});
SystemConfig.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
value = json['value'];
description = json['description'];
isActive = json['isActive'];
createdDate = JsonConverters.fromJson(json['createdDate'],'DateTime',context!);
updatedDate = JsonConverters.fromJson(json['updatedDate'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'value': value,
'description': description,
'isActive': isActive,
'createdDate': JsonConverters.toJson(createdDate,'DateTime',context!),
'updatedDate': JsonConverters.toJson(updatedDate,'DateTime',context!)
};
getTypeName() => "SystemConfig";
TypeContext? context = _ctx;
}
class BaseResponse<SystemConfig> implements IResponseRequest, IConvertible
{
int? code;
String? message;
SystemConfig? data;
BaseResponse({this.code,this.message,this.data});
BaseResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
code = json['code'];
message = json['message'];
data = JsonConverters.fromJson(json['data'],'SystemConfig',context!);
return this;
}
Map<String, dynamic> toJson() => {
'code': code,
'message': message,
'data': JsonConverters.toJson(data,'SystemConfig',context!)
};
getTypeName() => "BaseResponse<$SystemConfig>";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'chienbinhdevias_admin_api_sandbox.adnx.vn', types: <String, TypeInfo> {
'HttpFile': TypeInfo(TypeOf.Class, create:() => HttpFile()),
'Uint8List': TypeInfo(TypeOf.Class, create:() => Uint8List(0)),
'UploadS3FileRequest': TypeInfo(TypeOf.Class, create:() => UploadS3FileRequest()),
'SystemConfig': TypeInfo(TypeOf.Class, create:() => SystemConfig()),
'BaseResponse<SystemConfig>': TypeInfo(TypeOf.Class, create:() => BaseResponse<SystemConfig>()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /s3/files HTTP/1.1
Host: chienbinhdevias-admin-api-sandbox.adnx.vn
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UploadS3FileRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/adnx.devias.admin.api.ServiceModel">
<File xmlns:d2p1="http://schemas.datacontract.org/2004/07/ServiceStack.Host">
<d2p1:ContentLength>0</d2p1:ContentLength>
<d2p1:ContentType>String</d2p1:ContentType>
<d2p1:FileName>String</d2p1:FileName>
<d2p1:InputStream xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.IO" i:nil="true" />
<d2p1:Name>String</d2p1:Name>
</File>
<Path>String</Path>
</UploadS3FileRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <BaseResponseOfstring xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/adnx.devias.admin.api.ServiceModel"> <Code>0</Code> <Data>String</Data> <Message>String</Message> </BaseResponseOfstring>