@dataggo/node-akeneo-api 1.2.2 → 1.3.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.
@@ -2,6 +2,7 @@ export * as assetFamily from './asset-family';
2
2
  export * as attribute from './attribute';
3
3
  export * as category from './category';
4
4
  export * as family from './family';
5
+ export * as measurementFamily from './measurement-family';
5
6
  export * as productModel from './product-model';
6
7
  export * as product from './product';
7
8
  export * as referenceEntity from './reference-entity';
@@ -23,11 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.referenceEntity = exports.product = exports.productModel = exports.family = exports.category = exports.attribute = exports.assetFamily = void 0;
26
+ exports.referenceEntity = exports.product = exports.productModel = exports.measurementFamily = exports.family = exports.category = exports.attribute = exports.assetFamily = void 0;
27
27
  exports.assetFamily = __importStar(require("./asset-family"));
28
28
  exports.attribute = __importStar(require("./attribute"));
29
29
  exports.category = __importStar(require("./category"));
30
30
  exports.family = __importStar(require("./family"));
31
+ exports.measurementFamily = __importStar(require("./measurement-family"));
31
32
  exports.productModel = __importStar(require("./product-model"));
32
33
  exports.product = __importStar(require("./product"));
33
34
  exports.referenceEntity = __importStar(require("./reference-entity"));
@@ -0,0 +1,6 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ListResponse, MeasurementFamily } from '../types';
3
+ /**
4
+ * @see https://api.akeneo.com/api-reference.html#measurement_families_get_list
5
+ */
6
+ export declare const getAll: (http: AxiosInstance) => Promise<ListResponse<MeasurementFamily>>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getAll = void 0;
7
+ const raw_1 = __importDefault(require("./raw"));
8
+ /**
9
+ * @see https://api.akeneo.com/api-reference.html#measurement_families_get_list
10
+ */
11
+ // eslint-disable-next-line import/prefer-default-export
12
+ const getAll = (http) => raw_1.default.getAllNoPagination(http, `/api/rest/v1/measurement-families`, {
13
+ params: {},
14
+ });
15
+ exports.getAll = getAll;
@@ -4,6 +4,7 @@ declare const _default: {
4
4
  get: (http: AxiosInstance, url: string, config: AxiosRequestConfig) => Promise<ListResponse<any> & {
5
5
  _links: any;
6
6
  }>;
7
+ getAllNoPagination: (http: AxiosInstance, url: string, config: AxiosRequestConfig) => Promise<ListResponse<any>>;
7
8
  getOne: (http: AxiosInstance, url: string, config?: AxiosRequestConfig) => Promise<any>;
8
9
  getAllByPage: (http: AxiosInstance, url: string, { params }: AxiosRequestConfig) => Promise<ListResponse<any>>;
9
10
  getAllBySearchAfter: (http: AxiosInstance, url: string, config?: AxiosRequestConfig) => Promise<ListResponse<any>>;
@@ -46,6 +46,16 @@ exports.default = {
46
46
  return Object.assign(Object.assign(Object.assign({}, (data.current_page ? { current_page: data.current_page } : {})), (data.items_count ? { items_count: data.items_count } : {})), { items: data._embedded.items, _links: data._links });
47
47
  }, error_handler_1.default);
48
48
  },
49
+ getAllNoPagination: function getAllNoPagination(http, url, config) {
50
+ return http
51
+ .get(url, Object.assign({}, config))
52
+ .then((response) => {
53
+ const { data } = response;
54
+ return {
55
+ items: data,
56
+ };
57
+ }, error_handler_1.default);
58
+ },
49
59
  getOne: function getOne(http, url, config) {
50
60
  return http
51
61
  .get(url, Object.assign({}, config))
@@ -161,6 +161,9 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
161
161
  query?: import("./types").FamilyVariantQueryParameters | undefined;
162
162
  }) => Promise<import("./types").ListResponse<import("./types").Variant>>;
163
163
  };
164
+ measurementFamily: {
165
+ getAll: (params: Record<string, any>) => Promise<import("./types").ListResponse<import("./types").MeasurementFamily>>;
166
+ };
164
167
  };
