| POST | /consumerinitiation |
|---|
import 'package:servicestack/servicestack.dart';
class ValidateError implements IConvertible
{
String? ErrorNumber;
String? ErrorDescription;
ValidateError({this.ErrorNumber,this.ErrorDescription});
ValidateError.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ErrorNumber = json['ErrorNumber'];
ErrorDescription = json['ErrorDescription'];
return this;
}
Map<String, dynamic> toJson() => {
'ErrorNumber': ErrorNumber,
'ErrorDescription': ErrorDescription
};
getTypeName() => "ValidateError";
TypeContext? context = _ctx;
}
class ConsumerInitiationResponse implements IConvertible
{
/**
* Response message
*/
// @ApiMember(Description="Response message")
String? Message;
/**
* File identifier for the created initiation
*/
// @ApiMember(Description="File identifier for the created initiation")
String? FileId;
/**
* List of validation errors, if any
*/
// @ApiMember(Description="List of validation errors, if any")
List<ValidateError>? Errors;
ConsumerInitiationResponse({this.Message,this.FileId,this.Errors});
ConsumerInitiationResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Message = json['Message'];
FileId = json['FileId'];
Errors = JsonConverters.fromJson(json['Errors'],'List<ValidateError>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Message': Message,
'FileId': FileId,
'Errors': JsonConverters.toJson(Errors,'List<ValidateError>',context!)
};
getTypeName() => "ConsumerInitiationResponse";
TypeContext? context = _ctx;
}
class RelocationsRequestFileTransfereeDetails implements IConvertible
{
/**
* First name of the transferee
*/
// @ApiMember(Description="First name of the transferee", IsRequired=true)
String? FirstName;
/**
* Last name of the transferee
*/
// @ApiMember(Description="Last name of the transferee", IsRequired=true)
String? LastName;
/**
* Preferred email address
*/
// @ApiMember(Description="Preferred email address", IsRequired=true)
String? PreferredEmail;
RelocationsRequestFileTransfereeDetails({this.FirstName,this.LastName,this.PreferredEmail});
RelocationsRequestFileTransfereeDetails.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
FirstName = json['FirstName'];
LastName = json['LastName'];
PreferredEmail = json['PreferredEmail'];
return this;
}
Map<String, dynamic> toJson() => {
'FirstName': FirstName,
'LastName': LastName,
'PreferredEmail': PreferredEmail
};
getTypeName() => "RelocationsRequestFileTransfereeDetails";
TypeContext? context = _ctx;
}
class AssignmentLocationDetails implements IConvertible
{
/**
* Work city
*/
// @ApiMember(Description="Work city", IsRequired=true)
String? WorkCity;
/**
* Current work location state
*/
// @ApiMember(Description="Current work location state")
String? CurrentWorkState;
/**
* Work state or province
*/
// @ApiMember(Description="Work state or province")
String? WorkState;
/**
* Destination work location state
*/
// @ApiMember(Description="Destination work location state")
String? DestinationWorkState;
/**
* Work country
*/
// @ApiMember(Description="Work country", IsRequired=true)
String? WorkCountry;
/**
* Preferred work location state
*/
// @ApiMember(Description="Preferred work location state")
String? PreferredWorkState;
/**
* Preferred work location country
*/
// @ApiMember(Description="Preferred work location country")
String? PreferredWorkCountry;
AssignmentLocationDetails({this.WorkCity,this.CurrentWorkState,this.WorkState,this.DestinationWorkState,this.WorkCountry,this.PreferredWorkState,this.PreferredWorkCountry});
AssignmentLocationDetails.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
WorkCity = json['WorkCity'];
CurrentWorkState = json['CurrentWorkState'];
WorkState = json['WorkState'];
DestinationWorkState = json['DestinationWorkState'];
WorkCountry = json['WorkCountry'];
PreferredWorkState = json['PreferredWorkState'];
PreferredWorkCountry = json['PreferredWorkCountry'];
return this;
}
Map<String, dynamic> toJson() => {
'WorkCity': WorkCity,
'CurrentWorkState': CurrentWorkState,
'WorkState': WorkState,
'DestinationWorkState': DestinationWorkState,
'WorkCountry': WorkCountry,
'PreferredWorkState': PreferredWorkState,
'PreferredWorkCountry': PreferredWorkCountry
};
getTypeName() => "AssignmentLocationDetails";
TypeContext? context = _ctx;
}
class RelocationsRequestFileAssignmentDetails implements IConvertible
{
/**
* Program name or code
*/
// @ApiMember(Description="Program name or code", IsRequired=true)
String? Program;
/**
* Type of assignment
*/
// @ApiMember(Description="Type of assignment", IsRequired=true)
String? AssignmentType;
/**
* Assignment start date
*/
// @ApiMember(Description="Assignment start date", IsRequired=true)
DateTime? StartDate;
/**
* Company name
*/
// @ApiMember(Description="Company name", IsRequired=true)
String? CompanyName;
/**
* Contact
*/
// @ApiMember(Description="Contact", IsRequired=true)
String? Contact;
/**
* Current assignment location details
*/
// @ApiMember(Description="Current assignment location details", IsRequired=true)
AssignmentLocationDetails? Current;
/**
* Destination assignment location details
*/
// @ApiMember(Description="Destination assignment location details", IsRequired=true)
AssignmentLocationDetails? Destination;
RelocationsRequestFileAssignmentDetails({this.Program,this.AssignmentType,this.StartDate,this.CompanyName,this.Contact,this.Current,this.Destination});
RelocationsRequestFileAssignmentDetails.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Program = json['Program'];
AssignmentType = json['AssignmentType'];
StartDate = JsonConverters.fromJson(json['StartDate'],'DateTime',context!);
CompanyName = json['CompanyName'];
Contact = json['Contact'];
Current = JsonConverters.fromJson(json['Current'],'AssignmentLocationDetails',context!);
Destination = JsonConverters.fromJson(json['Destination'],'AssignmentLocationDetails',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Program': Program,
'AssignmentType': AssignmentType,
'StartDate': JsonConverters.toJson(StartDate,'DateTime',context!),
'CompanyName': CompanyName,
'Contact': Contact,
'Current': JsonConverters.toJson(Current,'AssignmentLocationDetails',context!),
'Destination': JsonConverters.toJson(Destination,'AssignmentLocationDetails',context!)
};
getTypeName() => "RelocationsRequestFileAssignmentDetails";
TypeContext? context = _ctx;
}
class RelocationsRequestFile implements IConvertible
{
/**
* Command type for the request (INITIATE)
*/
// @ApiMember(Description="Command type for the request (INITIATE)", IsRequired=true)
String? Command;
/**
* External identifier for the transferee
*/
// @ApiMember(Description="External identifier for the transferee", IsRequired=true)
String? ExternalID;
/**
* Details about the transferee
*/
// @ApiMember(Description="Details about the transferee", IsRequired=true)
RelocationsRequestFileTransfereeDetails? TransfereeDetails;
/**
* List of addresses associated with the transferee
*/
// @ApiMember(Description="List of addresses associated with the transferee", IsRequired=true)
List<RelocationsRequestFileAddress>? Addresses;
/**
* List of phone numbers associated with the transferee
*/
// @ApiMember(Description="List of phone numbers associated with the transferee", IsRequired=true)
List<RelocationsRequestFilePhone>? Phones;
/**
* Assignment details for the relocation
*/
// @ApiMember(Description="Assignment details for the relocation", IsRequired=true)
RelocationsRequestFileAssignmentDetails? AssignmentDetails;
RelocationsRequestFile({this.Command,this.ExternalID,this.TransfereeDetails,this.Addresses,this.Phones,this.AssignmentDetails});
RelocationsRequestFile.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Command = json['Command'];
ExternalID = json['ExternalID'];
TransfereeDetails = JsonConverters.fromJson(json['TransfereeDetails'],'RelocationsRequestFileTransfereeDetails',context!);
Addresses = JsonConverters.fromJson(json['Addresses'],'List<RelocationsRequestFileAddress>',context!);
Phones = JsonConverters.fromJson(json['Phones'],'List<RelocationsRequestFilePhone>',context!);
AssignmentDetails = JsonConverters.fromJson(json['AssignmentDetails'],'RelocationsRequestFileAssignmentDetails',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Command': Command,
'ExternalID': ExternalID,
'TransfereeDetails': JsonConverters.toJson(TransfereeDetails,'RelocationsRequestFileTransfereeDetails',context!),
'Addresses': JsonConverters.toJson(Addresses,'List<RelocationsRequestFileAddress>',context!),
'Phones': JsonConverters.toJson(Phones,'List<RelocationsRequestFilePhone>',context!),
'AssignmentDetails': JsonConverters.toJson(AssignmentDetails,'RelocationsRequestFileAssignmentDetails',context!)
};
getTypeName() => "RelocationsRequestFile";
TypeContext? context = _ctx;
}
/**
* Consumer Initiation Service
*/
// @Api(Description="Consumer Initiation Service")
// @ApiResponse(Description="Returned when the consumer initiation was successfully processed", StatusCode=200)
// @ApiResponse(Description="Returned if the request validation failed", StatusCode=400)
// @ApiResponse(Description="Returned if the client is not authorized", StatusCode=401)
// @ApiResponse(Description="Returned if an error occurred while processing the request", StatusCode=500)
class ConsumerInitiation implements IPost, IConvertible
{
/**
* Client identifier
*/
// @ApiMember(Description="Client identifier", IsRequired=true)
String? ClientID;
/**
* Consumer relocation request file details
*/
// @ApiMember(Description="Consumer relocation request file details", IsRequired=true)
RelocationsRequestFile? File;
ConsumerInitiation({this.ClientID,this.File});
ConsumerInitiation.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ClientID = json['ClientID'];
File = JsonConverters.fromJson(json['File'],'RelocationsRequestFile',context!);
return this;
}
Map<String, dynamic> toJson() => {
'ClientID': ClientID,
'File': JsonConverters.toJson(File,'RelocationsRequestFile',context!)
};
getTypeName() => "ConsumerInitiation";
TypeContext? context = _ctx;
}
enum AddressType
{
CurrentHome,
DestinationHome,
CurrentWork,
DestinationWork,
}
enum YesNo
{
Y,
N,
Item,
}
class RelocationsRequestFileAddress implements IConvertible
{
/**
* Type of address (CurrentHome, DestinationHome, CurrentWork, DestinationWork)
*/
// @ApiMember(Description="Type of address (CurrentHome, DestinationHome, CurrentWork, DestinationWork)", IsRequired=true)
AddressType? AddressType;
/**
* Indicates if this is the primary address
*/
// @ApiMember(Description="Indicates if this is the primary address", IsRequired=true)
YesNo? Primary;
/**
* Address line 1
*/
// @ApiMember(Description="Address line 1", IsRequired=true)
String? AddressLine1;
/**
* City
*/
// @ApiMember(Description="City", IsRequired=true)
String? City;
/**
* Country
*/
// @ApiMember(Description="Country", IsRequired=true)
String? Country;
RelocationsRequestFileAddress({this.AddressType,this.Primary,this.AddressLine1,this.City,this.Country});
RelocationsRequestFileAddress.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
AddressType = JsonConverters.fromJson(json['AddressType'],'AddressType',context!);
Primary = JsonConverters.fromJson(json['Primary'],'YesNo',context!);
AddressLine1 = json['AddressLine1'];
City = json['City'];
Country = json['Country'];
return this;
}
Map<String, dynamic> toJson() => {
'AddressType': JsonConverters.toJson(AddressType,'AddressType',context!),
'Primary': JsonConverters.toJson(Primary,'YesNo',context!),
'AddressLine1': AddressLine1,
'City': City,
'Country': Country
};
getTypeName() => "RelocationsRequestFileAddress";
TypeContext? context = _ctx;
}
class RelocationsRequestFilePhone implements IConvertible
{
/**
* Phone type (e.g., Mobile, OriginHome)
*/
// @ApiMember(Description="Phone type (e.g., Mobile, OriginHome)", IsRequired=true)
String? Type;
/**
* Indicates if this is the primary phone number
*/
// @ApiMember(Description="Indicates if this is the primary phone number", IsRequired=true)
YesNo? Primary;
/**
* Phone number
*/
// @ApiMember(Description="Phone number", IsRequired=true)
String? Number;
RelocationsRequestFilePhone({this.Type,this.Primary,this.Number});
RelocationsRequestFilePhone.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Type = json['Type'];
Primary = JsonConverters.fromJson(json['Primary'],'YesNo',context!);
Number = json['Number'];
return this;
}
Map<String, dynamic> toJson() => {
'Type': Type,
'Primary': JsonConverters.toJson(Primary,'YesNo',context!),
'Number': Number
};
getTypeName() => "RelocationsRequestFilePhone";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'initiation_pen.sirva.com', types: <String, TypeInfo> {
'ValidateError': TypeInfo(TypeOf.Class, create:() => ValidateError()),
'ConsumerInitiationResponse': TypeInfo(TypeOf.Class, create:() => ConsumerInitiationResponse()),
'List<ValidateError>': TypeInfo(TypeOf.Class, create:() => <ValidateError>[]),
'RelocationsRequestFileTransfereeDetails': TypeInfo(TypeOf.Class, create:() => RelocationsRequestFileTransfereeDetails()),
'AssignmentLocationDetails': TypeInfo(TypeOf.Class, create:() => AssignmentLocationDetails()),
'RelocationsRequestFileAssignmentDetails': TypeInfo(TypeOf.Class, create:() => RelocationsRequestFileAssignmentDetails()),
'RelocationsRequestFile': TypeInfo(TypeOf.Class, create:() => RelocationsRequestFile()),
'List<RelocationsRequestFileAddress>': TypeInfo(TypeOf.Class, create:() => <RelocationsRequestFileAddress>[]),
'RelocationsRequestFileAddress': TypeInfo(TypeOf.Class, create:() => RelocationsRequestFileAddress()),
'List<RelocationsRequestFilePhone>': TypeInfo(TypeOf.Class, create:() => <RelocationsRequestFilePhone>[]),
'RelocationsRequestFilePhone': TypeInfo(TypeOf.Class, create:() => RelocationsRequestFilePhone()),
'ConsumerInitiation': TypeInfo(TypeOf.Class, create:() => ConsumerInitiation()),
'AddressType': TypeInfo(TypeOf.Enum, enumValues:AddressType.values),
'YesNo': TypeInfo(TypeOf.Enum, enumValues:YesNo.values),
});
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 /consumerinitiation HTTP/1.1
Host: initiation-pen.sirva.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ClientID: String,
File:
{
Command: String,
ExternalID: String,
TransfereeDetails:
{
FirstName: String,
LastName: String,
PreferredEmail: String
},
Addresses:
[
{
AddressType: CurrentHome,
Primary: Y,
AddressLine1: String,
City: String,
Country: String
}
],
Phones:
[
{
Type: String,
Primary: Y,
Number: String
}
],
AssignmentDetails:
{
Program: String,
AssignmentType: String,
StartDate: 0001-01-01,
CompanyName: String,
Contact: String,
Current:
{
WorkCity: String,
CurrentWorkState: String,
WorkState: String,
DestinationWorkState: String,
WorkCountry: String,
PreferredWorkState: String,
PreferredWorkCountry: String
},
Destination:
{
WorkCity: String,
CurrentWorkState: String,
WorkState: String,
DestinationWorkState: String,
WorkCountry: String,
PreferredWorkState: String,
PreferredWorkCountry: String
}
}
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Message: String,
FileId: String,
Errors:
[
{
ErrorNumber: String,
ErrorDescription: String
}
]
}