rotacloud 2.1.0 → 2.1.2

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/main.d.ts CHANGED
@@ -160,16 +160,16 @@ export declare const createRotaCloudClient: (config: import("./interfaces/sdk-co
160
160
  };
161
161
  };
162
162
  terminalActive: {
163
- endpoint: "terminals";
163
+ endpoint: "terminals_active";
164
164
  endpointVersion: "v1";
165
165
  operations: ("list" | "listAll")[];
166
166
  customOperations: {
167
- launch: ({ request, service }: import("./ops.js").OperationContext, id: import("./interfaces/launch-terminal.interface.js").LaunchTerminal) => import("./ops.js").RequestConfig<void, import("./interfaces/terminal.interface.js").Terminal>;
168
- ping: ({ request, service }: import("./ops.js").OperationContext, id: {
167
+ launch: ({ request, service }: import("./ops.js").OperationContext, terminal: import("./interfaces/launch-terminal.interface.js").LaunchTerminal) => import("./ops.js").RequestConfig<import("./interfaces/launch-terminal.interface.js").LaunchTerminal, import("./interfaces/terminal.interface.js").Terminal>;
168
+ ping: ({ request, service }: import("./ops.js").OperationContext, terminal: {
169
169
  id: number;
170
170
  action: string;
171
171
  device: string;
172
- }) => import("./ops.js").RequestConfig<void, void>;
172
+ }) => import("./ops.js").RequestConfig<Omit<typeof terminal, "id">, void>;
173
173
  close: ({ request, service }: import("./ops.js").OperationContext, id: number) => import("./ops.js").RequestConfig<void, void>;
174
174
  };
175
175
  };
package/dist/service.d.ts CHANGED
@@ -201,16 +201,16 @@ export declare const SERVICES: {
201
201
  };
202
202
  };
203
203
  terminalActive: {
204
- endpoint: "terminals";
204
+ endpoint: "terminals_active";
205
205
  endpointVersion: "v1";
206
206
  operations: ("list" | "listAll")[];
207
207
  customOperations: {
208
- launch: ({ request, service }: OperationContext, id: LaunchTerminal) => RequestConfig<void, Terminal>;
209
- ping: ({ request, service }: OperationContext, id: {
208
+ launch: ({ request, service }: OperationContext, terminal: LaunchTerminal) => RequestConfig<LaunchTerminal, Terminal>;
209
+ ping: ({ request, service }: OperationContext, terminal: {
210
210
  id: number;
211
211
  action: string;
212
212
  device: string;
213
- }) => RequestConfig<void, void>;
213
+ }) => RequestConfig<Omit<typeof terminal, "id">, void>;
214
214
  close: ({ request, service }: OperationContext, id: number) => RequestConfig<void, void>;
215
215
  };
216
216
  };
package/dist/service.js CHANGED
@@ -256,19 +256,21 @@ export const SERVICES = {
256
256
  },
257
257
  },
258
258
  terminalActive: {
259
- endpoint: 'terminals',
259
+ endpoint: 'terminals_active',
260
260
  endpointVersion: 'v1',
261
261
  operations: ['list', 'listAll'],
262
262
  customOperations: {
263
- launch: ({ request, service }, id) => ({
263
+ launch: ({ request, service }, terminal) => ({
264
264
  ...request,
265
- method: 'DELETE',
266
- url: `${service.endpointVersion}/${service.endpoint}/${id}`,
265
+ method: 'POST',
266
+ url: `${service.endpointVersion}/${service.endpoint}`,
267
+ data: terminal,
267
268
  }),
268
- ping: ({ request, service }, id) => ({
269
+ ping: ({ request, service }, terminal) => ({
269
270
  ...request,
270
- method: 'DELETE',
271
- url: `${service.endpointVersion}/${service.endpoint}/${id}`,
271
+ method: 'POST',
272
+ url: `${service.endpointVersion}/${service.endpoint}/${terminal.id}`,
273
+ data: { action: terminal.action, device: terminal.device },
272
274
  }),
273
275
  close: ({ request, service }, id) => ({
274
276
  ...request,
package/dist/utils.js CHANGED
@@ -42,7 +42,7 @@ function toSearchParams(parameters) {
42
42
  }
43
43
  function parseClientError(error) {
44
44
  const axiosErrorLocation = error.response || error.request;
45
- const apiErrorMessage = axiosErrorLocation.data?.message;
45
+ const apiErrorMessage = axiosErrorLocation.data?.message ?? axiosErrorLocation.data?.error;
46
46
  let url;
47
47
  try {
48
48
  url = new URL(error.config?.url ?? '', error.config?.baseURL);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rotacloud",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "The RotaCloud SDK for the RotaCloud API",
5
5
  "type": "module",
6
6
  "engines": {
package/src/service.ts CHANGED
@@ -344,19 +344,24 @@ export const SERVICES = {
344
344
  },
345
345
  },
346
346
  terminalActive: {
347
- endpoint: 'terminals',
347
+ endpoint: 'terminals_active',
348
348
  endpointVersion: 'v1',
349
349
  operations: ['list', 'listAll'],
350
350
  customOperations: {
351
- launch: ({ request, service }, id: LaunchTerminal): RequestConfig<void, Terminal> => ({
351
+ launch: ({ request, service }, terminal: LaunchTerminal): RequestConfig<LaunchTerminal, Terminal> => ({
352
352
  ...request,
353
- method: 'DELETE',
354
- url: `${service.endpointVersion}/${service.endpoint}/${id}`,
353
+ method: 'POST',
354
+ url: `${service.endpointVersion}/${service.endpoint}`,
355
+ data: terminal,
355
356
  }),
356
- ping: ({ request, service }, id: { id: number; action: string; device: string }): RequestConfig<void, void> => ({
357
+ ping: (
358
+ { request, service },
359
+ terminal: { id: number; action: string; device: string },
360
+ ): RequestConfig<Omit<typeof terminal, 'id'>, void> => ({
357
361
  ...request,
358
- method: 'DELETE',
359
- url: `${service.endpointVersion}/${service.endpoint}/${id}`,
362
+ method: 'POST',
363
+ url: `${service.endpointVersion}/${service.endpoint}/${terminal.id}`,
364
+ data: { action: terminal.action, device: terminal.device },
360
365
  }),
361
366
  close: ({ request, service }, id: number): RequestConfig<void, void> => ({
362
367
  ...request,
package/src/utils.ts CHANGED
@@ -73,7 +73,7 @@ function toSearchParams(parameters?: Record<string, QueryParameterValue>): URLSe
73
73
 
74
74
  function parseClientError(error: AxiosError): SDKError {
75
75
  const axiosErrorLocation = error.response || error.request;
76
- const apiErrorMessage = axiosErrorLocation.data?.message;
76
+ const apiErrorMessage = axiosErrorLocation.data?.message ?? axiosErrorLocation.data?.error;
77
77
  let url: URL | undefined;
78
78
  try {
79
79
  url = new URL(error.config?.url ?? '', error.config?.baseURL);