@cpzxrobot/sdk 1.3.107 → 1.3.109
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/dist/factory_gateway.js +8 -6
- package/factory_gateway.ts +7 -6
- package/package.json +1 -1
package/dist/factory_gateway.js
CHANGED
|
@@ -149,17 +149,19 @@ class FactoryGateway extends Object {
|
|
|
149
149
|
return __awaiter(this, void 0, void 0, function* () {
|
|
150
150
|
var axios = yield this.context.ready;
|
|
151
151
|
var baseUrl = `/api/v1/factory/${id}/workshops`;
|
|
152
|
+
var response = null;
|
|
152
153
|
if (!tags) {
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
response = yield axios.get(baseUrl);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
response = yield axios.get(`${baseUrl}?tags=${tags === null || tags === void 0 ? void 0 : tags.join(',')}`);
|
|
155
158
|
}
|
|
156
|
-
const response = yield axios.get(`${baseUrl}?tags=${tags === null || tags === void 0 ? void 0 : tags.join(',')}`);
|
|
157
159
|
const body = response.data;
|
|
158
|
-
if (body.
|
|
159
|
-
|
|
160
|
+
if (body.Error) {
|
|
161
|
+
throw new Error(body.Error);
|
|
160
162
|
}
|
|
161
163
|
else {
|
|
162
|
-
|
|
164
|
+
return body;
|
|
163
165
|
}
|
|
164
166
|
});
|
|
165
167
|
}
|
package/factory_gateway.ts
CHANGED
|
@@ -132,16 +132,17 @@ export class FactoryGateway extends Object {
|
|
|
132
132
|
async workshops(id: number, tags?: string[]): Promise<any> {
|
|
133
133
|
var axios = await this.context.ready;
|
|
134
134
|
var baseUrl = `/api/v1/factory/${id}/workshops`;
|
|
135
|
+
var response = null;
|
|
135
136
|
if (!tags) {
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
response = await axios.get(baseUrl);
|
|
138
|
+
}else{
|
|
139
|
+
response = await axios.get(`${baseUrl}?tags=${tags?.join(',')}`);
|
|
138
140
|
}
|
|
139
|
-
const response = await axios.get(`${baseUrl}?tags=${tags?.join(',')}`);
|
|
140
141
|
const body = response.data;
|
|
141
|
-
if (body.
|
|
142
|
-
|
|
142
|
+
if (body.Error) {
|
|
143
|
+
throw new Error(body.Error);
|
|
143
144
|
}else{
|
|
144
|
-
|
|
145
|
+
return body;
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
|