@osaas/client-intercom 0.2.4 → 0.3.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.
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +16 -4
- package/lib/index.js.map +1 -1
- package/lib/system.d.ts +142 -4
- package/lib/system.d.ts.map +1 -1
- package/lib/system.js +166 -12
- package/lib/system.js.map +1 -1
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,cAAc,UAAU,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
3
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
Object.defineProperty(exports, "IntercomSystem", { enumerable: true, get: function () { return system_1.IntercomSystem; } });
|
|
17
|
+
/** @module @osaas/client-intercom */
|
|
18
|
+
__exportStar(require("./system"), exports);
|
|
7
19
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,2CAAyB"}
|
package/lib/system.d.ts
CHANGED
|
@@ -1,17 +1,155 @@
|
|
|
1
1
|
import { Context } from '@osaas/client-core';
|
|
2
|
+
export interface IntercomProductionLineParticipant {
|
|
3
|
+
name: string;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
endpointId: string;
|
|
6
|
+
isActive: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface IntercomProductionLine {
|
|
9
|
+
name: string;
|
|
10
|
+
id: string;
|
|
11
|
+
smbConferenceId: string;
|
|
12
|
+
participants: IntercomProductionLineParticipant[];
|
|
13
|
+
programOutputLine: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface IntercomProduction {
|
|
16
|
+
name: string;
|
|
17
|
+
productionId: string;
|
|
18
|
+
lines: IntercomProductionLine[];
|
|
19
|
+
}
|
|
20
|
+
export interface IntercomProductionList {
|
|
21
|
+
productions: IntercomProduction[];
|
|
22
|
+
offset: number;
|
|
23
|
+
limit: number;
|
|
24
|
+
totalItems: number;
|
|
25
|
+
}
|
|
26
|
+
export interface NewProduction {
|
|
27
|
+
name: string;
|
|
28
|
+
lines: {
|
|
29
|
+
name: string;
|
|
30
|
+
programOutputLine: boolean;
|
|
31
|
+
}[];
|
|
32
|
+
}
|
|
33
|
+
export interface NewProductionLine {
|
|
34
|
+
name: string;
|
|
35
|
+
programOutputLine: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @typedef {Object} IntercomProductionLine
|
|
39
|
+
* @property {string} name - The name of the line
|
|
40
|
+
* @property {string} id - The ID of the line
|
|
41
|
+
* @property {string} smbConferenceId - The SMB conference ID
|
|
42
|
+
* @property {IntercomProductionLineParticipant[]} participants - The list of participants in the line
|
|
43
|
+
* @property {boolean} programOutputLine - Whether the line is a program output line
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* @typedef {Object} IntercomProduction
|
|
47
|
+
* @property {string} name - The name of the production
|
|
48
|
+
* @property {string} productionId - The ID of the production
|
|
49
|
+
* @property {IntercomProductionLine[]} lines - The list of lines in the production
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* @typedef {Object} IntercomProductionList
|
|
53
|
+
* @property {IntercomProduction[]} productions - The list of productions
|
|
54
|
+
* @property {number} offset - The offset for pagination
|
|
55
|
+
* @property {number} limit - The limit for pagination
|
|
56
|
+
* @property {number} totalItems - The total number of items
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {Object} NewProductionLine
|
|
60
|
+
* @property {string} name - The name of the line
|
|
61
|
+
* @property {boolean} programOutputLine - Whether the line is a program output line
|
|
62
|
+
*/
|
|
63
|
+
/**
|
|
64
|
+
* @typedef {Object} NewProduction
|
|
65
|
+
* @property {string} name - The name of the production
|
|
66
|
+
* @property {NewProductionLine[]} lines - The new lines in the production
|
|
67
|
+
* @property {string} lines.name - The name of the line
|
|
68
|
+
* @property {boolean} lines.programOutputLine - Whether the line is a program output line
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* @memberof module:@osaas/client-intercom
|
|
72
|
+
*/
|
|
2
73
|
export declare class IntercomSystem {
|
|
3
74
|
private context;
|
|
4
75
|
private name;
|
|
5
76
|
private url?;
|
|
6
77
|
private token?;
|
|
7
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Constructor for IntercomSystem
|
|
80
|
+
* @param {Context} context - Open Source Cloud configuration context
|
|
81
|
+
* @param {string} name - The name of the Intercom system
|
|
82
|
+
* @param {string} [customEndpoint] - Optional custom endpoint for the Intercom system (if running outside of Open Source Cloud)
|
|
83
|
+
*/
|
|
84
|
+
constructor({ context, name, customEndpoint }: {
|
|
8
85
|
context: Context;
|
|
9
86
|
name: string;
|
|
87
|
+
customEndpoint?: string;
|
|
10
88
|
});
|
|
89
|
+
/**
|
|
90
|
+
* Initialize the Intercom system
|
|
91
|
+
*/
|
|
11
92
|
init(): Promise<void>;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
93
|
+
/**
|
|
94
|
+
* List all productions in the Intercom system
|
|
95
|
+
* @returns {Promise<IntercomProduction[]>} - List of productions
|
|
96
|
+
*/
|
|
97
|
+
listProductions(): Promise<IntercomProduction[]>;
|
|
98
|
+
/**
|
|
99
|
+
* List all lines for a given production
|
|
100
|
+
* @param {string} productionId - The production ID to list lines for
|
|
101
|
+
* @returns {IntercomProductionLine[]} - List of lines for the production
|
|
102
|
+
*/
|
|
103
|
+
listLinesForProduction(productionId: string): Promise<IntercomProductionLine[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Create a new production in the Intercom system
|
|
106
|
+
* @param {string} name - The name of the production
|
|
107
|
+
* @param {NewProductionLine} lines - The lines to create in the production
|
|
108
|
+
* @returns {Promise<IntercomProduction>} - The created production
|
|
109
|
+
* @example
|
|
110
|
+
* import { Context } from '@osaas/client-core';
|
|
111
|
+
* import { IntercomSystem } from '@osaas/client-intercom';
|
|
112
|
+
*
|
|
113
|
+
* const ctx = new Context();
|
|
114
|
+
* const intercom = new IntercomSystem({ context: ctx, name: 'example' });
|
|
115
|
+
* await intercom.init();
|
|
116
|
+
* await intercom.createProduction('my-production', [
|
|
117
|
+
* { name: 'Line 1', programOutputLine: true },
|
|
118
|
+
* { name: 'Line 2', programOutputLine: false }
|
|
119
|
+
* ]);
|
|
120
|
+
*/
|
|
121
|
+
createProduction(name: string, lines: {
|
|
122
|
+
name: string;
|
|
123
|
+
programOutputLine: boolean;
|
|
124
|
+
}[]): Promise<IntercomProduction>;
|
|
125
|
+
/**
|
|
126
|
+
* Delete a production in the Intercom system
|
|
127
|
+
* @param {string} productionId - The production ID to delete
|
|
128
|
+
*/
|
|
15
129
|
deleteProduction(productionId: string): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Add a new line to a production
|
|
132
|
+
* @param {string} productionId - The production ID to add the line to
|
|
133
|
+
* @param {string} lineName - The name of the line to add
|
|
134
|
+
* @param {boolean} programOutputLine - Whether the line is a program output line
|
|
135
|
+
* @returns {Promise<IntercomProductionLine[]>} - The updated list of lines for the production
|
|
136
|
+
*/
|
|
137
|
+
addLineToProduction(productionId: string, lineName: string, programOutputLine: boolean): Promise<IntercomProductionLine[]>;
|
|
138
|
+
/**
|
|
139
|
+
* Modify a line in a production
|
|
140
|
+
* @param {string} productionId - The production ID to modify the line in
|
|
141
|
+
* @param {string} lineId - The line ID to modify
|
|
142
|
+
* @param {string} name - The new name for the line
|
|
143
|
+
* @param {boolean} programOutputLine - Whether the line is a program output line
|
|
144
|
+
* @returns {Promise<IntercomProductionLine>} - The modified line
|
|
145
|
+
*/
|
|
146
|
+
modifyLine(productionId: string, lineId: string, name: string, programOutputLine: boolean): Promise<Omit<IntercomProductionLine, "smbConferenceId" | "participants">>;
|
|
147
|
+
/**
|
|
148
|
+
* Get the list of participants for a given line in a production
|
|
149
|
+
* @param {string} productionId - The production ID to get participants for
|
|
150
|
+
* @param {string} lineId - The line ID to get participants for
|
|
151
|
+
* @returns {Promise<IntercomProductionLineParticipant[]>} - The list of participants for the line
|
|
152
|
+
*/
|
|
153
|
+
getParticipantsForLine(productionId: string, lineId: string): Promise<IntercomProductionLineParticipant[]>;
|
|
16
154
|
}
|
|
17
155
|
//# sourceMappingURL=system.d.ts.map
|
package/lib/system.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../src/system.ts"],"names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;GAOG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;GAEG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,GAAG,CAAC,CAAS;IACrB,OAAO,CAAC,KAAK,CAAC,CAAS;IAEvB;;;;;OAKG;gBACS,EACV,OAAO,EACP,IAAI,EACJ,cAAc,EACf,EAAE;QACD,OAAO,EAAE,OAAO,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,cAAc,CAAC,EAAE,MAAM,CAAC;KACzB;IAQD;;OAEG;IACU,IAAI;IAkBjB;;;OAGG;IACU,eAAe;IAkB5B;;;;OAIG;IACU,sBAAsB,CAAC,YAAY,EAAE,MAAM;IAexD;;;;;;;;;;;;;;;;OAgBG;IACU,gBAAgB,CAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,iBAAiB,EAAE,OAAO,CAAA;KAAE,EAAE;IAsBvD;;;OAGG;IACU,gBAAgB,CAAC,YAAY,EAAE,MAAM;IAclD;;;;;;OAMG;IACU,mBAAmB,CAC9B,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,iBAAiB,EAAE,OAAO;IAoB5B;;;;;;;OAOG;IACU,UAAU,CACrB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,OAAO;IAwB5B;;;;;OAKG;IACU,sBAAsB,CACjC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iCAAiC,EAAE,CAAC;CAmBhD"}
|
package/lib/system.js
CHANGED
|
@@ -3,39 +3,101 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.IntercomSystem = void 0;
|
|
4
4
|
const client_core_1 = require("@osaas/client-core");
|
|
5
5
|
const SERVICE_ID = 'eyevinn-intercom-manager';
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {Object} IntercomProductionLine
|
|
8
|
+
* @property {string} name - The name of the line
|
|
9
|
+
* @property {string} id - The ID of the line
|
|
10
|
+
* @property {string} smbConferenceId - The SMB conference ID
|
|
11
|
+
* @property {IntercomProductionLineParticipant[]} participants - The list of participants in the line
|
|
12
|
+
* @property {boolean} programOutputLine - Whether the line is a program output line
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {Object} IntercomProduction
|
|
16
|
+
* @property {string} name - The name of the production
|
|
17
|
+
* @property {string} productionId - The ID of the production
|
|
18
|
+
* @property {IntercomProductionLine[]} lines - The list of lines in the production
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Object} IntercomProductionList
|
|
22
|
+
* @property {IntercomProduction[]} productions - The list of productions
|
|
23
|
+
* @property {number} offset - The offset for pagination
|
|
24
|
+
* @property {number} limit - The limit for pagination
|
|
25
|
+
* @property {number} totalItems - The total number of items
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {Object} NewProductionLine
|
|
29
|
+
* @property {string} name - The name of the line
|
|
30
|
+
* @property {boolean} programOutputLine - Whether the line is a program output line
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {Object} NewProduction
|
|
34
|
+
* @property {string} name - The name of the production
|
|
35
|
+
* @property {NewProductionLine[]} lines - The new lines in the production
|
|
36
|
+
* @property {string} lines.name - The name of the line
|
|
37
|
+
* @property {boolean} lines.programOutputLine - Whether the line is a program output line
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* @memberof module:@osaas/client-intercom
|
|
41
|
+
*/
|
|
6
42
|
class IntercomSystem {
|
|
7
43
|
context;
|
|
8
44
|
name;
|
|
9
45
|
url;
|
|
10
46
|
token;
|
|
11
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Constructor for IntercomSystem
|
|
49
|
+
* @param {Context} context - Open Source Cloud configuration context
|
|
50
|
+
* @param {string} name - The name of the Intercom system
|
|
51
|
+
* @param {string} [customEndpoint] - Optional custom endpoint for the Intercom system (if running outside of Open Source Cloud)
|
|
52
|
+
*/
|
|
53
|
+
constructor({ context, name, customEndpoint }) {
|
|
12
54
|
this.context = context;
|
|
13
55
|
this.name = name;
|
|
56
|
+
if (customEndpoint) {
|
|
57
|
+
this.url = customEndpoint;
|
|
58
|
+
}
|
|
14
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Initialize the Intercom system
|
|
62
|
+
*/
|
|
15
63
|
async init() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
64
|
+
if (!this.url) {
|
|
65
|
+
this.token = await this.context.getServiceAccessToken(SERVICE_ID);
|
|
66
|
+
const instance = await (0, client_core_1.getInstance)(this.context, SERVICE_ID, this.name, this.token);
|
|
67
|
+
if (!instance) {
|
|
68
|
+
throw new Error(`No Intercom system found with name ${this.name}`);
|
|
69
|
+
}
|
|
70
|
+
this.url = instance.url;
|
|
71
|
+
(0, client_core_1.Log)().debug(instance);
|
|
72
|
+
(0, client_core_1.Log)().debug(`Intercom system ${this.name} found on ${this.url}`);
|
|
20
73
|
}
|
|
21
|
-
this.url = instance.url;
|
|
22
|
-
(0, client_core_1.Log)().debug(instance);
|
|
23
|
-
(0, client_core_1.Log)().debug(`Intercom system ${this.name} found on ${this.url}`);
|
|
24
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* List all productions in the Intercom system
|
|
77
|
+
* @returns {Promise<IntercomProduction[]>} - List of productions
|
|
78
|
+
*/
|
|
25
79
|
async listProductions() {
|
|
26
80
|
if (!this.url) {
|
|
27
81
|
throw new Error('Intercom system not initialized');
|
|
28
82
|
}
|
|
29
|
-
const url = new URL(this.url + '/api/v1/
|
|
30
|
-
|
|
83
|
+
const url = new URL(this.url + '/api/v1/productionlist');
|
|
84
|
+
url.searchParams.append('extended', 'true');
|
|
85
|
+
url.searchParams.append('limit', '100');
|
|
86
|
+
// TODO: handle pagination
|
|
87
|
+
const productionList = await (0, client_core_1.createFetch)(url, {
|
|
31
88
|
method: 'GET',
|
|
32
89
|
headers: {
|
|
33
90
|
Authorization: `Bearer ${this.token}`,
|
|
34
91
|
'Content-Type': 'application/json'
|
|
35
92
|
}
|
|
36
93
|
});
|
|
37
|
-
return productions;
|
|
94
|
+
return productionList.productions;
|
|
38
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* List all lines for a given production
|
|
98
|
+
* @param {string} productionId - The production ID to list lines for
|
|
99
|
+
* @returns {IntercomProductionLine[]} - List of lines for the production
|
|
100
|
+
*/
|
|
39
101
|
async listLinesForProduction(productionId) {
|
|
40
102
|
if (!this.url) {
|
|
41
103
|
throw new Error('Intercom system not initialized');
|
|
@@ -50,6 +112,23 @@ class IntercomSystem {
|
|
|
50
112
|
});
|
|
51
113
|
return lines;
|
|
52
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Create a new production in the Intercom system
|
|
117
|
+
* @param {string} name - The name of the production
|
|
118
|
+
* @param {NewProductionLine} lines - The lines to create in the production
|
|
119
|
+
* @returns {Promise<IntercomProduction>} - The created production
|
|
120
|
+
* @example
|
|
121
|
+
* import { Context } from '@osaas/client-core';
|
|
122
|
+
* import { IntercomSystem } from '@osaas/client-intercom';
|
|
123
|
+
*
|
|
124
|
+
* const ctx = new Context();
|
|
125
|
+
* const intercom = new IntercomSystem({ context: ctx, name: 'example' });
|
|
126
|
+
* await intercom.init();
|
|
127
|
+
* await intercom.createProduction('my-production', [
|
|
128
|
+
* { name: 'Line 1', programOutputLine: true },
|
|
129
|
+
* { name: 'Line 2', programOutputLine: false }
|
|
130
|
+
* ]);
|
|
131
|
+
*/
|
|
53
132
|
async createProduction(name, lines) {
|
|
54
133
|
if (!this.url) {
|
|
55
134
|
throw new Error('Intercom system not initialized');
|
|
@@ -64,12 +143,16 @@ class IntercomSystem {
|
|
|
64
143
|
body: JSON.stringify({
|
|
65
144
|
name,
|
|
66
145
|
lines: lines.map((line) => {
|
|
67
|
-
return { name: line };
|
|
146
|
+
return { name: line.name, programOutputLine: line.programOutputLine };
|
|
68
147
|
})
|
|
69
148
|
})
|
|
70
149
|
});
|
|
71
150
|
return production;
|
|
72
151
|
}
|
|
152
|
+
/**
|
|
153
|
+
* Delete a production in the Intercom system
|
|
154
|
+
* @param {string} productionId - The production ID to delete
|
|
155
|
+
*/
|
|
73
156
|
async deleteProduction(productionId) {
|
|
74
157
|
if (!this.url) {
|
|
75
158
|
throw new Error('Intercom system not initialized');
|
|
@@ -83,6 +166,77 @@ class IntercomSystem {
|
|
|
83
166
|
});
|
|
84
167
|
(0, client_core_1.Log)().info(msg);
|
|
85
168
|
}
|
|
169
|
+
/**
|
|
170
|
+
* Add a new line to a production
|
|
171
|
+
* @param {string} productionId - The production ID to add the line to
|
|
172
|
+
* @param {string} lineName - The name of the line to add
|
|
173
|
+
* @param {boolean} programOutputLine - Whether the line is a program output line
|
|
174
|
+
* @returns {Promise<IntercomProductionLine[]>} - The updated list of lines for the production
|
|
175
|
+
*/
|
|
176
|
+
async addLineToProduction(productionId, lineName, programOutputLine) {
|
|
177
|
+
if (!this.url) {
|
|
178
|
+
throw new Error('Intercom system not initialized');
|
|
179
|
+
}
|
|
180
|
+
const url = new URL(this.url + `/api/v1/production/${productionId}/line`);
|
|
181
|
+
const lines = await (0, client_core_1.createFetch)(url, {
|
|
182
|
+
method: 'POST',
|
|
183
|
+
headers: {
|
|
184
|
+
Authorization: `Bearer ${this.token}`,
|
|
185
|
+
'Content-Type': 'application/json'
|
|
186
|
+
},
|
|
187
|
+
body: JSON.stringify({
|
|
188
|
+
name: lineName,
|
|
189
|
+
programOutputLine
|
|
190
|
+
})
|
|
191
|
+
});
|
|
192
|
+
return lines;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Modify a line in a production
|
|
196
|
+
* @param {string} productionId - The production ID to modify the line in
|
|
197
|
+
* @param {string} lineId - The line ID to modify
|
|
198
|
+
* @param {string} name - The new name for the line
|
|
199
|
+
* @param {boolean} programOutputLine - Whether the line is a program output line
|
|
200
|
+
* @returns {Promise<IntercomProductionLine>} - The modified line
|
|
201
|
+
*/
|
|
202
|
+
async modifyLine(productionId, lineId, name, programOutputLine) {
|
|
203
|
+
if (!this.url) {
|
|
204
|
+
throw new Error('Intercom system not initialized');
|
|
205
|
+
}
|
|
206
|
+
const url = new URL(this.url + `/api/v1/production/${productionId}/line/${lineId}`);
|
|
207
|
+
const line = await (0, client_core_1.createFetch)(url, {
|
|
208
|
+
method: 'PATCH',
|
|
209
|
+
headers: {
|
|
210
|
+
Authorization: `Bearer ${this.token}`,
|
|
211
|
+
'Content-Type': 'application/json'
|
|
212
|
+
},
|
|
213
|
+
body: JSON.stringify({
|
|
214
|
+
name,
|
|
215
|
+
programOutputLine
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
return line;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Get the list of participants for a given line in a production
|
|
222
|
+
* @param {string} productionId - The production ID to get participants for
|
|
223
|
+
* @param {string} lineId - The line ID to get participants for
|
|
224
|
+
* @returns {Promise<IntercomProductionLineParticipant[]>} - The list of participants for the line
|
|
225
|
+
*/
|
|
226
|
+
async getParticipantsForLine(productionId, lineId) {
|
|
227
|
+
if (!this.url) {
|
|
228
|
+
throw new Error('Intercom system not initialized');
|
|
229
|
+
}
|
|
230
|
+
const url = new URL(this.url + `/api/v1/production/${productionId}/line/${lineId}/participant`);
|
|
231
|
+
const participants = await (0, client_core_1.createFetch)(url, {
|
|
232
|
+
method: 'GET',
|
|
233
|
+
headers: {
|
|
234
|
+
Authorization: `Bearer ${this.token}`,
|
|
235
|
+
'Content-Type': 'application/json'
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
return participants;
|
|
239
|
+
}
|
|
86
240
|
}
|
|
87
241
|
exports.IntercomSystem = IntercomSystem;
|
|
88
242
|
//# sourceMappingURL=system.js.map
|
package/lib/system.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.js","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":";;;AAAA,oDAA4E;AAE5E,MAAM,UAAU,GAAG,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"system.js","sourceRoot":"","sources":["../src/system.ts"],"names":[],"mappings":";;;AAAA,oDAA4E;AAE5E,MAAM,UAAU,GAAG,0BAA0B,CAAC;AA2C9C;;;;;;;GAOG;AAEH;;;;;GAKG;AAEH;;;;;;GAMG;AAEH;;;;GAIG;AAEH;;;;;;GAMG;AAEH;;GAEG;AACH,MAAa,cAAc;IACjB,OAAO,CAAU;IACjB,IAAI,CAAS;IACb,GAAG,CAAU;IACb,KAAK,CAAU;IAEvB;;;;;OAKG;IACH,YAAY,EACV,OAAO,EACP,IAAI,EACJ,cAAc,EAKf;QACC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,cAAc,EAAE;YAClB,IAAI,CAAC,GAAG,GAAG,cAAc,CAAC;SAC3B;IACH,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACb,IAAI,CAAC,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,CAAC;YAClE,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAW,EAChC,IAAI,CAAC,OAAO,EACZ,UAAU,EACV,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,KAAK,CACX,CAAC;YACF,IAAI,CAAC,QAAQ,EAAE;gBACb,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;aACpE;YACD,IAAI,CAAC,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC;YACxB,IAAA,iBAAG,GAAE,CAAC,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ClB,CAAC;SACH,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,sBAAsB,CACjC,YAAoB,EACpB,MAAc;QAEd,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;SACpD;QACD,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,IAAI,CAAC,GAAG,GAAG,sBAAsB,YAAY,SAAS,MAAM,cAAc,CAC3E,CAAC;QACF,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAW,EACpC,GAAG,EACH;YACE,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE;gBACrC,cAAc,EAAE,kBAAkB;aACnC;SACF,CACF,CAAC;QACF,OAAO,YAAY,CAAC;IACtB,CAAC;CACF;AApPD,wCAoPC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osaas/client-intercom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Open Source Cloud Client SDK intercom library",
|
|
5
5
|
"author": "Eyevinn Open Source Cloud <work@eyevinn.se>",
|
|
6
6
|
"homepage": "https://www.osaas.io",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"test": "jest --passWithNoTests"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@osaas/client-core": "^0.16.
|
|
28
|
+
"@osaas/client-core": "^0.16.1",
|
|
29
29
|
"chalk": "4.1.2"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "9513b6f39b8e05d8fe169122864a43d9d5c10129"
|
|
35
35
|
}
|