@unito/integrations-platform-client 1.1.2 → 1.1.4

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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Integrations Platform - Client
2
2
 
3
3
  This component is a JS client library to communicate with the Integrations Platform Server. It exposes a standard
4
- [`oazapfts`](https://www.npmjs.com/package/oazapfts) interface compiled with the `--optimistic` option.
4
+ [`oazapfts`](https://www.npmjs.com/package/oazapfts) interface compiled without the `--optimistic` option.
5
5
 
6
6
  ## Getting started
7
7
 
@@ -14,13 +14,13 @@ npm install @unito/integrations-platform-client
14
14
  2. Use the library:
15
15
 
16
16
  ```typescript
17
- import IntegrationsPlatform from '@unito/integrations-platform-client';
17
+ import * as IntegrationsPlatform from '@unito/integrations-platform-client';
18
18
 
19
19
  IntegrationsPlatform.defaults.baseUrl = 'http://enpoint.to.the.server';
20
20
  IntegrationsPlatform.defaults.headers = { Authorization: 'Bearer YOUR_TOKEN' };
21
21
 
22
22
  try {
23
- await IntegrationsPlatform.getIntegrations();
23
+ IntegrationsPlatform.optimistic(IntegrationsPlatform.getIntegrations());
24
24
  } catch (err: unknown) {
25
25
  if (err instanceof IntegrationsPlatform.HttpError) {
26
26
  // Handle the error.
@@ -65,4 +65,3 @@ See `npm version help` for more information.
65
65
  By using the Integration Platform Client, you agree to be bound by our terms and conditions.
66
66
  Please ensure you have read and understood the Unito Software Development Kit Agreement before using the Platform Client.
67
67
  The full agreement can be found at [Unito SDK Agreement](https://unito.io/sdk-agreement/).
68
-
@@ -40,6 +40,9 @@ export declare function isErrorResponse(object: unknown): object is ErrorRespons
40
40
  * @returns the response's data, typed, if it's a success
41
41
  */
42
42
  export declare function optimistic<T>(asyncResponse: Promise<Response<T> | ErrorResponse>): Promise<T>;
43
+ /**
44
+ * Represents a successful response from the Integrations Platform Client.
45
+ */
43
46
  type Response<T> = ({
44
47
  status: 200;
45
48
  } | {
@@ -52,6 +55,9 @@ type Response<T> = ({
52
55
  data: T;
53
56
  headers: Headers;
54
57
  };
58
+ /**
59
+ * Represents an error response from the Integrations Platform Client.
60
+ */
55
61
  type ErrorResponse = ({
56
62
  status: 400;
57
63
  } | {
@@ -66,6 +72,8 @@ type ErrorResponse = ({
66
72
  status: 410;
67
73
  } | {
68
74
  status: 422;
75
+ } | {
76
+ status: 423;
69
77
  } | {
70
78
  status: 429;
71
79
  } | {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unito/integrations-platform-client",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "The Unito Integrations Platform Client",
5
5
  "type": "module",
6
6
  "types": "./dist/src/index.d.ts",