@cinerino/sdk 11.0.0-alpha.1 → 11.0.0-alpha.3

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.
@@ -0,0 +1,32 @@
1
+ // tslint:disable:no-implicit-dependencies no-console no-magic-numbers
2
+ import { loadCloudAdmin } from '../../../lib/';
3
+ import * as auth from '../auth/authAsAdmin';
4
+
5
+ const project = { id: String(process.env.PROJECT_ID) };
6
+
7
+ async function main() {
8
+ const authClient = await auth.login();
9
+ await authClient.refreshAccessToken();
10
+ const loginTicket = authClient.verifyIdToken({});
11
+ console.log('username is', loginTicket.getUsername());
12
+
13
+ const sellerService = await (await loadCloudAdmin({
14
+ endpoint: <string>process.env.API_ADMIN_ENDPOINT,
15
+ auth: authClient
16
+ })).createSellerInstance({
17
+ project
18
+ });
19
+
20
+ const sellers = await sellerService.search({
21
+ limit: 3,
22
+ page: 1
23
+ });
24
+ console.log(sellers);
25
+ console.log(sellers.length, 'sellers found');
26
+ }
27
+
28
+ main()
29
+ .then(() => {
30
+ console.log('main processed.');
31
+ })
32
+ .catch(console.error);
@@ -0,0 +1,63 @@
1
+
2
+ // tslint:disable:no-console
3
+ async function getToken() {
4
+ try {
5
+ const response = await fetch(
6
+ `https://${process.env.ST_AUTHORIZE_SERVER_DOMAIN}/oauth2/token`,
7
+ {
8
+ method: 'POST',
9
+ headers: {
10
+ 'Content-Type': 'application/x-www-form-urlencoded'
11
+ },
12
+ body: new URLSearchParams({
13
+ grant_type: 'client_credentials',
14
+ client_id: String(process.env.ST_CLIENT_ID),
15
+ client_secret: String(process.env.ST_CLIENT_SECRET)
16
+ }).toString()
17
+ });
18
+
19
+ if (!response.ok) {
20
+ console.log(await response.json());
21
+ throw new Error('Network response was not ok');
22
+ }
23
+
24
+ const data = await response.json();
25
+ console.log(data);
26
+
27
+ return data;
28
+ } catch (error) {
29
+ console.error('Error fetching token:', error);
30
+ }
31
+ }
32
+ async function fetchData(params: {
33
+ access_token: string;
34
+ // scope: string;
35
+ // expires_in: number;
36
+ // token_type: 'Bearer';
37
+ }) {
38
+ try {
39
+ const { access_token } = params;
40
+ const response = await fetch(
41
+ `${process.env.ST_API_ENDPOINT}/events/ScreeningEvent?limit=1`,
42
+ {
43
+ method: 'GET',
44
+ headers: {
45
+ authorization: `Bearer ${access_token}`
46
+ }
47
+ });
48
+ if (!response.ok) {
49
+ throw new Error(await response.text());
50
+ }
51
+ const data = await response.json();
52
+ console.log(data);
53
+ } catch (error) {
54
+ console.error('Error fetching data:', error);
55
+ }
56
+ }
57
+ async function main() {
58
+ const token = await getToken();
59
+ await fetchData(token);
60
+ }
61
+
62
+ main()
63
+ .catch(console.error);
@@ -14,7 +14,7 @@ async function main() {
14
14
  state: 'teststate'
15
15
  });
16
16
  auth.setCredentials({
17
- access_token: 'xxx'
17
+ access_token: process.env.SAMPLE_ACCESS_TOKEN
18
18
  });
19
19
 
20
20
  const sellerService = new (await client.loadService()).Seller({
@@ -0,0 +1,20 @@
1
+ import * as factory from '../factory';
2
+ import { IOptions, Service } from '../service';
3
+ declare type IKeyOfProjection = keyof Omit<factory.seller.ISeller, 'makesOffer' | 'paymentAccepted'>;
4
+ declare type IProjection = {
5
+ [key in IKeyOfProjection]?: 0;
6
+ };
7
+ /**
8
+ * 販売者サービス
9
+ */
10
+ export declare class SellerService extends Service<IOptions> {
11
+ /**
12
+ * 販売者検索
13
+ */
14
+ search(params: Omit<factory.seller.ISearchConditions, 'project' | 'id'> & {
15
+ limit: number;
16
+ page: number;
17
+ $projection: IProjection;
18
+ }): Promise<Pick<factory.seller.ISeller, 'additionalProperty' | 'branchCode' | 'id' | 'name' | 'project' | 'telephone' | 'typeOf' | 'url'>[]>;
19
+ }
20
+ export {};
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.SellerService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * 販売者サービス
59
+ */
60
+ var SellerService = /** @class */ (function (_super) {
61
+ __extends(SellerService, _super);
62
+ function SellerService() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ /**
66
+ * 販売者検索
67
+ */
68
+ SellerService.prototype.search = function (params) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var _this = this;
71
+ return __generator(this, function (_a) {
72
+ return [2 /*return*/, this.fetch({
73
+ uri: '/sellers',
74
+ method: 'GET',
75
+ qs: params,
76
+ expectedStatusCodes: [http_status_1.OK]
77
+ })
78
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
79
+ return [2 /*return*/, response.json()];
80
+ }); }); })];
81
+ });
82
+ });
83
+ };
84
+ return SellerService;
85
+ }(service_1.Service));
86
+ exports.SellerService = SellerService;
@@ -14,6 +14,7 @@ import type { OfferCatalogItemService } from './chevreAdmin/offerCatalogItem';
14
14
  import type { OrderService } from './chevreAdmin/order';
