POST | /RestApi/comments-api/comments |
---|
import 'package:servicestack/servicestack.dart';
class GroupCreateRequest implements IConvertible
{
String? Key;
String? Name;
String? Description;
GroupCreateRequest({this.Key,this.Name,this.Description});
GroupCreateRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Key = json['Key'];
Name = json['Name'];
Description = json['Description'];
return this;
}
Map<String, dynamic> toJson() => {
'Key': Key,
'Name': Name,
'Description': Description
};
getTypeName() => "GroupCreateRequest";
TypeContext? context = _ctx;
}
class ThreadCreateRequest implements IConvertible
{
String? Key;
String? Type;
String? Behavior;
String? Title;
String? Language;
String? DataSource;
String? GroupKey;
GroupCreateRequest? Group;
ThreadCreateRequest({this.Key,this.Type,this.Behavior,this.Title,this.Language,this.DataSource,this.GroupKey,this.Group});
ThreadCreateRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Key = json['Key'];
Type = json['Type'];
Behavior = json['Behavior'];
Title = json['Title'];
Language = json['Language'];
DataSource = json['DataSource'];
GroupKey = json['GroupKey'];
Group = JsonConverters.fromJson(json['Group'],'GroupCreateRequest',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Key': Key,
'Type': Type,
'Behavior': Behavior,
'Title': Title,
'Language': Language,
'DataSource': DataSource,
'GroupKey': GroupKey,
'Group': JsonConverters.toJson(Group,'GroupCreateRequest',context!)
};
getTypeName() => "ThreadCreateRequest";
TypeContext? context = _ctx;
}
class CaptchaInfo implements IConvertible
{
String? Answer;
String? CorrectAnswer;
String? InitializationVector;
String? Key;
CaptchaInfo({this.Answer,this.CorrectAnswer,this.InitializationVector,this.Key});
CaptchaInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Answer = json['Answer'];
CorrectAnswer = json['CorrectAnswer'];
InitializationVector = json['InitializationVector'];
Key = json['Key'];
return this;
}
Map<String, dynamic> toJson() => {
'Answer': Answer,
'CorrectAnswer': CorrectAnswer,
'InitializationVector': InitializationVector,
'Key': Key
};
getTypeName() => "CaptchaInfo";
TypeContext? context = _ctx;
}
class CommentCreateRequest implements IConvertible
{
String? Message;
String? Name;
String? Email;
String? CustomData;
String? ThreadKey;
ThreadCreateRequest? Thread;
CaptchaInfo? Captcha;
double? Rating;
CommentCreateRequest({this.Message,this.Name,this.Email,this.CustomData,this.ThreadKey,this.Thread,this.Captcha,this.Rating});
CommentCreateRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Message = json['Message'];
Name = json['Name'];
Email = json['Email'];
CustomData = json['CustomData'];
ThreadKey = json['ThreadKey'];
Thread = JsonConverters.fromJson(json['Thread'],'ThreadCreateRequest',context!);
Captcha = JsonConverters.fromJson(json['Captcha'],'CaptchaInfo',context!);
Rating = JsonConverters.toDouble(json['Rating']);
return this;
}
Map<String, dynamic> toJson() => {
'Message': Message,
'Name': Name,
'Email': Email,
'CustomData': CustomData,
'ThreadKey': ThreadKey,
'Thread': JsonConverters.toJson(Thread,'ThreadCreateRequest',context!),
'Captcha': JsonConverters.toJson(Captcha,'CaptchaInfo',context!),
'Rating': Rating
};
getTypeName() => "CommentCreateRequest";
TypeContext? context = _ctx;
}
class CommentResponse implements IConvertible
{
String? Key;
String? Name;
String? Message;
DateTime? DateCreated;
String? ProfilePictureUrl;
String? ProfilePictureThumbnailUrl;
String? Status;
String? Email;
String? ThreadKey;
String? AuthorIpAddress;
String? CustomData;
double? Rating;
CommentResponse({this.Key,this.Name,this.Message,this.DateCreated,this.ProfilePictureUrl,this.ProfilePictureThumbnailUrl,this.Status,this.Email,this.ThreadKey,this.AuthorIpAddress,this.CustomData,this.Rating});
CommentResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Key = json['Key'];
Name = json['Name'];
Message = json['Message'];
DateCreated = JsonConverters.fromJson(json['DateCreated'],'DateTime',context!);
ProfilePictureUrl = json['ProfilePictureUrl'];
ProfilePictureThumbnailUrl = json['ProfilePictureThumbnailUrl'];
Status = json['Status'];
Email = json['Email'];
ThreadKey = json['ThreadKey'];
AuthorIpAddress = json['AuthorIpAddress'];
CustomData = json['CustomData'];
Rating = JsonConverters.toDouble(json['Rating']);
return this;
}
Map<String, dynamic> toJson() => {
'Key': Key,
'Name': Name,
'Message': Message,
'DateCreated': JsonConverters.toJson(DateCreated,'DateTime',context!),
'ProfilePictureUrl': ProfilePictureUrl,
'ProfilePictureThumbnailUrl': ProfilePictureThumbnailUrl,
'Status': Status,
'Email': Email,
'ThreadKey': ThreadKey,
'AuthorIpAddress': AuthorIpAddress,
'CustomData': CustomData,
'Rating': Rating
};
getTypeName() => "CommentResponse";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'www.asg.com.au', types: <String, TypeInfo> {
'GroupCreateRequest': TypeInfo(TypeOf.Class, create:() => GroupCreateRequest()),
'ThreadCreateRequest': TypeInfo(TypeOf.Class, create:() => ThreadCreateRequest()),
'CaptchaInfo': TypeInfo(TypeOf.Class, create:() => CaptchaInfo()),
'CommentCreateRequest': TypeInfo(TypeOf.Class, create:() => CommentCreateRequest()),
'CommentResponse': TypeInfo(TypeOf.Class, create:() => CommentResponse()),
});
Dart CommentCreateRequest DTOs
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 /RestApi/comments-api/comments HTTP/1.1
Host: www.asg.com.au
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CommentCreateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Telerik.Sitefinity.Services.Comments.DTO">
<Captcha>
<Answer>String</Answer>
<CorrectAnswer>String</CorrectAnswer>
<InitializationVector>String</InitializationVector>
<Key>String</Key>
</Captcha>
<CustomData>String</CustomData>
<Email>String</Email>
<Message>String</Message>
<Name>String</Name>
<Rating>0</Rating>
<Thread>
<Behavior>String</Behavior>
<DataSource>String</DataSource>
<Group>
<Description>String</Description>
<Key>String</Key>
<Name>String</Name>
</Group>
<GroupKey>String</GroupKey>
<Key>String</Key>
<Language>String</Language>
<Title>String</Title>
<Type>String</Type>
</Thread>
<ThreadKey>String</ThreadKey>
</CommentCreateRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CommentResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Telerik.Sitefinity.Services.Comments.DTO"> <AuthorIpAddress>String</AuthorIpAddress> <CustomData>String</CustomData> <DateCreated>0001-01-01T00:00:00</DateCreated> <Email>String</Email> <Key>String</Key> <Message>String</Message> <Name>String</Name> <ProfilePictureThumbnailUrl>String</ProfilePictureThumbnailUrl> <ProfilePictureUrl>String</ProfilePictureUrl> <Rating>0</Rating> <Status>String</Status> <ThreadKey>String</ThreadKey> </CommentResponse>