POST | /v1/configurator | Validate and save a car configurator code for a back order | This endpoint calls Agency API to validate and save a car configurator code for a back order. The code is validated and saved in the database and returns a response from a third party CCS which provides car configuration details. These get saved to open search and returned to the front-end |
---|
import 'package:servicestack/servicestack.dart';
class KeyInformation implements IConvertible
{
String? BM7NST;
String? ConfigurationDate;
String? ModelYear;
String? HalfYear;
KeyInformation({this.BM7NST,this.ConfigurationDate,this.ModelYear,this.HalfYear});
KeyInformation.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
BM7NST = json['BM7NST'];
ConfigurationDate = json['ConfigurationDate'];
ModelYear = json['ModelYear'];
HalfYear = json['HalfYear'];
return this;
}
Map<String, dynamic> toJson() => {
'BM7NST': BM7NST,
'ConfigurationDate': ConfigurationDate,
'ModelYear': ModelYear,
'HalfYear': HalfYear
};
getTypeName() => "KeyInformation";
TypeContext? context = _ctx;
}
class OrderingOptions implements IConvertible
{
List<String>? Interior;
List<String>? Exterior;
List<String>? Other;
OrderingOptions({this.Interior,this.Exterior,this.Other});
OrderingOptions.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Interior = JsonConverters.fromJson(json['Interior'],'List<String>',context!);
Exterior = JsonConverters.fromJson(json['Exterior'],'List<String>',context!);
Other = JsonConverters.fromJson(json['Other'],'List<String>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Interior': JsonConverters.toJson(Interior,'List<String>',context!),
'Exterior': JsonConverters.toJson(Exterior,'List<String>',context!),
'Other': JsonConverters.toJson(Other,'List<String>',context!)
};
getTypeName() => "OrderingOptions";
TypeContext? context = _ctx;
}
class CarConfiguratorResponse implements IConvertible
{
String? Name;
KeyInformation? KeyInformation;
OrderingOptions? OrderingOptions;
ResponseStatus? ResponseStatus;
String? ConfiguratorCode;
CarConfiguratorResponse({this.Name,this.KeyInformation,this.OrderingOptions,this.ResponseStatus,this.ConfiguratorCode});
CarConfiguratorResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Name = json['Name'];
KeyInformation = JsonConverters.fromJson(json['KeyInformation'],'KeyInformation',context!);
OrderingOptions = JsonConverters.fromJson(json['OrderingOptions'],'OrderingOptions',context!);
ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
ConfiguratorCode = json['ConfiguratorCode'];
return this;
}
Map<String, dynamic> toJson() => {
'Name': Name,
'KeyInformation': JsonConverters.toJson(KeyInformation,'KeyInformation',context!),
'OrderingOptions': JsonConverters.toJson(OrderingOptions,'OrderingOptions',context!),
'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!),
'ConfiguratorCode': ConfiguratorCode
};
getTypeName() => "CarConfiguratorResponse";
TypeContext? context = _ctx;
}
class CarConfiguratorRequest implements IPost, IConvertible
{
/**
* Configurator code
*/
// @ApiMember(Description="Configurator code", IsRequired=true)
String? ConfiguratorCode;
CarConfiguratorRequest({this.ConfiguratorCode});
CarConfiguratorRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ConfiguratorCode = json['ConfiguratorCode'];
return this;
}
Map<String, dynamic> toJson() => {
'ConfiguratorCode': ConfiguratorCode
};
getTypeName() => "CarConfiguratorRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'prod_api_agency_orch_mb_dhc.rapp_customers.co.uk', types: <String, TypeInfo> {
'KeyInformation': TypeInfo(TypeOf.Class, create:() => KeyInformation()),
'OrderingOptions': TypeInfo(TypeOf.Class, create:() => OrderingOptions()),
'CarConfiguratorResponse': TypeInfo(TypeOf.Class, create:() => CarConfiguratorResponse()),
'CarConfiguratorRequest': TypeInfo(TypeOf.Class, create:() => CarConfiguratorRequest()),
});
Dart CarConfiguratorRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/configurator HTTP/1.1
Host: prod-api-agency-orch-mb-dhc.rapp-customers.co.uk
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"ConfiguratorCode":"String"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"Name":"String","KeyInformation":{"BM7NST":"String","ConfigurationDate":"String","ModelYear":"String","HalfYear":"String"},"OrderingOptions":{"Interior":["String"],"Exterior":["String"],"Other":["String"]},"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}},"ConfiguratorCode":"String"}