Richemont.Booster2.PublicApi

<back to all web services

CreateStockValidateRequest

Requires Authentication
The following routes are available for this service:
POST/stock/validateCreate Validate Stock Request
import 'package:servicestack/servicestack.dart';

class CreateStockValidateResponse implements IConvertible
{
    /**
    * Validation Id
    */
    // @ApiMember(Description="Validation Id", IsRequired=true)
    int validationId = 0;

    CreateStockValidateResponse({this.validationId=0});
    CreateStockValidateResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        validationId = json['validationId'] ?? 0;
        return this;
    }

    Map<String, dynamic> toJson() => {
        'validationId': validationId
    };

    getTypeName() => "CreateStockValidateResponse";
    TypeContext? context = _ctx;
}

class CreateStockValidateRequestItem implements IConvertible
{
    /**
    * Legacy Article Code of the item
    */
    // @ApiMember(Description="Legacy Article Code of the item", IsRequired=true)
    String articleCode = "";

    /**
    * Stock Quantity
    */
    // @ApiMember(Description="Stock Quantity", IsRequired=true)
    int quantity = 0;

    /**
    * Serial Numbers
    */
    // @ApiMember(Description="Serial Numbers")
    List<String>? serialNumbers;

    CreateStockValidateRequestItem({this.articleCode="",this.quantity=0,this.serialNumbers});
    CreateStockValidateRequestItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        articleCode = json['articleCode'] ?? "";
        quantity = json['quantity'] ?? 0;
        serialNumbers = JsonConverters.fromJson(json['serialNumbers'],'List<String>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'articleCode': articleCode,
        'quantity': quantity,
        'serialNumbers': JsonConverters.toJson(serialNumbers,'List<String>',context!)
    };

    getTypeName() => "CreateStockValidateRequestItem";
    TypeContext? context = _ctx;
}

class CreateStockValidateRequest implements IConvertible
{
    /**
    * Brand Trigram, e.g. CAR, IWC
    */
    // @ApiMember(Description="Brand Trigram, e.g. CAR, IWC", IsRequired=true)
    String brand = "";

    /**
    * POS Code e.g. ES100:102048
    */
    // @ApiMember(Description="POS Code e.g. ES100:102048", IsRequired=true)
    String posCode = "";

    /**
    * Validation Date
    */
    // @ApiMember(Description="Validation Date", IsRequired=true)
    DateTime? date;

    /**
    * Items
    */
    // @ApiMember(Description="Items", IsRequired=true)
    List<CreateStockValidateRequestItem> items = [];

    CreateStockValidateRequest({this.brand="",this.posCode="",this.date,this.items=const []});
    CreateStockValidateRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        brand = json['brand'] ?? "";
        posCode = json['posCode'] ?? "";
        date = JsonConverters.fromJson(json['date'],'DateTime',context!) ?? DateTime(0);
        items = JsonConverters.fromJson(json['items'],'List<CreateStockValidateRequestItem>',context!) ?? [];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'brand': brand,
        'posCode': posCode,
        'date': JsonConverters.toJson(date,'DateTime',context!),
        'items': JsonConverters.toJson(items,'List<CreateStockValidateRequestItem>',context!)
    };

    getTypeName() => "CreateStockValidateRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'dev_api_booster.richemont.com', types: <String, TypeInfo> {
    'CreateStockValidateResponse': TypeInfo(TypeOf.Class, create:() => CreateStockValidateResponse()),
    'CreateStockValidateRequestItem': TypeInfo(TypeOf.Class, create:() => CreateStockValidateRequestItem()),
    'CreateStockValidateRequest': TypeInfo(TypeOf.Class, create:() => CreateStockValidateRequest()),
    'List<CreateStockValidateRequestItem>': TypeInfo(TypeOf.Class, create:() => <CreateStockValidateRequestItem>[]),
});

Dart CreateStockValidateRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /stock/validate HTTP/1.1 
Host: dev-api-booster.richemont.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	brand: String,
	posCode: String,
	date: 0001-01-01,
	items: 
	[
		{
			articleCode: String,
			quantity: 0,
			serialNumbers: 
			[
				String
			]
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	validationId: 0
}