@cinerino/sdk 11.2.0-alpha.3 → 11.2.0-alpha.4

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.
@@ -15,9 +15,9 @@ async function main() {
15
15
  });
16
16
 
17
17
  const result = await productService.search({
18
- limit: 10,
18
+ limit: 2,
19
19
  page: 1,
20
- typeOf: { $eq: factory.product.ProductType.EventService }
20
+ typeOf: factory.product.ProductType.EventService
21
21
  });
22
22
  console.log(result);
23
23
  console.log(result.length, 'data found');
@@ -0,0 +1,32 @@
1
+ // tslint:disable:no-implicit-dependencies no-console
2
+ import * as client from '../../lib/index';
3
+ import { auth } from './auth/clientCredentials';
4
+
5
+ const PROJECT_ID = String(process.env.PROJECT_ID);
6
+
7
+ async function main() {
8
+ const creativeWorkService = new (await client.loadService()).CreativeWork({
9
+ endpoint: <string>process.env.API_ENDPOINT,
10
+ auth: await auth(),
11
+ project: { id: PROJECT_ID },
12
+ seller: { id: '' }
13
+ });
14
+
15
+ const { data } = await creativeWorkService.searchMovies({
16
+ limit: 3,
17
+ page: 1,
18
+ sort: {
19
+ identifier: client.factory.sortType.Descending
20
+ },
21
+ identifier: { $in: ['00001', '00002'] }
22
+ });
23
+ // tslint:disable-next-line:no-null-keyword
24
+ console.dir(data, { depth: null });
25
+ console.log(data.length, 'movies');
26
+ }
27
+
28
+ main()
29
+ .then(() => {
30
+ console.log('success!');
31
+ })
32
+ .catch(console.error);
@@ -3,9 +3,6 @@ import { Service } from '../service';
3
3
  export declare type IProductWithoutCredentials = Pick<factory.product.IProduct, 'description' | 'name' | 'productID' | 'serviceType' | 'typeOf'> & {
4
4
  id: string;
5
5
  };
6
- export declare type IPaymentServiceWithoutCredentials = Omit<factory.service.paymentService.IService, 'availableChannel' | 'project'> & {
7
- id: string;
8
- };
9
6
  declare type IPriceComponent = Pick<factory.place.seat.IPriceComponent, 'name' | 'price'>;
