| GET | /stock/{brand}/{posCode} | Get Paginated Stock |
|---|
import 'package:servicestack/servicestack.dart';
class RetailSalesPrice implements IConvertible
{
/**
* Currency Iso Code
*/
// @ApiMember(Description="Currency Iso Code", IsRequired=true)
String currencyIsoCode = "";
/**
* Value
*/
// @ApiMember(Description="Value", IsRequired=true)
double value = 0;
RetailSalesPrice({this.currencyIsoCode="",this.value=0});
RetailSalesPrice.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
currencyIsoCode = json['currencyIsoCode'] ?? "";
value = JsonConverters.toDouble(json['value']) ?? 0;
return this;
}
Map<String, dynamic> toJson() => {
'currencyIsoCode': currencyIsoCode,
'value': value
};
getTypeName() => "RetailSalesPrice";
TypeContext? context = _ctx;
}
class StorageLocation implements IConvertible
{
/**
* Storage Location Identifier
*/
// @ApiMember(Description="Storage Location Identifier", IsRequired=true)
String storageLocationId = "";
/**
* Storage Location Description
*/
// @ApiMember(Description="Storage Location Description")
String? storageLocationDs;
StorageLocation({this.storageLocationId="",this.storageLocationDs});
StorageLocation.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
storageLocationId = json['storageLocationId'] ?? "";
storageLocationDs = json['storageLocationDs'];
return this;
}
Map<String, dynamic> toJson() => {
'storageLocationId': storageLocationId,
'storageLocationDs': storageLocationDs
};
getTypeName() => "StorageLocation";
TypeContext? context = _ctx;
}
class PaginatedStockElement implements IConvertible
{
/**
* Pos Code
*/
// @ApiMember(Description="Pos Code", IsRequired=true)
String posCode = "";
/**
* Pos Code To Be Displayed
*/
// @ApiMember(Description="Pos Code To Be Displayed", IsRequired=true)
String posCodeToBeDisplayed = "";
/**
* Article Code
*/
// @ApiMember(Description="Article Code", IsRequired=true)
String articleCode = "";
/**
* Serial Number
*/
// @ApiMember(Description="Serial Number")
String? serialNumber;
/**
* Current Stock Quantity
*/
// @ApiMember(Description="Current Stock Quantity", IsRequired=true)
int quantity = 0;
/**
* Type e.g. consignment or standard
*/
// @ApiMember(Description="Type e.g. consignment or standard", IsRequired=true)
String type = "";
/**
* Is Consignment Sellable
*/
// @ApiMember(Description="Is Consignment Sellable ", IsRequired=true)
bool? isConsignmentSellable;
/**
* Retail Sales Price
*/
// @ApiMember(Description="Retail Sales Price", IsRequired=true)
RetailSalesPrice? retailSalesPrice;
/**
* Storage Location
*/
// @ApiMember(Description="Storage Location")
StorageLocation? storageLocation;
PaginatedStockElement({this.posCode="",this.posCodeToBeDisplayed="",this.articleCode="",this.serialNumber,this.quantity=0,this.type="",this.isConsignmentSellable,this.retailSalesPrice,this.storageLocation});
PaginatedStockElement.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
posCode = json['posCode'] ?? "";
posCodeToBeDisplayed = json['posCodeToBeDisplayed'] ?? "";
articleCode = json['articleCode'] ?? "";
serialNumber = json['serialNumber'];
quantity = json['quantity'] ?? 0;
type = json['type'] ?? "";
isConsignmentSellable = json['isConsignmentSellable'];
retailSalesPrice = JsonConverters.fromJson(json['retailSalesPrice'],'RetailSalesPrice',context!);
storageLocation = JsonConverters.fromJson(json['storageLocation'],'StorageLocation',context!);
return this;
}
Map<String, dynamic> toJson() => {
'posCode': posCode,
'posCodeToBeDisplayed': posCodeToBeDisplayed,
'articleCode': articleCode,
'serialNumber': serialNumber,
'quantity': quantity,
'type': type,
'isConsignmentSellable': isConsignmentSellable,
'retailSalesPrice': JsonConverters.toJson(retailSalesPrice,'RetailSalesPrice',context!),
'storageLocation': JsonConverters.toJson(storageLocation,'StorageLocation',context!)
};
getTypeName() => "PaginatedStockElement";
TypeContext? context = _ctx;
}
class GetStockPaginatedResponse implements IConvertible
{
/**
* Total Pages
*/
// @ApiMember(Description="Total Pages", IsRequired=true)
int totalPages = 0;
/**
* Total Results
*/
// @ApiMember(Description="Total Results", IsRequired=true)
int totalResults = 0;
/**
* Index of the result set returned
*/
// @ApiMember(Description="Index of the result set returned", IsRequired=true)
int page = 0;
/**
* Size of the result set returned
*/
// @ApiMember(Description="Size of the result set returned", IsRequired=true)
int items = 0;
/**
* List of movements
*/
// @ApiMember(Description="List of movements", IsRequired=true)
List<PaginatedStockElement>? elements;
GetStockPaginatedResponse({this.totalPages=0,this.totalResults=0,this.page=0,this.items=0,this.elements});
GetStockPaginatedResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
totalPages = json['totalPages'] ?? 0;
totalResults = json['totalResults'] ?? 0;
page = json['page'] ?? 0;
items = json['items'] ?? 0;
elements = JsonConverters.fromJson(json['elements'],'List<PaginatedStockElement>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'totalPages': totalPages,
'totalResults': totalResults,
'page': page,
'items': items,
'elements': JsonConverters.toJson(elements,'List<PaginatedStockElement>',context!)
};
getTypeName() => "GetStockPaginatedResponse";
TypeContext? context = _ctx;
}
class GetStockPaginated implements IPagedRequest, IConvertible
{
/**
* Brand
*/
// @ApiMember(Description="Brand", IsRequired=true)
String brand = "";
/**
* POS Legacy
*/
// @ApiMember(Description="POS Legacy", IsRequired=true)
String posCode = "";
/**
* Search Key (Article or SerialNumber)
*/
// @ApiMember(Description="Search Key (Article or SerialNumber)")
String? searchKey;
/**
* Index of the result set returned
*/
// @ApiMember(Description="Index of the result set returned")
int page = 0;
/**
* Size of the result set returned
*/
// @ApiMember(Description="Size of the result set returned")
int items = 0;
/**
* Omit precise record count - save on performance
*/
// @ApiMember(Description="Omit precise record count - save on performance")
bool? noCount;
/**
* Sorting expression
*/
// @ApiMember(Description="Sorting expression")
String? sortBy;
/**
* Parameter - Include Chain POSes Stock
*/
// @ApiMember(Description="Parameter - Include Chain POSes Stock ")
bool? includeChainPosesStock;
/**
* Include Retail Sales Price in the Output, by default: false
*/
// @ApiMember(Description="Include Retail Sales Price in the Output, by default: false")
bool? includeRSP;
/**
* Storage Location Identifier e.g. CPO, NEW, REP
*/
// @ApiMember(Description="Storage Location Identifier e.g. CPO, NEW, REP")
String? storageLocationId;
/**
* Inventory segment e.g. CPO or null
*/
// @ApiMember(Description="Inventory segment e.g. CPO or null")
String? inventorySegment;
GetStockPaginated({this.brand="",this.posCode="",this.searchKey,this.page=0,this.items=0,this.noCount,this.sortBy,this.includeChainPosesStock,this.includeRSP,this.storageLocationId,this.inventorySegment});
GetStockPaginated.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
brand = json['brand'] ?? "";
posCode = json['posCode'] ?? "";
searchKey = json['searchKey'];
page = json['page'] ?? 0;
items = json['items'] ?? 0;
noCount = json['noCount'];
sortBy = json['sortBy'];
includeChainPosesStock = json['includeChainPosesStock'];
includeRSP = json['includeRSP'];
storageLocationId = json['storageLocationId'];
inventorySegment = json['inventorySegment'];
return this;
}
Map<String, dynamic> toJson() => {
'brand': brand,
'posCode': posCode,
'searchKey': searchKey,
'page': page,
'items': items,
'noCount': noCount,
'sortBy': sortBy,
'includeChainPosesStock': includeChainPosesStock,
'includeRSP': includeRSP,
'storageLocationId': storageLocationId,
'inventorySegment': inventorySegment
};
getTypeName() => "GetStockPaginated";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'dev_api_booster.richemont.com', types: <String, TypeInfo> {
'RetailSalesPrice': TypeInfo(TypeOf.Class, create:() => RetailSalesPrice()),
'StorageLocation': TypeInfo(TypeOf.Class, create:() => StorageLocation()),
'PaginatedStockElement': TypeInfo(TypeOf.Class, create:() => PaginatedStockElement()),
'GetStockPaginatedResponse': TypeInfo(TypeOf.Class, create:() => GetStockPaginatedResponse()),
'List<PaginatedStockElement>': TypeInfo(TypeOf.Class, create:() => <PaginatedStockElement>[]),
'GetStockPaginated': TypeInfo(TypeOf.Class, create:() => GetStockPaginated()),
});
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.
GET /stock/{brand}/{posCode} HTTP/1.1
Host: dev-api-booster.richemont.com
Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <GetStockPaginatedResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Richemont.Booster2.PublicApi.Stock.ServiceModel"> <elements i:nil="true" /> <items>0</items> <page>0</page> <totalPages>0</totalPages> <totalResults>0</totalResults> </GetStockPaginatedResponse>