15
15
  import type { ProductService } from './chevreAdmin/product';
16
16
  import type { ReservationService } from './chevreAdmin/reservation';
17
+ import type { SellerService } from './chevreAdmin/seller';
17
18
  export declare namespace service {
18
19
  type IUnset = IUnsetOnService;
19
20
  /**
@@ -93,6 +94,13 @@ export declare namespace service {
93
94
  namespace Reservation {
94
95
  let svc: typeof ReservationService | undefined;
95
96
  }
97
+ /**
98
+ * 販売者サービス
99
+ */
100
+ type Seller = SellerService;
101
+ namespace Seller {
102
+ let svc: typeof SellerService | undefined;
103
+ }
96
104
  /**
97
105
  * オファーサービス
98
106
  */
@@ -141,6 +149,7 @@ export declare class ChevreAdmin {
141
149
  createOrderInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OrderService>;
142
150
  createProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductService>;
143
151
  createReservationInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ReservationService>;
152
+ createSellerInstance(params: Pick<IOptions, 'project'>): Promise<SellerService>;
144
153
  createOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferService>;
145
154
  createOfferCatalogInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferCatalogService>;
146
155
  createOfferCatalogItemInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferCatalogItemService>;
@@ -83,6 +83,9 @@ var service;
83
83
  var Reservation;
84
84
  (function (Reservation) {
85
85
  })(Reservation = service.Reservation || (service.Reservation = {}));
86
+ var Seller;
87
+ (function (Seller) {
88
+ })(Seller = service.Seller || (service.Seller = {}));
86
89
  var Offer;
87
90
  (function (Offer) {
88
91
  })(Offer = service.Offer || (service.Offer = {}));
@@ -293,6 +296,23 @@ var ChevreAdmin = /** @class */ (function () {
293
296
  });
294
297
  });
295
298
  };
299
+ ChevreAdmin.prototype.createSellerInstance = function (params) {
300
+ return __awaiter(this, void 0, void 0, function () {
301
+ var _a;
302
+ return __generator(this, function (_b) {
303
+ switch (_b.label) {
304
+ case 0:
305
+ if (!(service.Seller.svc === undefined)) return [3 /*break*/, 2];
306
+ _a = service.Seller;
307
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevreAdmin/seller'); })];
308
+ case 1:
309
+ _a.svc = (_b.sent()).SellerService;
310
+ _b.label = 2;
311
+ case 2: return [2 /*return*/, new service.Seller.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
312
+ }
313
+ });
314
+ });
315
+ };
296
316
  ChevreAdmin.prototype.createOfferInstance = function (params) {
297
317
  return __awaiter(this, void 0, void 0, function () {
298
318
  var _a;
@@ -0,0 +1,16 @@
1
+ import { IOptions, Service } from '../service';
2
+ /**
3
+ * チケットサービス
4
+ */
5
+ export declare class TicketService extends Service<IOptions> {
6
+ constructor(options: Pick<IOptions, 'endpoint' | 'transporter'>);
7
+ publish(params: {
8
+ audience: {
9
+ id: string;
10
+ };
11
+ expiresInSeconds: number;
12
+ }): Promise<{
13
+ token: string;
14
+ expiresIn: number;
15
+ }>;
16
+ }
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.TicketService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * チケットサービス
59
+ */
60
+ var TicketService = /** @class */ (function (_super) {
61
+ __extends(TicketService, _super);
62
+ function TicketService(options) {
63
+ var _this = this;
64
+ var endpoint = options.endpoint, transporter = options.transporter;
65
+ _this = _super.call(this, { endpoint: endpoint, transporter: transporter, project: { id: '' }, retryableStatusCodes: [] }) || this;
66
+ return _this;
67
+ }
68
+ TicketService.prototype.publish = function (params) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var _this = this;
71
+ return __generator(this, function (_a) {
72
+ return [2 /*return*/, this.fetch({
73
+ uri: '/tickets',
74
+ method: 'POST',
75
+ body: params,
76
+ expectedStatusCodes: [http_status_1.CREATED]
77
+ })
78
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
79
+ return [2 /*return*/, response.json()];
80
+ }); }); })];
81
+ });
82
+ });
83
+ };
84
+ return TicketService;
85
+ }(service_1.Service));
86
+ exports.TicketService = TicketService;
@@ -1,5 +1,6 @@
1
1
  import { IOptions, IUnset as IUnsetOnService } from './service';
