@cinerino/sdk 16.3.0 → 16.4.0-alpha.0

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.
@@ -1,8 +1,7 @@
1
1
  import { factory } from '../factory';
2
2
  import { Service } from '../service';
3
- export interface IProjection {
4
- $projection?: Record<string, 1>;
5
- }
3
+ export type IFindParams = Pick<factory.customer.ISearchConditions, 'additionalProperty' | 'branchCode' | 'id' | 'limit' | 'name' | 'page' | 'sort'>;
4
+ export type ICustomerAsFindResult = Pick<factory.customer.ICustomer, 'additionalProperty' | 'branchCode' | 'id' | 'name' | 'typeOf' | 'url'>;
6
5
  /**
7
6
  * 顧客サービス
8
7
  */
@@ -10,5 +9,5 @@ export declare class CustomerService extends Service {
10
9
  /**
11
10
  * 顧客検索
12
11
  */
13
- search(params: Omit<factory.customer.ISearchConditions, 'project'> & IProjection): Promise<factory.customer.ICustomer[]>;
12
+ findCustomers(params: IFindParams): Promise<ICustomerAsFindResult[]>;
14
13
  }
@@ -10,7 +10,7 @@ class CustomerService extends service_1.Service {
10
10
  /**
11
11
  * 顧客検索
12
12
  */
13
- async search(params) {
13
+ async findCustomers(params) {
14
14
  return this.fetch({
15
15
  uri: '/customers',
16
16
  method: 'GET',
@@ -1,8 +1,6 @@
1
1
  import { factory } from '../factory';
2
2
  import { IUnset, Service } from '../service';
3
- export interface IProjection {
4
- $projection?: Record<string, 1>;
5
- }
3
+ type IAddParams = Pick<factory.customer.ICustomer, 'additionalProperty' | 'branchCode' | 'name' | 'url'>;
6
4
  /**
7
5
  * 顧客サービス
8
6
  */
@@ -10,20 +8,21 @@ export declare class CustomerService extends Service {
10
8
  /**
11
9
  * 顧客作成
12
10
  */
13
- create(params: factory.customer.ICustomer): Promise<{
11
+ addCustomer(params: IAddParams): Promise<{
14
12
  id: string;
15
13
  }>;
16
14
  /**
17
15
  * 顧客編集
18
16
  */
19
- update(params: {
17
+ updateCustomerById(params: {
20
18
  id: string;
21
- attributes: factory.customer.ICustomer & IUnset;
19
+ attributes: IAddParams & IUnset;
22
20
  }): Promise<void>;
23
21
  /**
24
22
  * 顧客削除
25
23
  */
26
- deleteById(params: {
24
+ deleteCustomerById(params: {
27
25
  id: string;
28
26
  }): Promise<void>;
29
27
  }
28
+ export {};
@@ -10,7 +10,7 @@ class CustomerService extends service_1.Service {
10
10
  /**
11
11
  * 顧客作成
12
12
  */
13
- async create(params) {
13
+ async addCustomer(params) {
14
14
  return this.fetch({
15
15
  uri: '/customers',
16
16
  method: 'POST',
@@ -22,7 +22,7 @@ class CustomerService extends service_1.Service {
22
22
  /**
23
23
  * 顧客編集
24
24
  */
25
- async update(params) {
25
+ async updateCustomerById(params) {
26
26
  await this.fetch({
27
27
  uri: `/customers/${params.id}`,
28
28
  method: 'PUT',
@@ -33,7 +33,7 @@ class CustomerService extends service_1.Service {
33
33
  /**
34
34
  * 顧客削除
35
35
  */
36
- async deleteById(params) {
36
+ async deleteCustomerById(params) {
37
37
  await this.fetch({
38
38
  uri: `/customers/${params.id}`,
39
39
  method: 'DELETE',
@@ -1,5 +1,5 @@
1
- import { factory } from '../../factory';
2
1
  import { Service } from '../../service';
2
+ import type { IFindParams, ICustomerAsFindResult } from '../../chevreAdmin/customer';
3
3
  /**
4
4
  * 顧客サービス
5
5
  */
@@ -7,5 +7,5 @@ export declare class CustomerService extends Service {
7
7
  /**
8
8
  * 顧客検索
9
9
  */
10
- search(params: Omit<factory.customer.ISearchConditions, 'project'>): Promise<factory.customer.ICustomer[]>;
10
+ search(params: IFindParams): Promise<ICustomerAsFindResult[]>;
11
11
  }
@@ -7,41 +7,17 @@ const service_1 = require("../../service");
7
7
  * 顧客サービス
8
8
  */
9
9
  class CustomerService extends service_1.Service {
10
- // public async findById(params: {
11
- // id: string;
12
- // }): Promise<factory.customer.ICustomer> {
13
- // // return this.fetch({
14
- // // uri: `/customers/${params.id}`,
15
- // // method: 'GET',
16
- // // expectedStatusCodes: [status.OK]
17
- // // })
18
- // // .then(async (response) => response.json());
19
- // const { auth, endpoint, project, seller } = this.options;
20
- // const chevreAdmin = await loadChevreAdmin({ auth, endpoint });
21
- // const customerService = await chevreAdmin.createCustomerInstance({
22
- // project,
23
- // seller: { id: (typeof seller?.id === 'string') ? seller.id : '' }
24
- // });
25
- // return customerService.findById({ id: params.id });
26
- // }
27
10
  /**
28
11
  * 顧客検索
29
12
  */
30
13
  async search(params) {
31
- // return this.fetch({
32
- // uri: '/customers',
33
- // method: 'GET',
34
- // qs: params,
35
- // expectedStatusCodes: [status.OK]
36
- // })
37
- // .then(async (response) => response.json());
38
14
  const { auth, endpoint, project, seller } = this.options;
39
15
  const chevreAdmin = await (0, index_1.loadChevreAdmin)({ auth, endpoint });
40
16
  const customerService = await chevreAdmin.createCustomerInstance({
41
17
  project,
42
18
  seller: { id: (typeof seller?.id === 'string') ? seller.id : '' }
43
19
  });
44
- return customerService.search(params);
20
+ return customerService.findCustomers(params);
45
21
  }
46
22
  }
47
23
  exports.CustomerService = CustomerService;