@kiminix/tp-client 2.9.5 → 2.9.7

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,8 @@ import { Order } from "../shared/types";
2
2
  import { OrderStatus } from "../../enum";
3
3
  import { CallWaiter, CallWaiterStatus } from "./types/get-calls-response";
4
4
  import { Category } from "./types/get-menu-response";
5
+ import { Product } from "./types/get-product-response";
6
+ import { UpdateProductRequest } from "./types/update-product-request";
5
7
  export declare class MenuAdminAPIs {
6
8
  static updateOrders(props: {
7
9
  token?: string;
@@ -37,4 +39,12 @@ export declare class MenuAdminAPIs {
37
39
  static getMenu(props: {
38
40
  token?: string;
39
41
  }): Promise<Category[]>;
42
+ static getProduct(props: {
43
+ token?: string;
44
+ id: string;
45
+ }): Promise<Product>;
46
+ static updateProduct(props: {
47
+ token?: string;
48
+ request: UpdateProductRequest;
49
+ }): Promise<void>;
40
50
  }
@@ -152,6 +152,34 @@ var MenuAdminAPIs = /** @class */ (function () {
152
152
  });
153
153
  });
154
154
  };
155
+ MenuAdminAPIs.getProduct = function (props) {
156
+ return __awaiter(this, void 0, void 0, function () {
157
+ return __generator(this, function (_a) {
158
+ return [2 /*return*/, RequestUtils.send(function () {
159
+ return axios.get(base + "/menus/admin/products/".concat(props.id), {
160
+ headers: {
161
+ 'Authorization': "".concat(props.token)
162
+ }
163
+ })
164
+ .then(function (response) { return response.data; });
165
+ })];
166
+ });
167
+ });
168
+ };
169
+ MenuAdminAPIs.updateProduct = function (props) {
170
+ return __awaiter(this, void 0, void 0, function () {
171
+ return __generator(this, function (_a) {
172
+ return [2 /*return*/, RequestUtils.send(function () {
173
+ return axios.patch(base + "/menus/admin/products", props.request, {
174
+ headers: {
175
+ 'Authorization': "".concat(props.token)
176
+ }
177
+ })
178
+ .then(function (_) { return undefined; });
179
+ })];
180
+ });
181
+ });
182
+ };
155
183
  return MenuAdminAPIs;
156
184
  }());
157
185
  export { MenuAdminAPIs };
@@ -1,5 +1,6 @@
1
1
  export interface Category {
2
2
  label: string;
3
+ id: string;
3
4
  isPublic: boolean;
4
5
  products: Product[];
5
6
  }
@@ -0,0 +1,20 @@
1
+ export declare class Product {
2
+ id: string;
3
+ label: string;
4
+ category: Category;
5
+ description?: string;
6
+ picture: string;
7
+ variants: Variant[];
8
+ }
9
+ export interface Category {
10
+ id: string;
11
+ label: string;
12
+ isPublic: boolean;
13
+ }
14
+ export interface Variant {
15
+ id: string;
16
+ label?: string;
17
+ isAvailable: boolean;
18
+ price: number;
19
+ discount?: number;
20
+ }
@@ -0,0 +1,6 @@
1
+ var Product = /** @class */ (function () {
2
+ function Product() {
3
+ }
4
+ return Product;
5
+ }());
6
+ export { Product };
@@ -0,0 +1,12 @@
1
+ export interface UpdateProductRequest {
2
+ id: string;
3
+ label?: string | undefined;
4
+ description?: string | undefined;
5
+ variant?: VariantUpdate | undefined;
6
+ }
7
+ export interface VariantUpdate {
8
+ id: string;
9
+ label?: string | undefined;
10
+ isAvailable?: boolean | undefined;
11
+ price?: number | undefined;
12
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -6,5 +6,7 @@ export { MenuGuestAPIs } from './user/guest-apis';
6
6
  export * from "./admin/types/get-calls-response";
7
7
  import * as AdminMenuResponse from "./admin/types/get-menu-response";
8
8
  export { AdminMenuResponse };
9
+ import * as AdminProductResponse from "./admin/types/get-product-response";
10
+ export { AdminProductResponse };
9
11
  export { MenuAdminAPIs } from './admin/admin-apis';
10
12
  export * from "./shared/types";
@@ -6,8 +6,12 @@ export * from "./user/types/post-call-waiter-request";
6
6
  export { MenuGuestAPIs } from './user/guest-apis';
7
7
  // admin module
8
8
  export * from "./admin/types/get-calls-response";
9
+ // export api of get calls
9
10
  import * as AdminMenuResponse from "./admin/types/get-menu-response";
10
11
  export { AdminMenuResponse };
12
+ // export api of get product
13
+ import * as AdminProductResponse from "./admin/types/get-product-response";
14
+ export { AdminProductResponse };
11
15
  export { MenuAdminAPIs } from './admin/admin-apis';
12
16
  // shared module
13
17
  export * from "./shared/types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.9.5",
3
+ "version": "2.9.7",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [