POST | /beneficiary/save |
---|
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
class Beneficiary implements IConvertible
{
int? id;
int? memberId;
String? name;
DateTime? birthdate;
String? relationshipToMember;
String? identificationNumber;
int? allocation;
Beneficiary({this.id,this.memberId,this.name,this.birthdate,this.relationshipToMember,this.identificationNumber,this.allocation});
Beneficiary.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
memberId = json['memberId'];
name = json['name'];
birthdate = JsonConverters.fromJson(json['birthdate'],'DateTime',context!);
relationshipToMember = json['relationshipToMember'];
identificationNumber = json['identificationNumber'];
allocation = json['allocation'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'memberId': memberId,
'name': name,
'birthdate': JsonConverters.toJson(birthdate,'DateTime',context!),
'relationshipToMember': relationshipToMember,
'identificationNumber': identificationNumber,
'allocation': allocation
};
getTypeName() => "Beneficiary";
TypeContext? context = _ctx;
}
class BeneficiaryRequest implements IConvertible
{
List<Beneficiary>? beneficiaries;
int? memberId;
String? createdBy;
BeneficiaryRequest({this.beneficiaries,this.memberId,this.createdBy});
BeneficiaryRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
beneficiaries = JsonConverters.fromJson(json['beneficiaries'],'List<Beneficiary>',context!);
memberId = json['memberId'];
createdBy = json['createdBy'];
return this;
}
Map<String, dynamic> toJson() => {
'beneficiaries': JsonConverters.toJson(beneficiaries,'List<Beneficiary>',context!),
'memberId': memberId,
'createdBy': createdBy
};
getTypeName() => "BeneficiaryRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'hcbtas_q_albamfs_api.azurewebsites.net', types: <String, TypeInfo> {
'Beneficiary': TypeInfo(TypeOf.Class, create:() => Beneficiary()),
'BeneficiaryRequest': TypeInfo(TypeOf.Class, create:() => BeneficiaryRequest()),
'List<Beneficiary>': TypeInfo(TypeOf.Class, create:() => <Beneficiary>[]),
});
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 /beneficiary/save HTTP/1.1
Host: hcbtas-q-albamfs-api.azurewebsites.net
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
beneficiaries:
[
{
id: 0,
memberId: 0,
name: String,
birthdate: 0001-01-01,
relationshipToMember: String,
identificationNumber: String,
allocation: 0
}
],
memberId: 0,
createdBy: String
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length (HttpWebResponse)