| GET | /principal/get |
|---|
import 'package:servicestack/servicestack.dart';
class ApiServiceRequest implements IServiceRequest, IHasApiKey, IHasDeviceInfo, IConvertible
{
/**
* The API Key required for authentication
*/
// @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
String? ApiKey;
/**
* Latitude of the user making this request
*/
// @ApiMember(DataType="double", Description="Latitude of the user making this request")
double? Latitude;
/**
* Longitude of the user making this request
*/
// @ApiMember(DataType="double", Description="Longitude of the user making this request")
double? Longitude;
ApiServiceRequest({this.ApiKey,this.Latitude,this.Longitude});
ApiServiceRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ApiKey = json['ApiKey'];
Latitude = JsonConverters.toDouble(json['Latitude']);
Longitude = JsonConverters.toDouble(json['Longitude']);
return this;
}
Map<String, dynamic> toJson() => {
'ApiKey': ApiKey,
'Latitude': Latitude,
'Longitude': Longitude
};
getTypeName() => "ApiServiceRequest";
TypeContext? context = _ctx;
}
class ApiServiceResponse implements IServiceResponse, IConvertible
{
/**
* Information about the response.
*/
// @ApiMember(Description="Information about the response.", IsRequired=true)
String? Description;
/**
* Heading or summary of the response.
*/
// @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
String? Heading;
/**
* Did the intended operation for this response complete successfully?
*/
// @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)
bool? WasSuccessful;
ResponseStatus? ResponseStatus;
ApiServiceResponse({this.Description,this.Heading,this.WasSuccessful,this.ResponseStatus});
ApiServiceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Description = json['Description'];
Heading = json['Heading'];
WasSuccessful = json['WasSuccessful'];
ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Description': Description,
'Heading': Heading,
'WasSuccessful': WasSuccessful,
'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
};
getTypeName() => "ApiServiceResponse";
TypeContext? context = _ctx;
}
class ProductData implements IConvertible
{
int? ProductId;
int? PrincipalId;
String? PrincipalPrefix;
String? Name;
String? Category;
String? ProductCode;
String? UnitBarcode;
int? CartonQuantity;
int? ShrinkQuantity;
int? UnitQuantity;
String? CartonMeasurement;
String? ShrinkMeasurement;
String? UnitMeasurement;
double? CartonWeight;
double? ShrinkWeight;
double? UnitWeight;
double? CartonPrice;
double? ShrinkPrice;
double? UnitPrice;
int? UnitOfMeasureId;
ProductData({this.ProductId,this.PrincipalId,this.PrincipalPrefix,this.Name,this.Category,this.ProductCode,this.UnitBarcode,this.CartonQuantity,this.ShrinkQuantity,this.UnitQuantity,this.CartonMeasurement,this.ShrinkMeasurement,this.UnitMeasurement,this.CartonWeight,this.ShrinkWeight,this.UnitWeight,this.CartonPrice,this.ShrinkPrice,this.UnitPrice,this.UnitOfMeasureId});
ProductData.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ProductId = json['ProductId'];
PrincipalId = json['PrincipalId'];
PrincipalPrefix = json['PrincipalPrefix'];
Name = json['Name'];
Category = json['Category'];
ProductCode = json['ProductCode'];
UnitBarcode = json['UnitBarcode'];
CartonQuantity = json['CartonQuantity'];
ShrinkQuantity = json['ShrinkQuantity'];
UnitQuantity = json['UnitQuantity'];
CartonMeasurement = json['CartonMeasurement'];
ShrinkMeasurement = json['ShrinkMeasurement'];
UnitMeasurement = json['UnitMeasurement'];
CartonWeight = JsonConverters.toDouble(json['CartonWeight']);
ShrinkWeight = JsonConverters.toDouble(json['ShrinkWeight']);
UnitWeight = JsonConverters.toDouble(json['UnitWeight']);
CartonPrice = JsonConverters.toDouble(json['CartonPrice']);
ShrinkPrice = JsonConverters.toDouble(json['ShrinkPrice']);
UnitPrice = JsonConverters.toDouble(json['UnitPrice']);
UnitOfMeasureId = json['UnitOfMeasureId'];
return this;
}
Map<String, dynamic> toJson() => {
'ProductId': ProductId,
'PrincipalId': PrincipalId,
'PrincipalPrefix': PrincipalPrefix,
'Name': Name,
'Category': Category,
'ProductCode': ProductCode,
'UnitBarcode': UnitBarcode,
'CartonQuantity': CartonQuantity,
'ShrinkQuantity': ShrinkQuantity,
'UnitQuantity': UnitQuantity,
'CartonMeasurement': CartonMeasurement,
'ShrinkMeasurement': ShrinkMeasurement,
'UnitMeasurement': UnitMeasurement,
'CartonWeight': CartonWeight,
'ShrinkWeight': ShrinkWeight,
'UnitWeight': UnitWeight,
'CartonPrice': CartonPrice,
'ShrinkPrice': ShrinkPrice,
'UnitPrice': UnitPrice,
'UnitOfMeasureId': UnitOfMeasureId
};
getTypeName() => "ProductData";
TypeContext? context = _ctx;
}
class ProductDataCategory implements IConvertible
{
String? UnitBarcode;
List<ProductData>? Products;
ProductDataCategory({this.UnitBarcode,this.Products});
ProductDataCategory.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
UnitBarcode = json['UnitBarcode'];
Products = JsonConverters.fromJson(json['Products'],'List<ProductData>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'UnitBarcode': UnitBarcode,
'Products': JsonConverters.toJson(Products,'List<ProductData>',context!)
};
getTypeName() => "ProductDataCategory";
TypeContext? context = _ctx;
}
class StockStatusData implements IConvertible
{
int? Id;
String? Name;
bool? PhotoRequired;
bool? BatchCodeMandatory;
String? Color;
StockStatusData({this.Id,this.Name,this.PhotoRequired,this.BatchCodeMandatory,this.Color});
StockStatusData.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Id = json['Id'];
Name = json['Name'];
PhotoRequired = json['PhotoRequired'];
BatchCodeMandatory = json['BatchCodeMandatory'];
Color = json['Color'];
return this;
}
Map<String, dynamic> toJson() => {
'Id': Id,
'Name': Name,
'PhotoRequired': PhotoRequired,
'BatchCodeMandatory': BatchCodeMandatory,
'Color': Color
};
getTypeName() => "StockStatusData";
TypeContext? context = _ctx;
}
class PrincipalData implements IConvertible
{
int? PrincipalId;
String? Name;
String? LogoImageUrl;
List<ProductDataCategory>? Products;
String? UpliftPrefix;
String? ContactName;
String? ContactNumber;
String? ContactEmail;
bool? HasLogo;
bool? AllowProductLookup;
bool? CaptureSerialNumber;
bool? ShowProductionDate;
bool? ShowExpiryDate;
bool? ShowBatchCode;
bool? SealNumberPerProduct;
List<StockStatusData>? AllowedProductStockStatuses;
bool? Enabled;
bool? ShowSealNumber;
bool? ShowSealWeight;
bool? ConsolidationEnabled;
PrincipalData({this.PrincipalId,this.Name,this.LogoImageUrl,this.Products,this.UpliftPrefix,this.ContactName,this.ContactNumber,this.ContactEmail,this.HasLogo,this.AllowProductLookup,this.CaptureSerialNumber,this.ShowProductionDate,this.ShowExpiryDate,this.ShowBatchCode,this.SealNumberPerProduct,this.AllowedProductStockStatuses,this.Enabled,this.ShowSealNumber,this.ShowSealWeight,this.ConsolidationEnabled});
PrincipalData.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
PrincipalId = json['PrincipalId'];
Name = json['Name'];
LogoImageUrl = json['LogoImageUrl'];
Products = JsonConverters.fromJson(json['Products'],'List<ProductDataCategory>',context!);
UpliftPrefix = json['UpliftPrefix'];
ContactName = json['ContactName'];
ContactNumber = json['ContactNumber'];
ContactEmail = json['ContactEmail'];
HasLogo = json['HasLogo'];
AllowProductLookup = json['AllowProductLookup'];
CaptureSerialNumber = json['CaptureSerialNumber'];
ShowProductionDate = json['ShowProductionDate'];
ShowExpiryDate = json['ShowExpiryDate'];
ShowBatchCode = json['ShowBatchCode'];
SealNumberPerProduct = json['SealNumberPerProduct'];
AllowedProductStockStatuses = JsonConverters.fromJson(json['AllowedProductStockStatuses'],'List<StockStatusData>',context!);
Enabled = json['Enabled'];
ShowSealNumber = json['ShowSealNumber'];
ShowSealWeight = json['ShowSealWeight'];
ConsolidationEnabled = json['ConsolidationEnabled'];
return this;
}
Map<String, dynamic> toJson() => {
'PrincipalId': PrincipalId,
'Name': Name,
'LogoImageUrl': LogoImageUrl,
'Products': JsonConverters.toJson(Products,'List<ProductDataCategory>',context!),
'UpliftPrefix': UpliftPrefix,
'ContactName': ContactName,
'ContactNumber': ContactNumber,
'ContactEmail': ContactEmail,
'HasLogo': HasLogo,
'AllowProductLookup': AllowProductLookup,
'CaptureSerialNumber': CaptureSerialNumber,
'ShowProductionDate': ShowProductionDate,
'ShowExpiryDate': ShowExpiryDate,
'ShowBatchCode': ShowBatchCode,
'SealNumberPerProduct': SealNumberPerProduct,
'AllowedProductStockStatuses': JsonConverters.toJson(AllowedProductStockStatuses,'List<StockStatusData>',context!),
'Enabled': Enabled,
'ShowSealNumber': ShowSealNumber,
'ShowSealWeight': ShowSealWeight,
'ConsolidationEnabled': ConsolidationEnabled
};
getTypeName() => "PrincipalData";
TypeContext? context = _ctx;
}
class GetPrincipalResponse extends ApiServiceResponse implements IConvertible
{
PrincipalData? Data;
GetPrincipalResponse({this.Data});
GetPrincipalResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
Data = JsonConverters.fromJson(json['Data'],'PrincipalData',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'Data': JsonConverters.toJson(Data,'PrincipalData',context!)
});
getTypeName() => "GetPrincipalResponse";
TypeContext? context = _ctx;
}
class GetPrincipal extends ApiServiceRequest implements IConvertible
{
int? PrincipalId;
GetPrincipal({this.PrincipalId});
GetPrincipal.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
PrincipalId = json['PrincipalId'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'PrincipalId': PrincipalId
});
getTypeName() => "GetPrincipal";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'returnit_api_dev.happen.zone', types: <String, TypeInfo> {
'ApiServiceRequest': TypeInfo(TypeOf.Class, create:() => ApiServiceRequest()),
'ApiServiceResponse': TypeInfo(TypeOf.Class, create:() => ApiServiceResponse()),
'ProductData': TypeInfo(TypeOf.Class, create:() => ProductData()),
'ProductDataCategory': TypeInfo(TypeOf.Class, create:() => ProductDataCategory()),
'List<ProductData>': TypeInfo(TypeOf.Class, create:() => <ProductData>[]),
'StockStatusData': TypeInfo(TypeOf.Class, create:() => StockStatusData()),
'PrincipalData': TypeInfo(TypeOf.Class, create:() => PrincipalData()),
'List<ProductDataCategory>': TypeInfo(TypeOf.Class, create:() => <ProductDataCategory>[]),
'List<StockStatusData>': TypeInfo(TypeOf.Class, create:() => <StockStatusData>[]),
'GetPrincipalResponse': TypeInfo(TypeOf.Class, create:() => GetPrincipalResponse()),
'GetPrincipal': TypeInfo(TypeOf.Class, create:() => GetPrincipal()),
});
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.
GET /principal/get HTTP/1.1 Host: returnit-api-dev.happen.zone Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Data:
{
PrincipalId: 0,
Name: String,
LogoImageUrl: String,
Products:
[
{
UnitBarcode: String,
Products:
[
{
ProductId: 0,
PrincipalId: 0,
PrincipalPrefix: String,
Name: String,
Category: String,
ProductCode: String,
UnitBarcode: String,
CartonQuantity: 0,
ShrinkQuantity: 0,
UnitQuantity: 0,
CartonMeasurement: String,
ShrinkMeasurement: String,
UnitMeasurement: String,
CartonWeight: 0,
ShrinkWeight: 0,
UnitWeight: 0,
CartonPrice: 0,
ShrinkPrice: 0,
UnitPrice: 0,
UnitOfMeasureId: 0
}
]
}
],
UpliftPrefix: String,
ContactName: String,
ContactNumber: String,
ContactEmail: String,
HasLogo: False,
AllowProductLookup: False,
CaptureSerialNumber: False,
ShowProductionDate: False,
ShowExpiryDate: False,
ShowBatchCode: False,
SealNumberPerProduct: False,
AllowedProductStockStatuses:
[
{
Id: 0,
Name: String,
PhotoRequired: False,
BatchCodeMandatory: False,
Color: String
}
],
Enabled: False,
ShowSealNumber: False,
ShowSealWeight: False,
ConsolidationEnabled: False
},
Description: String,
Heading: String,
WasSuccessful: False,
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}