2
2
  import type { IdentityService } from './chevreAuth/identity';
3
+ import type { TicketService } from './chevreAuth/ticket';
3
4
  import type { TokenService } from './chevreAuth/token';
4
5
  export declare namespace service {
5
6
  type IUnset = IUnsetOnService;
@@ -17,6 +18,13 @@ export declare namespace service {
17
18
  namespace Identity {
18
19
  let svc: typeof IdentityService | undefined;
19
20
  }
21
+ /**
22
+ * チケットサービス
23
+ */
24
+ type Ticket = TicketService;
25
+ namespace Ticket {
26
+ let svc: typeof TicketService | undefined;
27
+ }
20
28
  }
21
29
  /**
22
30
  * 認可サービス
@@ -26,4 +34,5 @@ export declare class ChevreAuth {
26
34
  constructor(options: Pick<IOptions, 'endpoint'>);
27
35
  createTokenInstance(): Promise<TokenService>;
28
36
  createIdentityInstance(): Promise<IdentityService>;
37
+ createTicketInstance(): Promise<TicketService>;
29
38
  }
@@ -56,6 +56,9 @@ var service;
56
56
  var Identity;
57
57
  (function (Identity) {
58
58
  })(Identity = service.Identity || (service.Identity = {}));
59
+ var Ticket;
60
+ (function (Ticket) {
61
+ })(Ticket = service.Ticket || (service.Ticket = {}));
59
62
  })(service = exports.service || (exports.service = {}));
60
63
  /**
61
64
  * 認可サービス
@@ -98,6 +101,23 @@ var ChevreAuth = /** @class */ (function () {
98
101
  });
99
102
  });
100
103
  };
104
+ ChevreAuth.prototype.createTicketInstance = function () {
105
+ return __awaiter(this, void 0, void 0, function () {
106
+ var _a;
107
+ return __generator(this, function (_b) {
108
+ switch (_b.label) {
109
+ case 0:
110
+ if (!(service.Ticket.svc === undefined)) return [3 /*break*/, 2];
111
+ _a = service.Ticket;
112
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevreAuth/ticket'); })];
113
+ case 1:
114
+ _a.svc = (_b.sent()).TicketService;
115
+ _b.label = 2;
116
+ case 2: return [2 /*return*/, new service.Ticket.svc(__assign({}, this.options))];
117
+ }
118
+ });
119
+ });
120
+ };
101
121
  return ChevreAuth;
102
122
  }());
103
123
  exports.ChevreAuth = ChevreAuth;
@@ -18,5 +18,13 @@ export declare class MemberService extends Service {
18
18
  id: string;
19
19
  };
20
20
  }): Promise<void>;
21
+ createSoftwareApplication(params: IBody): Promise<void>;
22
+ searchSoftwareApplications(params: factory.iam.ISearchConditions): Promise<factory.iam.IMember[]>;
23
+ updateSoftwareApplication(params: IBody): Promise<void>;
24
+ deleteSoftwareApplication(params: {
25
+ member: {
26
+ id: string;
27
+ };
28
+ }): Promise<void>;
21
29
  }
22
30
  export {};
@@ -129,6 +129,72 @@ var MemberService = /** @class */ (function (_super) {
129
129
  });
130
130
  });
131
131
  };
