| GET | /dealers/part/{PartId} | Retrieves part info based on part id. |
|---|
import 'package:servicestack/servicestack.dart';
abstract class AuthenticatedRequest
{
/**
* Session token received from successful authentication.
*/
// @ApiMember(Description="Session token received from successful authentication.", IsRequired=true, ParameterType="query")
String SessionToken = "";
AuthenticatedRequest({this.SessionToken=""});
AuthenticatedRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
SessionToken = json['SessionToken'] ?? "";
return this;
}
Map<String, dynamic> toJson() => {
'SessionToken': SessionToken
};
getTypeName() => "AuthenticatedRequest";
TypeContext? context = _ctx;
}
class PartInfoResultImage implements IConvertible
{
/**
* Image number
*/
// @ApiMember(Description="Image number")
int ImageNumber = 0;
/**
* Image URL
*/
// @ApiMember(Description="Image URL")
String? ImageUrl;
PartInfoResultImage({this.ImageNumber=0,this.ImageUrl});
PartInfoResultImage.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ImageNumber = json['ImageNumber'] ?? 0;
ImageUrl = json['ImageUrl'];
return this;
}
Map<String, dynamic> toJson() => {
'ImageNumber': ImageNumber,
'ImageUrl': ImageUrl
};
getTypeName() => "PartInfoResultImage";
TypeContext? context = _ctx;
}
class PartStockQuantity implements IConvertible
{
/**
* Location ID
*/
// @ApiMember(Description="Location ID")
int LocationId = 0;
/**
* Location code
*/
// @ApiMember(Description="Location code")
String? LocationCode;
/**
* Stock quantity in location
*/
// @ApiMember(Description="Stock quantity in location")
int StockQuantity = 0;
PartStockQuantity({this.LocationId=0,this.LocationCode,this.StockQuantity=0});
PartStockQuantity.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
LocationId = json['LocationId'] ?? 0;
LocationCode = json['LocationCode'];
StockQuantity = json['StockQuantity'] ?? 0;
return this;
}
Map<String, dynamic> toJson() => {
'LocationId': LocationId,
'LocationCode': LocationCode,
'StockQuantity': StockQuantity
};
getTypeName() => "PartStockQuantity";
TypeContext? context = _ctx;
}
class PartInfoResult implements IConvertible
{
/**
* Unique ID for the part.
*/
// @ApiMember(Description="Unique ID for the part.")
int Id = 0;
/**
* Part number.
*/
// @ApiMember(Description="Part number.")
String? PartNumber;
/**
* Description of the part.
*/
// @ApiMember(Description="Description of the part.")
String? Description;
/**
* Part manufacturer.
*/
// @ApiMember(Description="Part manufacturer.")
String? Manufacturer;
/**
* Determines if the part can be ordered.
*/
// @ApiMember(Description="Determines if the part can be ordered.")
bool? CanBeOrdered;
/**
* Textual representation of the status of the part.
*/
// @ApiMember(Description="Textual representation of the status of the part.")
String? StatusText;
/**
* Available stock to order.
*/
// @ApiMember(Description="Available stock to order.")
int AvailableStockQuantity = 0;
/**
* Average days needed for delivery.
*/
// @ApiMember(Description="Average days needed for delivery.")
int? AverageDeliveryInDays;
/**
* Price of a single unit, excluding VAT.
*/
// @ApiMember(Description="Price of a single unit, excluding VAT.")
double? UnitPrice;
/**
* EAN number.
*/
// @ApiMember(Description="EAN number.")
String? EanNumber;
/**
* Images
*/
// @ApiMember(Description="Images")
List<PartInfoResultImage>? Images;
/**
* Secondary article numbers
*/
// @ApiMember(Description="Secondary article numbers")
List<String>? SecondaryArticleNumbers;
/**
* Replacement article numbers
*/
// @ApiMember(Description="Replacement article numbers")
List<String>? ReplacementArticleNumbers;
/**
* Stock quantities
*/
// @ApiMember(Description="Stock quantities")
List<PartStockQuantity>? StockQuantities;
PartInfoResult({this.Id=0,this.PartNumber,this.Description,this.Manufacturer,this.CanBeOrdered,this.StatusText,this.AvailableStockQuantity=0,this.AverageDeliveryInDays,this.UnitPrice,this.EanNumber,this.Images,this.SecondaryArticleNumbers,this.ReplacementArticleNumbers,this.StockQuantities});
PartInfoResult.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'] ?? 0;
PartNumber = json['PartNumber'];
Description = json['Description'];
Manufacturer = json['Manufacturer'];
CanBeOrdered = json['CanBeOrdered'];
StatusText = json['StatusText'];
AvailableStockQuantity = json['AvailableStockQuantity'] ?? 0;
AverageDeliveryInDays = json['AverageDeliveryInDays'];
UnitPrice = JsonConverters.toDouble(json['UnitPrice']);
EanNumber = json['EanNumber'];
Images = JsonConverters.fromJson(json['Images'],'List<PartInfoResultImage>',context!);
SecondaryArticleNumbers = JsonConverters.fromJson(json['SecondaryArticleNumbers'],'List<String>',context!);
ReplacementArticleNumbers = JsonConverters.fromJson(json['ReplacementArticleNumbers'],'List<String>',context!);
StockQuantities = JsonConverters.fromJson(json['StockQuantities'],'List<PartStockQuantity>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'PartNumber': PartNumber,
'Description': Description,
'Manufacturer': Manufacturer,
'CanBeOrdered': CanBeOrdered,
'StatusText': StatusText,
'AvailableStockQuantity': AvailableStockQuantity,
'AverageDeliveryInDays': AverageDeliveryInDays,
'UnitPrice': UnitPrice,
'EanNumber': EanNumber,
'Images': JsonConverters.toJson(Images,'List<PartInfoResultImage>',context!),
'SecondaryArticleNumbers': JsonConverters.toJson(SecondaryArticleNumbers,'List<String>',context!),
'ReplacementArticleNumbers': JsonConverters.toJson(ReplacementArticleNumbers,'List<String>',context!),
'StockQuantities': JsonConverters.toJson(StockQuantities,'List<PartStockQuantity>',context!)
};
getTypeName() => "PartInfoResult";
TypeContext? context = _ctx;
}
class OperationResult implements IConvertible
{
/**
* Specifies if the operation was successful.
*/
// @ApiMember(Description="Specifies if the operation was successful.", ParameterType="model")
bool? IsSuccessful;
/**
* States error message in case of unsuccessful operation.
*/
// @ApiMember(Description="States error message in case of unsuccessful operation.", ParameterType="model")
String? ErrorMessage;
OperationResult({this.IsSuccessful,this.ErrorMessage});
OperationResult.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
IsSuccessful = json['IsSuccessful'];
ErrorMessage = json['ErrorMessage'];
return this;
}
Map<String, dynamic> toJson() => {
'IsSuccessful': IsSuccessful,
'ErrorMessage': ErrorMessage
};
getTypeName() => "OperationResult";
TypeContext? context = _ctx;
}
class PartResults implements IConvertible
{
/**
* Total number of parts available.
*/
// @ApiMember(Description="Total number of parts available.")
int TotalNumberOfParts = 0;
/**
* Indication if there are more parts to retrieve.
*/
// @ApiMember(Description="Indication if there are more parts to retrieve.")
bool? HasMoreRecords;
/**
* Part records.
*/
// @ApiMember(Description="Part records.")
List<PartInfoResult>? Parts;
PartResults({this.TotalNumberOfParts=0,this.HasMoreRecords,this.Parts});
PartResults.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
TotalNumberOfParts = json['TotalNumberOfParts'] ?? 0;
HasMoreRecords = json['HasMoreRecords'];
Parts = JsonConverters.fromJson(json['Parts'],'List<PartInfoResult>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'TotalNumberOfParts': TotalNumberOfParts,
'HasMoreRecords': HasMoreRecords,
'Parts': JsonConverters.toJson(Parts,'List<PartInfoResult>',context!)
};
getTypeName() => "PartResults";
TypeContext? context = _ctx;
}
class OperationResult1<T> extends OperationResult implements IConvertible
{
/**
* Result value
*/
// @ApiMember(Description="Result value", ParameterType="model")
PartResults? Result;
OperationResult1({this.Result});
OperationResult1.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
Result = JsonConverters.fromJson(json['Result'],'PartResults',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'Result': JsonConverters.toJson(Result,'PartResults',context!)
});
getTypeName() => "OperationResult<$T>";
TypeContext? context = _ctx;
}
class PartInfoResponse extends OperationResult1<PartInfoResult> implements IConvertible
{
PartInfoResponse();
PartInfoResponse.fromJson(Map<String, dynamic> json) : super.fromJson(json);
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
return this;
}
Map<String, dynamic> toJson() => super.toJson();
getTypeName() => "PartInfoResponse";
TypeContext? context = _ctx;
}
class GetPartInfoById extends AuthenticatedRequest implements IConvertible
{
/**
* Part id to retrieve info for.
*/
// @ApiMember(Description="Part id to retrieve info for.", IsRequired=true, ParameterType="path")
int PartId = 0;
GetPartInfoById({this.PartId=0});
GetPartInfoById.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
PartId = json['PartId'] ?? 0;
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'PartId': PartId
});
getTypeName() => "GetPartInfoById";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'services.acct.2service.nl', types: <String, TypeInfo> {
'AuthenticatedRequest': TypeInfo(TypeOf.AbstractClass),
'PartInfoResultImage': TypeInfo(TypeOf.Class, create:() => PartInfoResultImage()),
'PartStockQuantity': TypeInfo(TypeOf.Class, create:() => PartStockQuantity()),
'PartInfoResult': TypeInfo(TypeOf.Class, create:() => PartInfoResult()),
'List<PartInfoResultImage>': TypeInfo(TypeOf.Class, create:() => <PartInfoResultImage>[]),
'List<PartStockQuantity>': TypeInfo(TypeOf.Class, create:() => <PartStockQuantity>[]),
'OperationResult': TypeInfo(TypeOf.Class, create:() => OperationResult()),
'PartResults': TypeInfo(TypeOf.Class, create:() => PartResults()),
'List<PartInfoResult>': TypeInfo(TypeOf.Class, create:() => <PartInfoResult>[]),
'OperationResult1<T>': TypeInfo(TypeOf.Class, create:() => OperationResult1<T>()),
'PartInfoResponse': TypeInfo(TypeOf.Class, create:() => PartInfoResponse()),
'GetPartInfoById': TypeInfo(TypeOf.Class, create:() => GetPartInfoById()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /dealers/part/{PartId} HTTP/1.1
Host: services.acct.2service.nl
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"IsSuccessful":false,"ErrorMessage":"String"}