@kiminix/tp-client 2.24.0 → 2.26.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,11 +1,11 @@
1
1
  import { AllBusiness } from "./types/get-all";
2
2
  import { Business } from "./types/get-id";
3
- import { UpdateBusinessRequest } from "./types/update-business";
3
+ import { PatchBusinessRequest } from "./types/update-business";
4
4
  export declare class BusinessAPIs {
5
5
  static getAll(timestamp: number, page?: number, size?: number): Promise<AllBusiness[]>;
6
6
  static get(identifier: string): Promise<Business | undefined>;
7
- static update(props: {
7
+ static patch(props: {
8
8
  token: string;
9
- request: UpdateBusinessRequest;
9
+ request: PatchBusinessRequest;
10
10
  }): Promise<void>;
11
11
  }
@@ -87,14 +87,14 @@ var BusinessAPIs = /** @class */ (function () {
87
87
  });
88
88
  });
89
89
  };
90
- BusinessAPIs.update = function (props) {
90
+ BusinessAPIs.patch = function (props) {
91
91
  return __awaiter(this, void 0, void 0, function () {
92
92
  var _this = this;
93
93
  return __generator(this, function (_a) {
94
94
  return [2 /*return*/, RequestUtils.send(function () { return __awaiter(_this, void 0, void 0, function () {
95
95
  return __generator(this, function (_a) {
96
96
  switch (_a.label) {
97
- case 0: return [4 /*yield*/, axios.put(base + "/business", props.request, {
97
+ case 0: return [4 /*yield*/, axios.patch(base + "/business", props.request, {
98
98
  headers: {
99
99
  'Authorization': "".concat(props.token)
100
100
  }
@@ -3,6 +3,7 @@ import { OpeningHours, TelegramConfig } from "./shared";
3
3
  export interface Business {
4
4
  id: string;
5
5
  identifier: string;
6
+ shortId: string;
6
7
  name: string;
7
8
  logo: string | undefined;
8
9
  coverPhoto: string | undefined;
@@ -1,10 +1,12 @@
1
+ import { Patch } from "../../utils/patch-utils";
1
2
  import { OpeningHours, SocialLinks } from "./shared";
2
- export interface UpdateBusinessRequest {
3
- name: string;
4
- address: string;
5
- phones: string[];
6
- openingHours?: OpeningHours | undefined;
7
- socialLinks?: SocialLinks | undefined;
8
- googleMapsUrl?: string | undefined;
9
- googleMapsReviewLink?: string | undefined;
3
+ export interface PatchBusinessRequest {
4
+ name?: Patch<string> | undefined;
5
+ identifier?: Patch<string> | undefined;
6
+ address?: Patch<string> | undefined;
7
+ phones?: Patch<string[]> | undefined;
8
+ openingHours?: Patch<OpeningHours> | undefined;
9
+ socialLinks?: Patch<SocialLinks> | undefined;
10
+ googleMapsUrl?: Patch<string> | undefined;
11
+ googleMapsReviewLink?: Patch<string> | undefined;
10
12
  }
package/dist/index.d.ts CHANGED
@@ -10,6 +10,7 @@ export * from './cashback/index';
10
10
  export * from './discounts/index';
11
11
  export * from './vouchers/index';
12
12
  export * from './menus/index';
13
+ export * from './utils/patch-utils';
13
14
  export * from './utils/business-utils';
14
15
  export * from './utils/date-utils';
15
16
  export * from './utils/math-utils';
package/dist/index.js CHANGED
@@ -19,6 +19,7 @@ export * from './vouchers/index';
19
19
  //menus module
20
20
  export * from './menus/index';
21
21
  //utils
22
+ export * from './utils/patch-utils';
22
23
  export * from './utils/business-utils';
23
24
  export * from './utils/date-utils';
24
25
  export * from './utils/math-utils';
@@ -0,0 +1,11 @@
1
+ type Set<T> = {
2
+ op: "set";
3
+ value: T;
4
+ };
5
+ type Unset = {
6
+ op: "unset";
7
+ };
8
+ export type Patch<T> = Set<T> | Unset;
9
+ export declare const set: <T>(value: T) => Patch<T>;
10
+ export declare const unset: () => Unset;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ export var set = function (value) { return ({ op: "set", value: value }); };
2
+ export var unset = function () { return ({ op: "unset" }); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiminix/tp-client",
3
- "version": "2.24.0",
3
+ "version": "2.26.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [