@qnx/client 0.6.16 → 0.6.20

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/client.mjs CHANGED
@@ -2,18 +2,43 @@ class s {
2
2
  constructor(r = {}) {
3
3
  this.response = r;
4
4
  }
5
+ /**
6
+ * Gets the error code from the response.
7
+ *
8
+ * @returns The error code, if present.
9
+ */
5
10
  getErrorCode() {
6
11
  return this.response.errorCode;
7
12
  }
13
+ /**
14
+ * Gets the errors from the response.
15
+ *
16
+ * @returns An object containing the errors, if present.
17
+ */
8
18
  getErrors() {
9
19
  return this.response.errors;
10
20
  }
21
+ /**
22
+ * Gets the error message from the response.
23
+ *
24
+ * @returns The error message, if present.
25
+ */
11
26
  getError() {
12
27
  return this.response.error;
13
28
  }
29
+ /**
30
+ * Gets the message from the response.
31
+ *
32
+ * @returns The message, if present.
33
+ */
14
34
  getMessage() {
15
35
  return this.response.message;
16
36
  }
37
+ /**
38
+ * Gets the data from the response.
39
+ *
40
+ * @returns The data, if present.
41
+ */
17
42
  getData() {
18
43
  return this.response.data;
19
44
  }
@@ -22,9 +47,19 @@ class t {
22
47
  constructor(r) {
23
48
  this.response = r;
24
49
  }
50
+ /**
51
+ * Gets the data from the response.
52
+ *
53
+ * @returns The response data.
54
+ */
25
55
  getData() {
26
56
  return this.response.data;
27
57
  }
58
+ /**
59
+ * Gets the message from the response.
60
+ *
61
+ * @returns The response message.
62
+ */
28
63
  getMessage() {
29
64
  return this.response.message;
30
65
  }
@@ -33,12 +68,27 @@ class o {
33
68
  constructor(r) {
34
69
  this.response = r;
35
70
  }
71
+ /**
72
+ * Gets the error message from the response.
73
+ *
74
+ * @returns The error message.
75
+ */
36
76
  getError() {
37
77
  return this.response.error;
38
78
  }
79
+ /**
80
+ * Gets the errors from the response.
81
+ *
82
+ * @returns An object containing the errors, if present.
83
+ */
39
84
  getErrors() {
40
85
  return this.response.errors;
41
86
  }
87
+ /**
88
+ * Gets the error code from the response.
89
+ *
90
+ * @returns The error code, if present.
91
+ */
42
92
  getErrorCode() {
43
93
  return this.response.errorCode;
44
94
  }
package/dist/index.d.ts CHANGED
@@ -1,9 +1,14 @@
1
- // Generated by dts-bundle-generator v9.3.1
1
+ // Generated by dts-bundle-generator v9.5.1
2
2
 
3
3
  export type ApiErrorCode = string;
4
4
  export type ApiErrors = Record<string, string[]>;
5
5
  export type ApiMessage = string;
6
6
  export type ApiError = string;
7
+ /**
8
+ * Interface defining methods to access various properties of an API response.
9
+ *
10
+ * @template T - The type of the response data.
11
+ */
7
12
  export interface ApiResponseInterface<T> {
8
13
  getData: () => T | undefined;
9
14
  getMessage: () => ApiMessage | undefined;
@@ -12,7 +17,7 @@ export interface ApiResponseInterface<T> {
12
17
  getError(): ApiError | undefined;
13
18
  }
14
19
  /**
15
- * Represents the response value returned by the API.
20
+ * Represents the structure of the value returned by the API.
16
21
  *
17
22
  * @template T - The type of the response data.
18
23
  */
@@ -25,55 +30,117 @@ export interface ApiResponseValue<T = any> {
25
30
  readonly serverError?: any;
26
31
  }
27
32
  /**
28
- * Will use collect data from api response
33
+ * Class to collect and provide data from an API response.
34
+ *
35
+ * @template T - The type of the response data.
29
36
  */
30
37
  export declare class ApiResponse<T = any> implements ApiResponseInterface<T> {
31
38
  private readonly response;
32
39
  constructor(response?: ApiResponseValue<T>);
40
+ /**
41
+ * Gets the error code from the response.
42
+ *
43
+ * @returns The error code, if present.
44
+ */
33
45
  getErrorCode(): ApiErrorCode | undefined;
46
+ /**
47
+ * Gets the errors from the response.
48
+ *
49
+ * @returns An object containing the errors, if present.
50
+ */
34
51
  getErrors(): ApiErrors | undefined;
52
+ /**
53
+ * Gets the error message from the response.
54
+ *
55
+ * @returns The error message, if present.
56
+ */
35
57
  getError(): ApiError | undefined;
58
+ /**
59
+ * Gets the message from the response.
60
+ *
61
+ * @returns The message, if present.
62
+ */
36
63
  getMessage(): ApiMessage | undefined;
64
+ /**
65
+ * Gets the data from the response.
66
+ *
67
+ * @returns The data, if present.
68
+ */
37
69
  getData(): T | undefined;
38
70
  }
71
+ /**
72
+ * Interface defining methods to access properties of a successful API response.
73
+ *
74
+ * @template T - The type of the response data.
75
+ */
39
76
  export interface ApiSuccessResponseInterface<T> {
40
77
  getData: () => T;
41
78
  getMessage: () => ApiMessage;
42
79
  }
43
80
  /**
44
- * Represents a successful API response value.
81
+ * Represents the structure of a successful API response value.
45
82
  * It includes the response data and a message.
46
83
  *
47
84
  * @template T - The type of the response data.
48
85
  */
49
86
  export type ApiSuccessResponseValue<T> = Pick<Required<ApiResponseValue<T>>, "data" | "message">;
50
87
  /**
51
- * Will use collect data from success api response
88
+ * Class to collect and provide data from a successful API response.
89
+ *
90
+ * @template T - The type of the response data.
52
91
  */
53
92
  export declare class ApiSuccessResponse<T> implements ApiSuccessResponseInterface<T> {
54
93
  private readonly response;
55
94
  constructor(response: ApiSuccessResponseValue<T>);
95
+ /**
96
+ * Gets the data from the response.
97
+ *
98
+ * @returns The response data.
99
+ */
56
100
  getData(): T;
101
+ /**
102
+ * Gets the message from the response.
103
+ *
104
+ * @returns The response message.
105
+ */
57
106
  getMessage(): ApiMessage;
58
107
  }
108
+ /**
109
+ * Interface defining methods to access properties of an error API response.
110
+ */
59
111
  export interface ApiErrorResponseInterface {
60
112
  getError: () => string;
61
113
  getErrors: () => Record<string, string[]> | undefined;
62
114
  getErrorCode: () => string | undefined;
63
115
  }
64
116
  /**
65
- * Represents an error API response value.
117
+ * Represents the structure of an error API response value.
66
118
  * It includes error details such as error message and error codes.
67
119
  */
68
120
  export type ApiErrorResponseValue = Pick<Required<ApiResponseValue<unknown>>, "errors" | "error"> & Pick<ApiResponseValue<unknown>, "errorCode">;
69
121
  /**
70
- * Will use collect data from error api response
122
+ * Class to collect and provide data from an error API response.
71
123
  */
72
124
  export declare class ApiErrorResponse implements ApiErrorResponseInterface {
73
125
  private readonly response;
74
126
  constructor(response: ApiErrorResponseValue);
127
+ /**
128
+ * Gets the error message from the response.
129
+ *
130
+ * @returns The error message.
131
+ */
75
132
  getError(): string;
133
+ /**
134
+ * Gets the errors from the response.
135
+ *
136
+ * @returns An object containing the errors, if present.
137
+ */
76
138
  getErrors(): ApiErrors;
139
+ /**
140
+ * Gets the error code from the response.
141
+ *
142
+ * @returns The error code, if present.
143
+ */
77
144
  getErrorCode(): string | undefined;
78
145
  }
79
146
 
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@qnx/client",
3
+ "description": "@qnx/client for handling response",
4
+ "author": "Yatendra Kushwaha <https://github.com/yatendra121>",
5
+ "version": "0.6.20",
6
+ "license": "MIT",
7
+ "funding": "https://github.com/sponsors/yatendra121",
8
+ "homepage": "https://github.com/yatendra121/qnx/tree/main/packages/client",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "keywords": [],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/yatendra121/qnx.git",
16
+ "directory": "packages/client"
17
+ },
18
+ "main": "./dist/client.cjs",
19
+ "module": "./dist/client.mjs",
20
+ "types": "./dist/index.d.ts",
21
+ "exports": {
22
+ ".": {
23
+ "types": "./dist/index.d.ts",
24
+ "require": "./dist/client.cjs",
25
+ "import": "./dist/client.mjs"
26
+ }
27
+ },
28
+ "unpkg": "./client.iife.js",
29
+ "jsdelivr": "./client.iife.js",
30
+ "scripts": {
31
+ "dev": "vite --host",
32
+ "build": "tsc && vite build && dts-bundle-generator --config ./dts-bundle-generator.config.ts",
33
+ "test": "vitest",
34
+ "test:coverage": "jest --runInBand --coverage",
35
+ "lint:scripts": "eslint . --ext .ts",
36
+ "format:scripts": "prettier . --write",
37
+ "format": "npm run format:scripts"
38
+ }
39
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@qnx/client",
3
3
  "description": "@qnx/client for handling response",
4
4
  "author": "Yatendra Kushwaha <https://github.com/yatendra121>",
5
- "version": "0.6.16",
5
+ "version": "0.6.20",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/yatendra121",
8
8
  "homepage": "https://github.com/yatendra121/qnx/tree/main/packages/client",