@bzbs/react-api-client 0.1.13 → 0.2.1

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/dist/index.mjs CHANGED
@@ -74,6 +74,35 @@ var BaseService = class {
74
74
  data
75
75
  };
76
76
  const response = yield this.client.request(__spreadValues({ method, url }, config));
77
+ if (response.status === 204) {
78
+ return { model: "", response, type: "success" };
79
+ }
80
+ if ("Success" in response.data) {
81
+ const data2 = response.data;
82
+ if (data2.Success) {
83
+ if ("Data" in response.data) {
84
+ return { model: data2.Data, response, type: "success" };
85
+ } else {
86
+ return { model: "", response, type: "success" };
87
+ }
88
+ } else {
89
+ const error = {
90
+ type: "server-error",
91
+ error: {
92
+ requestId: response.data.RequestId || "",
93
+ error: {
94
+ id: response.data.Code || 500,
95
+ message: response.data.Message || "An unexpected error occurred.",
96
+ code: response.data.Code || 500,
97
+ type: "buzzebees"
98
+ }
99
+ },
100
+ statusCode: response.data.Code || 500,
101
+ response
102
+ };
103
+ return this.normalizeError(error);
104
+ }
105
+ }
77
106
  return { model: response.data, response, type: "success" };
78
107
  } catch (error) {
79
108
  return this.normalizeError(error);
@@ -2189,13 +2218,35 @@ var RequestHelpApi = class extends BaseService {
2189
2218
  }
2190
2219
  };
2191
2220
 
2221
+ // src/api/blob/blob.ts
2222
+ var Blob = class extends BaseService {
2223
+ constructor(client, baseUrl) {
2224
+ super(client, baseUrl);
2225
+ }
2226
+ consentVersion(appId) {
2227
+ return __async(this, null, function* () {
2228
+ return this.get(`pdpaconsent/${appId}/version`);
2229
+ });
2230
+ }
2231
+ maintenance(appId) {
2232
+ return __async(this, null, function* () {
2233
+ return this.get(`config/maintenance/${appId}.json`);
2234
+ });
2235
+ }
2236
+ blob(path, requestOptions) {
2237
+ return __async(this, null, function* () {
2238
+ return this.get(path, requestOptions);
2239
+ });
2240
+ }
2241
+ };
2242
+
2192
2243
  // src/api/bzbs-service.ts
2193
2244
  var BzbsService = class {
2194
- constructor(client, baseUrl, baseLineUrl) {
2195
- var _a;
2245
+ constructor(client, baseUrl, baseLineUrl, baseBlobUrl) {
2196
2246
  this.client = client;
2197
2247
  this.baseUrl = baseUrl;
2198
2248
  this.baseLineUrl = baseLineUrl;
2249
+ this.baseBlobUrl = baseBlobUrl;
2199
2250
  this.authApi = new AuthenticateApi(this.client, this.baseUrl);
2200
2251
  this.badgeApi = new BadgeApi(this.client, this.baseUrl);
2201
2252
  this.campaignApi = new CampaignApi(this.client, this.baseUrl);
@@ -2205,7 +2256,7 @@ var BzbsService = class {
2205
2256
  this.couponApi = new CouponApi(this.client, this.baseUrl);
2206
2257
  this.dashboardApi = new DashboardApi(this.client, this.baseUrl);
2207
2258
  this.historyApi = new HistoryApi(this.client, this.baseUrl);
2208
- this.lineApi = new LineApi(this.client, (_a = this.baseLineUrl) != null ? _a : "");
2259
+ this.lineApi = new LineApi(this.client, this.baseLineUrl);
2209
2260
  this.notificationApi = new NotificationApi(this.client, this.baseUrl);
2210
2261
  this.placeApi = new PlaceApi(this.client, this.baseUrl);
2211
2262
  this.pointLogApi = new PointLogApi(this.client, this.baseUrl);
@@ -2214,6 +2265,7 @@ var BzbsService = class {
2214
2265
  this.addressApi = new AddressApi(this.client, this.baseUrl);
2215
2266
  this.stampApi = new StampApi(this.client, this.baseUrl);
2216
2267
  this.forumApi = new RequestHelpApi(this.client, this.baseUrl);
2268
+ this.blob = new Blob(this.client, this.baseBlobUrl);
2217
2269
  }
2218
2270
  };
2219
2271
  export {
@@ -2221,6 +2273,7 @@ export {
2221
2273
  AuthenticateApi,
2222
2274
  BadgeApi,
2223
2275
  BaseService,
2276
+ Blob,
2224
2277
  BzbsService,
2225
2278
  CampaignApi,
2226
2279
  CartApi,