@lcdp/api-react-rest-client 2.6.2-LDS-3445-api-ajouter-statitiques-user.8265269635 → 2.6.2-LDS-3445-api-ajouter-statitiques-user.8277726185

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lcdp/api-react-rest-client",
3
- "version": "2.6.2-LDS-3445-api-ajouter-statitiques-user.8265269635",
3
+ "version": "2.6.2-LDS-3445-api-ajouter-statitiques-user.8277726185",
4
4
  "scripts": {
5
5
  "build": "tsc"
6
6
  },
@@ -10,7 +10,10 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import { BaseAPI, ApiResponse, BlobWithMeta } from '../runtime';
13
- import { PaginatedUserStatistics } from '../models';
13
+ import { PaginatedUserStatistics, UserStatistic } from '../models';
14
+ export interface GetUserStatisticRequest {
15
+ userStatisticId: string;
16
+ }
14
17
  export interface GetUserStatisticsRequest {
15
18
  userIdEq?: Array<number>;
16
19
  p?: number;
@@ -20,6 +23,14 @@ export interface GetUserStatisticsRequest {
20
23
  * no description
21
24
  */
22
25
  export declare class SearchUserStatisticsApi extends BaseAPI {
26
+ /**
27
+ * Get a user statistic
28
+ */
29
+ getUserStatisticRaw(requestParameters: GetUserStatisticRequest): Promise<ApiResponse<UserStatistic | BlobWithMeta>>;
30
+ /**
31
+ * Get a user statistic
32
+ */
33
+ getUserStatistic(requestParameters: GetUserStatisticRequest): Promise<UserStatistic | BlobWithMeta>;
23
34
  /**
24
35
  * Search users statistics
25
36
  */
@@ -75,12 +75,93 @@ var SearchUserStatisticsApi = /** @class */ (function (_super) {
75
75
  function SearchUserStatisticsApi() {
76
76
  return _super !== null && _super.apply(this, arguments) || this;
77
77
  }
78
+ /**
79
+ * Get a user statistic
80
+ */
81
+ SearchUserStatisticsApi.prototype.getUserStatisticRaw = function (requestParameters) {
82
+ return __awaiter(this, void 0, void 0, function () {
83
+ var queryParameters, headerParameters, token, tokenString, _a, response, contentType, response_1;
84
+ return __generator(this, function (_b) {
85
+ switch (_b.label) {
86
+ case 0:
87
+ if (requestParameters.userStatisticId === null || requestParameters.userStatisticId === undefined) {
88
+ throw new runtime_1.RequiredError('userStatisticId', 'Required parameter requestParameters.userStatisticId was null or undefined when calling getUserStatistic.');
89
+ }
90
+ queryParameters = {};
91
+ headerParameters = {};
92
+ if (this.configuration && this.configuration.apiKey) {
93
+ headerParameters["x-api-key"] = this.configuration.apiKey("x-api-key"); // apiKeyAuth authentication
94
+ }
95
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 4];
96
+ token = this.configuration.accessToken;
97
+ if (!(typeof token === 'function')) return [3 /*break*/, 2];
98
+ return [4 /*yield*/, token("bearerAuth", [])];
99
+ case 1:
100
+ _a = _b.sent();
101
+ return [3 /*break*/, 3];
102
+ case 2:
103
+ _a = token;
104
+ _b.label = 3;
105
+ case 3:
106
+ tokenString = _a;
107
+ if (tokenString) {
108
+ headerParameters["Authorization"] = "Bearer ".concat(tokenString);
109
+ }
110
+ _b.label = 4;
111
+ case 4:
112
+ _b.trys.push([4, 6, , 7]);
113
+ return [4 /*yield*/, this.request({
114
+ path: "/user-statistics/{userStatisticId}".replace("{".concat("userStatisticId", "}"), encodeURIComponent(String(requestParameters.userStatisticId))),
115
+ method: 'GET',
116
+ headers: headerParameters,
117
+ query: queryParameters,
118
+ })];
119
+ case 5:
120
+ response = _b.sent();
121
+ contentType = response.headers.get("content-type");
122
+ if (contentType && contentType.indexOf("application/json") !== -1) {
123
+ return [2 /*return*/, new runtime_1.JSONApiResponse(response, function (jsonValue) { return (0, models_1.UserStatisticFromJSON)(jsonValue); })];
124
+ }
125
+ else if (contentType && contentType.indexOf("text/plain") !== -1) {
126
+ return [2 /*return*/, new runtime_1.TextApiResponse(response)];
127
+ }
128
+ else {
129
+ // TODO : Better handling of others application types
130
+ return [2 /*return*/, new runtime_1.BlobWithMetaApiResponse(response)];
131
+ }
132
+ return [3 /*break*/, 7];
133
+ case 6:
134
+ response_1 = _b.sent();
135
+ console.debug(response_1);
136
+ throw response_1;
137
+ case 7: return [2 /*return*/];
138
+ }
139
+ });
140
+ });
141
+ };
142
+ /**
143
+ * Get a user statistic
144
+ */
145
+ SearchUserStatisticsApi.prototype.getUserStatistic = function (requestParameters) {
146
+ return __awaiter(this, void 0, void 0, function () {
147
+ var response;
148
+ return __generator(this, function (_a) {
149
+ switch (_a.label) {
150
+ case 0: return [4 /*yield*/, this.getUserStatisticRaw(requestParameters)];
151
+ case 1:
152
+ response = _a.sent();
153
+ return [4 /*yield*/, response.value()];
154
+ case 2: return [2 /*return*/, _a.sent()];
155
+ }
156
+ });
157
+ });
158
+ };
78
159
  /**
79
160
  * Search users statistics
80
161
  */
81
162
  SearchUserStatisticsApi.prototype.getUserStatisticsRaw = function (requestParameters) {
82
163
  return __awaiter(this, void 0, void 0, function () {
83
- var queryParameters, headerParameters, token, tokenString, _a, response, contentType, response_1;
164
+ var queryParameters, headerParameters, token, tokenString, _a, response, contentType, response_2;
84
165
  return __generator(this, function (_b) {
85
166
  switch (_b.label) {
86
167
  case 0:
@@ -137,9 +218,9 @@ var SearchUserStatisticsApi = /** @class */ (function (_super) {
137
218
  }
138
219
  return [3 /*break*/, 7];
139
220
  case 6:
140
- response_1 = _b.sent();
141
- console.debug(response_1);
142
- throw response_1;
221
+ response_2 = _b.sent();
222
+ console.debug(response_2);
223
+ throw response_2;
143
224
  case 7: return [2 /*return*/];
144
225
  }
145
226
  });
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import { UserLink } from './UserLink';
13
13
  /**
14
- *
14
+ * All these statistics are computed based on a sampling taking the last [Variable] \'user.statistics.sampling_days\' days
15
15
  * @export
16
16
  * @interface UserStatistic
17
17
  */
@@ -35,25 +35,25 @@ export interface UserStatistic {
35
35
  */
36
36
  numberOfSales?: number;
37
37
  /**
38
- * Rate of sales that were modified by the seller
38
+ * Rate of sales that have at least one removed or refunded item
39
39
  * @type {number}
40
40
  * @memberof UserStatistic
41
41
  */
42
42
  salesErrorRate?: number;
43
43
  /**
44
- * Rate of sales that were canceled by the seller or by the buyer after order modifications
44
+ * Rate of sales that have been canceled, ignoring cancellation issued by the buyer without any reason
45
45
  * @type {number}
46
46
  * @memberof UserStatistic
47
47
  */
48
48
  salesCanceledRate?: number;
49
49
  /**
50
- * Rate of sales in litigation
50
+ * Rate of sales that are associated to a litigation
51
51
  * @type {number}
52
52
  * @memberof UserStatistic
53
53
  */
54
54
  salesLitigationRate?: number;
55
55
  /**
56
- * Average delay of responsiveness for sales (delay between order creation by buyer and accepted by seller)
56
+ * Average delay of responsiveness for sales (delay between order created by buyer and accepted/modified/canceled by seller)
57
57
  * @type {number}
58
58
  * @memberof UserStatistic
59
59
  */