10
7
  interface IPriceSpecification {
11
8
  /**
@@ -46,7 +43,7 @@ export interface ISearchProductModelConditions {
46
43
  /**
47
44
  * プロダクト検索条件
48
45
  */
49
- export interface ISearchConditions {
46
+ export interface IFindParams {
50
47
  typeOf: factory.product.ProductType;
51
48
  /**
52
49
  * max: 100
@@ -61,7 +58,7 @@ export declare class ProductService extends Service {
61
58
  /**
62
59
  * プロダクトタイプ指定でプロダクトを検索する
63
60
  */
64
- findProducts(params: ISearchConditions): Promise<IProductWithoutCredentials[]>;
61
+ findProducts(params: IFindParams): Promise<IProductWithoutCredentials[]>;
65
62
  /**
66
63
  * オファー検索
67
64
  */
@@ -8,7 +8,6 @@ import { EmailMessageService } from './service/emailMessage';
8
8
  import { EventService } from './service/event';
9
9
  import { PlaceService } from './service/place';
10
10
  import { HasPOSService } from './service/place/hasPOS';
11
- import { ProductService } from './service/product';
12
11
  import { SellerService } from './service/seller';
13
12
  /**
14
13
  * パブリックリソースサービス群
@@ -54,11 +53,6 @@ export declare namespace service {
54
53
  class HasPOS extends HasPOSService {
55
54
  }
56
55
  }
57
- /**
58
- * プロダクトサービス
59
- */
60
- class Product extends ProductService {
61
- }
62
56
  /**
63
57
  * 販売者サービス
64
58
  */
@@ -28,7 +28,6 @@ var emailMessage_1 = require("./service/emailMessage");
28
28
  var event_1 = require("./service/event");
29
29
  var place_1 = require("./service/place");
30
30
  var hasPOS_1 = require("./service/place/hasPOS");
31
- var product_1 = require("./service/product");
32
31
  var seller_1 = require("./service/seller");
33
32
  /**
34
33
  * パブリックリソースサービス群
@@ -115,17 +114,6 @@ var service;
115
114
  }(hasPOS_1.HasPOSService));
116
115
  place.HasPOS = HasPOS;
117
116
  })(place = service.place || (service.place = {}));
118
- /**
119
- * プロダクトサービス
120
- */
121
- var Product = /** @class */ (function (_super) {
122
- __extends(Product, _super);
123
- function Product() {
124
- return _super !== null && _super.apply(this, arguments) || this;
125
- }
126
- return Product;
127
- }(product_1.ProductService));
128
- service.Product = Product;
129
117
  /**
130
118
  * 販売者サービス
131
119
  */
@@ -8,5 +8,5 @@ export declare class CreativeWorkService extends Service {
8
8
  /**
9
9
  * コンテンツ検索
10
10
  */
11
- searchMovies(params: Omit<factory.creativeWork.movie.ISearchConditions, 'project'>): Promise<ISearchResult<Omit<factory.creativeWork.movie.ICreativeWork, 'offers' | 'project'>[]>>;
11
+ searchMovies(params: Pick<factory.creativeWork.movie.ISearchConditions, 'identifier' | 'limit' | 'page' | 'sort'>): Promise<ISearchResult<Omit<factory.creativeWork.movie.ICreativeWork, 'offers' | 'project'>[]>>;
12
12
  }
@@ -1,22 +1,14 @@
1
- import { IPaymentServiceWithoutCredentials, IProductModel, IProductWithoutCredentials, ISearchProductModelConditions } from '../../chevre/product';
1
+ import { IFindParams, IProductModel, IProductWithoutCredentials, ISearchProductModelConditions } from '../../chevre/product';
2
2
  import * as factory from '../../factory';
3
3
  import { Service } from '../../service';
4
- declare type ISearchProductsResult = IProductWithoutCredentials | IPaymentServiceWithoutCredentials;
5
4
  /**
6
5
  * プロダクトサービス
7
6
  */
8
7
  export declare class ProductService extends Service {
9
8
  /**
10
- * プロダクトタイプ指定で検索する
9
+ * プロダクトタイプ指定でプロダクトを検索する
11
10
  */
12
- search(params: Omit<factory.product.ISearchConditions, 'project' | 'typeOf'> & {
13
- typeOf: {
14
- /**
15
- * プロダクトタイプ
16
- */
17
- $eq: factory.product.ProductType.EventService | factory.product.ProductType.Product | factory.product.ProductType.MembershipService | factory.product.ProductType.PaymentCard;
18
- };
19
- }): Promise<ISearchProductsResult[]>;
11
+ search(params: IFindParams): Promise<IProductWithoutCredentials[]>;
20
12
  /**
21
13
  * プロダクトオファー検索
22
14
  */
@@ -35,4 +27,3 @@ export declare class ProductService extends Service {
35
27
  */
36
28
  searchProductModels(params: ISearchProductModelConditions): Promise<IProductModel[]>;
37
29
  }
38
- export {};
@@ -66,16 +66,18 @@ var ProductService = /** @class */ (function (_super) {
66
66
  // super({ ...options, retryableStatusCodes: [BAD_GATEWAY, FORBIDDEN, UNAUTHORIZED] });
67
67
  // }
68
68
  /**
69
- * プロダクトタイプ指定で検索する
69
+ * プロダクトタイプ指定でプロダクトを検索する
70
70
  */
71
71
  ProductService.prototype.search = function (params) {
72
72
  return __awaiter(this, void 0, void 0, function () {
73
+ var typeOf, limit, page;
73
74
  var _this = this;
74
75
  return __generator(this, function (_a) {
76
+ typeOf = params.typeOf, limit = params.limit, page = params.page;
75
77
  return [2 /*return*/, this.fetch({
76
78
  uri: '/products',
77
79
  method: 'GET',
78
- qs: params,
80
+ qs: { typeOf: typeOf, limit: limit, page: page },
79
81
  expectedStatusCodes: [http_status_1.OK]
80
82
  })
81
83
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {