@qnx/client 0.7.10 → 0.7.13

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,28 +1,34 @@
1
- # @qnx/client
1
+ # `@qnx/client`
2
2
 
3
- @qnx/client is providing components to simplify your codes.
3
+ `@qnx/client` provides utility classes and types to help standardize and simplify handling of API responses on the client side. It supports typed access to data, messages, and errors from server responses.
4
4
 
5
- ## Installation
5
+ ## ✨ Features
6
6
 
7
- Use the package manager [npm](https://www.npmjs.com/) to install @qnx/client.
7
+ - Typed wrappers for API responses
8
+ - Easy parsing of both success and error responses
9
+ - Works well with any REST API response structure
10
+ - Improves code readability and error handling consistency
8
11
 
9
- ```bash
10
- npm install @qnx/client
11
- ```
12
+ ## 📦 Installation
12
13
 
13
- You can also use [yarn](https://yarnpkg.com/) & [pnpm](https://pnpm.io/)
14
+ You can install via your preferred package manager:
14
15
 
15
16
  ```bash
17
+ # npm
18
+ npm install @qnx/client
19
+
20
+ # yarn
16
21
  yarn add @qnx/client
17
- ```
18
22
 
19
- ```bash
23
+ # pnpm
20
24
  pnpm install @qnx/client
21
25
  ```
22
26
 
23
- ## Usage
27
+ ## 🚀 Usage
28
+
29
+ ### General API Response
24
30
 
25
- ```javascript
31
+ ```ts
26
32
  import { ApiResponse } from '@qnx/client'
27
33
 
28
34
  const res = {
@@ -49,7 +55,9 @@ const error = apiRes.getError()
49
55
  const errorCode = apiRes.getErrorCode()
50
56
  ```
51
57
 
52
- ```javascript
58
+ ### Success Response
59
+
60
+ ```ts
53
61
  import { ApiSuccessResponse } from '@qnx/client'
54
62
 
55
63
  const res = {
@@ -63,7 +71,9 @@ const data = apiRes.getData()
63
71
  const message = apiRes.getMessage()
64
72
  ```
65
73
 
66
- ```javascript
74
+ ### Error Response
75
+
76
+ ```ts
67
77
  import { ApiErrorResponse } from '@qnx/client'
68
78
 
69
79
  const res = {
@@ -82,8 +92,11 @@ const error = apiRes.getError()
82
92
  const errorCode = apiRes.getErrorCode()
83
93
  ```
84
94
 
85
- ```javascript
86
- // ApiResponseValue
95
+ ### Types
96
+
97
+ #### ApiResponseValue
98
+
99
+ ```ts
87
100
  import type { ApiResponseValue } from '@qnx/client'
88
101
 
89
102
  const response: ApiResponseValue<number> = {
@@ -102,8 +115,9 @@ const response: ApiResponseValue<number> = {
102
115
  }
103
116
  ```
104
117
 
105
- ```javascript
106
- // ApiResponseValue
118
+ #### ApiSuccessResponseValue
119
+
120
+ ```ts
107
121
  import type { ApiSuccessResponseValue } from '@qnx/client'
108
122
 
109
123
  const successResponse: ApiSuccessResponseValue<number> = {
@@ -112,8 +126,9 @@ const successResponse: ApiSuccessResponseValue<number> = {
112
126
  }
113
127
  ```
114
128
 
115
- ```javascript
116
- // ApiErrorResponseValue
129
+ #### ApiErrorResponseValue
130
+
131
+ ```ts
117
132
  import type { ApiErrorResponseValue } from '@qnx/client'
118
133
 
119
134
  const errorResponse: ApiErrorResponseValue = {
@@ -126,13 +141,12 @@ const errorResponse: ApiErrorResponseValue = {
126
141
  }
127
142
  ```
128
143
 
129
- ## Contributing
130
-
131
- Pull requests are welcome. For major changes, please open an issue first
132
- to discuss what you would like to change.
144
+ ## 🤝 Contributing
133
145
 
134
- Please make sure to update tests as appropriate.
146
+ Pull requests are welcome!
147
+ For major changes, please open an issue first to discuss your proposed updates.
148
+ Ensure tests are updated for any feature changes.
135
149
 
136
- ## License
150
+ ## 📄 License
137
151
 
138
- [MIT License](https://github.com/yatendra121/client/blob/main/LICENSE.md) © 2023-PRESENT [Yatendra Kushwaha](https://github.com/yatendra121)
152
+ [MIT License](https://github.com/yatendra121/client/blob/main/LICENSE.md) © 2023–PRESENT [Yatendra Kushwaha](https://github.com/yatendra121)
@@ -1 +1 @@
1
- var client=function(r){"use strict";class t{constructor(e={}){this.response=e}getErrorCode(){return this.response.errorCode}getErrors(){return this.response.errors}getError(){return this.response.error}getMessage(){return this.response.message}getData(){return this.response.data}}class o{constructor(e){this.response=e}getData(){return this.response.data}getMessage(){return this.response.message}}class n{constructor(e){this.response=e}getError(){return this.response.error}getErrors(){return this.response.errors}getErrorCode(){return this.response.errorCode}}return r.ApiErrorResponse=n,r.ApiResponse=t,r.ApiSuccessResponse=o,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r}({});
1
+ var client=(function(r){"use strict";class t{constructor(e={}){this.response=e}getErrorCode(){return this.response.errorCode}getErrors(){return this.response.errors}getError(){return this.response.error}getMessage(){return this.response.message}getData(){return this.response.data}}class o{constructor(e){this.response=e}getData(){return this.response.data}getMessage(){return this.response.message}}class n{constructor(e){this.response=e}getError(){return this.response.error}getErrors(){return this.response.errors}getErrorCode(){return this.response.errorCode}}return r.ApiErrorResponse=n,r.ApiResponse=t,r.ApiSuccessResponse=o,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),r})({});
package/dist/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.7.10",
5
+ "version": "0.7.13",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/yatendra121",
8
8
  "homepage": "https://github.com/yatendra121/qnx/tree/main/packages/client",
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.7.10",
5
+ "version": "0.7.13",
6
6
  "license": "MIT",
7
7
  "funding": "https://github.com/sponsors/yatendra121",
8
8
  "homepage": "https://github.com/yatendra121/qnx/tree/main/packages/client",