@shopware/api-client
Advanced tools
Comparing version 0.1.0 to 0.2.0
{ | ||
"name": "@shopware/api-client", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Shopware client for API connection.", | ||
@@ -31,7 +31,7 @@ "author": "Shopware", | ||
"@types/prettier": "^2.7.3", | ||
"@vitest/coverage-c8": "^0.32.2", | ||
"prettier": "^2.8.8", | ||
"vitest": "^0.32.2", | ||
"eslint-config-shopware": "0.0.3", | ||
"@shopware/api-gen": "0.0.4", | ||
"@vitest/coverage-c8": "^0.33.0", | ||
"prettier": "^3.0.0", | ||
"vitest": "^0.33.0", | ||
"@shopware/api-gen": "0.0.5", | ||
"eslint-config-shopware": "0.0.4", | ||
"tsconfig": "0.0.0" | ||
@@ -38,0 +38,0 @@ }, |
@@ -104,3 +104,3 @@ # shopware/frontends - api-client | ||
...params, | ||
} | ||
}, | ||
); | ||
@@ -119,2 +119,21 @@ | ||
### Error handling | ||
Client is throwing `ApiClientError` with detailed information returned from the API. It will display clear message in the console or you can access `details` property to get raw information from the response. | ||
```typescript | ||
import { ApiClientError } from "@shopware/api-client"; | ||
try { | ||
// ... your request | ||
} catch (error) { | ||
if (error instanceof ApiClientError) { | ||
console.error(error); // This prints message summary | ||
console.error("Details:", error.details); // Raw response from API | ||
} else { | ||
console.error("==>", error); // Another type of error, not recognized by API client | ||
} | ||
} | ||
``` | ||
## Links | ||
@@ -132,11 +151,23 @@ | ||
### Latest changes: 0.1.0 | ||
### Latest changes: 0.2.0 | ||
### Minor Changes | ||
- [#300](https://github.com/shopware/frontends/pull/300) [`da347b5`](https://github.com/shopware/frontends/commit/da347b548aea93afaab1cc9ebab63f732ecdb964) Thanks [@patzick](https://github.com/patzick)! - Predefining methods: exported `RequestReturnType ` and `RequestParameters` types. You can now create predefined methods: | ||
- [#316](https://github.com/shopware/frontends/pull/316) [`589c09c`](https://github.com/shopware/frontends/commit/589c09cdd9dee0db172c371afc5ecd740bdb4723) Thanks [@patzick](https://github.com/patzick)! - Improved error handling. Api client now throws `ApiClientError` with detailed information about what went wrong with request. | ||
example: | ||
```typescript | ||
const readCart = (params: RequestParameters<"readCart", operations>) => | ||
apiInstance.invoke("readCart get /checkout/cart?name", params); | ||
import { ApiClientError } from "@shopware/api-client"; | ||
try { | ||
// ... your request | ||
} catch (error) { | ||
if (error instanceof ApiClientError) { | ||
console.error(error); // This prints message summary | ||
console.error("Details:", error.details); // Raw response from API | ||
} else { | ||
console.error("==>", error); // Another type of error, not recognized by API client | ||
} | ||
} | ||
``` | ||
@@ -146,2 +177,2 @@ | ||
- [#295](https://github.com/shopware/frontends/pull/295) [`23a0a53`](https://github.com/shopware/frontends/commit/23a0a532410990c0075ea7fff622949ccdecfd49) Thanks [@patzick](https://github.com/patzick)! - bump dependencies | ||
- [#303](https://github.com/shopware/frontends/pull/303) [`aeb639a`](https://github.com/shopware/frontends/commit/aeb639a3244f812c275145345618e5bc0045be0d) Thanks [@patzick](https://github.com/patzick)! - Improved linting in packages. Types should be more reliable |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3857512
115598
175