@or-sdk/tickets 1.0.1-324.0 → 1.0.1-327.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.
@@ -75,6 +75,17 @@ var Tickets = (function (_super) {
75
75
  });
76
76
  });
77
77
  };
78
+ Tickets.prototype.getTypes = function (query) {
79
+ return __awaiter(this, void 0, void 0, function () {
80
+ return __generator(this, function (_a) {
81
+ return [2, this.callApi({
82
+ method: 'get',
83
+ route: '/types',
84
+ params: query,
85
+ })];
86
+ });
87
+ });
88
+ };
78
89
  Tickets.prototype.updateType = function (id, data) {
79
90
  return __awaiter(this, void 0, void 0, function () {
80
91
  return __generator(this, function (_a) {
@@ -86,6 +97,17 @@ var Tickets = (function (_super) {
86
97
  });
87
98
  });
88
99
  };
100
+ Tickets.prototype.deleteType = function (data) {
101
+ return __awaiter(this, void 0, void 0, function () {
102
+ return __generator(this, function (_a) {
103
+ return [2, this.callApi({
104
+ method: 'delete',
105
+ route: '/types',
106
+ data: data,
107
+ })];
108
+ });
109
+ });
110
+ };
89
111
  return Tickets;
90
112
  }(base_1.Base));
91
113
  exports.Tickets = Tickets;
@@ -1 +1 @@
1
- {"version":3,"file":"Tickets.js","sourceRoot":"","sources":["../../src/Tickets.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoC;AAEpC,yCAA0C;AAS1C;IAA6B,2BAAI;IAO/B,iBAAY,MAAqB;QACvB,IAAA,KAAK,GAAiB,MAAM,MAAvB,EAAE,UAAU,GAAK,MAAM,WAAX,CAAY;eAErC,kBAAM;YACJ,KAAK,OAAA;YACL,UAAU,YAAA;YACV,UAAU,EAAE,uBAAW;SACxB,CAAC;IACJ,CAAC;IAEK,4BAAU,GAAhB,UAAiB,IAAuB;;;gBACtC,WAAO,IAAI,CAAC,OAAO,CAAC;wBAClB,MAAM,EAAE,MAAM;wBACd,KAAK,EAAE,QAA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4BAAU,GAAhB,UAAiB,IAAuB;;;gBACtC,WAAO,IAAI,CAAC,OAAO,CAAC;wBAClB,MAAM,EAAE,QAAQ;wBAChB,KAAK,EAAE,QAAQ;wBACf,IAAI,MAAA;qBACL,CAAC,EAAC;;;KACJ;IACH,cAAC;AAAD,CAAC,AArED,CAA6B,WAAI,GAqEhC;AArEY,0BAAO"}
@@ -27,6 +27,15 @@ export class Tickets extends Base {
27
27
  });
28
28
  });
29
29
  }
30
+ getTypes(query) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ return this.callApi({
33
+ method: 'get',
34
+ route: '/types',
35
+ params: query,
36
+ });
37
+ });
38
+ }
30
39
  updateType(id, data) {
31
40
  return __awaiter(this, void 0, void 0, function* () {
32
41
  return this.callApi({
@@ -36,5 +45,14 @@ export class Tickets extends Base {
36
45
  });
37
46
  });
38
47
  }
48
+ deleteType(data) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ return this.callApi({
51
+ method: 'delete',
52
+ route: '/types',
53
+ data,
54
+ });
55
+ });
56
+ }
39
57
  }
40
58
  //# sourceMappingURL=Tickets.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tickets.js","sourceRoot":"","sources":["../../src/Tickets.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS1C,MAAM,OAAO,OAAQ,SAAQ,IAAI;IAO/B,YAAY,MAAqB;QAC/B,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;QAErC,KAAK,CAAC;YACJ,KAAK;YACL,UAAU;YACV,UAAU,EAAE,WAAW;SACxB,CAAC,CAAC;IACL,CAAC;IAEK,UAAU,CAAC,IAAuB;;YACtC,OAAO,IAAI,CAAC,OAAO,CAAC;gBAClB,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE,QAAQ;gBACf,IAAI;aACL,CAAC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;gBACf,IAAI;aACL,CAAC,CAAC;QACL,CAAC;KAAA;CACF"}
@@ -1,7 +1,9 @@
1
1
  import { Base } from '@or-sdk/base';
2
- import { CreateTypeOptions, TicketsConfig, UpdateTypeOptions } from './types';
2
+ import { CreateTypeOptions, FindTypesOptions, TicketsConfig, UpdateTypeOptions, TypeRecordEntity, EntitiesListResponse, DeleteTypeOptions } from './types';
3
3
  export declare class Tickets extends Base {
4
4
  constructor(params: TicketsConfig);
5
- createType(data: CreateTypeOptions): Promise<unknown>;
6
- updateType(id: string, data: UpdateTypeOptions): Promise<unknown>;
5
+ createType(data: CreateTypeOptions): Promise<TypeRecordEntity>;
6
+ getTypes(query: FindTypesOptions): Promise<EntitiesListResponse<TypeRecordEntity>>;
7
+ updateType(id: string, data: UpdateTypeOptions): Promise<TypeRecordEntity>;
8
+ deleteType(data: DeleteTypeOptions): Promise<TypeRecordEntity>;
7
9
  }
@@ -3,6 +3,27 @@ export declare type TicketsConfig = {
3
3
  token: Token;
4
4
  serviceUrl?: string;
5
5
  };
6
+ declare type CreatedBy = {
7
+ accountId: string;
8
+ userId?: string;
9
+ flowId?: string;
10
+ };
11
+ export interface EntitiesListResponse<R extends Record<string, any> = Record<string, any>> {
12
+ total: number;
13
+ hits: R[];
14
+ }
15
+ export interface TypeRecordEntity {
16
+ id: string;
17
+ accountId: string;
18
+ label: string;
19
+ settings: Record<string, any>;
20
+ initialData: Record<string, any>;
21
+ createdBy: CreatedBy;
22
+ dateCreated: Date;
23
+ dateModified: Date;
24
+ meta?: Record<string, any>;
25
+ _isDeleted: boolean;
26
+ }
6
27
  export declare type CreateLabelOptions = {
7
28
  label: string;
8
29
  color: string;
@@ -15,10 +36,23 @@ export declare type CreateTypeOptions = {
15
36
  initialData: Record<string, any>;
16
37
  systemLabels?: Pick<CreateLabelOptions, 'label' | 'color'>[];
17
38
  };
18
- export interface UpdateTypeOptions {
39
+ export declare type UpdateTypeOptions = {
19
40
  label?: string;
20
41
  settings?: Record<string, any>;
21
42
  initialData?: Record<string, any>;
22
43
  meta?: Record<string, any>;
23
44
  _isDeleted?: boolean;
24
- }
45
+ };
46
+ export declare type DeleteTypeOptions = {
47
+ id: string;
48
+ };
49
+ export declare type FindTypesOptions = {
50
+ accountId?: string | string[];
51
+ projection?: string[];
52
+ from?: number;
53
+ size?: number;
54
+ orderBy?: string;
55
+ sortOrder?: string;
56
+ label?: string;
57
+ };
58
+ export {};
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.0.1-324.0",
2
+ "version": "1.0.1-327.0",
3
3
  "name": "@or-sdk/tickets",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
package/src/Tickets.ts CHANGED
@@ -1,5 +1,12 @@
1
1
  import { Base } from '@or-sdk/base';
2
- import { CreateTypeOptions, TicketsConfig, UpdateTypeOptions } from './types';
2
+ import {
3
+ CreateTypeOptions,
4
+ FindTypesOptions,
5
+ TicketsConfig,
6
+ UpdateTypeOptions,
7
+ TypeRecordEntity,
8
+ EntitiesListResponse, DeleteTypeOptions,
9
+ } from './types';
3
10
  import { SERVICE_KEY } from './constants';
4
11
 
5
12
  /**
@@ -26,7 +33,12 @@ export class Tickets extends Base {
26
33
  });
27
34
  }
28
35
 
29
- async createType(data: CreateTypeOptions) {
36
+ /**
37
+ * Create a Type
38
+ * @param data has CreateTypeOptions values inside
39
+ * @return Type Entity
40
+ */
41
+ async createType(data: CreateTypeOptions): Promise<TypeRecordEntity> {
30
42
  return this.callApi({
31
43
  method: 'post',
32
44
  route: '/types',
@@ -34,11 +46,43 @@ export class Tickets extends Base {
34
46
  });
35
47
  }
36
48
 
37
- async updateType(id: string, data: UpdateTypeOptions) {
49
+ /**
50
+ * Get the list of available Types
51
+ * @param query has FindTypesOptions values inside
52
+ * @return Type Entity
53
+ */
54
+ async getTypes(query: FindTypesOptions): Promise<EntitiesListResponse<TypeRecordEntity>> {
55
+ return this.callApi({
56
+ method: 'get',
57
+ route: '/types',
58
+ params: query,
59
+ });
60
+ }
61
+
62
+ /**
63
+ * Update the Type by provided id
64
+ * @param id string;
65
+ * @param data has UpdateTypeOptions values inside
66
+ * @return Type Entity
67
+ */
68
+ async updateType(id: string, data: UpdateTypeOptions): Promise<TypeRecordEntity> {
38
69
  return this.callApi({
39
70
  method: 'put',
40
71
  route: `/types/${id}`,
41
72
  data,
42
73
  });
43
74
  }
75
+
76
+ /**
77
+ * Delete the Type by provided id
78
+ * @param data has DeleteTypeOptions values inside
79
+ * @return Type Entity
80
+ */
81
+ async deleteType(data: DeleteTypeOptions): Promise<TypeRecordEntity> {
82
+ return this.callApi({
83
+ method: 'delete',
84
+ route: '/types',
85
+ data,
86
+ });
87
+ }
44
88
  }
package/src/types.ts CHANGED
@@ -1,16 +1,33 @@
1
1
  import { Token } from '@or-sdk/base';
2
2
 
3
3
  export type TicketsConfig = {
4
- /**
5
- * token
6
- */
7
4
  token: Token;
8
- /**
9
- * Direct service url, can be used to avoid discovery api call
10
- */
11
5
  serviceUrl?: string;
12
6
  };
13
7
 
8
+ type CreatedBy = {
9
+ accountId: string;
10
+ userId?: string;
11
+ flowId?: string;
12
+ };
13
+
14
+ export interface EntitiesListResponse<R extends Record<string, any> = Record<string, any>> {
15
+ total: number;
16
+ hits: R[];
17
+ }
18
+
19
+ export interface TypeRecordEntity {
20
+ id: string;
21
+ accountId: string;
22
+ label: string;
23
+ settings: Record<string, any>;
24
+ initialData: Record<string, any>;
25
+ createdBy: CreatedBy;
26
+ dateCreated: Date;
27
+ dateModified: Date;
28
+ meta?: Record<string, any>;
29
+ _isDeleted: boolean;
30
+ }
14
31
 
15
32
  export type CreateLabelOptions = {
16
33
  label: string;
@@ -26,10 +43,24 @@ export type CreateTypeOptions = {
26
43
  systemLabels?: Pick<CreateLabelOptions, 'label' | 'color'>[];
27
44
  };
28
45
 
29
- export interface UpdateTypeOptions {
46
+ export type UpdateTypeOptions = {
30
47
  label?: string;
31
48
  settings?: Record<string, any>;
32
49
  initialData?: Record<string, any>;
33
50
  meta?: Record<string, any>;
34
51
  _isDeleted?: boolean;
35
- }
52
+ };
53
+
54
+ export type DeleteTypeOptions = {
55
+ id: string;
56
+ };
57
+
58
+ export type FindTypesOptions = {
59
+ accountId?: string | string[];
60
+ projection?: string[];
61
+ from?: number;
62
+ size?: number;
63
+ orderBy?: string;
64
+ sortOrder?: string;
65
+ label?: string;
66
+ };