165
168
  /**
166
169
  * Create a client instance
@@ -333,6 +336,9 @@ export declare const createClient: (params: ClientParams) => {
333
336
  query?: import("./types").FamilyVariantQueryParameters | undefined;
334
337
  }) => Promise<import("./types").ListResponse<import("./types").Variant>>;
335
338
  };
339
+ measurementFamily: {
340
+ getAll: (params: Record<string, any>) => Promise<import("./types").ListResponse<import("./types").MeasurementFamily>>;
341
+ };
336
342
  };
337
343
  /**
338
344
  * Create a client instance
@@ -502,6 +508,9 @@ export declare const createAppClient: (params: AppParams) => {
502
508
  query?: import("./types").FamilyVariantQueryParameters | undefined;
503
509
  }) => Promise<import("./types").ListResponse<import("./types").Variant>>;
504
510
  };
511
+ measurementFamily: {
512
+ getAll: (params: Record<string, any>) => Promise<import("./types").ListResponse<import("./types").MeasurementFamily>>;
513
+ };
505
514
  };
506
515
  export type AkeneoClientAPI = ReturnType<typeof getHttpClientWithEndpoint>;
507
516
  export * from './types';
package/dist/cjs/index.js CHANGED
@@ -131,6 +131,9 @@ const getHttpClientWithEndpoint = (http) => ({
131
131
  get: wrap(http, endpoints.family.get),
132
132
  getVariants: wrap(http, endpoints.family.getVariants),
133
133
  },
134
+ measurementFamily: {
135
+ getAll: wrap(http, endpoints.measurementFamily.getAll),
136
+ }
134
137
  });
135
138
  /**
136
139
  * Create a client instance
@@ -249,4 +249,18 @@ export type Asset = {
249
249
  code: string;
250
250
  values: Record<string, ValuesRecord[]>;
251
251
  };
252
+ export type MeasurementFamily = {
253
+ code: string;
254
+ labels: Record<string, string>;
255
+ standard_unit_code: string;
256
+ units: Record<string, {
257
+ code: string;
258
+ labels: Record<string, string>;
259
+ convert_from_standard?: Record<string, {
260
+ operator: string;
261
+ value: string;
262
+ }>;
263
+ symbol: string;
264
+ }>;
265
+ };
252
266
  export {};
@@ -2,6 +2,7 @@ export * as assetFamily from './asset-family';
2
2
  export * as attribute from './attribute';
3
3
  export * as category from './category';
4
4
  export * as family from './family';
5
+ export * as measurementFamily from './measurement-family';
5
6
  export * as productModel from './product-model';
6
7
  export * as product from './product';
7
8
  export * as referenceEntity from './reference-entity';
@@ -2,6 +2,7 @@ export * as assetFamily from './asset-family';
2
2
  export * as attribute from './attribute';
3
3
  export * as category from './category';
4
4
  export * as family from './family';
5
+ export * as measurementFamily from './measurement-family';
5
6
  export * as productModel from './product-model';
6
7
  export * as product from './product';
7
8
  export * as referenceEntity from './reference-entity';
@@ -0,0 +1,6 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { ListResponse, MeasurementFamily } from '../types';
3
+ /**
4
+ * @see https://api.akeneo.com/api-reference.html#measurement_families_get_list
5
+ */
6
+ export declare const getAll: (http: AxiosInstance) => Promise<ListResponse<MeasurementFamily>>;
@@ -0,0 +1,8 @@
1
+ import raw from './raw';
2
+ /**
3
+ * @see https://api.akeneo.com/api-reference.html#measurement_families_get_list
4
+ */
5
+ // eslint-disable-next-line import/prefer-default-export
6
+ export const getAll = (http) => raw.getAllNoPagination(http, `/api/rest/v1/measurement-families`, {
7
+ params: {},
8
+ });
@@ -4,6 +4,7 @@ declare const _default: {
4
4
  get: (http: AxiosInstance, url: string, config: AxiosRequestConfig) => Promise<ListResponse<any> & {
5
5
  _links: any;
6
6
  }>;
7
+ getAllNoPagination: (http: AxiosInstance, url: string, config: AxiosRequestConfig) => Promise<ListResponse<any>>;
7
8
  getOne: (http: AxiosInstance, url: string, config?: AxiosRequestConfig) => Promise<any>;
8
9
  getAllByPage: (http: AxiosInstance, url: string, { params }: AxiosRequestConfig) => Promise<ListResponse<any>>;
9
10
  getAllBySearchAfter: (http: AxiosInstance, url: string, config?: AxiosRequestConfig) => Promise<ListResponse<any>>;
@@ -16,6 +16,18 @@ export default {
16
16
  };
17
17
  }, errorHandler);
18
18
  },
19
+ getAllNoPagination: function getAllNoPagination(http, url, config) {
20
+ return http
21
+ .get(url, {
22
+ ...config,
23
+ })
24
+ .then((response) => {
25
+ const { data } = response;
26
+ return {
27
+ items: data,
28
+ };
29
+ }, errorHandler);
30
+ },
19
31
  getOne: function getOne(http, url, config) {
20
32
  return http
21
33
  .get(url, {
@@ -161,6 +161,9 @@ declare const getHttpClientWithEndpoint: (http: AxiosInstance) => {
161
161
  query?: import("./types").FamilyVariantQueryParameters | undefined;
162
162
  }) => Promise<import("./types").ListResponse<import("./types").Variant>>;
163
163
  };
164
+ measurementFamily: {
165
+ getAll: (params: Record<string, any>) => Promise<import("./types").ListResponse<import("./types").MeasurementFamily>>;
166
+ };
164
167
  };
165
168
  /**
166
169
  * Create a client instance
@@ -333,6 +336,9 @@ export declare const createClient: (params: ClientParams) => {
333
336
  query?: import("./types").FamilyVariantQueryParameters | undefined;
334
337
  }) => Promise<import("./types").ListResponse<import("./types").Variant>>;
335
338
  };
339
+ measurementFamily: {
340
+ getAll: (params: Record<string, any>) => Promise<import("./types").ListResponse<import("./types").MeasurementFamily>>;
341
+ };
336
342
  };
337
343
  /**
338
344
  * Create a client instance
@@ -502,6 +508,9 @@ export declare const createAppClient: (params: AppParams) => {
502
508
  query?: import("./types").FamilyVariantQueryParameters | undefined;
503
509
  }) => Promise<import("./types").ListResponse<import("./types").Variant>>;
504
510
  };
511
+ measurementFamily: {
512
+ getAll: (params: Record<string, any>) => Promise<import("./types").ListResponse<import("./types").MeasurementFamily>>;
513
+ };
505
514
  };
506
515
  export type AkeneoClientAPI = ReturnType<typeof getHttpClientWithEndpoint>;
507
516
  export * from './types';
package/dist/mjs/index.js CHANGED
@@ -87,6 +87,9 @@ const getHttpClientWithEndpoint = (http) => ({
87
87
  get: wrap(http, endpoints.family.get),
88
88
  getVariants: wrap(http, endpoints.family.getVariants),
89
89
  },
90
+ measurementFamily: {
91
+ getAll: wrap(http, endpoints.measurementFamily.getAll),
92
+ }
90
93
  });
91
94
  /**
92
95
  * Create a client instance
@@ -249,4 +249,18 @@ export type Asset = {
249
249
  code: string;
250
250
  values: Record<string, ValuesRecord[]>;
251
251
  };
252
+ export type MeasurementFamily = {
253
+ code: string;
254
+ labels: Record<string, string>;
255
+ standard_unit_code: string;
256
+ units: Record<string, {
257
+ code: string;
258
+ labels: Record<string, string>;
259
+ convert_from_standard?: Record<string, {
260
+ operator: string;
261
+ value: string;
262
+ }>;
263
+ symbol: string;
264
+ }>;
265
+ };
252
266
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataggo/node-akeneo-api",
3
- "version": "1.2.2",
3
+ "version": "1.3.1",
4
4
  "description": "A Node Rest Client for the Akeneo PIM",
5
5
  "author": "Dataggo <contact@dataggo>",
6
6
  "license": "MIT",