@tiledesk/tiledesk-tybot-connector 0.2.8 → 0.2.9
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/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -98,103 +98,96 @@ class DirReply {
|
|
|
98
98
|
}
|
|
99
99
|
// send!
|
|
100
100
|
if (this.log) {console.log("Reply:", JSON.stringify(message))};
|
|
101
|
-
|
|
102
|
-
// this.requestId,
|
|
103
|
-
// message,
|
|
104
|
-
// (err) => {
|
|
105
|
-
// if (err) {
|
|
106
|
-
// console.error("Error sending reply:", err.message);
|
|
107
|
-
// }
|
|
108
|
-
// if (this.log) {console.log("Reply message sent.");}
|
|
109
|
-
// callback();
|
|
110
|
-
// });
|
|
111
|
-
|
|
112
|
-
this.sendSupportMessage(
|
|
101
|
+
this.context.tdclient.sendSupportMessage(
|
|
113
102
|
this.requestId,
|
|
114
103
|
message,
|
|
115
104
|
(err) => {
|
|
116
105
|
if (err) {
|
|
117
106
|
console.error("Error sending reply:", err);
|
|
118
107
|
}
|
|
119
|
-
|
|
120
|
-
console.log("Reply message sent.", JSON.stringify(message));
|
|
108
|
+
if (this.log) {console.log("Reply message sent");}
|
|
121
109
|
callback();
|
|
122
|
-
|
|
123
|
-
}
|
|
110
|
+
});
|
|
124
111
|
|
|
125
|
-
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
};
|
|
138
|
-
this.myrequest(
|
|
139
|
-
HTTPREQUEST,
|
|
140
|
-
function(err, resbody) {
|
|
141
|
-
if (err) {
|
|
142
|
-
if (callback) {
|
|
143
|
-
callback(err);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
if (callback) {
|
|
148
|
-
callback(null, resbody);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}, this.log
|
|
152
|
-
);
|
|
112
|
+
// this.sendSupportMessage(
|
|
113
|
+
// this.requestId,
|
|
114
|
+
// message,
|
|
115
|
+
// (err) => {
|
|
116
|
+
// if (err) {
|
|
117
|
+
// console.error("Error sending reply:", err);
|
|
118
|
+
// }
|
|
119
|
+
// // if (this.log) {console.log("Reply message sent.");}
|
|
120
|
+
// console.log("Reply message sent.", JSON.stringify(message));
|
|
121
|
+
// callback();
|
|
122
|
+
// }
|
|
123
|
+
// );
|
|
153
124
|
}
|
|
154
125
|
|
|
155
|
-
|
|
156
|
-
//
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
126
|
+
// sendSupportMessage(requestId, message, callback) {
|
|
127
|
+
// const url = `${this.context.tdclient.APIURL}/${this.projectId}/requests/${requestId}/messages`
|
|
128
|
+
// const HTTPREQUEST = {
|
|
129
|
+
// url: url,
|
|
130
|
+
// headers: {
|
|
131
|
+
// 'Content-Type' : 'application/json',
|
|
132
|
+
// 'Authorization': "JWT " + this.token
|
|
133
|
+
// },
|
|
134
|
+
// json: message,
|
|
135
|
+
// method: 'POST'
|
|
136
|
+
// };
|
|
137
|
+
// this.myrequest(
|
|
138
|
+
// HTTPREQUEST,
|
|
139
|
+
// function(err, resbody) {
|
|
140
|
+
// if (err) {
|
|
141
|
+
// if (callback) {
|
|
142
|
+
// callback(err);
|
|
143
|
+
// }
|
|
144
|
+
// }
|
|
145
|
+
// else {
|
|
146
|
+
// if (callback) {
|
|
147
|
+
// callback(null, resbody);
|
|
148
|
+
// }
|
|
149
|
+
// }
|
|
150
|
+
// }, this.log
|
|
151
|
+
// );
|
|
160
152
|
// }
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
153
|
+
|
|
154
|
+
// myrequest(options, callback, log) {
|
|
155
|
+
// console.log("API URL:", options.url);
|
|
156
|
+
// console.log("** Options:", JSON.stringify(options));
|
|
157
|
+
// console.log("** Sending reply json:", JSON.stringify(options.json));
|
|
158
|
+
// axios(
|
|
159
|
+
// {
|
|
160
|
+
// url: options.url,
|
|
161
|
+
// method: options.method,
|
|
162
|
+
// data: options.json,
|
|
163
|
+
// params: options.params,
|
|
164
|
+
// headers: options.headers
|
|
165
|
+
// })
|
|
166
|
+
// .then((res) => {
|
|
167
|
+
// console.log("Reply: Response for url:", options.url);
|
|
168
|
+
// console.log("Reply: Response headers:\n", JSON.stringify(res.headers));
|
|
169
|
+
// console.log("Reply: Status:", res.status);
|
|
170
|
+
// console.log("Reply: Data:", JSON.stringify(res.data));
|
|
171
|
+
// if (res && res.status == 200 && res.data) {
|
|
172
|
+
// console.log("Status 200 OK");
|
|
173
|
+
// if (callback) {
|
|
174
|
+
// callback(null, res.data);
|
|
175
|
+
// }
|
|
176
|
+
// }
|
|
177
|
+
// else {
|
|
178
|
+
// console.error("Status ! 200");
|
|
179
|
+
// if (callback) {
|
|
180
|
+
// callback({ message: "Response status not 200" }, null);
|
|
181
|
+
// }
|
|
182
|
+
// }
|
|
183
|
+
// })
|
|
184
|
+
// .catch((error) => {
|
|
185
|
+
// console.error("Reply error:", error);
|
|
186
|
+
// if (callback) {
|
|
187
|
+
// callback(error, null);
|
|
188
|
+
// }
|
|
189
|
+
// });
|
|
190
|
+
// }
|
|
198
191
|
|
|
199
192
|
}
|
|
200
193
|
|