@devite/shopware-client 1.6.1 → 1.7.0

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/index.cjs CHANGED
@@ -300,7 +300,7 @@ function createRestEndpoint(client, resourceIdentifier, dataName) {
300
300
  search: (criteria) => requestEndpoint(
301
301
  client,
302
302
  HTTPRequestMethod.POST,
303
- `/${resourceIdentifier}/search`,
303
+ `/search/${resourceIdentifier}`,
304
304
  200,
305
305
  `search ${dataName}`,
306
306
  void 0,
@@ -1965,7 +1965,7 @@ class DocumentClient extends Client {
1965
1965
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
1966
1966
  */
1967
1967
  async download(id, deepLinkCode) {
1968
- const response = await this.post(
1968
+ const response = await this.get(
1969
1969
  `/document/download/${id}/${deepLinkCode}`,
1970
1970
  this.client.withContextToken()
1971
1971
  );
@@ -1973,6 +1973,23 @@ class DocumentClient extends Client {
1973
1973
  return response.body.data;
1974
1974
  throw new ShopwareError("Failed to download document", response);
1975
1975
  }
1976
+ /**
1977
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
1978
+ */
1979
+ async downloadAsGuest(id, deepLinkCode, email, billingAddressZipCode) {
1980
+ const response = await this.post(
1981
+ `/document/download/${id}/${deepLinkCode}`,
1982
+ this.client.withContextToken({
1983
+ body: new JsonPayload({
1984
+ email,
1985
+ zipcode: billingAddressZipCode
1986
+ })
1987
+ })
1988
+ );
1989
+ if (response.statusCode === 200)
1990
+ return response.body.data;
1991
+ throw new ShopwareError("Failed to download document as guest", response);
1992
+ }
1976
1993
  }
1977
1994
 
1978
1995
  class GatewayClient extends Client {
package/dist/index.d.cts CHANGED
@@ -5940,6 +5940,10 @@ declare class DocumentClient extends Client {
5940
5940
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
5941
5941
  */
5942
5942
  download(id: string, deepLinkCode: string): Promise<DocumentDownloadResponse>;
5943
+ /**
5944
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
5945
+ */
5946
+ downloadAsGuest(id: string, deepLinkCode: string, email: string, billingAddressZipCode: string): Promise<DocumentDownloadResponse>;
5943
5947
  }
5944
5948
 
5945
5949
  declare class GatewayClient extends Client {
package/dist/index.d.mts CHANGED
@@ -5940,6 +5940,10 @@ declare class DocumentClient extends Client {
5940
5940
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
5941
5941
  */
5942
5942
  download(id: string, deepLinkCode: string): Promise<DocumentDownloadResponse>;
5943
+ /**
5944
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
5945
+ */
5946
+ downloadAsGuest(id: string, deepLinkCode: string, email: string, billingAddressZipCode: string): Promise<DocumentDownloadResponse>;
5943
5947
  }
5944
5948
 
5945
5949
  declare class GatewayClient extends Client {
package/dist/index.d.ts CHANGED
@@ -5940,6 +5940,10 @@ declare class DocumentClient extends Client {
5940
5940
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
5941
5941
  */
5942
5942
  download(id: string, deepLinkCode: string): Promise<DocumentDownloadResponse>;
5943
+ /**
5944
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
5945
+ */
5946
+ downloadAsGuest(id: string, deepLinkCode: string, email: string, billingAddressZipCode: string): Promise<DocumentDownloadResponse>;
5943
5947
  }
5944
5948
 
5945
5949
  declare class GatewayClient extends Client {
package/dist/index.mjs CHANGED
@@ -298,7 +298,7 @@ function createRestEndpoint(client, resourceIdentifier, dataName) {
298
298
  search: (criteria) => requestEndpoint(
299
299
  client,
300
300
  HTTPRequestMethod.POST,
301
- `/${resourceIdentifier}/search`,
301
+ `/search/${resourceIdentifier}`,
302
302
  200,
303
303
  `search ${dataName}`,
304
304
  void 0,
@@ -1963,7 +1963,7 @@ class DocumentClient extends Client {
1963
1963
  * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
1964
1964
  */
1965
1965
  async download(id, deepLinkCode) {
1966
- const response = await this.post(
1966
+ const response = await this.get(
1967
1967
  `/document/download/${id}/${deepLinkCode}`,
1968
1968
  this.client.withContextToken()
1969
1969
  );
@@ -1971,6 +1971,23 @@ class DocumentClient extends Client {
1971
1971
  return response.body.data;
1972
1972
  throw new ShopwareError("Failed to download document", response);
1973
1973
  }
1974
+ /**
1975
+ * @throws {ShopwareError | import('ofetch').FetchError} if the request failed
1976
+ */
1977
+ async downloadAsGuest(id, deepLinkCode, email, billingAddressZipCode) {
1978
+ const response = await this.post(
1979
+ `/document/download/${id}/${deepLinkCode}`,
1980
+ this.client.withContextToken({
1981
+ body: new JsonPayload({
1982
+ email,
1983
+ zipcode: billingAddressZipCode
1984
+ })
1985
+ })
1986
+ );
1987
+ if (response.statusCode === 200)
1988
+ return response.body.data;
1989
+ throw new ShopwareError("Failed to download document as guest", response);
1990
+ }
1974
1991
  }
1975
1992
 
1976
1993
  class GatewayClient extends Client {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devite/shopware-client",
3
- "version": "1.6.1",
3
+ "version": "1.7.0",
4
4
  "description": "Third party API client for Shopware 6.",
5
5
  "repository": "devite-io/shopware-client",
6
6
  "license": "MIT",