@interfy/client 0.0.10 → 0.0.12

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.
@@ -0,0 +1,7 @@
1
+ import CustomTableField from "./CustomTableField";
2
+ export default class CustomTable {
3
+ id: number;
4
+ name: string;
5
+ fields: Array<CustomTableField>;
6
+ constructor(id: number, name: string, fields: Array<CustomTableField>);
7
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class CustomTable {
4
+ constructor(id, name, fields) {
5
+ this.id = id;
6
+ this.name = name;
7
+ this.fields = fields;
8
+ }
9
+ }
10
+ exports.default = CustomTable;
@@ -0,0 +1,4 @@
1
+ export default class CustomTableField {
2
+ name: string;
3
+ constructor(name: string);
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class CustomTableField {
4
+ constructor(name) {
5
+ this.name = name;
6
+ }
7
+ }
8
+ exports.default = CustomTableField;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const authentication_1 = require("../models/authentication");
13
+ module.exports = function CustomTablesService(client) {
14
+ return {
15
+ list() {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ let endpoint = `customtables`;
18
+ if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
19
+ endpoint = 'client/' + endpoint;
20
+ }
21
+ let response = yield client.makeRequest('GET', endpoint);
22
+ return response.data;
23
+ });
24
+ },
25
+ get(customTable_name) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ let endpoint = `customtables/${customTable_name}`;
28
+ if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
29
+ endpoint = 'client/' + endpoint;
30
+ }
31
+ let response = yield client.makeRequest('GET', endpoint);
32
+ return response.data;
33
+ });
34
+ },
35
+ getColumns(customTable_name) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ let endpoint = `customtables/${customTable_name}/columns`;
38
+ if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
39
+ endpoint = 'client/' + endpoint;
40
+ }
41
+ let response = yield client.makeRequest('GET', endpoint);
42
+ return response.data;
43
+ });
44
+ },
45
+ listRows(customTable_name) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ let endpoint = `customtables/${customTable_name}/data`;
48
+ if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
49
+ endpoint = 'client/' + endpoint;
50
+ }
51
+ let response = yield client.makeRequest('GET', endpoint);
52
+ return response.data;
53
+ });
54
+ },
55
+ filterRows(customTable_name, data) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ let endpoint = `customtables/${customTable_name}/data/search`;
58
+ if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
59
+ endpoint = 'client/' + endpoint;
60
+ }
61
+ let response = yield client.makeRequest('POST', endpoint, data);
62
+ return response.data;
63
+ });
64
+ },
65
+ addRow(customTable_name, data) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ let endpoint = `customtables/${customTable_name}/data`;
68
+ if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
69
+ endpoint = 'client/' + endpoint;
70
+ }
71
+ let response = yield client.makeRequest('POST', endpoint, data);
72
+ return response.data;
73
+ });
74
+ },
75
+ getRow(customTable_name, row_id) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ let endpoint = `customtables/${customTable_name}/data/${row_id}`;
78
+ if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
79
+ endpoint = 'client/' + endpoint;
80
+ }
81
+ let response = yield client.makeRequest('GET', endpoint);
82
+ return response.data;
83
+ });
84
+ },
85
+ updateRow(customTable_name, row_id, data) {
86
+ return __awaiter(this, void 0, void 0, function* () {
87
+ let endpoint = `customtables/${customTable_name}/data/${row_id}`;
88
+ if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
89
+ endpoint = 'client/' + endpoint;
90
+ }
91
+ let response = yield client.makeRequest('PUT', endpoint, data);
92
+ return response.data;
93
+ });
94
+ },
95
+ deleteRow(customTable_name, row_id) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ let endpoint = `customtables/${customTable_name}/data/${row_id}`;
98
+ if (client.authenticationConfig.type == authentication_1.AuthenticationType.OAuthClient) {
99
+ endpoint = 'client/' + endpoint;
100
+ }
101
+ let response = yield client.makeRequest('DELETE', endpoint);
102
+ return response.data;
103
+ });
104
+ }
105
+ };
106
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interfy/client",
3
- "version": "0.0.10",
3
+ "version": "0.0.12",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {