@lcdp/api-react-rest-client 3.1.4 → 3.1.5-LDS-5354-refactoring-multi-panier.23008488553
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/magic-cart/src/models/ExpressOrder.d.ts +3 -3
- package/magic-cart/src/models/ExpressOrder.js +3 -3
- package/magic-cart/src/models/ShoppedOffer.d.ts +43 -0
- package/magic-cart/src/models/ShoppedOffer.js +53 -0
- package/magic-cart/src/models/index.d.ts +1 -2
- package/magic-cart/src/models/index.js +1 -2
- package/order/src/models/ShoppedOffer.d.ts +2 -2
- package/order/src/models/ShoppedOffer.js +2 -2
- package/package.json +1 -1
- package/shopping-cart/src/apis/ManageCartApi.d.ts +16 -28
- package/shopping-cart/src/apis/ManageCartApi.js +29 -188
- package/shopping-cart/src/apis/ManageCartLineApi.d.ts +45 -0
- package/shopping-cart/src/apis/ManageCartLineApi.js +238 -0
- package/shopping-cart/src/apis/SearchCartApi.d.ts +59 -0
- package/shopping-cart/src/apis/SearchCartApi.js +267 -0
- package/shopping-cart/src/apis/SearchCartLineApi.d.ts +41 -0
- package/shopping-cart/src/apis/SearchCartLineApi.js +241 -0
- package/shopping-cart/src/apis/index.d.ts +3 -2
- package/shopping-cart/src/apis/index.js +3 -2
- package/shopping-cart/src/models/Cart.d.ts +61 -4
- package/shopping-cart/src/models/Cart.js +47 -2
- package/shopping-cart/src/models/CartCreationParameters.d.ts +44 -0
- package/shopping-cart/src/models/CartCreationParameters.js +56 -0
- package/shopping-cart/src/models/{CartSubCartLine.d.ts → CartLine.d.ts} +13 -13
- package/shopping-cart/src/models/{CartSubCartLine.js → CartLine.js} +11 -11
- package/shopping-cart/src/models/CartLineUpdateParameters.d.ts +37 -0
- package/shopping-cart/src/models/CartLineUpdateParameters.js +49 -0
- package/shopping-cart/src/models/CartLineWithWarnings.d.ts +39 -0
- package/shopping-cart/src/models/CartLineWithWarnings.js +49 -0
- package/shopping-cart/src/models/CartSummary.d.ts +31 -0
- package/shopping-cart/src/models/CartSummary.js +47 -0
- package/shopping-cart/src/models/{CartSubCartTransport.d.ts → CartTransport.d.ts} +12 -12
- package/shopping-cart/src/models/{CartSubCartTransport.js → CartTransport.js} +11 -11
- package/shopping-cart/src/models/CartWarning.d.ts +70 -0
- package/shopping-cart/src/models/CartWarning.js +67 -0
- package/shopping-cart/src/models/CartsWithWarnings.d.ts +39 -0
- package/shopping-cart/src/models/CartsWithWarnings.js +49 -0
- package/shopping-cart/src/models/OwnerLink.d.ts +43 -0
- package/shopping-cart/src/models/OwnerLink.js +53 -0
- package/shopping-cart/src/models/PaginatedCarts.d.ts +46 -0
- package/shopping-cart/src/models/PaginatedCarts.js +58 -0
- package/shopping-cart/src/models/PagingMetadata.d.ts +49 -0
- package/shopping-cart/src/models/PagingMetadata.js +55 -0
- package/shopping-cart/src/models/ShoppedOffer.d.ts +2 -2
- package/shopping-cart/src/models/ShoppedOffer.js +2 -2
- package/shopping-cart/src/models/index.d.ts +11 -4
- package/shopping-cart/src/models/index.js +11 -4
- package/magic-cart/src/models/SaleOfferProposal.d.ts +0 -51
- package/magic-cart/src/models/SaleOfferProposal.js +0 -61
- package/magic-cart/src/models/SellerProposal.d.ts +0 -45
- package/magic-cart/src/models/SellerProposal.js +0 -57
- package/shopping-cart/src/apis/ManageCartSubCartApi.d.ts +0 -107
- package/shopping-cart/src/apis/ManageCartSubCartApi.js +0 -556
- package/shopping-cart/src/apis/ManageCartSubCartLineApi.d.ts +0 -151
- package/shopping-cart/src/apis/ManageCartSubCartLineApi.js +0 -879
- package/shopping-cart/src/models/CartSubCart.d.ts +0 -76
- package/shopping-cart/src/models/CartSubCart.js +0 -78
- package/shopping-cart/src/models/CartSubCartLineUpdateParameters.d.ts +0 -37
- package/shopping-cart/src/models/CartSubCartLineUpdateParameters.js +0 -49
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* https://openapi-generator.tech
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
|
-
import type {
|
|
12
|
+
import type { ShoppedOffer } from './ShoppedOffer';
|
|
13
13
|
/**
|
|
14
14
|
* Express Order as a list of sale offer proposal grouped by sellers
|
|
15
15
|
* @export
|
|
@@ -24,10 +24,10 @@ export interface ExpressOrder {
|
|
|
24
24
|
optimal?: boolean;
|
|
25
25
|
/**
|
|
26
26
|
*
|
|
27
|
-
* @type {Array<
|
|
27
|
+
* @type {Array<ShoppedOffer>}
|
|
28
28
|
* @memberof ExpressOrder
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
shoppedOffers?: Array<ShoppedOffer>;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Check if a given object implements the ExpressOrder interface.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
16
|
exports.ExpressOrderToJSON = exports.ExpressOrderFromJSONTyped = exports.ExpressOrderFromJSON = exports.instanceOfExpressOrder = void 0;
|
|
17
|
-
var
|
|
17
|
+
var ShoppedOffer_1 = require("./ShoppedOffer");
|
|
18
18
|
/**
|
|
19
19
|
* Check if a given object implements the ExpressOrder interface.
|
|
20
20
|
*/
|
|
@@ -32,7 +32,7 @@ function ExpressOrderFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
32
32
|
}
|
|
33
33
|
return {
|
|
34
34
|
'optimal': json['optimal'],
|
|
35
|
-
'
|
|
35
|
+
'shoppedOffers': (json['shoppedOffers'] === null || json['shoppedOffers'] === undefined) ? json['shoppedOffers'] : json['shoppedOffers'].map(ShoppedOffer_1.ShoppedOfferFromJSON),
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
exports.ExpressOrderFromJSONTyped = ExpressOrderFromJSONTyped;
|
|
@@ -42,7 +42,7 @@ function ExpressOrderToJSON(value) {
|
|
|
42
42
|
}
|
|
43
43
|
return {
|
|
44
44
|
'optimal': value['optimal'],
|
|
45
|
-
'
|
|
45
|
+
'shoppedOffers': (value['shoppedOffers'] === null || value['shoppedOffers'] === undefined) ? value['shoppedOffers'] : value['shoppedOffers'].map(ShoppedOffer_1.ShoppedOfferToJSON),
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
48
|
exports.ExpressOrderToJSON = ExpressOrderToJSON;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lcdp-magic-cart
|
|
3
|
+
* This is the REST API of Magic cart
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
* Contact: contact@lecomptoirdespharmacies.fr
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface ShoppedOffer
|
|
16
|
+
*/
|
|
17
|
+
export interface ShoppedOffer {
|
|
18
|
+
/**
|
|
19
|
+
* Reference of the sale offer
|
|
20
|
+
* @type {string}
|
|
21
|
+
* @memberof ShoppedOffer
|
|
22
|
+
*/
|
|
23
|
+
offerReference: string;
|
|
24
|
+
/**
|
|
25
|
+
* Identifier of picked distribution range
|
|
26
|
+
* @type {number}
|
|
27
|
+
* @memberof ShoppedOffer
|
|
28
|
+
*/
|
|
29
|
+
distributionRangeId?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Quantity to add in the cart
|
|
32
|
+
* @type {number}
|
|
33
|
+
* @memberof ShoppedOffer
|
|
34
|
+
*/
|
|
35
|
+
quantity: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check if a given object implements the ShoppedOffer interface.
|
|
39
|
+
*/
|
|
40
|
+
export declare function instanceOfShoppedOffer(value: object): value is ShoppedOffer;
|
|
41
|
+
export declare function ShoppedOfferFromJSON(json: any): ShoppedOffer;
|
|
42
|
+
export declare function ShoppedOfferFromJSONTyped(json: any, ignoreDiscriminator: boolean): ShoppedOffer;
|
|
43
|
+
export declare function ShoppedOfferToJSON(value?: ShoppedOffer | null): any;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
/**
|
|
5
|
+
* lcdp-magic-cart
|
|
6
|
+
* This is the REST API of Magic cart
|
|
7
|
+
*
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
|
+
* Contact: contact@lecomptoirdespharmacies.fr
|
|
10
|
+
*
|
|
11
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
12
|
+
* https://openapi-generator.tech
|
|
13
|
+
* Do not edit the class manually.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.ShoppedOfferToJSON = exports.ShoppedOfferFromJSONTyped = exports.ShoppedOfferFromJSON = exports.instanceOfShoppedOffer = void 0;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a given object implements the ShoppedOffer interface.
|
|
19
|
+
*/
|
|
20
|
+
function instanceOfShoppedOffer(value) {
|
|
21
|
+
if (!('offerReference' in value) || value['offerReference'] === undefined)
|
|
22
|
+
return false;
|
|
23
|
+
if (!('quantity' in value) || value['quantity'] === undefined)
|
|
24
|
+
return false;
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
exports.instanceOfShoppedOffer = instanceOfShoppedOffer;
|
|
28
|
+
function ShoppedOfferFromJSON(json) {
|
|
29
|
+
return ShoppedOfferFromJSONTyped(json, false);
|
|
30
|
+
}
|
|
31
|
+
exports.ShoppedOfferFromJSON = ShoppedOfferFromJSON;
|
|
32
|
+
function ShoppedOfferFromJSONTyped(json, ignoreDiscriminator) {
|
|
33
|
+
if (json == null) {
|
|
34
|
+
return json;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
'offerReference': json['offerReference'],
|
|
38
|
+
'distributionRangeId': json['distributionRangeId'],
|
|
39
|
+
'quantity': json['quantity'],
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
exports.ShoppedOfferFromJSONTyped = ShoppedOfferFromJSONTyped;
|
|
43
|
+
function ShoppedOfferToJSON(value) {
|
|
44
|
+
if (value == null) {
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
'offerReference': value['offerReference'],
|
|
49
|
+
'distributionRangeId': value['distributionRangeId'],
|
|
50
|
+
'quantity': value['quantity'],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
exports.ShoppedOfferToJSON = ShoppedOfferToJSON;
|
|
@@ -12,8 +12,7 @@ export * from './ProductLink';
|
|
|
12
12
|
export * from './ProductStorageType';
|
|
13
13
|
export * from './QuotationDistributionMode';
|
|
14
14
|
export * from './SaleOfferLink';
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './SellerProposal';
|
|
15
|
+
export * from './ShoppedOffer';
|
|
17
16
|
export * from './Stock';
|
|
18
17
|
export * from './UnitaryDistributionMode';
|
|
19
18
|
export * from './UserLink';
|
|
@@ -30,8 +30,7 @@ __exportStar(require("./ProductLink"), exports);
|
|
|
30
30
|
__exportStar(require("./ProductStorageType"), exports);
|
|
31
31
|
__exportStar(require("./QuotationDistributionMode"), exports);
|
|
32
32
|
__exportStar(require("./SaleOfferLink"), exports);
|
|
33
|
-
__exportStar(require("./
|
|
34
|
-
__exportStar(require("./SellerProposal"), exports);
|
|
33
|
+
__exportStar(require("./ShoppedOffer"), exports);
|
|
35
34
|
__exportStar(require("./Stock"), exports);
|
|
36
35
|
__exportStar(require("./UnitaryDistributionMode"), exports);
|
|
37
36
|
__exportStar(require("./UserLink"), exports);
|
|
@@ -22,11 +22,11 @@ export interface ShoppedOffer {
|
|
|
22
22
|
*/
|
|
23
23
|
offerReference: string;
|
|
24
24
|
/**
|
|
25
|
-
* Identifier of picked
|
|
25
|
+
* Identifier of picked distribution range
|
|
26
26
|
* @type {number}
|
|
27
27
|
* @memberof ShoppedOffer
|
|
28
28
|
*/
|
|
29
|
-
|
|
29
|
+
distributionRangeId?: number;
|
|
30
30
|
/**
|
|
31
31
|
* Quantity to add in the cart
|
|
32
32
|
* @type {number}
|
|
@@ -35,7 +35,7 @@ function ShoppedOfferFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
35
35
|
}
|
|
36
36
|
return {
|
|
37
37
|
'offerReference': json['offerReference'],
|
|
38
|
-
'
|
|
38
|
+
'distributionRangeId': json['distributionRangeId'],
|
|
39
39
|
'quantity': json['quantity'],
|
|
40
40
|
};
|
|
41
41
|
}
|
|
@@ -46,7 +46,7 @@ function ShoppedOfferToJSON(value) {
|
|
|
46
46
|
}
|
|
47
47
|
return {
|
|
48
48
|
'offerReference': value['offerReference'],
|
|
49
|
-
'
|
|
49
|
+
'distributionRangeId': value['distributionRangeId'],
|
|
50
50
|
'quantity': value['quantity'],
|
|
51
51
|
};
|
|
52
52
|
}
|
package/package.json
CHANGED
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime';
|
|
13
|
-
import type {
|
|
14
|
-
export interface
|
|
15
|
-
|
|
13
|
+
import type { CartCreationParameters, CartsWithWarnings } from '../models/index';
|
|
14
|
+
export interface CreateCartsRequest {
|
|
15
|
+
cartCreationParameters: CartCreationParameters;
|
|
16
16
|
}
|
|
17
|
-
export interface
|
|
17
|
+
export interface DeleteCartRequest {
|
|
18
18
|
cartId: number;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
@@ -22,35 +22,23 @@ export interface GetCartRequest {
|
|
|
22
22
|
*/
|
|
23
23
|
export declare class ManageCartApi extends runtime.BaseAPI {
|
|
24
24
|
/**
|
|
25
|
-
* Create
|
|
26
|
-
|
|
27
|
-
createCartRaw(requestParameters: CreateCartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Cart | runtime.BlobWithMeta>>;
|
|
28
|
-
/**
|
|
29
|
-
* Create current cart if get cart return object not found
|
|
30
|
-
*/
|
|
31
|
-
createCart(requestParameters: CreateCartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Cart | runtime.BlobWithMeta>;
|
|
32
|
-
/**
|
|
33
|
-
* Create current cart if get cart return object not found
|
|
34
|
-
*/
|
|
35
|
-
createCurrentCartRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Cart | runtime.BlobWithMeta>>;
|
|
36
|
-
/**
|
|
37
|
-
* Create current cart if get cart return object not found
|
|
38
|
-
*/
|
|
39
|
-
createCurrentCart(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Cart | runtime.BlobWithMeta>;
|
|
40
|
-
/**
|
|
41
|
-
* Get current cart
|
|
25
|
+
* Create one or more carts for the given owner with items from shopped offers. Each cart is associated with a channel and a seller. Multiple carts may be created if the shopped offers belong to different sellers.
|
|
26
|
+
* Create carts and add items
|
|
42
27
|
*/
|
|
43
|
-
|
|
28
|
+
createCartsRaw(requestParameters: CreateCartsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CartsWithWarnings | runtime.BlobWithMeta>>;
|
|
44
29
|
/**
|
|
45
|
-
*
|
|
30
|
+
* Create one or more carts for the given owner with items from shopped offers. Each cart is associated with a channel and a seller. Multiple carts may be created if the shopped offers belong to different sellers.
|
|
31
|
+
* Create carts and add items
|
|
46
32
|
*/
|
|
47
|
-
|
|
33
|
+
createCarts(requestParameters: CreateCartsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CartsWithWarnings | runtime.BlobWithMeta>;
|
|
48
34
|
/**
|
|
49
|
-
*
|
|
35
|
+
* Delete a cart and all its lines.
|
|
36
|
+
* Delete a cart
|
|
50
37
|
*/
|
|
51
|
-
|
|
38
|
+
deleteCartRaw(requestParameters: DeleteCartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
52
39
|
/**
|
|
53
|
-
*
|
|
40
|
+
* Delete a cart and all its lines.
|
|
41
|
+
* Delete a cart
|
|
54
42
|
*/
|
|
55
|
-
|
|
43
|
+
deleteCart(requestParameters: DeleteCartRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
56
44
|
}
|
|
@@ -76,19 +76,21 @@ var ManageCartApi = /** @class */ (function (_super) {
|
|
|
76
76
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
-
* Create
|
|
79
|
+
* Create one or more carts for the given owner with items from shopped offers. Each cart is associated with a channel and a seller. Multiple carts may be created if the shopped offers belong to different sellers.
|
|
80
|
+
* Create carts and add items
|
|
80
81
|
*/
|
|
81
|
-
ManageCartApi.prototype.
|
|
82
|
+
ManageCartApi.prototype.createCartsRaw = function (requestParameters, initOverrides) {
|
|
82
83
|
return __awaiter(this, void 0, void 0, function () {
|
|
83
84
|
var queryParameters, headerParameters, _a, _b, token, tokenString, response, contentType, response_1;
|
|
84
85
|
return __generator(this, function (_c) {
|
|
85
86
|
switch (_c.label) {
|
|
86
87
|
case 0:
|
|
87
|
-
if (requestParameters['
|
|
88
|
-
throw new runtime.RequiredError('
|
|
88
|
+
if (requestParameters['cartCreationParameters'] == null) {
|
|
89
|
+
throw new runtime.RequiredError('cartCreationParameters', 'Required parameter "cartCreationParameters" was null or undefined when calling createCarts().');
|
|
89
90
|
}
|
|
90
91
|
queryParameters = {};
|
|
91
92
|
headerParameters = {};
|
|
93
|
+
headerParameters['Content-Type'] = 'application/json';
|
|
92
94
|
if (!(this.configuration && this.configuration.apiKey)) return [3 /*break*/, 2];
|
|
93
95
|
_a = headerParameters;
|
|
94
96
|
_b = "x-api-key";
|
|
@@ -109,16 +111,17 @@ var ManageCartApi = /** @class */ (function (_super) {
|
|
|
109
111
|
case 4:
|
|
110
112
|
_c.trys.push([4, 6, , 7]);
|
|
111
113
|
return [4 /*yield*/, this.request({
|
|
112
|
-
path: "/carts
|
|
114
|
+
path: "/carts",
|
|
113
115
|
method: 'POST',
|
|
114
116
|
headers: headerParameters,
|
|
115
117
|
query: queryParameters,
|
|
118
|
+
body: (0, index_1.CartCreationParametersToJSON)(requestParameters['cartCreationParameters']),
|
|
116
119
|
}, initOverrides)];
|
|
117
120
|
case 5:
|
|
118
121
|
response = _c.sent();
|
|
119
122
|
contentType = response.headers.get("content-type");
|
|
120
123
|
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
121
|
-
return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.
|
|
124
|
+
return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.CartsWithWarningsFromJSON)(jsonValue); })];
|
|
122
125
|
}
|
|
123
126
|
else if (contentType && contentType.indexOf("text/plain") !== -1) {
|
|
124
127
|
return [2 /*return*/, new runtime.TextApiResponse(response)];
|
|
@@ -138,90 +141,15 @@ var ManageCartApi = /** @class */ (function (_super) {
|
|
|
138
141
|
});
|
|
139
142
|
};
|
|
140
143
|
/**
|
|
141
|
-
* Create
|
|
142
|
-
|
|
143
|
-
ManageCartApi.prototype.createCart = function (requestParameters, initOverrides) {
|
|
144
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
145
|
-
var response;
|
|
146
|
-
return __generator(this, function (_a) {
|
|
147
|
-
switch (_a.label) {
|
|
148
|
-
case 0: return [4 /*yield*/, this.createCartRaw(requestParameters, initOverrides)];
|
|
149
|
-
case 1:
|
|
150
|
-
response = _a.sent();
|
|
151
|
-
return [4 /*yield*/, response.value()];
|
|
152
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* Create current cart if get cart return object not found
|
|
159
|
-
*/
|
|
160
|
-
ManageCartApi.prototype.createCurrentCartRaw = function (initOverrides) {
|
|
161
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
-
var queryParameters, headerParameters, _a, _b, token, tokenString, response, contentType, response_2;
|
|
163
|
-
return __generator(this, function (_c) {
|
|
164
|
-
switch (_c.label) {
|
|
165
|
-
case 0:
|
|
166
|
-
queryParameters = {};
|
|
167
|
-
headerParameters = {};
|
|
168
|
-
if (!(this.configuration && this.configuration.apiKey)) return [3 /*break*/, 2];
|
|
169
|
-
_a = headerParameters;
|
|
170
|
-
_b = "x-api-key";
|
|
171
|
-
return [4 /*yield*/, this.configuration.apiKey("x-api-key")];
|
|
172
|
-
case 1:
|
|
173
|
-
_a[_b] = _c.sent(); // apiKeyAuth authentication
|
|
174
|
-
_c.label = 2;
|
|
175
|
-
case 2:
|
|
176
|
-
if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 4];
|
|
177
|
-
token = this.configuration.accessToken;
|
|
178
|
-
return [4 /*yield*/, token("bearerAuth", [])];
|
|
179
|
-
case 3:
|
|
180
|
-
tokenString = _c.sent();
|
|
181
|
-
if (tokenString) {
|
|
182
|
-
headerParameters["Authorization"] = "Bearer ".concat(tokenString);
|
|
183
|
-
}
|
|
184
|
-
_c.label = 4;
|
|
185
|
-
case 4:
|
|
186
|
-
_c.trys.push([4, 6, , 7]);
|
|
187
|
-
return [4 /*yield*/, this.request({
|
|
188
|
-
path: "/carts/me",
|
|
189
|
-
method: 'POST',
|
|
190
|
-
headers: headerParameters,
|
|
191
|
-
query: queryParameters,
|
|
192
|
-
}, initOverrides)];
|
|
193
|
-
case 5:
|
|
194
|
-
response = _c.sent();
|
|
195
|
-
contentType = response.headers.get("content-type");
|
|
196
|
-
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
197
|
-
return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.CartFromJSON)(jsonValue); })];
|
|
198
|
-
}
|
|
199
|
-
else if (contentType && contentType.indexOf("text/plain") !== -1) {
|
|
200
|
-
return [2 /*return*/, new runtime.TextApiResponse(response)];
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
// TODO : Better handling of others application types
|
|
204
|
-
return [2 /*return*/, new runtime.BlobWithMetaApiResponse(response)];
|
|
205
|
-
}
|
|
206
|
-
return [3 /*break*/, 7];
|
|
207
|
-
case 6:
|
|
208
|
-
response_2 = _c.sent();
|
|
209
|
-
console.debug(response_2);
|
|
210
|
-
throw response_2;
|
|
211
|
-
case 7: return [2 /*return*/];
|
|
212
|
-
}
|
|
213
|
-
});
|
|
214
|
-
});
|
|
215
|
-
};
|
|
216
|
-
/**
|
|
217
|
-
* Create current cart if get cart return object not found
|
|
144
|
+
* Create one or more carts for the given owner with items from shopped offers. Each cart is associated with a channel and a seller. Multiple carts may be created if the shopped offers belong to different sellers.
|
|
145
|
+
* Create carts and add items
|
|
218
146
|
*/
|
|
219
|
-
ManageCartApi.prototype.
|
|
147
|
+
ManageCartApi.prototype.createCarts = function (requestParameters, initOverrides) {
|
|
220
148
|
return __awaiter(this, void 0, void 0, function () {
|
|
221
149
|
var response;
|
|
222
150
|
return __generator(this, function (_a) {
|
|
223
151
|
switch (_a.label) {
|
|
224
|
-
case 0: return [4 /*yield*/, this.
|
|
152
|
+
case 0: return [4 /*yield*/, this.createCartsRaw(requestParameters, initOverrides)];
|
|
225
153
|
case 1:
|
|
226
154
|
response = _a.sent();
|
|
227
155
|
return [4 /*yield*/, response.value()];
|
|
@@ -231,16 +159,17 @@ var ManageCartApi = /** @class */ (function (_super) {
|
|
|
231
159
|
});
|
|
232
160
|
};
|
|
233
161
|
/**
|
|
234
|
-
*
|
|
162
|
+
* Delete a cart and all its lines.
|
|
163
|
+
* Delete a cart
|
|
235
164
|
*/
|
|
236
|
-
ManageCartApi.prototype.
|
|
165
|
+
ManageCartApi.prototype.deleteCartRaw = function (requestParameters, initOverrides) {
|
|
237
166
|
return __awaiter(this, void 0, void 0, function () {
|
|
238
|
-
var queryParameters, headerParameters, _a, _b, token, tokenString, response,
|
|
167
|
+
var queryParameters, headerParameters, _a, _b, token, tokenString, response, response_2;
|
|
239
168
|
return __generator(this, function (_c) {
|
|
240
169
|
switch (_c.label) {
|
|
241
170
|
case 0:
|
|
242
171
|
if (requestParameters['cartId'] == null) {
|
|
243
|
-
throw new runtime.RequiredError('cartId', 'Required parameter "cartId" was null or undefined when calling
|
|
172
|
+
throw new runtime.RequiredError('cartId', 'Required parameter "cartId" was null or undefined when calling deleteCart().');
|
|
244
173
|
}
|
|
245
174
|
queryParameters = {};
|
|
246
175
|
headerParameters = {};
|
|
@@ -265,122 +194,34 @@ var ManageCartApi = /** @class */ (function (_super) {
|
|
|
265
194
|
_c.trys.push([4, 6, , 7]);
|
|
266
195
|
return [4 /*yield*/, this.request({
|
|
267
196
|
path: "/carts/{cartId}".replace("{".concat("cartId", "}"), encodeURIComponent(String(requestParameters['cartId']))),
|
|
268
|
-
method: '
|
|
269
|
-
headers: headerParameters,
|
|
270
|
-
query: queryParameters,
|
|
271
|
-
}, initOverrides)];
|
|
272
|
-
case 5:
|
|
273
|
-
response = _c.sent();
|
|
274
|
-
contentType = response.headers.get("content-type");
|
|
275
|
-
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
276
|
-
return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.CartFromJSON)(jsonValue); })];
|
|
277
|
-
}
|
|
278
|
-
else if (contentType && contentType.indexOf("text/plain") !== -1) {
|
|
279
|
-
return [2 /*return*/, new runtime.TextApiResponse(response)];
|
|
280
|
-
}
|
|
281
|
-
else {
|
|
282
|
-
// TODO : Better handling of others application types
|
|
283
|
-
return [2 /*return*/, new runtime.BlobWithMetaApiResponse(response)];
|
|
284
|
-
}
|
|
285
|
-
return [3 /*break*/, 7];
|
|
286
|
-
case 6:
|
|
287
|
-
response_3 = _c.sent();
|
|
288
|
-
console.debug(response_3);
|
|
289
|
-
throw response_3;
|
|
290
|
-
case 7: return [2 /*return*/];
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
});
|
|
294
|
-
};
|
|
295
|
-
/**
|
|
296
|
-
* Get current cart
|
|
297
|
-
*/
|
|
298
|
-
ManageCartApi.prototype.getCart = function (requestParameters, initOverrides) {
|
|
299
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
300
|
-
var response;
|
|
301
|
-
return __generator(this, function (_a) {
|
|
302
|
-
switch (_a.label) {
|
|
303
|
-
case 0: return [4 /*yield*/, this.getCartRaw(requestParameters, initOverrides)];
|
|
304
|
-
case 1:
|
|
305
|
-
response = _a.sent();
|
|
306
|
-
return [4 /*yield*/, response.value()];
|
|
307
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
});
|
|
311
|
-
};
|
|
312
|
-
/**
|
|
313
|
-
* Get current cart
|
|
314
|
-
*/
|
|
315
|
-
ManageCartApi.prototype.getCurrentCartRaw = function (initOverrides) {
|
|
316
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
317
|
-
var queryParameters, headerParameters, _a, _b, token, tokenString, response, contentType, response_4;
|
|
318
|
-
return __generator(this, function (_c) {
|
|
319
|
-
switch (_c.label) {
|
|
320
|
-
case 0:
|
|
321
|
-
queryParameters = {};
|
|
322
|
-
headerParameters = {};
|
|
323
|
-
if (!(this.configuration && this.configuration.apiKey)) return [3 /*break*/, 2];
|
|
324
|
-
_a = headerParameters;
|
|
325
|
-
_b = "x-api-key";
|
|
326
|
-
return [4 /*yield*/, this.configuration.apiKey("x-api-key")];
|
|
327
|
-
case 1:
|
|
328
|
-
_a[_b] = _c.sent(); // apiKeyAuth authentication
|
|
329
|
-
_c.label = 2;
|
|
330
|
-
case 2:
|
|
331
|
-
if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 4];
|
|
332
|
-
token = this.configuration.accessToken;
|
|
333
|
-
return [4 /*yield*/, token("bearerAuth", [])];
|
|
334
|
-
case 3:
|
|
335
|
-
tokenString = _c.sent();
|
|
336
|
-
if (tokenString) {
|
|
337
|
-
headerParameters["Authorization"] = "Bearer ".concat(tokenString);
|
|
338
|
-
}
|
|
339
|
-
_c.label = 4;
|
|
340
|
-
case 4:
|
|
341
|
-
_c.trys.push([4, 6, , 7]);
|
|
342
|
-
return [4 /*yield*/, this.request({
|
|
343
|
-
path: "/carts/me",
|
|
344
|
-
method: 'GET',
|
|
197
|
+
method: 'DELETE',
|
|
345
198
|
headers: headerParameters,
|
|
346
199
|
query: queryParameters,
|
|
347
200
|
}, initOverrides)];
|
|
348
201
|
case 5:
|
|
349
202
|
response = _c.sent();
|
|
350
|
-
|
|
351
|
-
if (contentType && contentType.indexOf("application/json") !== -1) {
|
|
352
|
-
return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, index_1.CartFromJSON)(jsonValue); })];
|
|
353
|
-
}
|
|
354
|
-
else if (contentType && contentType.indexOf("text/plain") !== -1) {
|
|
355
|
-
return [2 /*return*/, new runtime.TextApiResponse(response)];
|
|
356
|
-
}
|
|
357
|
-
else {
|
|
358
|
-
// TODO : Better handling of others application types
|
|
359
|
-
return [2 /*return*/, new runtime.BlobWithMetaApiResponse(response)];
|
|
360
|
-
}
|
|
361
|
-
return [3 /*break*/, 7];
|
|
203
|
+
return [2 /*return*/, new runtime.VoidApiResponse(response)];
|
|
362
204
|
case 6:
|
|
363
|
-
|
|
364
|
-
console.debug(
|
|
365
|
-
throw
|
|
205
|
+
response_2 = _c.sent();
|
|
206
|
+
console.debug(response_2);
|
|
207
|
+
throw response_2;
|
|
366
208
|
case 7: return [2 /*return*/];
|
|
367
209
|
}
|
|
368
210
|
});
|
|
369
211
|
});
|
|
370
212
|
};
|
|
371
213
|
/**
|
|
372
|
-
*
|
|
214
|
+
* Delete a cart and all its lines.
|
|
215
|
+
* Delete a cart
|
|
373
216
|
*/
|
|
374
|
-
ManageCartApi.prototype.
|
|
217
|
+
ManageCartApi.prototype.deleteCart = function (requestParameters, initOverrides) {
|
|
375
218
|
return __awaiter(this, void 0, void 0, function () {
|
|
376
|
-
var response;
|
|
377
219
|
return __generator(this, function (_a) {
|
|
378
220
|
switch (_a.label) {
|
|
379
|
-
case 0: return [4 /*yield*/, this.
|
|
221
|
+
case 0: return [4 /*yield*/, this.deleteCartRaw(requestParameters, initOverrides)];
|
|
380
222
|
case 1:
|
|
381
|
-
|
|
382
|
-
return [
|
|
383
|
-
case 2: return [2 /*return*/, _a.sent()];
|
|
223
|
+
_a.sent();
|
|
224
|
+
return [2 /*return*/];
|
|
384
225
|
}
|
|
385
226
|
});
|
|
386
227
|
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lcdp-monolith-service
|
|
3
|
+
* This is the REST API of LCDP products
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
* Contact: contact@lecomptoirdespharmacies.fr
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
import * as runtime from '../runtime';
|
|
13
|
+
import type { CartLineUpdateParameters, CartLineWithWarnings } from '../models/index';
|
|
14
|
+
export interface DeleteCartLineRequest {
|
|
15
|
+
cartId: number;
|
|
16
|
+
lineId: number;
|
|
17
|
+
}
|
|
18
|
+
export interface UpdateCartLineRequest {
|
|
19
|
+
cartId: number;
|
|
20
|
+
lineId: number;
|
|
21
|
+
cartLineUpdateParameters: CartLineUpdateParameters;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export declare class ManageCartLineApi extends runtime.BaseAPI {
|
|
27
|
+
/**
|
|
28
|
+
* Delete a shopping cart line. Note: Deleting a cart line does not delete the parent cart, even if it\'s the last line. The associated ad (sale offer) is not affected by this deletion.
|
|
29
|
+
* Delete a cart line
|
|
30
|
+
*/
|
|
31
|
+
deleteCartLineRaw(requestParameters: DeleteCartLineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
32
|
+
/**
|
|
33
|
+
* Delete a shopping cart line. Note: Deleting a cart line does not delete the parent cart, even if it\'s the last line. The associated ad (sale offer) is not affected by this deletion.
|
|
34
|
+
* Delete a cart line
|
|
35
|
+
*/
|
|
36
|
+
deleteCartLine(requestParameters: DeleteCartLineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Update a cart line
|
|
39
|
+
*/
|
|
40
|
+
updateCartLineRaw(requestParameters: UpdateCartLineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<CartLineWithWarnings | runtime.BlobWithMeta>>;
|
|
41
|
+
/**
|
|
42
|
+
* Update a cart line
|
|
43
|
+
*/
|
|
44
|
+
updateCartLine(requestParameters: UpdateCartLineRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<CartLineWithWarnings | runtime.BlobWithMeta>;
|
|
45
|
+
}
|