| POST | /api/attachments |
|---|
import 'package:servicestack/servicestack.dart';
class AddAttachmentsResponse implements IConvertible
{
ResponseStatus? ResponseStatus;
AddAttachmentsResponse({this.ResponseStatus});
AddAttachmentsResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
};
getTypeName() => "AddAttachmentsResponse";
TypeContext? context = _ctx;
}
class MediaModel implements IConvertible
{
String? MediaFileId;
String? MediaName;
String? FileContent;
String? FileContentType;
String? FilePath;
String? OriginalFileName;
int? ImageWidth;
int? ImageHeight;
int? FileSizeKB;
String? BlobUriRaw;
String? BlobUriFull;
String? BlobUriThumbnail;
String? WatermarkUri;
DateTime? CapturedDate;
String? CapturedByContactId;
String? CapturedByContactName;
String? CapturedByContactThumbnailUrl;
String? Notes;
String? ResourceActionName;
String? LocationVerified;
String? TrafficLightLocationVerified;
String? AudienceLevel;
String? WorksFor;
MediaModel({this.MediaFileId,this.MediaName,this.FileContent,this.FileContentType,this.FilePath,this.OriginalFileName,this.ImageWidth,this.ImageHeight,this.FileSizeKB,this.BlobUriRaw,this.BlobUriFull,this.BlobUriThumbnail,this.WatermarkUri,this.CapturedDate,this.CapturedByContactId,this.CapturedByContactName,this.CapturedByContactThumbnailUrl,this.Notes,this.ResourceActionName,this.LocationVerified,this.TrafficLightLocationVerified,this.AudienceLevel,this.WorksFor});
MediaModel.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
MediaFileId = json['MediaFileId'];
MediaName = json['MediaName'];
FileContent = json['FileContent'];
FileContentType = json['FileContentType'];
FilePath = json['FilePath'];
OriginalFileName = json['OriginalFileName'];
ImageWidth = json['ImageWidth'];
ImageHeight = json['ImageHeight'];
FileSizeKB = json['FileSizeKB'];
BlobUriRaw = json['BlobUriRaw'];
BlobUriFull = json['BlobUriFull'];
BlobUriThumbnail = json['BlobUriThumbnail'];
WatermarkUri = json['WatermarkUri'];
CapturedDate = JsonConverters.fromJson(json['CapturedDate'],'DateTime',context!);
CapturedByContactId = json['CapturedByContactId'];
CapturedByContactName = json['CapturedByContactName'];
CapturedByContactThumbnailUrl = json['CapturedByContactThumbnailUrl'];
Notes = json['Notes'];
ResourceActionName = json['ResourceActionName'];
LocationVerified = json['LocationVerified'];
TrafficLightLocationVerified = json['TrafficLightLocationVerified'];
AudienceLevel = json['AudienceLevel'];
WorksFor = json['WorksFor'];
return this;
}
Map<String, dynamic> toJson() => {
'MediaFileId': MediaFileId,
'MediaName': MediaName,
'FileContent': FileContent,
'FileContentType': FileContentType,
'FilePath': FilePath,
'OriginalFileName': OriginalFileName,
'ImageWidth': ImageWidth,
'ImageHeight': ImageHeight,
'FileSizeKB': FileSizeKB,
'BlobUriRaw': BlobUriRaw,
'BlobUriFull': BlobUriFull,
'BlobUriThumbnail': BlobUriThumbnail,
'WatermarkUri': WatermarkUri,
'CapturedDate': JsonConverters.toJson(CapturedDate,'DateTime',context!),
'CapturedByContactId': CapturedByContactId,
'CapturedByContactName': CapturedByContactName,
'CapturedByContactThumbnailUrl': CapturedByContactThumbnailUrl,
'Notes': Notes,
'ResourceActionName': ResourceActionName,
'LocationVerified': LocationVerified,
'TrafficLightLocationVerified': TrafficLightLocationVerified,
'AudienceLevel': AudienceLevel,
'WorksFor': WorksFor
};
getTypeName() => "MediaModel";
TypeContext? context = _ctx;
}
class AddAttachments implements IConvertible
{
/**
* including file content, file type, content type and connected object.
*/
// @ApiMember(DataType="string", Description=" including file content, file type, content type and connected object.", Name="Files", ParameterType="query")
List<MediaModel>? Files;
/**
* Appliance from which primary image file is to be uploaded.
*/
// @ApiMember(DataType="Guid", Description="Appliance from which primary image file is to be uploaded.", IsRequired=true, Name="ApplianceId")
String? ApplianceId;
/**
* Object for which primary image is to be uploaded.
*/
// @ApiMember(DataType="Guid", Description="Object for which primary image is to be uploaded.", IsRequired=true, Name="ConnectedObjectId")
String? ConnectedObjectId;
/**
* Licensee Id of the Object owner for which primary image is to be uploaded.
*/
// @ApiMember(DataType="Guid", Description="Licensee Id of the Object owner for which primary image is to be uploaded.", IsRequired=true, Name="ConnectedObjectLicenseeId")
String? ConnectedObjectLicenseeId;
AddAttachments({this.Files,this.ApplianceId,this.ConnectedObjectId,this.ConnectedObjectLicenseeId});
AddAttachments.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Files = JsonConverters.fromJson(json['Files'],'List<MediaModel>',context!);
ApplianceId = json['ApplianceId'];
ConnectedObjectId = json['ConnectedObjectId'];
ConnectedObjectLicenseeId = json['ConnectedObjectLicenseeId'];
return this;
}
Map<String, dynamic> toJson() => {
'Files': JsonConverters.toJson(Files,'List<MediaModel>',context!),
'ApplianceId': ApplianceId,
'ConnectedObjectId': ConnectedObjectId,
'ConnectedObjectLicenseeId': ConnectedObjectLicenseeId
};
getTypeName() => "AddAttachments";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'pfapi.pstpf.com.au', types: <String, TypeInfo> {
'AddAttachmentsResponse': TypeInfo(TypeOf.Class, create:() => AddAttachmentsResponse()),
'MediaModel': TypeInfo(TypeOf.Class, create:() => MediaModel()),
'AddAttachments': TypeInfo(TypeOf.Class, create:() => AddAttachments()),
'List<MediaModel>': TypeInfo(TypeOf.Class, create:() => <MediaModel>[]),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/attachments HTTP/1.1
Host: pfapi.pstpf.com.au
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
Files:
[
{
MediaName: String,
FileContent: String,
FileContentType: String,
FilePath: String,
OriginalFileName: String,
ImageWidth: 0,
ImageHeight: 0,
FileSizeKB: 0,
BlobUriRaw: String,
BlobUriFull: String,
BlobUriThumbnail: String,
WatermarkUri: String,
CapturedDate: 0001-01-01,
CapturedByContactId: 00000000000000000000000000000000,
CapturedByContactName: String,
CapturedByContactThumbnailUrl: String,
Notes: String,
ResourceActionName: String,
LocationVerified: String,
AudienceLevel: String,
WorksFor: String
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}