132
+ MemberService.prototype.createSoftwareApplication = function (params) {
133
+ return __awaiter(this, void 0, void 0, function () {
134
+ return __generator(this, function (_a) {
135
+ switch (_a.label) {
136
+ case 0: return [4 /*yield*/, this.fetch({
137
+ uri: "/members/" + factory.creativeWorkType.SoftwareApplication,
138
+ method: 'POST',
139
+ body: params,
140
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
141
+ })];
142
+ case 1:
143
+ _a.sent();
144
+ return [2 /*return*/];
145
+ }
146
+ });
147
+ });
148
+ };
149
+ MemberService.prototype.searchSoftwareApplications = function (params) {
150
+ return __awaiter(this, void 0, void 0, function () {
151
+ var _this = this;
152
+ return __generator(this, function (_a) {
153
+ return [2 /*return*/, this.fetch({
154
+ uri: "/members/" + factory.creativeWorkType.SoftwareApplication,
155
+ method: 'GET',
156
+ qs: params,
157
+ expectedStatusCodes: [http_status_1.OK]
158
+ })
159
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
160
+ return [2 /*return*/, response.json()];
161
+ }); }); })];
162
+ });
163
+ });
164
+ };
165
+ MemberService.prototype.updateSoftwareApplication = function (params) {
166
+ return __awaiter(this, void 0, void 0, function () {
167
+ return __generator(this, function (_a) {
168
+ switch (_a.label) {
169
+ case 0: return [4 /*yield*/, this.fetch({
170
+ uri: "/members/" + factory.creativeWorkType.SoftwareApplication + "/" + params.member.id,
171
+ method: 'PUT',
172
+ body: params,
173
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
174
+ })];
175
+ case 1:
176
+ _a.sent();
177
+ return [2 /*return*/];
178
+ }
179
+ });
180
+ });
181
+ };
182
+ MemberService.prototype.deleteSoftwareApplication = function (params) {
183
+ return __awaiter(this, void 0, void 0, function () {
184
+ return __generator(this, function (_a) {
185
+ switch (_a.label) {
186
+ case 0: return [4 /*yield*/, this.fetch({
187
+ uri: "/members/" + factory.creativeWorkType.SoftwareApplication + "/" + params.member.id,
188
+ method: 'DELETE',
189
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
190
+ })];
191
+ case 1:
192
+ _a.sent();
193
+ return [2 /*return*/];
194
+ }
195
+ });
196
+ });
197
+ };
132
198
  return MemberService;
133
199
  }(service_1.Service));
134
200
  exports.MemberService = MemberService;
@@ -0,0 +1,11 @@
1
+ import * as factory from '../../factory';
2
+ import { IOptions, Service } from '../../service';
3
+ /**
4
+ * 販売者サービス
5
+ */
6
+ export declare class SellerService extends Service<IOptions> {
7
+ search(params: Omit<factory.seller.ISearchConditions, 'project' | 'id'> & {
8
+ limit: number;
9
+ page: number;
10
+ }): Promise<Pick<factory.seller.ISeller, 'additionalProperty' | 'branchCode' | 'id' | 'name' | 'telephone' | 'typeOf' | 'url'>[]>;
11
+ }
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __generator = (this && this.__generator) || function (thisArg, body) {
38
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
+ function verb(n) { return function (v) { return step([n, v]); }; }
41
+ function step(op) {
42
+ if (f) throw new TypeError("Generator is already executing.");
43
+ while (_) try {
44
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
45
+ if (y = 0, t) op = [op[0] & 2, t.value];
46
+ switch (op[0]) {
47
+ case 0: case 1: t = op; break;
48
+ case 4: _.label++; return { value: op[1], done: false };
49
+ case 5: _.label++; y = op[1]; op = [0]; continue;
50
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
+ default:
52
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
+ if (t[2]) _.ops.pop();
57
+ _.trys.pop(); continue;
58
+ }
59
+ op = body.call(thisArg, _);
60
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
+ }
63
+ };
64
+ Object.defineProperty(exports, "__esModule", { value: true });
65
+ exports.SellerService = void 0;
66
+ var index_1 = require("../../index");
67
+ var service_1 = require("../../service");
68
+ /**
69
+ * 販売者サービス
70
+ */
71
+ var SellerService = /** @class */ (function (_super) {
72
+ __extends(SellerService, _super);
73
+ function SellerService() {
74
+ return _super !== null && _super.apply(this, arguments) || this;
75
+ }
76
+ SellerService.prototype.search = function (params) {
77
+ return __awaiter(this, void 0, void 0, function () {
78
+ var _a, auth, endpoint, project, chevreAdmin, sellerService;
79
+ return __generator(this, function (_b) {
80
+ switch (_b.label) {
81
+ case 0:
82
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project;
83
+ return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint })];
84
+ case 1:
85
+ chevreAdmin = _b.sent();
86
+ return [4 /*yield*/, chevreAdmin.createSellerInstance({
87
+ project: project
88
+ })];
89
+ case 2:
90
+ sellerService = _b.sent();
91
+ return [2 /*return*/, sellerService.search(__assign(__assign({}, params), { $projection: {} }))];
92
+ }
93
+ });
94
+ });
95
+ };
96
+ return SellerService;
97
+ }(service_1.Service));
98
+ exports.SellerService = SellerService;