bring-shopping
Advanced tools
Comparing version 1.4.3 to 1.5.0
@@ -114,2 +114,14 @@ interface BringOptions { | ||
/** | ||
* Save an image to an item | ||
* | ||
* @param formData The formdata you want to send. | ||
* @param itemUuid The itemUUID you want to update. | ||
* returns an imageUrl and answerHttpStatus should contain 204. If not -> error | ||
*/ | ||
saveItemImage(itemUuid: string, formData: { | ||
[key: string]: any; | ||
} | undefined): Promise<{ | ||
imageUrl: string; | ||
}>; | ||
/** | ||
* remove an item from your current shopping list | ||
@@ -123,2 +135,9 @@ * | ||
/** | ||
* Remove the image from your item | ||
* | ||
* @param itemUuid The itemUUID you want to remove the image from. | ||
* returns an empty string and answerHttpStatus should contain 204. If not -> error | ||
*/ | ||
removeItemImage(itemUuid: string): Promise<string>; | ||
/** | ||
* move an item to recent items list | ||
@@ -125,0 +144,0 @@ * |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -18,3 +18,3 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
} // endConstructor | ||
} | ||
/** | ||
@@ -35,3 +35,3 @@ * Try to log into given account | ||
throw new Error(`Cannot Login: ${e.message}`); | ||
} // endCatch | ||
} | ||
data = JSON.parse(data); | ||
@@ -48,3 +48,3 @@ this.name = data.name; | ||
}; | ||
} // endLogin | ||
} | ||
/** | ||
@@ -60,4 +60,4 @@ * Loads all shopping lists | ||
throw new Error(`Cannot get lists: ${e.message}`); | ||
} // endCatch | ||
} // endLoadLists | ||
} | ||
} | ||
/** | ||
@@ -73,4 +73,4 @@ * Get all items from the current selected shopping list | ||
throw new Error(`Cannot get items for list ${listUuid}: ${e.message}`); | ||
} // endCatch | ||
} // endGetItems | ||
} | ||
} | ||
/** | ||
@@ -86,4 +86,4 @@ * Get detailed information about all items from the current selected shopping list | ||
throw new Error(`Cannot get detailed items for list ${listUuid}: ${e.message}`); | ||
} // endCatch | ||
} // endGetItemsDetails | ||
} | ||
} | ||
/** | ||
@@ -107,5 +107,24 @@ * Save an item to your current shopping list | ||
throw new Error(`Cannot save item ${itemName} (${specification}) to ${listUuid}: ${e.message}`); | ||
} // endCatch | ||
} // endSaveItem | ||
} | ||
} | ||
/** | ||
* Save an image to an item | ||
* | ||
* @param formData The formdata you want to send. | ||
* @param itemUuid The itemUUID you want to update. | ||
* returns an imageUrl and answerHttpStatus should contain 204. If not -> error | ||
*/ | ||
async saveItemImage(itemUuid, formData) { | ||
try { | ||
const data = await request_promise_native_1.default.put(`${this.url}bringlistitemdetails/${itemUuid}/image`, { | ||
headers: this.putHeaders, | ||
formData: formData | ||
}); | ||
return JSON.parse(data); | ||
} | ||
catch (e) { | ||
throw new Error(`Cannot save item image ${itemUuid}: ${e.message}`); | ||
} | ||
} | ||
/** | ||
* remove an item from your current shopping list | ||
@@ -127,5 +146,20 @@ * | ||
throw new Error(`Cannot remove item ${itemName} from ${listUuid}: ${e.message}`); | ||
} // endCatch | ||
} // endRemoveItem | ||
} | ||
} | ||
/** | ||
* Remove the image from your item | ||
* | ||
* @param itemUuid The itemUUID you want to remove the image from. | ||
* returns an empty string and answerHttpStatus should contain 204. If not -> error | ||
*/ | ||
async removeItemImage(itemUuid) { | ||
try { | ||
const data = await request_promise_native_1.default.delete(`${this.url}bringlistitemdetails/${itemUuid}/image`); | ||
return data; | ||
} | ||
catch (e) { | ||
throw new Error(`Cannot remove item image ${itemUuid}: ${e.message}`); | ||
} | ||
} | ||
/** | ||
* move an item to recent items list | ||
@@ -147,4 +181,4 @@ * | ||
throw new Error(`Cannot remove item ${itemName} from ${listUuid}: ${e.message}`); | ||
} // endCatch | ||
} // endRemoveItem | ||
} | ||
} | ||
/** | ||
@@ -162,4 +196,4 @@ * Get all users from a shopping list | ||
throw new Error(`Cannot get users from list: ${e.message}`); | ||
} // endCatch | ||
} // endGetAllUsersFromList | ||
} | ||
} | ||
/** | ||
@@ -175,4 +209,4 @@ * Get the user settings | ||
throw new Error(`Cannot get user settings: ${e.message}`); | ||
} // endCatch | ||
} // endGetUserSettings | ||
} | ||
} | ||
/** | ||
@@ -189,4 +223,4 @@ * Load translation file e. g. via 'de-DE' | ||
throw new Error(`Cannot get translations: ${e.message}`); | ||
} // endCatch | ||
} // endLoadTranslations | ||
} | ||
} | ||
/** | ||
@@ -203,4 +237,4 @@ * Load translation file e. g. via 'de-DE' | ||
throw new Error(`Cannot get catalog: ${e.message}`); | ||
} // endCatch | ||
} // endLoadCatalog | ||
} | ||
} | ||
/** | ||
@@ -218,6 +252,6 @@ * Get pending invitations | ||
throw new Error(`Cannot get pending invitations: ${e.message}`); | ||
} // endCatch | ||
} // endGetPendingInvitations | ||
} | ||
} | ||
} | ||
module.exports = Bring; | ||
//# sourceMappingURL=bring.js.map |
{ | ||
"name": "bring-shopping", | ||
"version": "1.4.3", | ||
"version": "1.5.0", | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=12.0.0" | ||
}, | ||
@@ -29,12 +29,12 @@ "description": "Nodejs wrapper for the Bring! API", | ||
"devDependencies": { | ||
"@types/node": "^17.0.21", | ||
"@types/node": "^18.11.8", | ||
"@types/request-promise-native": "^1.0.18", | ||
"@typescript-eslint/eslint-plugin": "^5.13.0", | ||
"@typescript-eslint/parser": "^5.13.0", | ||
"@typescript-eslint/eslint-plugin": "^5.41.0", | ||
"@typescript-eslint/parser": "^5.41.0", | ||
"chai": "^4.3.6", | ||
"eslint": "^8.14.0", | ||
"eslint-config-prettier": "^8.4.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"eslint": "^8.26.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"mocha": "^9.2.1", | ||
"prettier": "^2.5.1", | ||
"prettier": "^2.7.1", | ||
"typescript": "^4.6.2" | ||
@@ -41,0 +41,0 @@ }, |
@@ -49,2 +49,5 @@ # Node-Bring-Shopping | ||
## Changelog | ||
### 1.5.0 (2022-10-31) | ||
* (Aliyss) added methods to link an image to an item (PR #221) | ||
### 1.4.3 (2022-05-01) | ||
@@ -60,3 +63,3 @@ * (foxriver76) fixed typos in types (thanks to @Squawnchy) | ||
### 1.3.0 (2020-10-05) | ||
* (mdhom) added getItemsDetails method | ||
* (mdhom) added `getItemsDetails` method | ||
* (foxriver76) now reject with real errors instead of strings | ||
@@ -63,0 +66,0 @@ |
Sorry, the diff of this file is not supported yet
25144
415
89